X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=cmd%2Fsf.c;h=84bb0575f233892e22f8cb9162cbde2cc5a22f8e;hb=fa241e2f19c58d08f2d978f32d133eab24b02a92;hp=42862d9d921a9e0121169bb9c552a388cbf56fb8;hpb=d82477748d641e60ba3e1a0b55d98362aed70f80;p=u-boot diff --git a/cmd/sf.c b/cmd/sf.c index 42862d9d92..84bb0575f2 100644 --- a/cmd/sf.c +++ b/cmd/sf.c @@ -1,9 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Command for accessing SPI flash. * * Copyright (C) 2008 Atmel Corporation - * - * SPDX-License-Identifier: GPL-2.0+ */ #include @@ -88,6 +87,8 @@ static int do_spi_flash_probe(int argc, char * const argv[]) #ifdef CONFIG_DM_SPI_FLASH struct udevice *new, *bus_dev; int ret; + /* In DM mode defaults will be taken from DT */ + speed = 0, mode = 0; #else struct spi_flash *new; #endif @@ -122,8 +123,7 @@ static int do_spi_flash_probe(int argc, char * const argv[]) /* 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); + device_remove(new, DM_REMOVE_NORMAL); } flash = NULL; ret = spi_flash_probe_bus_cs(bus, cs, speed, mode, &new); @@ -286,7 +286,7 @@ static int do_spi_flash_read_write(int argc, char * const argv[]) } buf = map_physmem(addr, len, MAP_WRBACK); - if (!buf) { + if (!buf && addr) { puts("Failed to map physical memory\n"); return 1; }