Re: [PATCH v2] mtd: spi-nor: Add support for BoHong bh25q128as

From: Tudor Ambarus
Date: Thu Feb 22 2024 - 04:20:01 EST




On 2/20/24 20:03, Christian Marangi wrote:
> From: David Bauer <mail@xxxxxxxxxxxxxxx>
>
> Add MTD support for the BoHong bh25q128as SPI NOR chip.
> The chip has 16MB of total capacity, divided into a total of 256
> sectors, each 64KB sized. The chip also supports 4KB sectors.
> Additionally, it supports dual and quad read modes.
>
> Datasheet is public and can be found at the referenced link.
>
> Functionality was verified on an Tenbay WR1800K / MTK MT7621 board.
>
> Link: https://www.e-interlink.com.tw/userUpload/files/BH25Q128AS_v1_0.pdf
> Signed-off-by: David Bauer <mail@xxxxxxxxxxxxxxx>
> [ reworked to new flash_info format ]
> Signed-off-by: Christian Marangi <ansuelsmth@xxxxxxxxx>
> ---
> Read/write/erase test are done by flashing and installing an OpenWrt
> image on the spi and by using overlayfs on it confirming correct
> read/write.
>
> root@OpenWrt:/tmp/tmp2# cat /sys/bus/spi/devices/spi0.0/spi-nor/partname
> bh25q128as
> root@OpenWrt:/tmp/tmp2# cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
> 684018
> root@OpenWrt:/tmp/tmp2# cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
> bohong
>
> root@OpenWrt:/# xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
> 53464450000101ff00000109300000ff68000103600000ffffffffffffff
> ffffffffffffffffffffffffffffffffffffe520f1ffffffff0744eb086b
> 083b42bbeeffffffffff00ffffff44eb0c200f5210d800ffffffffffffff
> ffffffffffff003600279ef97764fcebffff
>

Hey, Christian,

Seems that the flash defines the SFDP tables, thus it's likely you won't
need a flash entry at all, and instead rely on the generic SFDP driver
to parse the flash settings from SFDP and initialize the flash based on
that.

Have you tried testing the flash without adding a dedicated entry for
it? Just specifying the jedec,spi-nor compatible in dt will do the
trick. As you do now, but without this patch :).

Cheers,
ta