diff mbox series

[v3,08/25] mtd: spi-nor: winbond: Use manufacturer late_init() for OTP ops

Message ID 20211029172633.886453-9-tudor.ambarus@microchip.com (mailing list archive)
State New, archived
Headers show
Series mtd: spi-nor: Clean params init | expand

Commit Message

Tudor Ambarus Oct. 29, 2021, 5:26 p.m. UTC
OTP is not described in the JESD216 SFDP standard, place the
OTP ops init in late_init().

We can't get rid of the default_init() hook for winbond, as the
4byte_addr_mode is SFDP specific and will require to have all
flashes at hand, in order to check which has the SFDP tables defined,
in which case there's nothing to do if the SFDP tables are corect,
and which of the flashes do not define the SFDP tables in which case
each flash should declare a late_init() fixup.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/mtd/spi-nor/winbond.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Michael Walle Nov. 9, 2021, 9:36 a.m. UTC | #1
Am 2021-10-29 19:26, schrieb Tudor Ambarus:
> OTP is not described in the JESD216 SFDP standard, place the
> OTP ops init in late_init().
> 
> We can't get rid of the default_init() hook for winbond, as the
> 4byte_addr_mode is SFDP specific and will require to have all
> flashes at hand, in order to check which has the SFDP tables defined,
> in which case there's nothing to do if the SFDP tables are corect,
> and which of the flashes do not define the SFDP tables in which case
> each flash should declare a late_init() fixup.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>

Reviewed-by: Michael Walle <michael@walle.cc>
Pratyush Yadav Nov. 15, 2021, 7 p.m. UTC | #2
On 29/10/21 08:26PM, Tudor Ambarus wrote:
> OTP is not described in the JESD216 SFDP standard, place the
> OTP ops init in late_init().
> 
> We can't get rid of the default_init() hook for winbond, as the
> 4byte_addr_mode is SFDP specific and will require to have all
> flashes at hand, in order to check which has the SFDP tables defined,
> in which case there's nothing to do if the SFDP tables are corect,
> and which of the flashes do not define the SFDP tables in which case
> each flash should declare a late_init() fixup.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>

Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
diff mbox series

Patch

diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
index 96573f61caf5..dd4be0f78e67 100644
--- a/drivers/mtd/spi-nor/winbond.c
+++ b/drivers/mtd/spi-nor/winbond.c
@@ -147,12 +147,17 @@  static const struct spi_nor_otp_ops winbond_otp_ops = {
 static void winbond_default_init(struct spi_nor *nor)
 {
 	nor->params->set_4byte_addr_mode = winbond_set_4byte_addr_mode;
+}
+
+static void winbond_late_init(struct spi_nor *nor)
+{
 	if (nor->params->otp.org->n_regions)
 		nor->params->otp.ops = &winbond_otp_ops;
 }
 
 static const struct spi_nor_fixups winbond_fixups = {
 	.default_init = winbond_default_init,
+	.late_init = winbond_late_init,
 };
 
 const struct spi_nor_manufacturer spi_nor_winbond = {