aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-03-03 22:53:53 -0500
committerTom Rini <trini@konsulko.com>2021-03-03 22:53:53 -0500
commit2b82b1d26ae44ac2f43d8a87f482fe906ba863fb (patch)
tree34016a954bbcba79b78713790480b5072828d29b
parent52ba373b7825e9feab8357065155cf43dfe2f4ff (diff)
parent384b62c073f3aaccba0c917a8da7701a82441aec (diff)
downloadu-boot-2b82b1d26ae44ac2f43d8a87f482fe906ba863fb.zip
u-boot-2b82b1d26ae44ac2f43d8a87f482fe906ba863fb.tar.gz
u-boot-2b82b1d26ae44ac2f43d8a87f482fe906ba863fb.tar.bz2
Merge tag 'dm-pull-3mar21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dmWIP/03Mar2021
dm: Fix an obscure bug with empty of-platdata Fixes for ns16550 base address and frequency-reading Other minor fixes
-rw-r--r--common/Kconfig.boot3
-rw-r--r--common/bootstage.c2
-rw-r--r--drivers/block/sandbox.c13
-rw-r--r--drivers/core/device.c36
-rw-r--r--drivers/serial/ns16550.c4
-rw-r--r--dts/Kconfig2
-rw-r--r--lib/Kconfig2
-rw-r--r--tools/patman/series.py2
8 files changed, 47 insertions, 17 deletions
diff --git a/common/Kconfig.boot b/common/Kconfig.boot
index 70c02b9..e650c60 100644
--- a/common/Kconfig.boot
+++ b/common/Kconfig.boot
@@ -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
diff --git a/common/bootstage.c b/common/bootstage.c
index d5b78b9..2c0110c 100644
--- a/common/bootstage.c
+++ b/common/bootstage.c
@@ -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");
diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c
index 9d7d68c..e2f229b 100644
--- a/drivers/block/sandbox.c
+++ b/drivers/block/sandbox.c
@@ -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
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 6251349..81f6880 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -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);
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index b9e99ba..cc121ee 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -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;
diff --git a/dts/Kconfig b/dts/Kconfig
index 71f5055..00ac29a 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -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
diff --git a/lib/Kconfig b/lib/Kconfig
index b35a71a..7f4c30e 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -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,
diff --git a/tools/patman/series.py b/tools/patman/series.py
index a6746e8..41a1173 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -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