dm: Fix an obscure bug with empty of-platdata

Fixes for ns16550 base address and frequency-reading
 Other minor fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAmBAUv0RHHNqZ0BjaHJv
 bWl1bS5vcmcACgkQfxc6PpAIreaq5gf/bZSxaOdCV+Lbadw9oRRfTCJpPFKj0Y9P
 9ed33TiNsH+7kRQnm4+gf20gLEpqxuAWTiZTnYKN1txibgIkmCoEC+zZEDObfyi0
 pzS1+UYRki2eBi2gv9+jJFpb1LG9rU7if4kaODQl9kerRahMX1yg6YEppTUAoa42
 i7pv3P9nlMC/4hcPD0cDNn7MVDrpTKIOVf6EuvtpIX19QPSH8D4Oj3sFSkFJpit7
 aGOFPkcUyl2wG3IL9ySRLrX6/J0xfL9UKnwmTkJn29Yh6gHM9+1ttQeETMl/GcP5
 kS3pnZUovkxNKDjBD0K0eDI85VCdW8oQBGu7wtCPRwvn+yFkzs27/Q==
 =a3D2
 -----END PGP SIGNATURE-----

Merge tag 'dm-pull-3mar21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

dm: Fix an obscure bug with empty of-platdata
Fixes for ns16550 base address and frequency-reading
Other minor fixes
This commit is contained in:
Tom Rini 2021-03-03 22:53:53 -05:00
commit 2b82b1d26a
8 changed files with 47 additions and 17 deletions

View File

@ -449,6 +449,7 @@ config BOOTSTAGE_REPORT
config BOOTSTAGE_RECORD_COUNT
int "Number of boot stage records to store"
depends on BOOTSTAGE
default 30
help
This is the size of the bootstage record list and is the maximum
@ -456,6 +457,7 @@ config BOOTSTAGE_RECORD_COUNT
config SPL_BOOTSTAGE_RECORD_COUNT
int "Number of boot stage records to store for SPL"
depends on SPL_BOOTSTAGE
default 5
help
This is the size of the bootstage record list and is the maximum
@ -463,6 +465,7 @@ config SPL_BOOTSTAGE_RECORD_COUNT
config TPL_BOOTSTAGE_RECORD_COUNT
int "Number of boot stage records to store for TPL"
depends on TPL_BOOTSTAGE
default 5
help
This is the size of the bootstage record list and is the maximum

View File

@ -349,7 +349,7 @@ void bootstage_report(void)
}
if (data->rec_count > RECORD_COUNT)
printf("Overflowed internal boot id table by %d entries\n"
"Please increase CONFIG_(SPL_)BOOTSTAGE_RECORD_COUNT\n",
"Please increase CONFIG_(SPL_TPL_)BOOTSTAGE_RECORD_COUNT\n",
data->rec_count - RECORD_COUNT);
puts("\nAccumulated time:\n");

View File

