[PATCH] Avoid adding the same dataflash for the second time

The spi_dataflash_probe function should return after jedec_probe if it finds any serial flash. This functions adds the same SPI device two times without this path. Serial output when reading environment:
Loading Environment from SPIFlash... SPI DataFlash: Detected at45db321d with page size 512 Bytes, erase size 512 Bytes, total 4 MiB, revision d SPI DataFlash: Detected AT45DB321x with page size 528 Bytes, erase size 528 Bytes, total 4.1 MiB, revision *** Warning - bad CRC, using default environment
When this patch is applied:
Loading Environment from SPIFlash... SPI DataFlash: Detected at45db321d with page size 512 Bytes, erase size 512 Bytes, total 4 MiB, revision d OK --- drivers/mtd/spi/sf_dataflash.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/mtd/spi/sf_dataflash.c b/drivers/mtd/spi/sf_dataflash.c index b59edd152c..7040f21eb2 100644 --- a/drivers/mtd/spi/sf_dataflash.c +++ b/drivers/mtd/spi/sf_dataflash.c @@ -630,6 +630,9 @@ static int spi_dataflash_probe(struct udevice *dev) if (status == 0 || status == 0xff) status = -ENODEV; goto err_jedec_probe; + + if (!status) + return 0; }
/*

On Fri, Jun 18, 2021 at 8:26 PM Jakub Frackowiak jakub@mikronika.com.pl wrote:
The spi_dataflash_probe function should return after jedec_probe if it finds any serial flash. This functions adds the same SPI device two times without this path. Serial output when reading environment:
Loading Environment from SPIFlash... SPI DataFlash: Detected at45db321d with page size 512 Bytes, erase size 512 Bytes, total 4 MiB, revision d SPI DataFlash: Detected AT45DB321x with page size 528 Bytes, erase size 528 Bytes, total 4.1 MiB, revision *** Warning - bad CRC, using default environment
When this patch is applied:
Loading Environment from SPIFlash... SPI DataFlash: Detected at45db321d with page size 512 Bytes, erase size 512 Bytes, total 4 MiB, revision d OK
Please send the patch properly, check it the guidelines - if you aren't aware it before. https://www.denx.de/wiki/view/U-Boot/Patches#General_Patch_Submission_Rules
participants (2)
-
Jagan Teki
-
Jakub Frackowiak