diff options
author | Apurva Nandan <a-nandan@ti.com> | 2023-01-23 23:13:27 +0530 |
---|---|---|
committer | Praneeth Bajjuri <praneeth@ti.com> | 2023-01-25 14:10:19 -0600 |
commit | a7dd90588ca3753c0ee44c51d6b21a8f4b23541d (patch) | |
tree | 6ef179a2128db3335b842b3da013b37c8753b8e9 /drivers | |
parent | bcd1218825fe47803107946127fa846e3f58df25 (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')
-rw-r--r-- | drivers/mtd/nand/spi/winbond.c | 25 |
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 = { |