From: Frank Li <Frank.li@nxp.com>
To: Haibo Chen <haibo.chen@nxp.com>
Cc: Han Xu <han.xu@nxp.com>, Yogesh Gaur <yogeshgaur.83@gmail.com>,
Mark Brown <broonie@kernel.org>,
linux-spi@vger.kernel.org, imx@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] spi: spi-nxp-fspi: Add the DDR LUT command support
Date: Tue, 16 Sep 2025 11:31:35 -0400 [thread overview]
Message-ID: <aMmC167rzSYrIeTd@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250916-flexspi-ddr-v1-2-69358b5dc862@nxp.com>
On Tue, Sep 16, 2025 at 03:56:41PM +0800, Haibo Chen wrote:
> For DTR mode, flexspi need to use DDR LUT command, flexspi will switch
> to DDR mode when detect the DDR LUT command.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> ---
> drivers/spi/spi-nxp-fspi.c | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
> index a1c9ad03379682dc1fc2908fbd83e1ae8e91588f..6b3e6b427ba84734a2359a964635a8f05cd146fd 100644
> --- a/drivers/spi/spi-nxp-fspi.c
> +++ b/drivers/spi/spi-nxp-fspi.c
> @@ -559,12 +559,22 @@ static void nxp_fspi_prepare_lut(struct nxp_fspi *f,
> u32 target_lut_reg;
>
> /* cmd */
> - lutval[0] |= LUT_DEF(0, LUT_CMD, LUT_PAD(op->cmd.buswidth),
> - op->cmd.opcode);
> + if (op->cmd.dtr) {
> + lutval[0] |= LUT_DEF(0, LUT_CMD_DDR, LUT_PAD(op->cmd.buswidth),
> + op->cmd.opcode >> 8);
> + lutval[lutidx / 2] |= LUT_DEF(lutidx, LUT_CMD_DDR,
> + LUT_PAD(op->cmd.buswidth),
> + op->cmd.opcode & 0xFF);
> + lutidx++;
> + } else {
> + lutval[0] |= LUT_DEF(0, LUT_CMD, LUT_PAD(op->cmd.buswidth),
> + op->cmd.opcode);
> + }
>
> /* addr bytes */
> if (op->addr.nbytes) {
> - lutval[lutidx / 2] |= LUT_DEF(lutidx, LUT_ADDR,
> + lutval[lutidx / 2] |= LUT_DEF(lutidx, op->addr.dtr ?
> + LUT_ADDR_DDR : LUT_ADDR,
op->addr.dtr ? UT_ADDR_DDR : LUT_ADDR,
put ? to one line to look better.
> LUT_PAD(op->addr.buswidth),
> op->addr.nbytes * 8);
> lutidx++;
> @@ -572,7 +582,8 @@ static void nxp_fspi_prepare_lut(struct nxp_fspi *f,
>
> /* dummy bytes, if needed */
> if (op->dummy.nbytes) {
> - lutval[lutidx / 2] |= LUT_DEF(lutidx, LUT_DUMMY,
> + lutval[lutidx / 2] |= LUT_DEF(lutidx, op->dummy.dtr ?
> + LUT_DUMMY_DDR : LUT_DUMMY,
the same here.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> /*
> * Due to FlexSPI controller limitation number of PAD for dummy
> * buswidth needs to be programmed as equal to data buswidth.
> @@ -587,7 +598,8 @@ static void nxp_fspi_prepare_lut(struct nxp_fspi *f,
> if (op->data.nbytes) {
> lutval[lutidx / 2] |= LUT_DEF(lutidx,
> op->data.dir == SPI_MEM_DATA_IN ?
> - LUT_NXP_READ : LUT_NXP_WRITE,
> + (op->data.dtr ? LUT_READ_DDR : LUT_NXP_READ) :
> + (op->data.dtr ? LUT_WRITE_DDR : LUT_NXP_WRITE),
> LUT_PAD(op->data.buswidth),
> 0);
> lutidx++;
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-09-16 15:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-16 7:56 [PATCH 0/5] spi: spi-nxp-fspi: add DTR mode support Haibo Chen
2025-09-16 7:56 ` [PATCH 1/5] spi: spi-nxp-fspi: extract function nxp_fspi_dll_override() Haibo Chen
2025-09-16 15:28 ` Frank Li
2025-09-16 7:56 ` [PATCH 2/5] spi: spi-nxp-fspi: Add the DDR LUT command support Haibo Chen
2025-09-16 15:31 ` Frank Li [this message]
2025-09-16 7:56 ` [PATCH 3/5] spi: spi-nxp-fspi: add the support for sample data from DQS pad Haibo Chen
2025-09-16 15:37 ` Frank Li
2025-09-16 7:56 ` [PATCH 4/5] spi: spi-nxp-fspi: correct the clock rate for DTR mode Haibo Chen
2025-09-16 15:39 ` Frank Li
2025-09-16 7:56 ` [PATCH 5/5] spi: spi-nxp-fspi: Add OCT-DTR mode support Haibo Chen
2025-09-16 15:43 ` Frank Li
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=aMmC167rzSYrIeTd@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=broonie@kernel.org \
--cc=haibo.chen@nxp.com \
--cc=han.xu@nxp.com \
--cc=imx@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=yogeshgaur.83@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox