[U-Boot] [PATCH 1/3] sf: Add dm_spi_flash_probe
Simon Glass
sjg at chromium.org
Wed Oct 28 19:49:08 CET 2015
Hi Jagan,
On 19 October 2015 at 10:09, Jagan Teki <jteki at openedev.com> wrote:
> Updated dm-spi-flash probe using dm_spi_flash_probe.
>
> Signed-off-by: Jagan Teki <jteki at openedev.com>
> Cc: Simon Glass <sjg at chromium.org>
> ---
> common/cmd_sf.c | 23 ++++-------------------
> drivers/mtd/spi/sf-uclass.c | 27 ++++++++++++++++++++++++++-
> include/spi_flash.h | 5 ++---
> 3 files changed, 32 insertions(+), 23 deletions(-)
>
> diff --git a/common/cmd_sf.c b/common/cmd_sf.c
> index ac7f5df..f1926e3 100644
> --- a/common/cmd_sf.c
> +++ b/common/cmd_sf.c
> @@ -8,7 +8,6 @@
>
> #include <common.h>
> #include <div64.h>
> -#include <dm.h>
> #include <malloc.h>
> #include <mapmem.h>
> #include <spi.h>
> @@ -17,7 +16,6 @@
> #include <linux/mtd/mtd.h>
>
> #include <asm/io.h>
> -#include <dm/device-internal.h>
>
> static struct spi_flash *flash;
>
> @@ -85,10 +83,7 @@ static int do_spi_flash_probe(int argc, char * const argv[])
> unsigned int speed = CONFIG_SF_DEFAULT_SPEED;
> unsigned int mode = CONFIG_SF_DEFAULT_MODE;
> char *endp;
> -#ifdef CONFIG_DM_SPI_FLASH
> - struct udevice *new, *bus_dev;
> - int ret;
> -#else
> +#ifndef CONFIG_DM_SPI_FLASH
> struct spi_flash *new;
> #endif
>
> @@ -119,21 +114,11 @@ static int do_spi_flash_probe(int argc, char * const argv[])
> }
>
> #ifdef CONFIG_DM_SPI_FLASH
> - /* Remove the old device, otherwise probe will just be a nop */
> - ret = spi_find_bus_and_cs(bus, cs, &bus_dev, &new);
> - if (!ret) {
> - device_remove(new);
> - device_unbind(new);
> - }
> - flash = NULL;
> - ret = spi_flash_probe_bus_cs(bus, cs, speed, mode, &new);
> - if (ret) {
> - printf("Failed to initialize SPI flash at %u:%u (error %d)\n",
> - bus, cs, ret);
> + flash = dm_spi_flash_probe(bus, cs, speed, mode);
The dm_ functions should use driver model - i.e. a udevice, not a bus
number and CS number.
[snip]
Regards,
Simon
More information about the U-Boot
mailing list