From: James Clark <james.clark@linaro.org>
To: Vladimir Oltean <olteanv@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Frank Li <Frank.Li@nxp.com>,
Chester Lin <chester62515@gmail.com>,
Matthias Brugger <mbrugger@suse.com>,
Ghennadi Procopciuc <ghennadi.procopciuc@oss.nxp.com>,
NXP S32 Linux Team <s32@nxp.com>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
larisa.grigore@nxp.com, arnd@linaro.org,
andrei.stefanescu@nxp.com, dan.carpenter@linaro.org
Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
James Clark <james.clark@linaro.org>
Subject: [PATCH 04/14] spi: spi-fsl-dspi: Add config and regmaps for S32G platforms
Date: Fri, 09 May 2025 12:05:51 +0100 [thread overview]
Message-ID: <20250509-james-nxp-spi-v1-4-32bfcd2fea11@linaro.org> (raw)
In-Reply-To: <20250509-james-nxp-spi-v1-0-32bfcd2fea11@linaro.org>
From: Larisa Grigore <larisa.grigore@nxp.com>
S32G adds SPI_{T,R}XFR4 and extends SPI_CTAR registers to 5. Add the
new regmaps, configs and bits.
dspi_volatile_ranges gets SPI_{T,R}XFR4 added which affects all
platforms, however they are further limited by dspi_yes_ranges.
Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
---
drivers/spi/spi-fsl-dspi.c | 39 ++++++++++++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 701cf56d28e7..df6f85122bfe 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -35,7 +35,7 @@
#define SPI_TCR 0x08
#define SPI_TCR_GET_TCNT(x) (((x) & GENMASK(31, 16)) >> 16)
-#define SPI_CTAR(x) (0x0c + (((x) & GENMASK(1, 0)) * 4))
+#define SPI_CTAR(x) (0x0c + (((x) & GENMASK(2, 0)) * 4))
#define SPI_CTAR_FMSZ(x) (((x) << 27) & GENMASK(30, 27))
#define SPI_CTAR_CPOL BIT(26)
#define SPI_CTAR_CPHA BIT(25)
@@ -92,12 +92,14 @@
#define SPI_TXFR1 0x40
#define SPI_TXFR2 0x44
#define SPI_TXFR3 0x48
+#define SPI_TXFR4 0x4C
#define SPI_RXFR0 0x7c
#define SPI_RXFR1 0x80
#define SPI_RXFR2 0x84
#define SPI_RXFR3 0x88
+#define SPI_RXFR4 0x8C
-#define SPI_CTARE(x) (0x11c + (((x) & GENMASK(1, 0)) * 4))
+#define SPI_CTARE(x) (0x11c + (((x) & GENMASK(2, 0)) * 4))
#define SPI_CTARE_FMSZE(x) (((x) & 0x1) << 16)
#define SPI_CTARE_DTCP(x) ((x) & 0x7ff)
@@ -135,6 +137,7 @@ enum {
LX2160A,
MCF5441X,
VF610,
+ S32G
};
static const struct regmap_range dspi_yes_ranges[] = {
@@ -146,15 +149,29 @@ static const struct regmap_range dspi_yes_ranges[] = {
regmap_reg_range(SPI_SREX, SPI_SREX),
};
+static const struct regmap_range s32g_dspi_yes_ranges[] = {
+ regmap_reg_range(SPI_MCR, SPI_MCR),
+ regmap_reg_range(SPI_TCR, SPI_CTAR(5)),
+ regmap_reg_range(SPI_SR, SPI_TXFR4),
+ regmap_reg_range(SPI_RXFR0, SPI_RXFR4),
+ regmap_reg_range(SPI_CTARE(0), SPI_CTARE(5)),
+ regmap_reg_range(SPI_SREX, SPI_SREX),
+};
+
static const struct regmap_access_table dspi_access_table = {
.yes_ranges = dspi_yes_ranges,
.n_yes_ranges = ARRAY_SIZE(dspi_yes_ranges),
};
+static const struct regmap_access_table s32g_dspi_access_table = {
+ .yes_ranges = s32g_dspi_yes_ranges,
+ .n_yes_ranges = ARRAY_SIZE(s32g_dspi_yes_ranges),
+};
+
static const struct regmap_range dspi_volatile_ranges[] = {
regmap_reg_range(SPI_MCR, SPI_TCR),
regmap_reg_range(SPI_SR, SPI_SR),
- regmap_reg_range(SPI_PUSHR, SPI_RXFR3),
+ regmap_reg_range(SPI_PUSHR, SPI_RXFR4),
regmap_reg_range(SPI_SREX, SPI_SREX)
};
@@ -166,6 +183,7 @@ static const struct regmap_access_table dspi_volatile_table = {
enum {
DSPI_REGMAP,
DSPI_XSPI_REGMAP,
+ S32G_DSPI_XSPI_REGMAP,
DSPI_PUSHR
};
@@ -188,6 +206,15 @@ static const struct regmap_config dspi_regmap_config[] = {
.wr_table = &dspi_access_table,
.rd_table = &dspi_access_table
},
+ [S32G_DSPI_XSPI_REGMAP] = {
+ .reg_bits = 32,
+ .val_bits = 32,
+ .reg_stride = 4,
+ .max_register = 0x13c,
+ .volatile_table = &dspi_volatile_table,
+ .wr_table = &s32g_dspi_access_table,
+ .rd_table = &s32g_dspi_access_table,
+ },
[DSPI_PUSHR] = {
.name = "pushr",
.reg_bits = 16,
@@ -262,6 +289,12 @@ static const struct fsl_dspi_devtype_data devtype_data[] = {
.fifo_size = 16,
.regmap = &dspi_regmap_config[DSPI_REGMAP]
},
+ [S32G] = {
+ .trans_mode = DSPI_XSPI_MODE,
+ .max_clock_factor = 1,
+ .fifo_size = 5,
+ .regmap = &dspi_regmap_config[S32G_DSPI_XSPI_REGMAP]
+ }
};
struct fsl_dspi_dma {
--
2.34.1
next prev parent reply other threads:[~2025-05-09 12:01 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 11:05 [PATCH 00/14] spi: spi-fsl-dspi: DSPI support for NXP S32G platforms James Clark
2025-05-09 11:05 ` [PATCH 01/14] spi: spi-fsl-dspi: Define regmaps per device James Clark
2025-05-09 16:04 ` Vladimir Oltean
2025-05-09 11:05 ` [PATCH 02/14] spi: spi-fsl-dspi: Re-use one volatile regmap for both device types James Clark
2025-05-09 16:07 ` Vladimir Oltean
2025-05-09 11:05 ` [PATCH 03/14] spi: spi-fsl-dspi: restrict register range for regmap access James Clark
2025-05-09 14:06 ` Vladimir Oltean
2025-05-19 10:25 ` James Clark
2025-05-10 1:16 ` Mark Brown
2025-05-09 11:05 ` James Clark [this message]
2025-05-09 11:05 ` [PATCH 05/14] spi: spi-fsl-dspi: Use spi_alloc_target for target James Clark
2025-05-09 11:05 ` [PATCH 06/14] spi: spi-fsl-dspi: Avoid setup_accel logic for DMA transfers James Clark
2025-05-09 11:05 ` [PATCH 07/14] spi: spi-fsl-dspi: Reset SR flags before sending a new message James Clark
2025-05-09 11:05 ` [PATCH 08/14] spi: spi-fsl-dspi: Use DMA for S32G controller in target mode James Clark
2025-05-09 11:05 ` [PATCH 09/14] spi: spi-fsl-dspi: Reinitialize DSPI regs after resuming for S32G James Clark
2025-05-09 11:05 ` [PATCH 10/14] spi: spi-fsl-dspi: Enable modified transfer protocol James Clark
2025-05-10 1:18 ` Mark Brown
2025-05-15 12:20 ` James Clark
2025-05-09 11:05 ` [PATCH 11/14] spi: spi-fsl-dspi: Halt the module after a new message transfer James Clark
2025-05-10 1:19 ` Mark Brown
2025-05-09 11:05 ` [PATCH 12/14] dt-bindings: spi: dspi: Add S32G support James Clark
2025-05-09 11:14 ` Krzysztof Kozlowski
2025-05-09 11:26 ` James Clark
2025-05-09 11:06 ` [PATCH 13/14] spi: spi-fsl-dspi: Enable support for S32G platforms James Clark
2025-05-09 11:06 ` [PATCH 14/14] arm64: dts: Add DSPI entries " James Clark
2025-05-09 11:26 ` Krzysztof Kozlowski
2025-05-09 12:54 ` Matti Vaittinen
2025-05-09 13:46 ` James Clark
2025-05-09 13:57 ` Krzysztof Kozlowski
2025-05-09 14:17 ` [PATCH 00/14] spi: spi-fsl-dspi: DSPI support for NXP " Rob Herring (Arm)
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=20250509-james-nxp-spi-v1-4-32bfcd2fea11@linaro.org \
--to=james.clark@linaro.org \
--cc=Frank.Li@nxp.com \
--cc=andrei.stefanescu@nxp.com \
--cc=arnd@linaro.org \
--cc=broonie@kernel.org \
--cc=chester62515@gmail.com \
--cc=conor+dt@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=ghennadi.procopciuc@oss.nxp.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=larisa.grigore@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mbrugger@suse.com \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=s32@nxp.com \
--cc=shawnguo@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).