summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorApurva Nandan <a-nandan@ti.com>2023-05-26 14:42:44 +0530
committerPraneeth Bajjuri <praneeth@ti.com>2023-05-30 06:35:37 -0500
commit7d34b958463a07980bf02a12dde93bee96adbbfe (patch)
tree8884762b2d1592e34dcbb239ad2df56c908e8770 /drivers/mtd/nand
parent53018216cede283256579ce614e12d45171f825e (diff)
mtd: spianand: winbond: Add change_protocol() manufacturer_ops
Add implementation of change_protocol() 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@ti.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/spi/winbond.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
index a9d03fbb1a..e9c7e48c34 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
@@ -321,9 +321,34 @@ static int winbond_spinand_octal_dtr_disable(struct spinand_device *spinand)
return 0;
}
+static int winbond_change_spi_protocol(struct spinand_device *spinand,
+ const enum spinand_protocol protocol)
+{
+ if (spinand->protocol == protocol)
+ return 0;
+
+ switch (spinand->protocol) {
+ case SPINAND_1S:
+ if (protocol == SPINAND_8D)
+ return winbond_spinand_octal_dtr_enable(spinand);
+ break;
+
+ case SPINAND_8D:
+ if (protocol == SPINAND_1S)
+ return winbond_spinand_octal_dtr_disable(spinand);
+ break;
+
+ default:
+ return -EOPNOTSUPP;
+ }
+
+ return -EOPNOTSUPP;
+}
+
static const struct spinand_manufacturer_ops winbond_spinand_manuf_ops = {
.detect = winbond_spinand_detect,
.init = winbond_spinand_init,
+ .change_protocol = winbond_change_spi_protocol,
};
const struct spinand_manufacturer winbond_spinand_manufacturer = {