From e7b14e9ab0ceef3068722007e7396f89f4ede9c2 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 15 Sep 2014 06:33:18 -0600 Subject: [PATCH 1/5] dm: Fix repeated comment in README A merge error ended up repeating a similar sentence twice. Fix it. Signed-off-by: Simon Glass --- README | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README b/README index 0a0f528af1..298e8d62a0 100644 --- a/README +++ b/README @@ -3849,12 +3849,9 @@ Configuration Settings: The memory will be freed (or in fact just forgotton) when U-Boot relocates itself. - Pre-relocation malloc() is only supported on sandbox + Pre-relocation malloc() is only supported on ARM and sandbox at present but is fairly easy to enable for other archs. - Pre-relocation malloc() is only supported on ARM at present - but is fairly easy to enable for other archs. - - CONFIG_SYS_BOOTM_LEN: Normally compressed uImages are limited to an uncompressed size of 8 MBytes. If this is not enough, From bf1a86fca0111067021f3d263242767d3709d7be Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 15 Sep 2014 06:33:36 -0600 Subject: [PATCH 2/5] sf: Add an empty entry to the parameter list The list is supposed to be terminated with a NULL name, but is not. If a board probes a chip which does not appear in the table, U-Boot will crash (at least on sandbox). Signed-off-by: Simon Glass --- drivers/mtd/spi/sf_params.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c index ac886fd071..856eb4cfbe 100644 --- a/drivers/mtd/spi/sf_params.c +++ b/drivers/mtd/spi/sf_params.c @@ -116,6 +116,7 @@ const struct spi_flash_params spi_flash_params_table[] = { {"W25Q64DW", 0xef6017, 0x0, 64 * 1024, 128, RD_FULL, WR_QPP | SECT_4K}, {"W25Q128FW", 0xef6018, 0x0, 64 * 1024, 256, RD_FULL, WR_QPP | SECT_4K}, #endif + {}, /* Empty entry to terminate the list */ /* * Note: * Below paired flash devices has similar spi_flash params. From 91cbd792c46c916ef196c5b7cd16ff592d2f3632 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Sep 2014 09:02:38 -0600 Subject: [PATCH 3/5] dm: core: Allow device_bind() to used without CONFIG_OF_CONTROL The sequence number support in driver model requires device tree control. It should be skipped if CONFIG_OF_CONTROL is not defined, and should not require functions from fdtdec. Signed-off-by: Simon Glass --- drivers/core/device.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/core/device.c b/drivers/core/device.c index 166b0732ab..ef41a9be3e 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -106,13 +106,16 @@ int device_bind(struct udevice *parent, struct driver *drv, const char *name, * a 'requested' sequence, and will be resolved (and ->seq updated) * when the device is probed. */ - dev->req_seq = fdtdec_get_int(gd->fdt_blob, of_offset, "reg", -1); dev->seq = -1; +#ifdef CONFIG_OF_CONTROL + dev->req_seq = fdtdec_get_int(gd->fdt_blob, of_offset, "reg", -1); if (uc->uc_drv->name && of_offset != -1) { fdtdec_get_alias_seq(gd->fdt_blob, uc->uc_drv->name, of_offset, &dev->req_seq); } - +#else + dev->req_seq = -1; +#endif if (!dev->platdata && drv->platdata_auto_alloc_size) dev->flags |= DM_FLAG_ALLOC_PDATA; From 59990bf0eaa12b123759cb0485f38e156103e93c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Sep 2014 09:02:40 -0600 Subject: [PATCH 4/5] dm: serial: Don't require device tree to configure a console Allow serial_find_console_or_panic() to work without a device tree. Signed-off-by: Simon Glass --- drivers/serial/serial-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index d04104e747..1ac943f692 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -25,6 +25,7 @@ struct udevice *cur_dev __attribute__ ((section(".data"))); static void serial_find_console_or_panic(void) { +#ifdef CONFIG_OF_CONTROL int node; /* Check for a chosen console */ @@ -44,7 +45,7 @@ static void serial_find_console_or_panic(void) return; cur_dev = NULL; } - +#endif /* * Failing that, get the device with sequence number 0, or in extremis * just the first serial device we can find. But we insist on having From cae025aab3e8ea8ad455cce8b0e4647401cdd091 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Thu, 18 Sep 2014 17:13:07 +0200 Subject: [PATCH 5/5] dm: avoid dev->req_seq overflow Since dev->req_seq value is initialized from "reg" property of fdt node, there is posibility, that address value contained in fdt is greater than INT_MAX, and then value in dev->req_seq is negative which led to probe() fail. This patch fix this problem by ensuring that req_seq is positive, unless it's one of errno codes. Signed-off-by: Robert Baldyga Acked-by: Simon Glass --- drivers/core/device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/core/device.c b/drivers/core/device.c index ef41a9be3e..32e80e82b5 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -109,6 +109,8 @@ int device_bind(struct udevice *parent, struct driver *drv, const char *name, dev->seq = -1; #ifdef CONFIG_OF_CONTROL dev->req_seq = fdtdec_get_int(gd->fdt_blob, of_offset, "reg", -1); + if (!IS_ERR_VALUE(dev->req_seq)) + dev->req_seq &= INT_MAX; if (uc->uc_drv->name && of_offset != -1) { fdtdec_get_alias_seq(gd->fdt_blob, uc->uc_drv->name, of_offset, &dev->req_seq);