[PATCH v1 1/2] mtd: spinand: rework detect procedure for different READ_ID operation

Igor Prusov ivprusov at salutedevices.com
Tue Oct 17 21:22:15 CEST 2023


Hi Frieder,

On Mon, Oct 09, 2023 at 10:23:53AM +0200, Frieder Schrempf wrote:
> On 04.10.23 17:07, Igor Prusov wrote:
> > Adaptation of Linux commit f1541773af49.
> > 
> > Currently there are 3 different variants of read_id implementation:
> > 1. opcode only. Found in GD5FxGQ4xF.
> > 2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
> > 3. opcode + 1 dummy byte. Found in other currently supported chips.
> > 
> > Original implementation was for variant 1 and let detect function
> > of chips with variant 2 and 3 to ignore the first byte. This isn't
> > robust:
> > 
> > 1. For chips of variant 2, if SPI master doesn't keep MOSI low
> > during read, chip will get a random id offset, and the entire id
> > buffer will shift by that offset, causing detect failure.
> > 
> > 2. For chips of variant 1, if it happens to get a devid that equals
> > to manufacture id of variant 2 or 3 chips, it'll get incorrectly
> > detected.
> > 
> > This patch reworks detect procedure to address problems above. New
> > logic do detection for all variants separatedly, in 1-2-3 order.
> > Since all current detect methods do exactly the same id matching
> > procedure, unify them into core.c and remove detect method from
> > manufacture_ops.
> > 
> > Signed-off-by: Chuanhong Guo <gch981213 at gmail.com>
> > Signed-off-by: Igor Prusov <ivprusov at salutedevices.com>
> 
> An adaptation of this patch was already sent long ago [1] and Dario also
> picked it up in nand-next [2]. Though it looks like this was never
> merged upstream as there wasn't any pull request sent to Tom, right?

Thanks for pointing this out, looks like this rework made it to
upstream, so I'll drop it in v2.

> Dario, as you already seem to have rebased nand-next recently, can you
> please sent the changes to Tom for picking them up? As the merge window
> is open at the moment it would be good to get it done soon. Thanks!
> 
> [1]
> https://patchwork.ozlabs.org/project/uboot/patch/20230110115843.391630-1-frieder@fris.de/
> [2]
> https://source.denx.de/u-boot/custodians/u-boot-nand-flash/-/commits/nand-next/

-- 
Best Regards,
Igor Prusov


More information about the U-Boot mailing list