[PATCH v3 15/17] mtd: spianand: winbond: Add change_mode() manufacturer_ops
Apurva Nandan
a-nandan at ti.com
Fri Dec 31 23:42:48 PST 2021
Add implementation of change_mode() for Winbond's manufacturer_ops,
that executes octal_dtr_enable() and octal_dtr_disable() according
to requested protocol.
Datasheet: https://www.winbond.com/export/sites/winbond/datasheet/W35N01JW_Datasheet_Brief.pdf
Signed-off-by: Apurva Nandan <a-nandan at ti.com>
---
drivers/mtd/nand/spi/winbond.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
index c7478faf6cee..d8eccb40c80f 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
@@ -242,8 +242,33 @@ static int winbond_spinand_octal_dtr_disable(struct spinand_device *spinand)
return 0;
}
+static int winbond_change_spi_mode(struct spinand_device *spinand,
+ const enum spinand_protocol protocol)
+{
+ if (spinand->protocol == protocol)
+ return 0;
+
+ switch (spinand->protocol) {
+ case SPINAND_1S_1S_1S:
+ if (protocol == SPINAND_8D_8D_8D)
+ return winbond_spinand_octal_dtr_enable(spinand);
+ break;
+
+ case SPINAND_8D_8D_8D:
+ if (protocol == SPINAND_1S_1S_1S)
+ return winbond_spinand_octal_dtr_disable(spinand);
+ break;
+
+ default:
+ return -EOPNOTSUPP;
+ }
+
+ return -EOPNOTSUPP;
+}
+
static const struct spinand_manufacturer_ops winbond_spinand_manuf_ops = {
.init = winbond_spinand_init,
+ .change_mode = winbond_change_spi_mode,
};
const struct spinand_manufacturer winbond_spinand_manufacturer = {
--
2.25.1
More information about the linux-mtd
mailing list