diff options
author | Tudor Ambarus <tudor.ambarus@microchip.com> | 2021-12-07 17:02:44 +0300 |
---|---|---|
committer | Tudor Ambarus <tudor.ambarus@microchip.com> | 2021-12-07 18:05:10 +0300 |
commit | 5273cc6df984967068f3acfcbe0def1562db5409 (patch) | |
tree | e807d0562f148f6ccdddd4c9923fee0969ad5ae2 /drivers/mtd/spi-nor/sfdp.c | |
parent | ff67592cbdfc74c4237b2d02c4cb50a5eef56ff1 (diff) | |
download | linux-5273cc6df984967068f3acfcbe0def1562db5409.tar.xz |
mtd: spi-nor: core: Call spi_nor_post_sfdp_fixups() only when SFDP is defined
spi_nor_post_sfdp_fixups() was called even when there were no SFDP
tables defined. late_init() should be instead used for flashes that
do not define SFDP tables.
Use spi_nor_post_sfdp_fixups() just to fix SFDP data. post_sfdp()
hook is as of now used just by s28hs512t, mt35xu512aba, and both
support SFDP, there's no functional change with this patch.
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Link: https://lore.kernel.org/r/20211207140254.87681-5-tudor.ambarus@microchip.com
Diffstat (limited to 'drivers/mtd/spi-nor/sfdp.c')
-rw-r--r-- | drivers/mtd/spi-nor/sfdp.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index c500c2118a5d..a5211543d30d 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -1229,6 +1229,25 @@ out: } /** + * spi_nor_post_sfdp_fixups() - Updates the flash's parameters and settings + * after SFDP has been parsed. Called only for flashes that define JESD216 SFDP + * tables. + * @nor: pointer to a 'struct spi_nor' + * + * Used to tweak various flash parameters when information provided by the SFDP + * tables are wrong. + */ +static void spi_nor_post_sfdp_fixups(struct spi_nor *nor) +{ + if (nor->manufacturer && nor->manufacturer->fixups && + nor->manufacturer->fixups->post_sfdp) + nor->manufacturer->fixups->post_sfdp(nor); + + if (nor->info->fixups && nor->info->fixups->post_sfdp) + nor->info->fixups->post_sfdp(nor); +} + +/** * spi_nor_parse_sfdp() - parse the Serial Flash Discoverable Parameters. * @nor: pointer to a 'struct spi_nor' * @@ -1408,6 +1427,7 @@ int spi_nor_parse_sfdp(struct spi_nor *nor) } } + spi_nor_post_sfdp_fixups(nor); exit: kfree(param_headers); return err; |