@ -231,6 +231,18 @@ int host_get_dev_err(int devnum, struct blk_desc **blk_devp)
}
#ifdef CONFIG_BLK
int sandbox_host_unbind(struct udevice *dev)
{
struct host_block_dev *host_dev;
/* Data validity is checked in host_dev_bind() */
host_dev = dev_get_plat(dev);
os_close(host_dev->fd);
return 0;
}
static const struct blk_ops sandbox_host_blk_ops = {
.read = host_block_read,
.write = host_block_write,
@ -240,6 +252,7 @@ U_BOOT_DRIVER(sandbox_host_blk) = {
.name = "sandbox_host_blk",
.id = UCLASS_BLK,
.ops = &sandbox_host_blk_ops,
.unbind = sandbox_host_unbind,
.plat_auto = sizeof(struct host_block_dev),
};
#else

View File

@ -92,15 +92,19 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
if (auto_seq && !(uc->uc_drv->flags & DM_UC_FLAG_NO_AUTO_SEQ))
dev->seq_ = uclass_find_next_free_seq(uc);
/* Check if we need to allocate plat */
if (drv->plat_auto) {
bool alloc = !plat;
/*
* For of-platdata, we try use the existing data, but if
* plat_auto is larger, we must allocate a new space
*/
if (CONFIG_IS_ENABLED(OF_PLATDATA)) {
if (of_plat_size) {
if (of_plat_size)
dev_or_flags(dev, DM_FLAG_OF_PLATDATA);
if (of_plat_size < drv->plat_auto)
alloc = true;
}
if (of_plat_size < drv->plat_auto)
alloc = true;
}
if (alloc) {
dev_or_flags(dev, DM_FLAG_ALLOC_PDATA);
@ -109,6 +113,11 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
ret = -ENOMEM;
goto fail_alloc1;
}
/*
* For of-platdata, copy the old plat into the new
* space
*/
if (CONFIG_IS_ENABLED(OF_PLATDATA) && plat)
memcpy(ptr, plat, of_plat_size);
dev_set_plat(dev, ptr);
@ -128,9 +137,8 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
if (parent) {
size = parent->driver->per_child_plat_auto;
if (!size) {
if (!size)
size = parent->uclass->uc_drv->per_child_plat_auto;
}
if (size) {
dev_or_flags(dev, DM_FLAG_ALLOC_PARENT_PDATA);
ptr = calloc(1, size);
@ -200,14 +208,18 @@ fail_uclass_bind:
}
}
fail_alloc3:
if (dev_get_flags(dev) & DM_FLAG_ALLOC_UCLASS_PDATA) {
free(dev_get_uclass_plat(dev));
dev_set_uclass_plat(dev, NULL);
if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) {
if (dev_get_flags(dev) & DM_FLAG_ALLOC_UCLASS_PDATA) {
free(dev_get_uclass_plat(dev));
dev_set_uclass_plat(dev, NULL);
}
}
fail_alloc2:
if (dev_get_flags(dev) & DM_FLAG_ALLOC_PDATA) {
free(dev_get_plat(dev));
dev_set_plat(dev, NULL);
if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) {
if (dev_get_flags(dev) & DM_FLAG_ALLOC_PDATA) {
free(dev_get_plat(dev));
dev_set_plat(dev, NULL);
}
}
fail_alloc1:
devres_release_all(dev);

View File

@ -483,7 +483,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
return 0;
}
static int ns16550_serial_assign_base(struct ns16550_plat *plat, ulong base)
static int ns16550_serial_assign_base(struct ns16550_plat *plat, fdt_addr_t base)
{
if (base == FDT_ADDR_T_NONE)
return -EINVAL;
@ -564,6 +564,8 @@ int ns16550_serial_of_to_plat(struct udevice *dev)
if (!plat->clock)
plat->clock = dev_read_u32_default(dev, "clock-frequency",
CONFIG_SYS_NS16550_CLK);
if (!plat->clock)
plat->clock = CONFIG_SYS_NS16550_CLK;
if (!plat->clock) {
debug("ns16550 clock not defined\n");
return -EINVAL;

View File

@ -60,7 +60,7 @@ config TPL_OF_CONTROL
config OF_LIVE
bool "Enable use of a live tree"
depends on OF_CONTROL
depends on DM && OF_CONTROL
help
Normally U-Boot uses a flat device tree which saves space and
avoids the need to unpack the tree before use. However a flat

View File

@ -22,7 +22,7 @@ config BCH
config BINMAN_FDT
bool "Allow access to binman information in the device tree"
depends on BINMAN && OF_CONTROL
depends on BINMAN && DM && OF_CONTROL
default y
help
This enables U-Boot to access information about binman entries,

View File

@ -271,7 +271,7 @@ class Series(dict):
cc += get_maintainer.GetMaintainer(dir_list, commit.patch)
for x in set(cc) & set(settings.bounces):
print(col.Color(col.YELLOW, 'Skipping "%s"' % x))
cc = set(cc) - set(settings.bounces)
cc = list(set(cc) - set(settings.bounces))
if limit is not None:
cc = cc[:limit]
all_ccs += cc