From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Sky Huang <SkyLake.Huang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Daniel Golle <daniel@makrotopia.org>,
Chia-Lin Kao <acelan.kao@canonical.com>,
"Mika Westerberg" <mika.westerberg@linux.intel.com>,
Cheng Ming Lin <chengminglin@mxic.com.tw>,
<linux-kernel@vger.kernel.org>, <linux-mtd@lists.infradead.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
Steven Liu <Steven.Liu@mediatek.com>
Subject: Re: [RFC PATCH nand/next 3/4] include: mtd: spinand: Add CASN page related macros and flags.
Date: Mon, 18 Nov 2024 14:06:08 +0100 [thread overview]
Message-ID: <87r078y9mn.fsf@bootlin.com> (raw)
In-Reply-To: <20241020132722.20565-4-SkyLake.Huang@mediatek.com> (Sky Huang's message of "Sun, 20 Oct 2024 21:27:21 +0800")
On 20/10/2024 at 21:27:21 +08, Sky Huang <SkyLake.Huang@mediatek.com> wrote:
> From: "Sky Huang" <skylake.huang@mediatek.com>
>
> This patch adds SPINAND CASN page manipulation macros for
> SPI-NAND driver to use. Also, some important flag bits, like
> SPINAND_SUPR_CR(continuous read), are added to show the
> SPI-NAND device's capability.
>
> Signed-off-by: Sky Huang <skylake.huang@mediatek.com>
> ---
> include/linux/mtd/spinand.h | 100 +++++++++++++++++++++++++++++++++++-
> 1 file changed, 98 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
> index 702e5fb13dae..de97994c357b 100644
> --- a/include/linux/mtd/spinand.h
> +++ b/include/linux/mtd/spinand.h
> @@ -62,6 +62,59 @@
> SPI_MEM_OP_NO_DUMMY, \
> SPI_MEM_OP_NO_DATA)
>
> +/* Macros for CASN */
> +#define SPINAND_CASN_PAGE_READ_FROM_CACHE_OP(fast, naddr, addr, ndummy, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(fast ? 0x0b : 0x03, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 1), \
> + SPI_MEM_OP_DUMMY(ndummy, 1), \
> + SPI_MEM_OP_DATA_IN(len, buf, 1))
> +
> +#define SPINAND_CASN_PAGE_READ_FROM_CACHE_X2_OP(naddr, addr, ndummy, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 1), \
> + SPI_MEM_OP_DUMMY(ndummy, 1), \
> + SPI_MEM_OP_DATA_IN(len, buf, 2))
> +
> +#define SPINAND_CASN_PAGE_READ_FROM_CACHE_DUALIO_OP(naddr, addr, ndummy, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 2), \
> + SPI_MEM_OP_DUMMY(ndummy, 2), \
> + SPI_MEM_OP_DATA_IN(len, buf, 2))
> +
> +#define SPINAND_CASN_PAGE_READ_FROM_CACHE_X4_OP(naddr, addr, ndummy, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 1), \
> + SPI_MEM_OP_DUMMY(ndummy, 1), \
> + SPI_MEM_OP_DATA_IN(len, buf, 4))
> +
> +#define SPINAND_CASN_PAGE_READ_FROM_CACHE_QUADIO_OP(naddr, addr, ndummy, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 4), \
> + SPI_MEM_OP_DUMMY(ndummy, 4), \
> + SPI_MEM_OP_DATA_IN(len, buf, 4))
> +
> +#define SPINAND_CASN_PROG_LOAD(reset, naddr, addr, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(reset ? 0x02 : 0x84, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 1), \
> + SPI_MEM_OP_NO_DUMMY, \
> + SPI_MEM_OP_DATA_OUT(len, buf, 1))
> +
> +#define SPINAND_CASN_PROG_LOAD_X4(reset, naddr, addr, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(reset ? 0x32 : 0x34, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 1), \
> + SPI_MEM_OP_NO_DUMMY, \
> + SPI_MEM_OP_DATA_OUT(len, buf, 4))
Why would you need to redefine all these?
> +
> +#define SPINAND_CASN_ADVECC_OP(casn_adv_ecc_status, buf) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(casn_adv_ecc_status.cmd, 1), \
> + SPI_MEM_OP_ADDR(casn_adv_ecc_status.addr_nbytes, \
> + casn_adv_ecc_status.addr, \
> + casn_adv_ecc_status.addr_buswidth), \
> + SPI_MEM_OP_DUMMY(casn_adv_ecc_status.dummy_nbytes, \
> + casn_adv_ecc_status.dummy_buswidth), \
> + SPI_MEM_OP_DATA_IN(casn_adv_ecc_status.status_nbytes, buf, 1))
> +/* Macros for CASN end */
> +
> #define SPINAND_PAGE_READ_FROM_CACHE_OP(fast, addr, ndummy, buf, len) \
> SPI_MEM_OP(SPI_MEM_OP_CMD(fast ? 0x0b : 0x03, 1), \
> SPI_MEM_OP_ADDR(2, addr, 1), \
> @@ -312,8 +365,11 @@ struct spinand_ecc_info {
>
> #define SPINAND_HAS_QE_BIT BIT(0)
> #define SPINAND_HAS_CR_FEAT_BIT BIT(1)
> -#define SPINAND_HAS_PROG_PLANE_SELECT_BIT BIT(2)
> -#define SPINAND_HAS_READ_PLANE_SELECT_BIT BIT(3)
Why do you remove that?
> +#define SPINAND_SUP_CR BIT(2)
> +#define SPINAND_SUP_ON_DIE_ECC BIT(3)
> +#define SPINAND_SUP_LEGACY_ECC_STATUS BIT(4)
> +#define SPINAND_SUP_ADV_ECC_STATUS BIT(5)
> +#define SPINAND_ECC_PARITY_READABLE BIT(6)
>
> /**
> * struct spinand_ondie_ecc_conf - private SPI-NAND on-die ECC engine structure
> @@ -406,6 +462,28 @@ struct spinand_dirmap {
> struct spi_mem_dirmap_desc *rdesc_ecc;
> };
>
> +/**
> + * struct CASN_ADVECC - CASN's advanced ECC description
> + * @cmd: Command to access SPI-NAND on-chip ECC status registers
> + * @mask: Mask to access SPI-NAND on-chip ECC status registers.
> + * ADV_ECC_STATUS->status_nbytes | CASN_ADVECC->mask
> + * 1 | 0 to 0xff
> + * 2 | 0 to 0xffff
> + * @shift: How many bits to shift to get on-chip ECC status
> + * @pre_op: This comes from CASN page's ADV_ECC_STATUS's pre_op.
> + * After reading on-chip ECC status, we need to do some math
> + * operations if this is specified.
I'm not sure I understand how you'll encode a math operation there.
> + * @pre_mask: This comes from CASN page's ADV_ECC_STATUS's pre_mask.
> + * This is used in companion with pre_op above.
> + */
> +struct CASN_ADVECC {
This is usually changing when continuous reads are enabled, it would
need to be handled.
> + u8 cmd;
> + u16 mask;
> + u8 shift;
> + u8 pre_op;
> + u8 pre_mask;
> +};
> +
Thanks,
Miquèl
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Sky Huang <SkyLake.Huang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Daniel Golle <daniel@makrotopia.org>,
Chia-Lin Kao <acelan.kao@canonical.com>,
"Mika Westerberg" <mika.westerberg@linux.intel.com>,
Cheng Ming Lin <chengminglin@mxic.com.tw>,
<linux-kernel@vger.kernel.org>, <linux-mtd@lists.infradead.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
Steven Liu <Steven.Liu@mediatek.com>
Subject: Re: [RFC PATCH nand/next 3/4] include: mtd: spinand: Add CASN page related macros and flags.
Date: Mon, 18 Nov 2024 14:06:08 +0100 [thread overview]
Message-ID: <87r078y9mn.fsf@bootlin.com> (raw)
In-Reply-To: <20241020132722.20565-4-SkyLake.Huang@mediatek.com> (Sky Huang's message of "Sun, 20 Oct 2024 21:27:21 +0800")
On 20/10/2024 at 21:27:21 +08, Sky Huang <SkyLake.Huang@mediatek.com> wrote:
> From: "Sky Huang" <skylake.huang@mediatek.com>
>
> This patch adds SPINAND CASN page manipulation macros for
> SPI-NAND driver to use. Also, some important flag bits, like
> SPINAND_SUPR_CR(continuous read), are added to show the
> SPI-NAND device's capability.
>
> Signed-off-by: Sky Huang <skylake.huang@mediatek.com>
> ---
> include/linux/mtd/spinand.h | 100 +++++++++++++++++++++++++++++++++++-
> 1 file changed, 98 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
> index 702e5fb13dae..de97994c357b 100644
> --- a/include/linux/mtd/spinand.h
> +++ b/include/linux/mtd/spinand.h
> @@ -62,6 +62,59 @@
> SPI_MEM_OP_NO_DUMMY, \
> SPI_MEM_OP_NO_DATA)
>
> +/* Macros for CASN */
> +#define SPINAND_CASN_PAGE_READ_FROM_CACHE_OP(fast, naddr, addr, ndummy, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(fast ? 0x0b : 0x03, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 1), \
> + SPI_MEM_OP_DUMMY(ndummy, 1), \
> + SPI_MEM_OP_DATA_IN(len, buf, 1))
> +
> +#define SPINAND_CASN_PAGE_READ_FROM_CACHE_X2_OP(naddr, addr, ndummy, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 1), \
> + SPI_MEM_OP_DUMMY(ndummy, 1), \
> + SPI_MEM_OP_DATA_IN(len, buf, 2))
> +
> +#define SPINAND_CASN_PAGE_READ_FROM_CACHE_DUALIO_OP(naddr, addr, ndummy, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 2), \
> + SPI_MEM_OP_DUMMY(ndummy, 2), \
> + SPI_MEM_OP_DATA_IN(len, buf, 2))
> +
> +#define SPINAND_CASN_PAGE_READ_FROM_CACHE_X4_OP(naddr, addr, ndummy, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 1), \
> + SPI_MEM_OP_DUMMY(ndummy, 1), \
> + SPI_MEM_OP_DATA_IN(len, buf, 4))
> +
> +#define SPINAND_CASN_PAGE_READ_FROM_CACHE_QUADIO_OP(naddr, addr, ndummy, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 4), \
> + SPI_MEM_OP_DUMMY(ndummy, 4), \
> + SPI_MEM_OP_DATA_IN(len, buf, 4))
> +
> +#define SPINAND_CASN_PROG_LOAD(reset, naddr, addr, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(reset ? 0x02 : 0x84, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 1), \
> + SPI_MEM_OP_NO_DUMMY, \
> + SPI_MEM_OP_DATA_OUT(len, buf, 1))
> +
> +#define SPINAND_CASN_PROG_LOAD_X4(reset, naddr, addr, buf, len) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(reset ? 0x32 : 0x34, 1), \
> + SPI_MEM_OP_ADDR(naddr, addr, 1), \
> + SPI_MEM_OP_NO_DUMMY, \
> + SPI_MEM_OP_DATA_OUT(len, buf, 4))
Why would you need to redefine all these?
> +
> +#define SPINAND_CASN_ADVECC_OP(casn_adv_ecc_status, buf) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(casn_adv_ecc_status.cmd, 1), \
> + SPI_MEM_OP_ADDR(casn_adv_ecc_status.addr_nbytes, \
> + casn_adv_ecc_status.addr, \
> + casn_adv_ecc_status.addr_buswidth), \
> + SPI_MEM_OP_DUMMY(casn_adv_ecc_status.dummy_nbytes, \
> + casn_adv_ecc_status.dummy_buswidth), \
> + SPI_MEM_OP_DATA_IN(casn_adv_ecc_status.status_nbytes, buf, 1))
> +/* Macros for CASN end */
> +
> #define SPINAND_PAGE_READ_FROM_CACHE_OP(fast, addr, ndummy, buf, len) \
> SPI_MEM_OP(SPI_MEM_OP_CMD(fast ? 0x0b : 0x03, 1), \
> SPI_MEM_OP_ADDR(2, addr, 1), \
> @@ -312,8 +365,11 @@ struct spinand_ecc_info {
>
> #define SPINAND_HAS_QE_BIT BIT(0)
> #define SPINAND_HAS_CR_FEAT_BIT BIT(1)
> -#define SPINAND_HAS_PROG_PLANE_SELECT_BIT BIT(2)
> -#define SPINAND_HAS_READ_PLANE_SELECT_BIT BIT(3)
Why do you remove that?
> +#define SPINAND_SUP_CR BIT(2)
> +#define SPINAND_SUP_ON_DIE_ECC BIT(3)
> +#define SPINAND_SUP_LEGACY_ECC_STATUS BIT(4)
> +#define SPINAND_SUP_ADV_ECC_STATUS BIT(5)
> +#define SPINAND_ECC_PARITY_READABLE BIT(6)
>
> /**
> * struct spinand_ondie_ecc_conf - private SPI-NAND on-die ECC engine structure
> @@ -406,6 +462,28 @@ struct spinand_dirmap {
> struct spi_mem_dirmap_desc *rdesc_ecc;
> };
>
> +/**
> + * struct CASN_ADVECC - CASN's advanced ECC description
> + * @cmd: Command to access SPI-NAND on-chip ECC status registers
> + * @mask: Mask to access SPI-NAND on-chip ECC status registers.
> + * ADV_ECC_STATUS->status_nbytes | CASN_ADVECC->mask
> + * 1 | 0 to 0xff
> + * 2 | 0 to 0xffff
> + * @shift: How many bits to shift to get on-chip ECC status
> + * @pre_op: This comes from CASN page's ADV_ECC_STATUS's pre_op.
> + * After reading on-chip ECC status, we need to do some math
> + * operations if this is specified.
I'm not sure I understand how you'll encode a math operation there.
> + * @pre_mask: This comes from CASN page's ADV_ECC_STATUS's pre_mask.
> + * This is used in companion with pre_op above.
> + */
> +struct CASN_ADVECC {
This is usually changing when continuous reads are enabled, it would
need to be handled.
> + u8 cmd;
> + u16 mask;
> + u8 shift;
> + u8 pre_op;
> + u8 pre_mask;
> +};
> +
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2024-11-18 13:31 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-20 13:27 [RFC PATCH nand/next 0/4] mtd: nand: spi: Add CASN page support Sky Huang
2024-10-20 13:27 ` Sky Huang
2024-10-20 13:27 ` [RFC PATCH nand/next 1/4] mtd: nand: Create param.c to do CRC check and bitwise majority for Parameter & CASN page Sky Huang
2024-10-20 13:27 ` Sky Huang
2024-10-23 15:03 ` kernel test robot
2024-11-18 10:55 ` Miquel Raynal
2024-11-18 10:55 ` Miquel Raynal
2024-10-20 13:27 ` [RFC PATCH nand/next 2/4] include: mtd: Add CASN page definition and related structs Sky Huang
2024-10-20 13:27 ` Sky Huang
2024-11-18 10:58 ` Miquel Raynal
2024-11-18 10:58 ` Miquel Raynal
2024-10-20 13:27 ` [RFC PATCH nand/next 3/4] include: mtd: spinand: Add CASN page related macros and flags Sky Huang
2024-10-20 13:27 ` Sky Huang
2024-10-23 5:22 ` kernel test robot
2024-10-23 5:23 ` kernel test robot
2024-11-18 13:06 ` Miquel Raynal [this message]
2024-11-18 13:06 ` Miquel Raynal
2024-10-20 13:27 ` [RFC PATCH nand/next 4/4] mtd: nand: spi: Add CASN page support Sky Huang
2024-10-20 13:27 ` Sky Huang
2024-10-28 15:25 ` [RFC PATCH nand/next 0/4] " SkyLake Huang (黃啟澤)
2024-10-28 15:25 ` SkyLake Huang (黃啟澤)
2024-11-06 15:20 ` Miquel Raynal
2024-11-06 15:20 ` Miquel Raynal
2024-11-18 10:53 ` Miquel Raynal
2024-11-18 10:53 ` Miquel Raynal
2024-11-20 7:24 ` SkyLake Huang (黃啟澤)
2024-11-20 7:24 ` SkyLake Huang (黃啟澤)
2024-11-20 10:13 ` Miquel Raynal
2024-11-20 10:13 ` Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r078y9mn.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=SkyLake.Huang@mediatek.com \
--cc=Steven.Liu@mediatek.com \
--cc=acelan.kao@canonical.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chengminglin@mxic.com.tw \
--cc=daniel@makrotopia.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mika.westerberg@linux.intel.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.