]> git.dujemihanovic.xyz Git - u-boot.git/commit
mtd: spi-nor-core: Introduce flash-specific fixup hooks
authorPratyush Yadav <p.yadav@ti.com>
Fri, 25 Jun 2021 19:17:13 +0000 (00:47 +0530)
committerJagan Teki <jagan@amarulasolutions.com>
Mon, 28 Jun 2021 06:29:10 +0000 (11:59 +0530)
commit8702188ce5479729c81863680fb8ac7fffbd6b6a
tree3888999026859ff80bcc2c37aab1741ab3a78c7a
parente2e31fa6800f701cd370b886035c72d6116a8cb1
mtd: spi-nor-core: Introduce flash-specific fixup hooks

Sometimes the information in a flash's SFDP tables is wrong. Sometimes
some information just can't be expressed in the SFDP table. So,
introduce the fixup hooks to allow tailoring settings for a specific
flash.

Three hooks are added: default_init, post_sfdp, and post_bfpt. These
allow tweaking the flash settings at different point in the probe
sequence. Since the hooks reside in nor->info, set that value just
before the call to spi_nor_init_params().

The hooks and at what points they are executed mimics Linux's spi-nor
framework. One major difference is that Linux puts the struct
spi_nor_fixups in nor->info. This is not possible in U-Boot because the
spi-nor-ids list is shared between spi-nor-core.c and spi-nor-tiny.c.
Since spi-nor-tiny shouldn't have those fixup hooks populated, add a
separate function that lets flashes populate their fixup hooks.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
drivers/mtd/spi/spi-nor-core.c
include/linux/mtd/spi-nor.h