* [PATCH v2 1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1
2025-10-23 17:59 [PATCH v2 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
@ 2025-10-23 17:59 ` Alex Elder
2025-10-23 18:51 ` Conor Dooley
2025-10-23 23:29 ` Frank Li
2025-10-23 17:59 ` [PATCH v2 2/9] dt-bindings: spi: fsl-qspi: add optional resets Alex Elder
` (5 subsequent siblings)
6 siblings, 2 replies; 25+ messages in thread
From: Alex Elder @ 2025-10-23 17:59 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
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.
Signed-off-by: Alex Elder <elder@riscstar.com>
---
v2: - Point out that this is the first non-Freescale device used here
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.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* Re: [PATCH v2 1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1
2025-10-23 17:59 ` [PATCH v2 1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1 Alex Elder
@ 2025-10-23 18:51 ` Conor Dooley
2025-10-23 23:29 ` Frank Li
1 sibling, 0 replies; 25+ messages in thread
From: Conor Dooley @ 2025-10-23 18:51 UTC (permalink / raw)
To: Alex Elder
Cc: robh, krzk+dt, conor+dt, han.xu, broonie, dlan, Frank.li, guodong,
devicetree, linux-spi, imx, spacemit, linux-riscv, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 500 bytes --]
On Thu, Oct 23, 2025 at 12:59:13PM -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.
>
> Signed-off-by: Alex Elder <elder@riscstar.com>
> ---
> v2: - Point out that this is the first non-Freescale device used here
Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1
2025-10-23 17:59 ` [PATCH v2 1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1 Alex Elder
2025-10-23 18:51 ` Conor Dooley
@ 2025-10-23 23:29 ` Frank Li
1 sibling, 0 replies; 25+ messages in thread
From: Frank Li @ 2025-10-23 23:29 UTC (permalink / raw)
To: Alex Elder
Cc: robh, krzk+dt, conor+dt, han.xu, broonie, dlan, guodong,
devicetree, linux-spi, imx, spacemit, linux-riscv, linux-kernel
On Thu, Oct 23, 2025 at 12:59:13PM -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.
>
> Signed-off-by: Alex Elder <elder@riscstar.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> v2: - Point out that this is the first non-Freescale device used here
>
> 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.43.0
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v2 2/9] dt-bindings: spi: fsl-qspi: add optional resets
2025-10-23 17:59 [PATCH v2 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
2025-10-23 17:59 ` [PATCH v2 1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1 Alex Elder
@ 2025-10-23 17:59 ` Alex Elder
2025-10-23 18:52 ` Conor Dooley
2025-10-23 23:32 ` Frank Li
2025-10-23 17:59 ` [PATCH v2 3/9] spi: fsl-qspi: add optional reset support Alex Elder
` (4 subsequent siblings)
6 siblings, 2 replies; 25+ messages in thread
From: Alex Elder @ 2025-10-23 17:59 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
Allow two resets to be defined to support the SpacemiT K1 SoC QSPI IP.
Signed-off-by: Alex Elder <elder@riscstar.com>
---
v2: - The "reset" property now only applies to spacemit,k1-qspi compatible
.../devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml b/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
index 5e6aff1bc2ed3..edd3158a6f2e8 100644
--- a/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
+++ b/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
@@ -55,6 +55,21 @@ properties:
- const: qspi_en
- const: qspi
+ resets:
+ items:
+ - description: SoC QSPI reset
+ - description: SoC QSPI bus reset
+
+if:
+ properties:
+ compatible:
+ not:
+ contains:
+ const: spacemit,k1-qspi
+then:
+ properties:
+ resets: false
+
required:
- compatible
- reg
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* Re: [PATCH v2 2/9] dt-bindings: spi: fsl-qspi: add optional resets
2025-10-23 17:59 ` [PATCH v2 2/9] dt-bindings: spi: fsl-qspi: add optional resets Alex Elder
@ 2025-10-23 18:52 ` Conor Dooley
2025-10-23 23:32 ` Frank Li
1 sibling, 0 replies; 25+ messages in thread
From: Conor Dooley @ 2025-10-23 18:52 UTC (permalink / raw)
To: Alex Elder
Cc: robh, krzk+dt, conor+dt, han.xu, broonie, dlan, Frank.li, guodong,
linux-spi, imx, devicetree, spacemit, linux-riscv, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 353 bytes --]
On Thu, Oct 23, 2025 at 12:59:14PM -0500, Alex Elder wrote:
> Allow two resets to be defined to support the SpacemiT K1 SoC QSPI IP.
>
> Signed-off-by: Alex Elder <elder@riscstar.com>
> ---
> v2: - The "reset" property now only applies to spacemit,k1-qspi compatible
Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 2/9] dt-bindings: spi: fsl-qspi: add optional resets
2025-10-23 17:59 ` [PATCH v2 2/9] dt-bindings: spi: fsl-qspi: add optional resets Alex Elder
2025-10-23 18:52 ` Conor Dooley
@ 2025-10-23 23:32 ` Frank Li
2025-10-24 0:04 ` Alex Elder
1 sibling, 1 reply; 25+ messages in thread
From: Frank Li @ 2025-10-23 23:32 UTC (permalink / raw)
To: Alex Elder
Cc: robh, krzk+dt, conor+dt, han.xu, broonie, dlan, guodong,
linux-spi, imx, devicetree, spacemit, linux-riscv, linux-kernel
On Thu, Oct 23, 2025 at 12:59:14PM -0500, Alex Elder wrote:
> Allow two resets to be defined to support the SpacemiT K1 SoC QSPI IP.
>
> Signed-off-by: Alex Elder <elder@riscstar.com>
> ---
> v2: - The "reset" property now only applies to spacemit,k1-qspi compatible
>
> .../devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml b/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
> index 5e6aff1bc2ed3..edd3158a6f2e8 100644
> --- a/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
> +++ b/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
> @@ -55,6 +55,21 @@ properties:
> - const: qspi_en
> - const: qspi
>
> + resets:
> + items:
> + - description: SoC QSPI reset
> + - description: SoC QSPI bus reset
> +
> +if:
> + properties:
> + compatible:
> + not:
> + contains:
> + const: spacemit,k1-qspi
> +then:
> + properties:
> + resets: false
> +
strange, if-then should be under allOf, I have not seen you add allOf. And
original file have not allOf.
Frank
> required:
> - compatible
> - reg
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 2/9] dt-bindings: spi: fsl-qspi: add optional resets
2025-10-23 23:32 ` Frank Li
@ 2025-10-24 0:04 ` Alex Elder
0 siblings, 0 replies; 25+ messages in thread
From: Alex Elder @ 2025-10-24 0:04 UTC (permalink / raw)
To: Frank Li
Cc: robh, krzk+dt, conor+dt, han.xu, broonie, dlan, guodong,
linux-spi, imx, devicetree, spacemit, linux-riscv, linux-kernel
On 10/23/25 6:32 PM, Frank Li wrote:
> On Thu, Oct 23, 2025 at 12:59:14PM -0500, Alex Elder wrote:
>> Allow two resets to be defined to support the SpacemiT K1 SoC QSPI IP.
>>
>> Signed-off-by: Alex Elder <elder@riscstar.com>
>> ---
>> v2: - The "reset" property now only applies to spacemit,k1-qspi compatible
>>
>> .../devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml | 15 +++++++++++++++
>> 1 file changed, 15 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml b/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
>> index 5e6aff1bc2ed3..edd3158a6f2e8 100644
>> --- a/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
>> +++ b/Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml
>> @@ -55,6 +55,21 @@ properties:
>> - const: qspi_en
>> - const: qspi
>>
>> + resets:
>> + items:
>> + - description: SoC QSPI reset
>> + - description: SoC QSPI bus reset
>> +
>> +if:
>> + properties:
>> + compatible:
>> + not:
>> + contains:
>> + const: spacemit,k1-qspi
>> +then:
>> + properties:
>> + resets: false
>> +
>
> strange, if-then should be under allOf, I have not seen you add allOf. And
> original file have not allOf.
The file currently has allOf at the top, to reference
spi-controller.yaml. I'll include this next time within
that allOf.
-Alex
>
> Frank
>
>> required:
>> - compatible
>> - reg
>> --
>> 2.43.0
>>
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v2 3/9] spi: fsl-qspi: add optional reset support
2025-10-23 17:59 [PATCH v2 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
2025-10-23 17:59 ` [PATCH v2 1/9] dt-bindings: spi: fsl-qspi: support SpacemiT K1 Alex Elder
2025-10-23 17:59 ` [PATCH v2 2/9] dt-bindings: spi: fsl-qspi: add optional resets Alex Elder
@ 2025-10-23 17:59 ` Alex Elder
2025-10-23 17:59 ` [PATCH v2 4/9] spi: fsl-qspi: switch predicates to bool Alex Elder
` (3 subsequent siblings)
6 siblings, 0 replies; 25+ messages in thread
From: Alex Elder @ 2025-10-23 17:59 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>
---
v2: - Added Frank Li's Reviewed-by
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.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH v2 4/9] spi: fsl-qspi: switch predicates to bool
2025-10-23 17:59 [PATCH v2 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (2 preceding siblings ...)
2025-10-23 17:59 ` [PATCH v2 3/9] spi: fsl-qspi: add optional reset support Alex Elder
@ 2025-10-23 17:59 ` Alex Elder
2025-10-23 23:33 ` Frank Li
2025-10-23 17:59 ` [PATCH v2 5/9] spi: fsl-qspi: add a clock disable quirk Alex Elder
` (2 subsequent siblings)
6 siblings, 1 reply; 25+ messages in thread
From: Alex Elder @ 2025-10-23 17:59 UTC (permalink / raw)
To: han.xu, broonie
Cc: dlan, Frank.li, guodong, linux-spi, imx, spacemit, linux-riscv,
linux-kernel
Change all the needs_*() functions so they are no longer inline, and return
bool rather than int.
Signed-off-by: Alex Elder <elder@riscstar.com>
---
v2: - New patch: predicates now return bool type and drop inline
patch (patch 4).
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.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* Re: [PATCH v2 4/9] spi: fsl-qspi: switch predicates to bool
2025-10-23 17:59 ` [PATCH v2 4/9] spi: fsl-qspi: switch predicates to bool Alex Elder
@ 2025-10-23 23:33 ` Frank Li
2025-10-24 0:04 ` Alex Elder
0 siblings, 1 reply; 25+ messages in thread
From: Frank Li @ 2025-10-23 23:33 UTC (permalink / raw)
To: Alex Elder
Cc: han.xu, broonie, dlan, guodong, linux-spi, imx, spacemit,
linux-riscv, linux-kernel
On Thu, Oct 23, 2025 at 12:59:16PM -0500, Alex Elder wrote:
> Change all the needs_*() functions so they are no longer inline, and return
> bool rather than int.
>
> Signed-off-by: Alex Elder <elder@riscstar.com>
> ---
> v2: - New patch: predicates now return bool type and drop inline
>
> patch (patch 4).
> 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)
why drop inline, and next patch needs_disable_clk() have inline.
Frank
> {
> - 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.43.0
>
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: [PATCH v2 4/9] spi: fsl-qspi: switch predicates to bool
2025-10-23 23:33 ` Frank Li
@ 2025-10-24 0:04 ` Alex Elder
0 siblings, 0 replies; 25+ messages in thread
From: Alex Elder @ 2025-10-24 0:04 UTC (permalink / raw)
To: Frank Li
Cc: han.xu, broonie, dlan, guodong, linux-spi, imx, spacemit,
linux-riscv, linux-kernel
On 10/23/25 6:33 PM, Frank Li wrote:
> On Thu, Oct 23, 2025 at 12:59:16PM -0500, Alex Elder wrote:
>> Change all the needs_*() functions so they are no longer inline, and return
>> bool rather than int.
>>
>> Signed-off-by: Alex Elder <elder@riscstar.com>
>> ---
>> v2: - New patch: predicates now return bool type and drop inline
>>
>> patch (patch 4).
>> 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)
>
> why drop inline, and next patch needs_disable_clk() have inline.
That was a mistake. I intend to drop inline on all of them.
Will fix.
-Alex
>
> Frank
>> {
>> - 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.43.0
>>
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v2 5/9] spi: fsl-qspi: add a clock disable quirk
2025-10-23 17:59 [PATCH v2 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (3 preceding siblings ...)
2025-10-23 17:59 ` [PATCH v2 4/9] spi: fsl-qspi: switch predicates to bool Alex Elder
@ 2025-10-23 17:59 ` Alex Elder
2025-10-23 23:36 ` Frank Li
2025-10-23 17:59 ` [PATCH v2 6/9] spi: fsl-qspi: allot 1KB per chip Alex Elder
2025-10-23 17:59 ` [PATCH v2 7/9] spi: fsl-qspi: support the SpacemiT K1 SoC Alex Elder
6 siblings, 1 reply; 25+ messages in thread
From: Alex Elder @ 2025-10-23 17:59 UTC (permalink / raw)
To: han.xu, broonie
Cc: dlan, Frank.li, guodong, linux-spi, imx, spacemit, linux-riscv,
linux-kernel
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 for
operations.
Signed-off-by: Alex Elder <elder@riscstar.com>
---
v2: - The quirk flag is now named QUADSPI_QUIRK_SKIP_CLK_DISABLE
- The predicate now returns bool and is not inline
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..c21e3804cb032 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 inline 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.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* Re: [PATCH v2 5/9] spi: fsl-qspi: add a clock disable quirk
2025-10-23 17:59 ` [PATCH v2 5/9] spi: fsl-qspi: add a clock disable quirk Alex Elder
@ 2025-10-23 23:36 ` Frank Li
2025-10-24 0:04 ` Alex Elder
0 siblings, 1 reply; 25+ messages in thread
From: Frank Li @ 2025-10-23 23:36 UTC (permalink / raw)
To: Alex Elder
Cc: han.xu, broonie, dlan, guodong, linux-spi, imx, spacemit,
linux-riscv, linux-kernel
On Thu, Oct 23, 2025 at 12:59:17PM -0500, Alex Elder wrote:
> 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 for
> operations.
remove "for operations."
>
> Signed-off-by: Alex Elder <elder@riscstar.com>
> ---
> v2: - The quirk flag is now named QUADSPI_QUIRK_SKIP_CLK_DISABLE
> - The predicate now returns bool and is not inline
>
> 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..c21e3804cb032 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 inline bool needs_clk_disable(struct fsl_qspi *q)
needs_skip_clk_disable()
Frank
> +{
> + 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.43.0
>
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: [PATCH v2 5/9] spi: fsl-qspi: add a clock disable quirk
2025-10-23 23:36 ` Frank Li
@ 2025-10-24 0:04 ` Alex Elder
2025-10-24 2:07 ` Frank Li
0 siblings, 1 reply; 25+ messages in thread
From: Alex Elder @ 2025-10-24 0:04 UTC (permalink / raw)
To: Frank Li
Cc: han.xu, broonie, dlan, guodong, linux-spi, imx, spacemit,
linux-riscv, linux-kernel
On 10/23/25 6:36 PM, Frank Li wrote:
> On Thu, Oct 23, 2025 at 12:59:17PM -0500, Alex Elder wrote:
>> 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 for
>> operations.
>
> remove "for operations."
OK.
>>
>> Signed-off-by: Alex Elder <elder@riscstar.com>
>> ---
>> v2: - The quirk flag is now named QUADSPI_QUIRK_SKIP_CLK_DISABLE
>> - The predicate now returns bool and is not inline
>>
>> 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..c21e3804cb032 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 inline bool needs_clk_disable(struct fsl_qspi *q)
>
> needs_skip_clk_disable()
OK. I was trying to avoid the double-negative:
if (!needs_skip_clk_disasble())
clk_disable...()
But I'll do as you suggest.
Thanks.
-Alex
>
> Frank
>> +{
>> + 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.43.0
>>
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: [PATCH v2 5/9] spi: fsl-qspi: add a clock disable quirk
2025-10-24 0:04 ` Alex Elder
@ 2025-10-24 2:07 ` Frank Li
2025-10-24 2:31 ` Alex Elder
0 siblings, 1 reply; 25+ messages in thread
From: Frank Li @ 2025-10-24 2:07 UTC (permalink / raw)
To: Alex Elder
Cc: han.xu, broonie, dlan, guodong, linux-spi, imx, spacemit,
linux-riscv, linux-kernel
On Thu, Oct 23, 2025 at 07:04:10PM -0500, Alex Elder wrote:
> On 10/23/25 6:36 PM, Frank Li wrote:
> > On Thu, Oct 23, 2025 at 12:59:17PM -0500, Alex Elder wrote:
> > > 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 for
> > > operations.
> >
> > remove "for operations."
>
> OK.
>
> > >
> > > Signed-off-by: Alex Elder <elder@riscstar.com>
> > > ---
> > > v2: - The quirk flag is now named QUADSPI_QUIRK_SKIP_CLK_DISABLE
> > > - The predicate now returns bool and is not inline
> > >
> > > 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..c21e3804cb032 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 inline bool needs_clk_disable(struct fsl_qspi *q)
> >
> > needs_skip_clk_disable()
>
> OK. I was trying to avoid the double-negative:
>
> if (!needs_skip_clk_disasble())
> clk_disable...()
Oh, Make senso, needs_clk_disable() is fine
Frank
>
> But I'll do as you suggest.
>
> Thanks.
>
> -Alex
> >
> > Frank
> > > +{
> > > + 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.43.0
> > >
>
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: [PATCH v2 5/9] spi: fsl-qspi: add a clock disable quirk
2025-10-24 2:07 ` Frank Li
@ 2025-10-24 2:31 ` Alex Elder
0 siblings, 0 replies; 25+ messages in thread
From: Alex Elder @ 2025-10-24 2:31 UTC (permalink / raw)
To: Frank Li
Cc: han.xu, broonie, dlan, guodong, linux-spi, imx, spacemit,
linux-riscv, linux-kernel
On 10/23/25 9:07 PM, Frank Li wrote:
>>>> +static inline bool needs_clk_disable(struct fsl_qspi *q)
>>> needs_skip_clk_disable()
>> OK. I was trying to avoid the double-negative:
>>
>> if (!needs_skip_clk_disasble())
>> clk_disable...()
> Oh, Make senso, needs_clk_disable() is fine
I will leave it as it was: needs_clk_disable(). Thanks. -Alex
> Frank
>
>> But I'll do as you suggest.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v2 6/9] spi: fsl-qspi: allot 1KB per chip
2025-10-23 17:59 [PATCH v2 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (4 preceding siblings ...)
2025-10-23 17:59 ` [PATCH v2 5/9] spi: fsl-qspi: add a clock disable quirk Alex Elder
@ 2025-10-23 17:59 ` Alex Elder
2025-10-23 23:38 ` Frank Li
2025-10-23 17:59 ` [PATCH v2 7/9] spi: fsl-qspi: support the SpacemiT K1 SoC Alex Elder
6 siblings, 1 reply; 25+ messages in thread
From: Alex Elder @ 2025-10-23 17:59 UTC (permalink / raw)
To: han.xu, broonie
Cc: dlan, Frank.li, guodong, linux-spi, imx, spacemit, linux-riscv,
linux-kernel
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 (which is
always 1KB).
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.
Signed-off-by: Alex Elder <elder@riscstar.com>
---
v2: - New field fsl_qspi_devtype_data->sfa_size now defines the size of
the serial flash regions if it's non-zero
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 c21e3804cb032..a474d1b341b6a 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 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);
+ size = q->devtype_data->sfa_size ? : q->devtype_data->ahb_buf_size;
+ qspi_writel(q, addr_offset + 1 * size, base + QUADSPI_SFA1AD);
+ qspi_writel(q, addr_offset + 2 * size, base + QUADSPI_SFA2AD);
+ qspi_writel(q, addr_offset + 3 * size, base + QUADSPI_SFB1AD);
+ qspi_writel(q, addr_offset + 4 * size, base + QUADSPI_SFB2AD);
q->selected = -1;
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* Re: [PATCH v2 6/9] spi: fsl-qspi: allot 1KB per chip
2025-10-23 17:59 ` [PATCH v2 6/9] spi: fsl-qspi: allot 1KB per chip Alex Elder
@ 2025-10-23 23:38 ` Frank Li
2025-10-24 0:04 ` Alex Elder
0 siblings, 1 reply; 25+ messages in thread
From: Frank Li @ 2025-10-23 23:38 UTC (permalink / raw)
To: Alex Elder
Cc: han.xu, broonie, dlan, guodong, linux-spi, imx, spacemit,
linux-riscv, linux-kernel
On Thu, Oct 23, 2025 at 12:59:18PM -0500, Alex Elder wrote:
> 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 (which is
> always 1KB).
>
> 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.
>
> Signed-off-by: Alex Elder <elder@riscstar.com>
> ---
> v2: - New field fsl_qspi_devtype_data->sfa_size now defines the size of
> the serial flash regions if it's non-zero
>
> 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 c21e3804cb032..a474d1b341b6a 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 size;
I think use 'sfa_size' is better to read code.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> 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);
> + size = q->devtype_data->sfa_size ? : q->devtype_data->ahb_buf_size;
> + qspi_writel(q, addr_offset + 1 * size, base + QUADSPI_SFA1AD);
> + qspi_writel(q, addr_offset + 2 * size, base + QUADSPI_SFA2AD);
> + qspi_writel(q, addr_offset + 3 * size, base + QUADSPI_SFB1AD);
> + qspi_writel(q, addr_offset + 4 * size, base + QUADSPI_SFB2AD);
>
> q->selected = -1;
>
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: [PATCH v2 6/9] spi: fsl-qspi: allot 1KB per chip
2025-10-23 23:38 ` Frank Li
@ 2025-10-24 0:04 ` Alex Elder
0 siblings, 0 replies; 25+ messages in thread
From: Alex Elder @ 2025-10-24 0:04 UTC (permalink / raw)
To: Frank Li
Cc: han.xu, broonie, dlan, guodong, linux-spi, imx, spacemit,
linux-riscv, linux-kernel
On 10/23/25 6:38 PM, Frank Li wrote:
> On Thu, Oct 23, 2025 at 12:59:18PM -0500, Alex Elder wrote:
>> 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 (which is
>> always 1KB).
>>
>> 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.
>>
>> Signed-off-by: Alex Elder <elder@riscstar.com>
>> ---
>> v2: - New field fsl_qspi_devtype_data->sfa_size now defines the size of
>> the serial flash regions if it's non-zero
>>
>> 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 c21e3804cb032..a474d1b341b6a 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 size;
>
> I think use 'sfa_size' is better to read code.
OK I'll rename in the next version. Thanks. -Alex
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
>> 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);
>> + size = q->devtype_data->sfa_size ? : q->devtype_data->ahb_buf_size;
>> + qspi_writel(q, addr_offset + 1 * size, base + QUADSPI_SFA1AD);
>> + qspi_writel(q, addr_offset + 2 * size, base + QUADSPI_SFA2AD);
>> + qspi_writel(q, addr_offset + 3 * size, base + QUADSPI_SFB1AD);
>> + qspi_writel(q, addr_offset + 4 * size, base + QUADSPI_SFB2AD);
>>
>> q->selected = -1;
>>
>> --
>> 2.43.0
>>
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v2 7/9] spi: fsl-qspi: support the SpacemiT K1 SoC
2025-10-23 17:59 [PATCH v2 0/9] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
` (5 preceding siblings ...)
2025-10-23 17:59 ` [PATCH v2 6/9] spi: fsl-qspi: allot 1KB per chip Alex Elder
@ 2025-10-23 17:59 ` Alex Elder
2025-10-23 19:56 ` han.xu
2025-10-23 23:41 ` Frank Li
6 siblings, 2 replies; 25+ messages in thread
From: Alex Elder @ 2025-10-23 17:59 UTC (permalink / raw)
To: broonie, han.xu
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>
---
v2: - A continued line the Kconfig file is now aligned
drivers/spi/Kconfig | 3 ++-
drivers/spi/spi-fsl-qspi.c | 10 ++++++++++
2 files changed, 12 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 a474d1b341b6a..d4b007e8172b2 100644
--- a/drivers/spi/spi-fsl-qspi.c
+++ b/drivers/spi/spi-fsl-qspi.c
@@ -268,6 +268,15 @@ 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,
+ .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 +1012,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.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* Re: [PATCH v2 7/9] spi: fsl-qspi: support the SpacemiT K1 SoC
2025-10-23 17:59 ` [PATCH v2 7/9] spi: fsl-qspi: support the SpacemiT K1 SoC Alex Elder
@ 2025-10-23 19:56 ` han.xu
2025-10-24 0:04 ` Alex Elder
2025-10-23 23:41 ` Frank Li
1 sibling, 1 reply; 25+ messages in thread
From: han.xu @ 2025-10-23 19:56 UTC (permalink / raw)
To: Alex Elder
Cc: broonie, dlan, Frank.li, guodong, linux-spi, imx, spacemit,
linux-riscv, linux-kernel
On 25/10/23 12:59PM, Alex Elder wrote:
> 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>
> ---
> v2: - A continued line the Kconfig file is now aligned
>
> drivers/spi/Kconfig | 3 ++-
> drivers/spi/spi-fsl-qspi.c | 10 ++++++++++
> 2 files changed, 12 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 a474d1b341b6a..d4b007e8172b2 100644
> --- a/drivers/spi/spi-fsl-qspi.c
> +++ b/drivers/spi/spi-fsl-qspi.c
> @@ -268,6 +268,15 @@ 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,
Do you need to set the new sfa_size here for multiples of 1KB requirement?
> + .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 +1012,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.43.0
>
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: [PATCH v2 7/9] spi: fsl-qspi: support the SpacemiT K1 SoC
2025-10-23 19:56 ` han.xu
@ 2025-10-24 0:04 ` Alex Elder
0 siblings, 0 replies; 25+ messages in thread
From: Alex Elder @ 2025-10-24 0:04 UTC (permalink / raw)
To: han.xu
Cc: broonie, dlan, Frank.li, guodong, linux-spi, imx, spacemit,
linux-riscv, linux-kernel
On 10/23/25 2:56 PM, han.xu wrote:
> On 25/10/23 12:59PM, Alex Elder wrote:
>> 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>
>> ---
>> v2: - A continued line the Kconfig file is now aligned
>>
>> drivers/spi/Kconfig | 3 ++-
>> drivers/spi/spi-fsl-qspi.c | 10 ++++++++++
>> 2 files changed, 12 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 a474d1b341b6a..d4b007e8172b2 100644
>> --- a/drivers/spi/spi-fsl-qspi.c
>> +++ b/drivers/spi/spi-fsl-qspi.c
>> @@ -268,6 +268,15 @@ 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,
>
> Do you need to set the new sfa_size here for multiples of 1KB requirement?
Wow, yes. I'm very sorry, I shouldn't have sent this series
out so soon. I'm not at home and am not using my normal
development machine. But importantly I admit to not testing
this on the target hardware before sending.
I won't do that again.
-Alex
>
>> + .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 +1012,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.43.0
>>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 7/9] spi: fsl-qspi: support the SpacemiT K1 SoC
2025-10-23 17:59 ` [PATCH v2 7/9] spi: fsl-qspi: support the SpacemiT K1 SoC Alex Elder
2025-10-23 19:56 ` han.xu
@ 2025-10-23 23:41 ` Frank Li
2025-10-24 0:04 ` Alex Elder
1 sibling, 1 reply; 25+ messages in thread
From: Frank Li @ 2025-10-23 23:41 UTC (permalink / raw)
To: Alex Elder
Cc: broonie, han.xu, dlan, guodong, linux-spi, imx, spacemit,
linux-riscv, linux-kernel
On Thu, Oct 23, 2025 at 12:59:19PM -0500, Alex Elder wrote:
> 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>
> ---
> v2: - A continued line the Kconfig file is now aligned
>
> drivers/spi/Kconfig | 3 ++-
> drivers/spi/spi-fsl-qspi.c | 10 ++++++++++
> 2 files changed, 12 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 a474d1b341b6a..d4b007e8172b2 100644
> --- a/drivers/spi/spi-fsl-qspi.c
> +++ b/drivers/spi/spi-fsl-qspi.c
> @@ -268,6 +268,15 @@ 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,
> + .invalid_mstrid = QUADSPI_BUFXCR_INVALID_MSTRID,
> + .quirks = QUADSPI_QUIRK_TKT253890 | QUADSPI_QUIRK_SKIP_CLK_DISABLE,
> + .little_endian = true,
did you test your code? miss set sfa_size here.
Frank
> +};
> +
> struct fsl_qspi {
> void __iomem *iobase;
> void __iomem *ahb_addr;
> @@ -1003,6 +1012,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.43.0
>
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: [PATCH v2 7/9] spi: fsl-qspi: support the SpacemiT K1 SoC
2025-10-23 23:41 ` Frank Li
@ 2025-10-24 0:04 ` Alex Elder
0 siblings, 0 replies; 25+ messages in thread
From: Alex Elder @ 2025-10-24 0:04 UTC (permalink / raw)
To: Frank Li
Cc: broonie, han.xu, dlan, guodong, linux-spi, imx, spacemit,
linux-riscv, linux-kernel
On 10/23/25 6:41 PM, Frank Li wrote:
> On Thu, Oct 23, 2025 at 12:59:19PM -0500, Alex Elder wrote:
>> 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>
>> ---
>> v2: - A continued line the Kconfig file is now aligned
>>
>> drivers/spi/Kconfig | 3 ++-
>> drivers/spi/spi-fsl-qspi.c | 10 ++++++++++
>> 2 files changed, 12 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 a474d1b341b6a..d4b007e8172b2 100644
>> --- a/drivers/spi/spi-fsl-qspi.c
>> +++ b/drivers/spi/spi-fsl-qspi.c
>> @@ -268,6 +268,15 @@ 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,
>> + .invalid_mstrid = QUADSPI_BUFXCR_INVALID_MSTRID,
>> + .quirks = QUADSPI_QUIRK_TKT253890 | QUADSPI_QUIRK_SKIP_CLK_DISABLE,
>> + .little_endian = true,
>
> did you test your code? miss set sfa_size here.
I confessed earlier I did not, and I'm very sorry about that.
No future version will be sent until it's all tested.
-Alex
>
> Frank
>
>> +};
>> +
>> struct fsl_qspi {
>> void __iomem *iobase;
>> void __iomem *ahb_addr;
>> @@ -1003,6 +1012,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.43.0
>>
^ permalink raw reply [flat|nested] 25+ messages in thread