From: Haibo Chen <haibo.chen@nxp.com>
To: Han Xu <han.xu@nxp.com>, Yogesh Gaur <yogeshgaur.83@gmail.com>,
Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev,
linux-kernel@vger.kernel.org, Haibo Chen <haibo.chen@nxp.com>
Subject: [PATCH 4/5] spi: spi-nxp-fspi: correct the clock rate for DTR mode
Date: Tue, 16 Sep 2025 15:56:43 +0800 [thread overview]
Message-ID: <20250916-flexspi-ddr-v1-4-69358b5dc862@nxp.com> (raw)
In-Reply-To: <20250916-flexspi-ddr-v1-0-69358b5dc862@nxp.com>
For DTR mode, flexspi will automatically div 2 of the root clock
and output to device. the formula is:
device_clock = root_clock / (is_dtr ? 2 : 1);
So correct the clock rate setting for DTR mode to get the max
performance.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
drivers/spi/spi-nxp-fspi.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index be1e56072b94f38af934556055e321d9834bb07b..15b094e8e892f0b61c1f320bba897fa1f588be91 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -806,10 +806,15 @@ static void nxp_fspi_select_mem(struct nxp_fspi *f, struct spi_device *spi,
nxp_fspi_select_rx_sample_clk_source(f, op_is_dtr);
- if (op_is_dtr)
+ if (op_is_dtr) {
f->flags |= FSPI_DTR_MODE;
- else
+ /* For DTR mode, flexspi will default div 2 and output to device.
+ * so here to config the root clock to 2 * device rate.
+ */
+ rate = rate * 2;
+ } else {
f->flags &= ~FSPI_DTR_MODE;
+ }
nxp_fspi_clk_disable_unprep(f);
--
2.34.1
next prev parent reply other threads:[~2025-09-16 7:57 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
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 ` Haibo Chen [this message]
2025-09-16 15:39 ` [PATCH 4/5] spi: spi-nxp-fspi: correct the clock rate for DTR mode 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=20250916-flexspi-ddr-v1-4-69358b5dc862@nxp.com \
--to=haibo.chen@nxp.com \
--cc=broonie@kernel.org \
--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
all inboxes | Powered by JetHome®