All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Avoid adding the same dataflash for the second time
@ 2021-06-18  8:48 Jakub Frackowiak
  2021-08-03  6:18 ` Jagan Teki
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Frackowiak @ 2021-06-18  8:48 UTC (permalink / raw)
  To: u-boot

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;
      }

         /*
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Avoid adding the same dataflash for the second time
  2021-06-18  8:48 [PATCH] Avoid adding the same dataflash for the second time Jakub Frackowiak
@ 2021-08-03  6:18 ` Jagan Teki
  0 siblings, 0 replies; 2+ messages in thread
From: Jagan Teki @ 2021-08-03  6:18 UTC (permalink / raw)
  To: Jakub Frackowiak; +Cc: U-Boot-Denx

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-03  6:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18  8:48 [PATCH] Avoid adding the same dataflash for the second time Jakub Frackowiak
2021-08-03  6:18 ` Jagan Teki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.