spi: nxp_fspi: new driver for the FlexSPI controller
Subsystems (2)
PATCH v3 1/3 spi: nxp_fspi: new driver for the FlexSPI controller
This is a port of the kernel's spi-nxp-fspi driver. It uses the new spi-mem interface and does not expose the more generic spi-xfer interface. The source was taken from the v5.3-rc3 tag.
The port was straightforward:
- remove the interrupt handling and the completion by busy polling the controller
- remove locks
- move the setup of the memory windows into claim_bus()
- move the setup of the speed into set_speed()
- port the device tree bindings from the original fspi_probe() to ofdata_to_platdata()
There were only some style change fixes, no change in any logic. For example, there are busy loops where the return code is not handled correctly, eg. only prints a warning with WARN_ON(). This port intentionally left most functions unchanged to ease future bugfixes.
This was tested on a custom LS1028A board. Because the LS1028A doesn't have proper clock framework support, changing the clock speed was not tested. This also means that it is not possible to change the SPI speed on LS1028A for now (neither is it possible in the linux driver).
---
changes since v1:
- fixed typo, thanks Jagan
changes since v2:
- none
drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/nxp_fspi.c | 997 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1005 insertions(+) create mode 100644 drivers/spi/nxp_fspi.c
drivers/spi/Kconfig +7 -0
@@ -192,6 +192,13 @@ config MVEBU_A3700_SPI used to access the SPI NOR flash on platforms embedding this Marvell IP core. +config NXP_FSPI + bool "NXP FlexSPI driver" + depends on SPI_MEM + help + Enable the NXP FlexSPI (FSPI) driver. This driver can be used to + access the SPI NOR flash on platforms embedding this NXP IP core. + config PIC32_SPI bool "Microchip PIC32 SPI driver" depends on MACH_PIC32
drivers/spi/Makefile +1 -0
@@ -43,6 +43,7 @@ obj-$(CONFIG_MSCC_BB_SPI) += mscc_bb_spi.o obj-$(CONFIG_MVEBU_A3700_SPI) += mvebu_a3700_spi.o obj-$(CONFIG_MXC_SPI) += mxc_spi.o obj-$(CONFIG_MXS_SPI) += mxs_spi.o +obj-$(CONFIG_NXP_FSPI) += nxp_fspi.o obj-$(CONFIG_ATCSPI200_SPI) += atcspi200_spi.o obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o obj-$(CONFIG_PIC32_SPI) += pic32_spi.o
drivers/spi/nxp_fspi.c new file +997 -0
997 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v3 1/3 spi: nxp_fspi: new driver for the FlexSPI controller
Am 2019-11-06 00:03, schrieb Michael Walle:
Quoted 23 lines
This is a port of the kernel's spi-nxp-fspi driver. It uses the new spi-mem interface and does not expose the more generic spi-xfer interface. The source was taken from the v5.3-rc3 tag.
The port was straightforward:
- remove the interrupt handling and the completion by busy polling the controller
- remove locks
- move the setup of the memory windows intoclaim_bus()
- move the setup of the speed intoset_speed()
- port the device tree bindings from the originalfspi_probe()toofdata_to_platdata()There were only some style change fixes, no change in any logic. For example, there are busy loops where the return code is not handled correctly, eg. only prints a warning with
WARN_ON(). This port intentionally left most functions unchanged to ease future bugfixes.This was tested on a custom LS1028A board. Because the LS1028A doesn't have proper clock framework support, changing the clock speed was not tested. This also means that it is not possible to change the SPI speed on LS1028A for now (neither is it possible in the linux driver).
Quoted 7 lines
Signed-off-by Michael Walle <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
changes since v1:
- fixed typo, thanks Jagan
changes since v2:
- none
Ping. any news on this?
-michael
PATCH v3 1/3 spi: nxp_fspi: new driver for the FlexSPI controller
Quoted 42 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Walle
Sent: Thursday, November 21, 2019 6:18 PM
To: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v3 1/3] spi:nxp_fspi: new driver for the FlexSPI controllerAm 2019-11-06 00:03, schrieb Michael Walle:
Quoted 23 lines
This is a port of the kernel's spi-nxp-fspi driver. It uses the new spi-mem interface and does not expose the more generic spi-xfer interface. The source was taken from the v5.3-rc3 tag.
The port was straightforward:
- remove the interrupt handling and the completion by busy polling the controller
- remove locks
- move the setup of the memory windows intoclaim_bus()
- move the setup of the speed intoset_speed()
- port the device tree bindings from the originalfspi_probe()toofdata_to_platdata()There were only some style change fixes, no change in any logic. For example, there are busy loops where the return code is not handled correctly, eg. only prints a warning with
WARN_ON(). This port intentionally left most functions unchanged to ease future bugfixes.This was tested on a custom LS1028A board. Because the LS1028A doesn't have proper clock framework support, changing the clock speed was not tested. This also means that it is not possible to change the SPI speed on LS1028A for now (neither is it possible in the linux driver).
Quoted 7 lines
Signed-off-by Michael Walle <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
changes since v1:
- fixed typo, thanks Jagan
changes since v2:
- none
Quoted 1 line
Ping. any news on this?
Will pick this patch in next merge window
Quoted 2 lines
-michael
-priyankajain
PATCH v3 2/3 arm: ls1028a: use the new flexspi driver
In reply to Michael WalleAlso align the fspi node with the kernel one.
---
changes since v1:
- none
changes since v2:
- none
arch/arm/dts/fsl-ls1028a.dtsi | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
arch/arm/dts/fsl-ls1028a.dtsi +8 -6
@@ -49,14 +49,16 @@ <1 10 0x8>; /* Hypervisor PPI, active-low */ }; - fspi: flexspi at 20C0000 { - compatible = "nxp,dn-fspi"; + fspi: flexspi at 20c0000 { + compatible = "nxp,lx2160a-fspi"; #address-cells = <1>; #size-cells = <0>; - reg = <0x0 0x20C0000 0x0 0x10000>, - <0x0 0x20000000 0x0 0x10000000>; /*64MB flash*/ - reg-names = "FSPI", "FSPI-memory"; - num-cs = <1>; + reg = <0x0 0x20c0000 0x0 0x10000>, + <0x0 0x20000000 0x0 0x10000000>; + reg-names = "fspi_base", "fspi_mmap"; + clocks = <&clockgen 4 3>, <&clockgen 4 3>; + clock-names = "fspi_en", "fspi"; + interrupts = <0 25 0x4>; status = "disabled"; };
Signature · 1 line
2.20.1
PATCH v3 1/3 spi: nxp_fspi: new driver for the FlexSPI controller
In reply to Michael WalleHi,
Quoted 31 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Wednesday, November 6, 2019 4:33 AM
To: u-boot at lists.denx.de
Cc: Vignesh R <[email protected]>; Prabhakar X <[email protected]>; Kuldeep Singh <[email protected]>; Michael Walle <[email protected]>; Jagan Teki <[email protected]>
Subject: [EXT] [PATCH v3 1/3] spi:nxp_fspi: new driver for the FlexSPI controllerCaution: EXT Email
This is a port of the kernel's spi-nxp-fspi driver. It uses the new spi-mem interface and does not expose the more generic spi-xfer interface. The source was taken from the v5.3-rc3 tag.
The port was straightforward:
- remove the interrupt handling and the completion by busy polling the controller
- remove locks
- move the setup of the memory windows intoclaim_bus()
- move the setup of the speed intoset_speed()
- port the device tree bindings from the originalfspi_probe()toofdata_to_platdata()There were only some style change fixes, no change in any logic. For example, there are busy loops where the return code is not handled correctly, eg. only prints a warning with
WARN_ON(). This port intentionally left most functions unchanged to ease future bugfixes.
Quoted 7 lines
This was tested on a custom LS1028A board. Because the LS1028A doesn't have proper clock framework support, changing the clock speed was not tested. This also means that it is not possible to change the SPI speed on LS1028A for now (neither is it possible in the linux driver).
Signed-off-by Michael Walle <[email protected]>Reviewed-by Jagan Teki <[email protected]>
Tested on LS1028A-RDB and LX2160A-RDB
Regards,
Kuldeep
PATCH v3 3/3 arm: dts: ls1028a: fix interrupt properties
In reply to Michael WalleSync the interrupt properties with the ones from Linux. Also use the constants provided by the dt-bindings header. Please note, that there are actual changes/fixes in the irq flags. U-Boot won't use the interrupt properties anyway. It's just to be consistent with the Linux device tree.
---
changes since v1:
- n/a
changes since v2:
- new patch
arch/arm/dts/fsl-ls1028a.dtsi | 55 ++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 24 deletions(-)
arch/arm/dts/fsl-ls1028a.dtsi +31 -24
@@ -6,6 +6,8 @@ * */ +#include <dt-bindings/interrupt-controller/arm-gic.h> + / { compatible = "fsl,ls1028a"; interrupt-parent = <&gic>;
@@ -38,15 +40,20 @@ <0x0 0x06040000 0 0x40000>; #interrupt-cells = <3>; interrupt-controller; - interrupts = <1 9 0x4>; + interrupts = <GIC_PPI 9 (GIC_CPU_MASK_RAW(0xf) | + IRQ_TYPE_LEVEL_LOW)>; }; timer { compatible = "arm,armv8-timer"; - interrupts = <1 13 0x8>, /* Physical Secure PPI, active-low */ - <1 14 0x8>, /* Physical Non-Secure PPI, active-low */ - <1 11 0x8>, /* Virtual PPI, active-low */ - <1 10 0x8>; /* Hypervisor PPI, active-low */ + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | + IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | + IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | + IRQ_TYPE_LEVEL_LOW)>, + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | + IRQ_TYPE_LEVEL_LOW)>; }; fspi: flexspi at 20c0000 {
@@ -58,7 +65,7 @@ reg-names = "fspi_base", "fspi_mmap"; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "fspi_en", "fspi"; - interrupts = <0 25 0x4>; + interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>; status = "disabled"; };
@@ -66,7 +73,7 @@ device_type = "serial"; compatible = "fsl,ns16550", "ns16550a"; reg = <0x0 0x21c0500 0x0 0x100>; - interrupts = <0 32 0x1>; /* edge triggered */ + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; status = "disabled"; };
@@ -74,7 +81,7 @@ device_type = "serial"; compatible = "fsl,ns16550", "ns16550a"; reg = <0x0 0x21c0600 0x0 0x100>; - interrupts = <0 32 0x1>; /* edge triggered */ + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; status = "disabled"; };
@@ -150,7 +157,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x0 0x2000000 0x0 0x10000>; - interrupts = <0 34 0x4>; + interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>; clock-names = "i2c"; clocks = <&clockgen 4 0>; status = "disabled";
@@ -161,7 +168,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x0 0x2010000 0x0 0x10000>; - interrupts = <0 34 0x4>; + interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>; clock-names = "i2c"; clocks = <&clockgen 4 0>; status = "disabled";
@@ -172,7 +179,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x0 0x2020000 0x0 0x10000>; - interrupts = <0 35 0x4>; + interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>; clock-names = "i2c"; clocks = <&clockgen 4 0>; status = "disabled";
@@ -183,7 +190,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x0 0x2030000 0x0 0x10000>; - interrupts = <0 35 0x4>; + interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>; clock-names = "i2c"; clocks = <&clockgen 4 0>; status = "disabled";
@@ -194,7 +201,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x0 0x2040000 0x0 0x10000>; - interrupts = <0 74 0x4>; + interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; clock-names = "i2c"; clocks = <&clockgen 4 0>; status = "disabled";
@@ -205,7 +212,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x0 0x2050000 0x0 0x10000>; - interrupts = <0 74 0x4>; + interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; clock-names = "i2c"; clocks = <&clockgen 4 0>; status = "disabled";
@@ -216,7 +223,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x0 0x2060000 0x0 0x10000>; - interrupts = <0 75 0x4>; + interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; clock-names = "i2c"; clocks = <&clockgen 4 0>; status = "disabled";
@@ -227,7 +234,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x0 0x2070000 0x0 0x10000>; - interrupts = <0 75 0x4>; + interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; clock-names = "i2c"; clocks = <&clockgen 4 0>; status = "disabled";
@@ -236,7 +243,7 @@ usb1: usb3 at 3100000 { compatible = "fsl,layerscape-dwc3"; reg = <0x0 0x3100000 0x0 0x10000>; - interrupts = <0 80 0x4>; + interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>; dr_mode = "host"; status = "disabled"; };
@@ -244,7 +251,7 @@ usb2: usb3 at 3110000 { compatible = "fsl,layerscape-dwc3"; reg = <0x0 0x3110000 0x0 0x10000>; - interrupts = <0 81 0x4>; + interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>; dr_mode = "host"; status = "disabled"; };
@@ -254,7 +261,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x0 0x2100000 0x0 0x10000>; - interrupts = <0 26 0x4>; + interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; clock-names = "dspi"; clocks = <&clockgen 4 0>; num-cs = <5>;
@@ -267,7 +274,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x0 0x2110000 0x0 0x10000>; - interrupts = <0 26 0x4>; + interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; clock-names = "dspi"; clocks = <&clockgen 4 0>; num-cs = <5>;
@@ -280,7 +287,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x0 0x2120000 0x0 0x10000>; - interrupts = <0 26 0x4>; + interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; clock-names = "dspi"; clocks = <&clockgen 4 0>; num-cs = <5>;
@@ -291,7 +298,7 @@ esdhc0: esdhc at 2140000 { compatible = "fsl,esdhc"; reg = <0x0 0x2140000 0x0 0x10000>; - interrupts = <0 28 0x4>; + interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; big-endian; bus-width = <4>; status = "disabled";
@@ -300,7 +307,7 @@ esdhc1: esdhc at 2150000 { compatible = "fsl,esdhc"; reg = <0x0 0x2150000 0x0 0x10000>; - interrupts = <0 63 0x4>; + interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>; big-endian; non-removable; bus-width = <4>;
@@ -312,7 +319,7 @@ reg = <0x0 0x3200000 0x0 0x10000 /* ccsr sata base */ 0x7 0x100520 0x0 0x4>; /* ecc sata addr*/ reg-names = "sata-base", "ecc-addr"; - interrupts = <0 133 4>; + interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>; status = "disabled"; };
Signature · 1 line
2.20.1