lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 1 Jan 2022 13:12:36 +0530 From: Apurva Nandan <a-nandan@...com> To: Miquel Raynal <miquel.raynal@...tlin.com>, Richard Weinberger <richard@....at>, Vignesh Raghavendra <vigneshr@...com>, Mark Brown <broonie@...nel.org>, Apurva Nandan <a-nandan@...com>, Patrice Chotard <patrice.chotard@...s.st.com>, Christophe Kerello <christophe.kerello@...s.st.com>, Boris Brezillon <boris.brezillon@...labora.com>, Daniel Palmer <daniel@...f.com>, Alexander Lobakin <alobakin@...me>, <linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>, <linux-spi@...r.kernel.org> CC: <p.yadav@...com> Subject: [PATCH v3 03/17] mtd: spinand: Add enum spinand_protocol to indicate current SPI IO mode Unlike Dual and Quad SPI modes flashes, Octal DTR SPI NAND flashes require all instructions to be made in 8D-8D-8D protocol when the flash is in Octal DTR mode. Hence, storing the current SPI IO mode becomes necessary for operating the flash and switching between modes. Store the current SPI IO mode in the spinand struct using a spinand_protocol enum. This would act as a flag, denoting that the core should use the given SPI protocol all types of flash operations. Signed-off-by: Apurva Nandan <a-nandan@...com> --- drivers/mtd/nand/spi/core.c | 2 ++ include/linux/mtd/spinand.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 2c8685f1f2fa..7d8c2873ab29 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -1155,6 +1155,7 @@ static void spinand_mtd_resume(struct mtd_info *mtd) struct spinand_device *spinand = mtd_to_spinand(mtd); int ret; + spinand->protocol = SPINAND_1S_1S_1S; ret = spinand_reset_op(spinand); if (ret) return; @@ -1181,6 +1182,7 @@ static int spinand_init(struct spinand_device *spinand) if (!spinand->scratchbuf) return -ENOMEM; + spinand->protocol = SPINAND_1S_1S_1S; ret = spinand_detect(spinand); if (ret) goto err_free_bufs; diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h index 69e06e741717..77927afcea0f 100644 --- a/include/linux/mtd/spinand.h +++ b/include/linux/mtd/spinand.h @@ -194,6 +194,18 @@ SPI_MEM_OP_NO_DUMMY, \ SPI_MEM_OP_DATA_OUT_DTR(len, buf, 8)) +/** + * enum spinand_protocol - List of SPI protocols to denote the op protocol and + * SPI NAND flash IO modes. + */ +enum spinand_protocol { + SPINAND_1S_1S_1S, + SPINAND_2S_2S_2S, + SPINAND_4S_4S_4S, + SPINAND_8S_8S_8S, + SPINAND_8D_8D_8D, +}; + /** * Standard SPI NAND flash commands */ @@ -461,6 +473,8 @@ struct spinand_dirmap { * this die. Only required if your chip exposes several dies * @cur_target: currently selected target/die * @eccinfo: on-die ECC information + * @protocol: SPI IO protocol in operation. Update on successful transition into + * a different SPI IO protocol. * @cfg_cache: config register cache. One entry per die * @databuf: bounce buffer for data * @oobbuf: bounce buffer for OOB data @@ -492,6 +506,8 @@ struct spinand_device { struct spinand_ecc_info eccinfo; + enum spinand_protocol protocol; + u8 *cfg_cache; u8 *databuf; u8 *oobbuf; -- 2.25.1
Powered by blists - more mailing lists