* [PATCH v4 1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1
2025-10-27 13:29 [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
@ 2025-10-27 13:29 ` Alex Elder
2025-11-06 16:55 ` Mark Brown
2025-10-27 13:30 ` [PATCH v4 2/9] dt-bindings: spi: fsl-qspi: add optional resets Alex Elder
` (10 subsequent siblings)
11 siblings, 1 reply; 15+ messages in thread
From: Alex Elder @ 2025-10-27 13:29 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, han.xu, broonie
Cc: dlan, Frank.li, guodong, devicetree, linux-spi, imx, spacemit,
linux-riscv, linux-kernel, Conor Dooley, Frank Li
Add the SpacemiT K1 SoC QSPI IP to the list of supported hardware. This
is the first non-Freescale device represented here. It has a nearly
identidal register set, and this binding correctly describes the hardware.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Alex Elder <elder@riscstar.com>
---
Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml b/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
index f2dd20370dbb3..5e6aff1bc2ed3 100644
--- a/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
+++ b/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
@@ -22,6 +22,7 @@ properties:
- fsl,imx6ul-qspi
- fsl,ls1021a-qspi
- fsl,ls2080a-qspi
+ - spacemit,k1-qspi
- items:
- enum:
- fsl,ls1043a-qspi
--
2.48.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH v4 1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1
2025-10-27 13:29 ` [PATCH v4 1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1 Alex Elder
@ 2025-11-06 16:55 ` Mark Brown
0 siblings, 0 replies; 15+ messages in thread
From: Mark Brown @ 2025-11-06 16:55 UTC (permalink / raw)
To: Alex Elder
Cc: robh, krzk+dt, conor+dt, han.xu, dlan, Frank.li, guodong,
devicetree, linux-spi, imx, spacemit, linux-riscv, linux-kernel,
Conor Dooley
[-- Attachment #1.1: Type: text/plain, Size: 614 bytes --]
On Mon, Oct 27, 2025 at 08:29:59AM -0500, Alex Elder wrote:
> Add the SpacemiT K1 SoC QSPI IP to the list of supported hardware. This
> is the first non-Freescale device represented here. It has a nearly
> identidal register set, and this binding correctly describes the hardware.
Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 2/9] dt-bindings: spi: fsl-qspi: add optional resets
2025-10-27 13:29 [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
2025-10-27 13:29 ` [PATCH v4 1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1 Alex Elder
@ 2025-10-27 13:30 ` Alex Elder
2025-10-27 13:30 ` [PATCH v4 3/9] spi: fsl-qspi: add optional reset support Alex Elder
` (9 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Alex Elder @ 2025-10-27 13:30 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, han.xu, broonie
Cc: dlan, Frank.li, guodong, linux-spi, imx, devicetree, spacemit,
linux-riscv, linux-kernel, Frank Li, Conor Dooley
Allow two resets to be defined to support the SpacemiT K1 SoC QSPI IP.
Move the allOf block down, below the required section.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Alex Elder <elder@riscstar.com>
---
v4: - Moved the allOf block below the required section
- Added Frank Li's Reviewed-by
.../bindings/spi/fsl,spi-fsl-qspi.yaml | 20 ++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml b/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
index 5e6aff1bc2ed3..1d10cfbad86c7 100644
--- a/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
+++ b/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
@@ -9,9 +9,6 @@ title: Freescale Quad Serial Peripheral Interface (QuadSPI)
maintainers:
- Han Xu <han.xu@nxp.com>
-allOf:
- - $ref: spi-controller.yaml#
-
properties:
compatible:
oneOf:
@@ -55,6 +52,11 @@ properties:
- const: qspi_en
- const: qspi
+ resets:
+ items:
+ - description: SoC QSPI reset
+ - description: SoC QSPI bus reset
+
required:
- compatible
- reg
@@ -63,6 +65,18 @@ required:
- clocks
- clock-names
+allOf:
+ - $ref: spi-controller.yaml#
+ - if:
+ properties:
+ compatible:
+ not:
+ contains:
+ const: spacemit,k1-qspi
+ then:
+ properties:
+ resets: false
+
unevaluatedProperties: false
examples:
--
2.48.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v4 3/9] spi: fsl-qspi: add optional reset support
2025-10-27 13:29 [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
2025-10-27 13:29 ` [PATCH v4 1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1 Alex Elder
2025-10-27 13:30 ` [PATCH v4 2/9] dt-bindings: spi: fsl-qspi: add optional resets Alex Elder
@ 2025-10-27 13:30 ` Alex Elder
2025-10-27 13:30 ` [PATCH v4 4/9] spi: fsl-qspi: switch predicates to bool Alex Elder
` (8 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Alex Elder @ 2025-10-27 13:30 UTC (permalink / raw)
To: han.xu, broonie, p.zabel
Cc: dlan, Frank.li, guodong, linux-spi, imx, spacemit, linux-riscv,
linux-kernel, Frank Li
Add support for one or more optional exclusive resets. These simply need
to be deasserted at probe time, and can remain that way for the life of the
device.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Alex Elder <elder@riscstar.com>
---
drivers/spi/spi-fsl-qspi.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
index c887abb028d77..1e27647dd2a09 100644
--- a/drivers/spi/spi-fsl-qspi.c
+++ b/drivers/spi/spi-fsl-qspi.c
@@ -36,6 +36,7 @@
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_qos.h>
+#include <linux/reset.h>
#include <linux/sizes.h>
#include <linux/spi/spi.h>
@@ -267,6 +268,7 @@ struct fsl_qspi {
const struct fsl_qspi_devtype_data *devtype_data;
struct mutex lock;
struct completion c;
+ struct reset_control *resets;
struct clk *clk, *clk_en;
struct pm_qos_request pm_qos_req;
struct device *dev;
@@ -857,6 +859,8 @@ static void fsl_qspi_cleanup(void *data)
{
struct fsl_qspi *q = data;
+ reset_control_assert(q->resets);
+
fsl_qspi_clk_disable_unprep(q);
mutex_destroy(&q->lock);
@@ -902,6 +906,10 @@ static int fsl_qspi_probe(struct platform_device *pdev)
if (!q->ahb_addr)
return -ENOMEM;
+ q->resets = devm_reset_control_array_get_optional_exclusive(dev);
+ if (IS_ERR(q->resets))
+ return PTR_ERR(q->resets);
+
/* find the clocks */
q->clk_en = devm_clk_get(dev, "qspi_en");
if (IS_ERR(q->clk_en))
@@ -923,6 +931,10 @@ static int fsl_qspi_probe(struct platform_device *pdev)
if (ret)
return ret;
+ ret = reset_control_deassert(q->resets);
+ if (ret)
+ return ret;
+
/* find the irq */
ret = platform_get_irq(pdev, 0);
if (ret < 0)
--
2.48.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v4 4/9] spi: fsl-qspi: switch predicates to bool
2025-10-27 13:29 [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (2 preceding siblings ...)
2025-10-27 13:30 ` [PATCH v4 3/9] spi: fsl-qspi: add optional reset support Alex Elder
@ 2025-10-27 13:30 ` Alex Elder
2025-10-27 13:30 ` [PATCH v4 5/9] spi: fsl-qspi: add a clock disable quirk Alex Elder
` (7 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Alex Elder @ 2025-10-27 13:30 UTC (permalink / raw)
To: han.xu, broonie
Cc: dlan, Frank.li, guodong, linux-spi, imx, spacemit, linux-riscv,
linux-kernel, Frank Li
Change all the needs_*() functions so they are no longer inline, and return
bool rather than int.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Alex Elder <elder@riscstar.com>
---
v4: - Added Frank Li's Reviewed-by
drivers/spi/spi-fsl-qspi.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
index 1e27647dd2a09..1944e63169d36 100644
--- a/drivers/spi/spi-fsl-qspi.c
+++ b/drivers/spi/spi-fsl-qspi.c
@@ -276,34 +276,34 @@ struct fsl_qspi {
u32 memmap_phy;
};
-static inline int needs_swap_endian(struct fsl_qspi *q)
+static bool needs_swap_endian(struct fsl_qspi *q)
{
- return q->devtype_data->quirks & QUADSPI_QUIRK_SWAP_ENDIAN;
+ return !!(q->devtype_data->quirks & QUADSPI_QUIRK_SWAP_ENDIAN);
}
-static inline int needs_4x_clock(struct fsl_qspi *q)
+static bool needs_4x_clock(struct fsl_qspi *q)
{
- return q->devtype_data->quirks & QUADSPI_QUIRK_4X_INT_CLK;
+ return !!(q->devtype_data->quirks & QUADSPI_QUIRK_4X_INT_CLK);
}
-static inline int needs_fill_txfifo(struct fsl_qspi *q)
+static bool needs_fill_txfifo(struct fsl_qspi *q)
{
- return q->devtype_data->quirks & QUADSPI_QUIRK_TKT253890;
+ return !!(q->devtype_data->quirks & QUADSPI_QUIRK_TKT253890);
}
-static inline int needs_wakeup_wait_mode(struct fsl_qspi *q)
+static bool needs_wakeup_wait_mode(struct fsl_qspi *q)
{
- return q->devtype_data->quirks & QUADSPI_QUIRK_TKT245618;
+ return !!(q->devtype_data->quirks & QUADSPI_QUIRK_TKT245618);
}
-static inline int needs_amba_base_offset(struct fsl_qspi *q)
+static bool needs_amba_base_offset(struct fsl_qspi *q)
{
return !(q->devtype_data->quirks & QUADSPI_QUIRK_BASE_INTERNAL);
}
-static inline int needs_tdh_setting(struct fsl_qspi *q)
+static bool needs_tdh_setting(struct fsl_qspi *q)
{
- return q->devtype_data->quirks & QUADSPI_QUIRK_USE_TDH_SETTING;
+ return !!(q->devtype_data->quirks & QUADSPI_QUIRK_USE_TDH_SETTING);
}
/*
--
2.48.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v4 5/9] spi: fsl-qspi: add a clock disable quirk
2025-10-27 13:29 [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (3 preceding siblings ...)
2025-10-27 13:30 ` [PATCH v4 4/9] spi: fsl-qspi: switch predicates to bool Alex Elder
@ 2025-10-27 13:30 ` Alex Elder
2025-10-27 13:30 ` [PATCH v4 6/9] spi: fsl-qspi: introduce sfa_size devtype data Alex Elder
` (6 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Alex Elder @ 2025-10-27 13:30 UTC (permalink / raw)
To: han.xu, broonie
Cc: dlan, Frank.li, guodong, linux-spi, imx, spacemit, linux-riscv,
linux-kernel, Frank Li
The SpacemiT K1 SoC QSPI implementation needs to avoid shutting off the
clock when changing its rate. Add a new quirk to indicate that disabling
and enabling the clock should be skipped when changing its rate.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Alex Elder <elder@riscstar.com>
---
v4: - Added Frank Li's Reviewed-by
drivers/spi/spi-fsl-qspi.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
index 1944e63169d36..2c030dd6facc7 100644
--- a/drivers/spi/spi-fsl-qspi.c
+++ b/drivers/spi/spi-fsl-qspi.c
@@ -197,6 +197,11 @@
*/
#define QUADSPI_QUIRK_USE_TDH_SETTING BIT(5)
+/*
+ * Do not disable the "qspi" clock when changing its rate.
+ */
+#define QUADSPI_QUIRK_SKIP_CLK_DISABLE BIT(6)
+
struct fsl_qspi_devtype_data {
unsigned int rxfifo;
unsigned int txfifo;
@@ -306,6 +311,11 @@ static bool needs_tdh_setting(struct fsl_qspi *q)
return !!(q->devtype_data->quirks & QUADSPI_QUIRK_USE_TDH_SETTING);
}
+static bool needs_clk_disable(struct fsl_qspi *q)
+{
+ return !(q->devtype_data->quirks & QUADSPI_QUIRK_SKIP_CLK_DISABLE);
+}
+
/*
* An IC bug makes it necessary to rearrange the 32-bit data.
* Later chips, such as IMX6SLX, have fixed this bug.
@@ -536,15 +546,18 @@ static void fsl_qspi_select_mem(struct fsl_qspi *q, struct spi_device *spi,
if (needs_4x_clock(q))
rate *= 4;
- fsl_qspi_clk_disable_unprep(q);
+ if (needs_clk_disable(q))
+ fsl_qspi_clk_disable_unprep(q);
ret = clk_set_rate(q->clk, rate);
if (ret)
return;
- ret = fsl_qspi_clk_prep_enable(q);
- if (ret)
- return;
+ if (needs_clk_disable(q)) {
+ ret = fsl_qspi_clk_prep_enable(q);
+ if (ret)
+ return;
+ }
q->selected = spi_get_chipselect(spi, 0);
--
2.48.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v4 6/9] spi: fsl-qspi: introduce sfa_size devtype data
2025-10-27 13:29 [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (4 preceding siblings ...)
2025-10-27 13:30 ` [PATCH v4 5/9] spi: fsl-qspi: add a clock disable quirk Alex Elder
@ 2025-10-27 13:30 ` Alex Elder
2025-10-27 13:30 ` [PATCH v4 7/9] spi: fsl-qspi: support the SpacemiT K1 SoC Alex Elder
` (5 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Alex Elder @ 2025-10-27 13:30 UTC (permalink / raw)
To: han.xu, broonie
Cc: dlan, Frank.li, guodong, linux-spi, imx, spacemit, linux-riscv,
linux-kernel, Frank Li
In fsl_qspi_default_setup(), four registers define the size of blocks of
data to written to each of four chips that comprise SPI NOR flash storage.
They are currently defined to be the same as the AHB buffer size.
The SpacemiT QSPI has an AHB buffer size of 512 bytes, but requires these
four sizes to be multiples of 1024 bytes.
Define a new field sfa_size in the fsl_qspi_devtype_data structure that, if
non-zero, will be used instead of the AHB buffer size to define the size of
these chip regions.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Alex Elder <elder@riscstar.com>
---
drivers/spi/spi-fsl-qspi.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
index 2c030dd6facc7..46a3187b33548 100644
--- a/drivers/spi/spi-fsl-qspi.c
+++ b/drivers/spi/spi-fsl-qspi.c
@@ -207,6 +207,7 @@ struct fsl_qspi_devtype_data {
unsigned int txfifo;
int invalid_mstrid;
unsigned int ahb_buf_size;
+ unsigned int sfa_size;
unsigned int quirks;
bool little_endian;
};
@@ -737,6 +738,7 @@ static int fsl_qspi_default_setup(struct fsl_qspi *q)
{
void __iomem *base = q->iobase;
u32 reg, addr_offset = 0;
+ u32 sfa_size;
int ret;
/* disable and unprepare clock to avoid glitch pass to controller */
@@ -795,17 +797,17 @@ static int fsl_qspi_default_setup(struct fsl_qspi *q)
* In HW there can be a maximum of four chips on two buses with
* two chip selects on each bus. We use four chip selects in SW
* to differentiate between the four chips.
- * We use ahb_buf_size for each chip and set SFA1AD, SFA2AD, SFB1AD,
- * SFB2AD accordingly.
+ *
+ * By default we write the AHB buffer size to each chip, but
+ * a different size can be specified with devtype_data->sfa_size.
+ * The SFA1AD, SFA2AD, SFB1AD, and SFB2AD registers define the
+ * top (end) of these four regions.
*/
- qspi_writel(q, q->devtype_data->ahb_buf_size + addr_offset,
- base + QUADSPI_SFA1AD);
- qspi_writel(q, q->devtype_data->ahb_buf_size * 2 + addr_offset,
- base + QUADSPI_SFA2AD);
- qspi_writel(q, q->devtype_data->ahb_buf_size * 3 + addr_offset,
- base + QUADSPI_SFB1AD);
- qspi_writel(q, q->devtype_data->ahb_buf_size * 4 + addr_offset,
- base + QUADSPI_SFB2AD);
+ sfa_size = q->devtype_data->sfa_size ? : q->devtype_data->ahb_buf_size;
+ qspi_writel(q, addr_offset + 1 * sfa_size, base + QUADSPI_SFA1AD);
+ qspi_writel(q, addr_offset + 2 * sfa_size, base + QUADSPI_SFA2AD);
+ qspi_writel(q, addr_offset + 3 * sfa_size, base + QUADSPI_SFB1AD);
+ qspi_writel(q, addr_offset + 4 * sfa_size, base + QUADSPI_SFB2AD);
q->selected = -1;
--
2.48.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v4 7/9] spi: fsl-qspi: support the SpacemiT K1 SoC
2025-10-27 13:29 [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (5 preceding siblings ...)
2025-10-27 13:30 ` [PATCH v4 6/9] spi: fsl-qspi: introduce sfa_size devtype data Alex Elder
@ 2025-10-27 13:30 ` Alex Elder
2025-10-27 13:30 ` [PATCH v4 8/9] riscv: dts: spacemit: enable K1 SoC QSPI on BPI-F3 Alex Elder
` (4 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Alex Elder @ 2025-10-27 13:30 UTC (permalink / raw)
To: han.xu, broonie
Cc: dlan, Frank.li, guodong, linux-spi, imx, spacemit, linux-riscv,
linux-kernel
Allow the SPI_FSL_QUADSPI Kconfig option to be selected if ARCH_SPACEMIT
enabled.
Add support for the SpacemiT K1 SoC in the Freescale QSPI driver by
defining the device type data for its QSPI implementation.
Signed-off-by: Alex Elder <elder@riscstar.com>
---
drivers/spi/Kconfig | 3 ++-
drivers/spi/spi-fsl-qspi.c | 11 +++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 4d8f00c850c14..592d46c9998bb 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -435,7 +435,8 @@ config SPI_FSL_LPSPI
config SPI_FSL_QUADSPI
tristate "Freescale QSPI controller"
- depends on ARCH_MXC || SOC_LS1021A || ARCH_LAYERSCAPE || COMPILE_TEST
+ depends on ARCH_MXC || SOC_LS1021A || ARCH_LAYERSCAPE || \
+ ARCH_SPACEMIT || COMPILE_TEST
depends on HAS_IOMEM
help
This enables support for the Quad SPI controller in master mode.
diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
index 46a3187b33548..a223b4bc6e637 100644
--- a/drivers/spi/spi-fsl-qspi.c
+++ b/drivers/spi/spi-fsl-qspi.c
@@ -268,6 +268,16 @@ static const struct fsl_qspi_devtype_data ls2080a_data = {
.little_endian = true,
};
+static const struct fsl_qspi_devtype_data spacemit_k1_data = {
+ .rxfifo = SZ_128,
+ .txfifo = SZ_256,
+ .ahb_buf_size = SZ_512,
+ .sfa_size = SZ_1K,
+ .invalid_mstrid = QUADSPI_BUFXCR_INVALID_MSTRID,
+ .quirks = QUADSPI_QUIRK_TKT253890 | QUADSPI_QUIRK_SKIP_CLK_DISABLE,
+ .little_endian = true,
+};
+
struct fsl_qspi {
void __iomem *iobase;
void __iomem *ahb_addr;
@@ -1003,6 +1013,7 @@ static const struct of_device_id fsl_qspi_dt_ids[] = {
{ .compatible = "fsl,imx6ul-qspi", .data = &imx6ul_data, },
{ .compatible = "fsl,ls1021a-qspi", .data = &ls1021a_data, },
{ .compatible = "fsl,ls2080a-qspi", .data = &ls2080a_data, },
+ { .compatible = "spacemit,k1-qspi", .data = &spacemit_k1_data, },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, fsl_qspi_dt_ids);
--
2.48.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v4 8/9] riscv: dts: spacemit: enable K1 SoC QSPI on BPI-F3
2025-10-27 13:29 [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (6 preceding siblings ...)
2025-10-27 13:30 ` [PATCH v4 7/9] spi: fsl-qspi: support the SpacemiT K1 SoC Alex Elder
@ 2025-10-27 13:30 ` Alex Elder
2025-10-27 13:30 ` [PATCH v4 9/9] riscv: defconfig: enable SPI_FSL_QUADSPI as a module Alex Elder
` (3 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Alex Elder @ 2025-10-27 13:30 UTC (permalink / raw)
To: dlan, broonie, han.xu
Cc: Frank.li, guodong, linux-spi, imx, spacemit, linux-riscv,
linux-kernel
Define DTS nodes to enable support for QSPI on the K1 SoC, including the
pin control configuration used. Enable QSPI on the Banana Pi BPI-F3 board.
Signed-off-by: Alex Elder <elder@riscstar.com>
---
.../boot/dts/spacemit/k1-bananapi-f3.dts | 6 ++++++
arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi | 21 +++++++++++++++++++
arch/riscv/boot/dts/spacemit/k1.dtsi | 16 ++++++++++++++
3 files changed, 43 insertions(+)
diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
index 33ca816bfd4b3..02f218a16318e 100644
--- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
@@ -113,6 +113,12 @@ &pdma {
status = "okay";
};
+&qspi {
+ pinctrl-names = "default";
+ pinctrl-0 = <&qspi_cfg>;
+ status = "okay";
+};
+
&i2c2 {
pinctrl-0 = <&i2c2_0_cfg>;
pinctrl-names = "default";
diff --git a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
index 4eef81d583f3d..e922e05ff856d 100644
--- a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
@@ -73,6 +73,27 @@ i2c8-0-pins {
};
};
+ qspi_cfg: qspi-cfg {
+ qspi-pins {
+ pinmux = <K1_PADCONF(98, 0)>, /* QSPI_DATA3 */
+ <K1_PADCONF(99, 0)>, /* QSPI_DATA2 */
+ <K1_PADCONF(100, 0)>, /* QSPI_DATA1 */
+ <K1_PADCONF(101, 0)>, /* QSPI_DATA0 */
+ <K1_PADCONF(102, 0)>; /* QSPI_CLK */
+
+ bias-disable;
+ drive-strength = <19>;
+ power-source = <3300>;
+ };
+
+ qspi-cs1-pins {
+ pinmux = <K1_PADCONF(103, 0)>; /* QSPI_CS1 */
+ bias-pull-up = <0>;
+ drive-strength = <19>;
+ power-source = <3300>;
+ };
+ };
+
/omit-if-no-ref/
uart0_0_cfg: uart0-0-cfg {
uart0-0-pins {
diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
index af35f9cd64351..47f97105bff0b 100644
--- a/arch/riscv/boot/dts/spacemit/k1.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
@@ -823,6 +823,22 @@ uart9: serial@d4017800 {
status = "disabled";
};
+ qspi: spi@d420c000 {
+ compatible = "spacemit,k1-qspi";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0x0 0xd420c000 0x0 0x1000>,
+ <0x0 0xb8000000 0x0 0xc00000>;
+ reg-names = "QuadSPI", "QuadSPI-memory";
+ clocks = <&syscon_apmu CLK_QSPI_BUS>,
+ <&syscon_apmu CLK_QSPI>;
+ clock-names = "qspi_en", "qspi";
+ resets = <&syscon_apmu RESET_QSPI>,
+ <&syscon_apmu RESET_QSPI_BUS>;
+ interrupts = <117>;
+ status = "disabled";
+ };
+
/* sec_uart1: 0xf0612000, not available from Linux */
};
--
2.48.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v4 9/9] riscv: defconfig: enable SPI_FSL_QUADSPI as a module
2025-10-27 13:29 [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (7 preceding siblings ...)
2025-10-27 13:30 ` [PATCH v4 8/9] riscv: dts: spacemit: enable K1 SoC QSPI on BPI-F3 Alex Elder
@ 2025-10-27 13:30 ` Alex Elder
2025-11-12 11:19 ` Yixun Lan
2025-11-07 10:15 ` (subset) [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Mark Brown
` (2 subsequent siblings)
11 siblings, 1 reply; 15+ messages in thread
From: Alex Elder @ 2025-10-27 13:30 UTC (permalink / raw)
To: pjw, palmer, aou, alex, conor.dooley, dlan
Cc: Frank.li, guodong, fustini, geert+renesas, cyy, heylenay, apatel,
joel, linux-riscv, linux-kernel
The SpacemiT K1 SoC QSPI IP uses the Freescale driver. Enable it as a
module in the default kernel configuration for RISC-V.
Acked-by: Paul Walmsley <pjw@kernel.org> # for arch/riscv
Signed-off-by: Alex Elder <elder@riscstar.com>
---
v4: - Added Paul Walmsley's Acked-by on patch 9
arch/riscv/configs/defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index fc2725cbca187..48afe30d42e88 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -158,6 +158,7 @@ CONFIG_I2C_DESIGNWARE_CORE=y
CONFIG_I2C_MV64XXX=m
CONFIG_SPI=y
CONFIG_SPI_CADENCE_QUADSPI=m
+CONFIG_SPI_FSL_QUADSPI=m
CONFIG_SPI_PL022=m
CONFIG_SPI_SIFIVE=y
CONFIG_SPI_SUN6I=y
--
2.48.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH v4 9/9] riscv: defconfig: enable SPI_FSL_QUADSPI as a module
2025-10-27 13:30 ` [PATCH v4 9/9] riscv: defconfig: enable SPI_FSL_QUADSPI as a module Alex Elder
@ 2025-11-12 11:19 ` Yixun Lan
0 siblings, 0 replies; 15+ messages in thread
From: Yixun Lan @ 2025-11-12 11:19 UTC (permalink / raw)
To: Alex Elder, Conor Dooley
Cc: pjw, palmer, aou, alex, conor.dooley, Frank.li, guodong, fustini,
geert+renesas, cyy, heylenay, apatel, joel, linux-riscv,
linux-kernel
Hi Conor,
On 08:30 Mon 27 Oct , Alex Elder wrote:
> The SpacemiT K1 SoC QSPI IP uses the Freescale driver. Enable it as a
> module in the default kernel configuration for RISC-V.
>
Can you take this one via your defconfig tree? thanks
--
Yixun Lan (dlan)
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: (subset) [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI
2025-10-27 13:29 [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (8 preceding siblings ...)
2025-10-27 13:30 ` [PATCH v4 9/9] riscv: defconfig: enable SPI_FSL_QUADSPI as a module Alex Elder
@ 2025-11-07 10:15 ` Mark Brown
2025-11-12 10:23 ` Yixun Lan
2025-11-12 18:56 ` Conor Dooley
11 siblings, 0 replies; 15+ messages in thread
From: Mark Brown @ 2025-11-07 10:15 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, han.xu, dlan, pjw, Alex Elder
Cc: Frank.li, p.zabel, guodong, palmer, aou, alex, apatel, joel,
geert+renesas, cyy, heylenay, conor.dooley, fustini, linux-spi,
devicetree, imx, spacemit, linux-riscv, linux-kernel
On Mon, 27 Oct 2025 08:29:58 -0500, Alex Elder wrote:
> This series adds support for the SpacemiT K1 SoC QSPI. This IP is
> generally compatible with the Freescale QSPI driver, requiring three
> minor changes to enable it to be supported. The changes are:
> - Adding support for optional resets
> - Having the clock *not* be disabled when changing its rate
> - Allowing the size of storage blocks written to flash chips
> to be set to something different from the AHB buffer size
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1
commit: bd352547df647be8a1e6c9d4ca2b54b459f3abc1
[2/9] dt-bindings: spi: fsl-qspi: add optional resets
commit: 873a46141460d209bb62eaa0dc9e7b67bff924a6
[3/9] spi: fsl-qspi: add optional reset support
commit: 106d7641e55a472e7523c1f525c77fb6d420064d
[4/9] spi: fsl-qspi: switch predicates to bool
commit: 6b398c1d3da7a673b13b1857f9fff4c15ee20cef
[5/9] spi: fsl-qspi: add a clock disable quirk
commit: 1797d254f5c4b46b295527a635af7321a3fe1318
[6/9] spi: fsl-qspi: introduce sfa_size devtype data
commit: 56931105074fe7e5fc9d54e3163df3b95075643c
[7/9] spi: fsl-qspi: support the SpacemiT K1 SoC
commit: abc9a349b87ac0fd3ba8787ca00971b59c2e1257
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: (subset) [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI
2025-10-27 13:29 [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (9 preceding siblings ...)
2025-11-07 10:15 ` (subset) [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Mark Brown
@ 2025-11-12 10:23 ` Yixun Lan
2025-11-12 18:56 ` Conor Dooley
11 siblings, 0 replies; 15+ messages in thread
From: Yixun Lan @ 2025-11-12 10:23 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, han.xu, broonie, pjw, Alex Elder
Cc: Yixun Lan, Frank.li, p.zabel, guodong, palmer, aou, alex, apatel,
joel, geert+renesas, cyy, heylenay, conor.dooley, fustini,
linux-spi, devicetree, imx, spacemit, linux-riscv, linux-kernel
On Mon, 27 Oct 2025 08:29:58 -0500, Alex Elder wrote:
> This series adds support for the SpacemiT K1 SoC QSPI. This IP is
> generally compatible with the Freescale QSPI driver, requiring three
> minor changes to enable it to be supported. The changes are:
> - Adding support for optional resets
> - Having the clock *not* be disabled when changing its rate
> - Allowing the size of storage blocks written to flash chips
> to be set to something different from the AHB buffer size
>
> [...]
Applied, thanks!
[8/9] riscv: dts: spacemit: enable K1 SoC QSPI on BPI-F3
https://github.com/spacemit-com/linux/commit/41d34e0b5497f919229d32580fbe34386087458f
Best regards,
--
Yixun Lan
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: (subset) [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI
2025-10-27 13:29 [PATCH v4 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (10 preceding siblings ...)
2025-11-12 10:23 ` Yixun Lan
@ 2025-11-12 18:56 ` Conor Dooley
11 siblings, 0 replies; 15+ messages in thread
From: Conor Dooley @ 2025-11-12 18:56 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, han.xu, broonie, dlan, pjw, Alex Elder
Cc: conor, Conor Dooley, Frank.li, p.zabel, guodong, palmer, aou,
alex, apatel, joel, geert+renesas, cyy, heylenay, fustini,
linux-spi, devicetree, imx, spacemit, linux-riscv, linux-kernel
From: Conor Dooley <conor.dooley@microchip.com>
On Mon, 27 Oct 2025 08:29:58 -0500, Alex Elder wrote:
> This series adds support for the SpacemiT K1 SoC QSPI. This IP is
> generally compatible with the Freescale QSPI driver, requiring three
> minor changes to enable it to be supported. The changes are:
> - Adding support for optional resets
> - Having the clock *not* be disabled when changing its rate
> - Allowing the size of storage blocks written to flash chips
> to be set to something different from the AHB buffer size
>
> [...]
Applied to riscv-config-for-next, thanks!
[9/9] riscv: defconfig: enable SPI_FSL_QUADSPI as a module
(no commit info)
Thanks,
Conor.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 15+ messages in thread