spi: nxp_fspi: new driver for the FlexSPI controller
Subsystems (2)
PATCH v2 1/2 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
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 v2 2/2 arm: ls1028a: use the new flexspi driver
Also align the fspi node with the kernel one. There is actually no driver which would match "nxp,dn-fspi".
---
changes since v1:
- 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 v2 2/2 arm: ls1028a: use the new flexspi driver
Hi Michael,
Quoted 34 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Walle
Sent: Saturday, November 2, 2019 11:56 PM
To: u-boot at lists.denx.de
Subject: [EXT] [U-Boot] [PATCH v2 2/2] arm: ls1028a: use the new flexspi driverCaution: EXT Email
Also align the fspi node with the kernel one. There is actually no driver which would match "nxp,dn-fspi".
Signed-off-by Michael Walle <[email protected]>---
changes since v1:
- nonearch/arm/dts/fsl-ls1028a.dtsi | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)arch/arm/dts/fsl-ls1028a.dtsi index renamed from arch/arm/dts/fsl-ls1028a.dtsi +0
-0
43a154e8e7..774e477542100644arch/arm/dts/fsl-ls1028a.dtsi +2
-2@@ -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>;
arch/arm/dts/fsl-ls1028a.dtsi line 61
Quoted 10 lines
arch/arm/dts/fsl-ls1028a.dtsi +6
-4- 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>;
Please change the interrupts to "<GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>" as it avoids magic numbers.
Quoted 5 lines
arch/arm/dts/fsl-ls1028a.dtsi +0
-1status = "disabled"; }; --2.20.1
PATCH v2 2/2 arm: ls1028a: use the new flexspi driver
Hi Singh,
Am 2019-11-05 07:40, schrieb Kuldeep Singh:
Quoted 46 lines
Hi Michael,
Quoted 44 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Walle
Sent: Saturday, November 2, 2019 11:56 PM
To: u-boot at lists.denx.de
Subject: [EXT] [U-Boot] [PATCH v2 2/2] arm: ls1028a: use the new flexspi
driverCaution: EXT Email
Also align the fspi node with the kernel one. There is actually no driver which
would match "nxp,dn-fspi".Signed-off-by Michael Walle <[email protected]>---
changes since v1:
- nonearch/arm/dts/fsl-ls1028a.dtsi | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/arch/arm/dts/fsl-ls1028a.dtsiindex43a154e8e7..774e477542100644arch/arm/dts/fsl-ls1028a.dtsi +2
-4@@ -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>; /*64MBflash*/
arch/arm/dts/fsl-ls1028a.dtsi +1
-2- reg-names = "FSPI", "FSPI-memory"; - num-cs = <1>; + reg = <0x0 0x20c0000 0x0 0x10000>,
Quoted 8 lines
arch/arm/dts/fsl-ls1028a.dtsi line 61
Quoted 5 lines
arch/arm/dts/fsl-ls1028a.dtsi +5
-0+ <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>;Please change the interrupts to "<
GIC_SPI25IRQ_TYPE_LEVEL_HIGH>" as it avoids magic numbers.
This is consistent with the other interrupt properties, which doesn't have these constants either. IMHO another commit where all these magic numbers are removed would be better.
Quoted 1 line
Reviewed-by Kuldeep Singh <[email protected]>
Thanks.
-michael
PATCH v2 2/2 arm: ls1028a: use the new flexspi driver
Hi Michael,
Quoted 67 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Tuesday, November 5, 2019 3:07 PM
To: Kuldeep Singh <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [EXT] [U-Boot] [PATCH v2 2/2] arm: ls1028a: use the new flexspi driverCaution: EXT Email
Hi Singh,
Am 2019-11-05 07:40, schrieb Kuldeep Singh:
Quoted 45 lines
Hi Michael,
Quoted 43 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Walle
Sent: Saturday, November 2, 2019 11:56 PM
To: u-boot at lists.denx.de
Subject: [EXT] [U-Boot] [PATCH v2 2/2] arm: ls1028a: use the new flexspi driverCaution: EXT Email
Also align the fspi node with the kernel one. There is actually no driver which would match "nxp,dn-fspi".
Signed-off-by Michael Walle <[email protected]>---
changes since v1:
- nonearch/arm/dts/fsl-ls1028a.dtsi | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/arch/arm/dts/fsl-ls1028a.dtsiindex43a154e8e7..774e477542100644arch/arm/dts/fsl-ls1028a.dtsi +0
-0@@ -49,14 +49,16 @@ <1 10 0x8>; /* Hypervisor PPI,active-low */
};arch/arm/dts/fsl-ls1028a.dtsi +2
-4- 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>; /*64MBflash*/
arch/arm/dts/fsl-ls1028a.dtsi +1
-2- reg-names = "FSPI", "FSPI-memory"; - num-cs = <1>; + reg = <0x0 0x20c0000 0x0 0x10000>,Quoted 8 lines
arch/arm/dts/fsl-ls1028a.dtsi line 61
Quoted 5 lines
arch/arm/dts/fsl-ls1028a.dtsi +5
-0+ <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>;Please change the interrupts to "<
GIC_SPI25IRQ_TYPE_LEVEL_HIGH>" as it avoids magic numbers.
Quoted 4 lines
This is consistent with the other interrupt properties, which doesn't have these constants either. IMHO another commit where all these magic numbers are removed would be better.
I just checked and found no interrupt handler in spi/nxp_fspi.c driver. So, it's better to remove this line altogether. What do you think?
-Kuldeep
Quoted 5 lines
Quoted 2 lines
Reviewed-by Kuldeep Singh <[email protected]>Thanks.
-michael
PATCH v2 2/2 arm: ls1028a: use the new flexspi driver
Am 2019-11-05 10:53, schrieb Kuldeep Singh:
Hi Kuldeep,
Quoted 38 lines
Quoted 31 lines
Quoted 22 lines
Quoted 22 lines
(quoted diff) +0
-0
b/arch/arm/dts/fsl-ls1028a.dtsiindex43a154e8e7..774e477542100644arch/arm/dts/fsl-ls1028a.dtsi +0
-0@@ -49,14 +49,16 @@ <1 10 0x8>; /* Hypervisor PPI,active-low */
};arch/arm/dts/fsl-ls1028a.dtsi +2
-4- 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>; /*64MBflash*/
arch/arm/dts/fsl-ls1028a.dtsi +1
-2- reg-names = "FSPI", "FSPI-memory"; - num-cs = <1>; + reg = <0x0 0x20c0000 0x0 0x10000>,Quoted 8 lines
arch/arm/dts/fsl-ls1028a.dtsi line 61
Quoted 5 lines
arch/arm/dts/fsl-ls1028a.dtsi +5
-0+ <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>;Please change the interrupts to "<
GIC_SPI25IRQ_TYPE_LEVEL_HIGH>" as it avoids magic numbers.Quoted 6 lines
This is consistent with the other interrupt properties, which doesn't have these
constants either. IMHO another commit where all these magic numbers are
removed would be better.
Quoted 3 lines
I just checked and found no interrupt handler in
spi/nxp_fspi.cdriver. So, it's better to remove this line altogether. What do you think?
For the sake of consistency (with all other nodes and with the linux device tree) and if someone would like to sync the device tree with the linux one, I'd keep that. Like I said before, I'd do another patch were all interrupt magic numbers are replaced with the correct constants.
-michael
PATCH v2 1/2 spi: nxp_fspi: new driver for the FlexSPI controller
In reply to Michael WalleQuoted 79 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Walle
Sent: Saturday, November 2, 2019 11:56 PM
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] spi:nxp_fspi: new driver for the FlexSPI controllerThis 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).
Signed-off-by Michael Walle <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
changes since v1:
- fixed typo, thanks Jagandrivers/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.cdrivers/spi/Kconfig index renamed from drivers/spi/Kconfig +0
-0
7be867d5b6..ad20309df8100644drivers/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 onMACH_PIC32drivers/spi/Makefile index renamed from drivers/spi/Makefile +0
-0
ae4f2958f8..52462e19a3100644drivers/spi/Makefile +0
-0@@ -43,6 +43,7 @@ obj-$(CONFIG_MSCC_BB_SPI) += mscc_bb_spi.oobj-$(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 mode renamed from drivers/spi/nxp_fspi.c +0
-0100644 index 0000000000..b808418eb6
drivers/spi/nxp_fspi.c line 5
Quoted 5 lines
drivers/spi/nxp_fspi.c new file +5
-0@@ -0,0 +1,997 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* NXP FlexSPI(FSPI) controller driver. +* +* Copyright (c) 2019 Michael Walle <[email protected]>
The file is ported from Linux.
Any particular reason of adding copyright?
Can you change this to Author/Ported-by?
drivers/spi/nxp_fspi.c line 9
Quoted 5 lines
drivers/spi/nxp_fspi.c new file +5
-0+* +* This driver was originally ported from the linux kernel v5.4-rc3, +which had +* the following notes: +*
<snip>
-priyankajain
PATCH v2 1/2 spi: nxp_fspi: new driver for the FlexSPI controller
Am 2019-11-29 06:03, schrieb Priyanka Jain:
Quoted 84 lines
Quoted 84 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Walle
Sent: Saturday, November 2, 2019 11:56 PM
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] spi:nxp_fspi: new driver for the FlexSPI
controllerThis 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 withWARN_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).Signed-off-by Michael Walle <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
changes since v1:
- fixed typo, thanks Jagandrivers/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.cdrivers/spi/Kconfig index renamed from drivers/spi/Kconfig +0
-0
7be867d5b6..ad20309df8100644drivers/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 onMACH_PIC32drivers/spi/Makefile index renamed from drivers/spi/Makefile +0
-0
ae4f2958f8..52462e19a3100644drivers/spi/Makefile +0
-0@@ -43,6 +43,7 @@ obj-$(CONFIG_MSCC_BB_SPI) += mscc_bb_spi.oobj-$(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 renamed from drivers/spi/nxp_fspi.c +0
-0mode
100644 index 0000000000..b808418eb6drivers/spi/nxp_fspi.c new file +0
-0
Quoted 8 lines
drivers/spi/nxp_fspi.c line 5
Quoted 6 lines
drivers/spi/nxp_fspi.c new file +5
-0@@ -0,0 +1,997 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* NXP FlexSPI(FSPI) controller driver. +* +* Copyright (c) 2019 Michael Walle <[email protected]> The file is ported from Linux.
Any particular reason of adding copyright?
so what? the "original" copyright is mentioned. It is certainly not the case that there wasn't any changes. I get the feeling that you just want to have "your" NXP copyright here. If any, there should be the copyright of the original spi-nxp-qspi.c driver, which is not NXP. But instead NXP
- lets say borrowed - much of its code for "their" spi-nxp-fspi.c and _dropped_ all former copyrights.
Quoted 1 line
Can you change this to Author/Ported-by?
Nope.
-michael
Quoted 7 lines
drivers/spi/nxp_fspi.c line 9
Quoted 5 lines
drivers/spi/nxp_fspi.c new file +5
-0+* +* This driver was originally ported from the linux kernel v5.4-rc3, +which had +* the following notes: +* <snip>
-priyankajain
PATCH v2 1/2 spi: nxp_fspi: new driver for the FlexSPI controller
Hi Priyanka, Hi Jagan, Hi Vingesh,
Am 2019-11-29 08:49, schrieb Michael Walle:
Quoted 106 lines
Am 2019-11-29 06:03, schrieb Priyanka Jain:
Quoted 88 lines
Quoted 88 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Walle
Sent: Saturday, November 2, 2019 11:56 PM
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] spi:nxp_fspi: new driver for the FlexSPI
controllerThis 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 withWARN_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).Signed-off-by Michael Walle <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
changes since v1:
- fixed typo, thanks Jagandrivers/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.cdrivers/spi/Kconfig index renamed from drivers/spi/Kconfig +0
-0
7be867d5b6..ad20309df8100644drivers/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 onMACH_PIC32drivers/spi/Makefile index renamed from drivers/spi/Makefile +0
-0
ae4f2958f8..52462e19a3100644drivers/spi/Makefile +0
-0@@ -43,6 +43,7 @@ obj-$(CONFIG_MSCC_BB_SPI) += mscc_bb_spi.oobj-$(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 renamed from drivers/spi/nxp_fspi.c +0
-0mode
100644 index 0000000000..b808418eb6drivers/spi/nxp_fspi.c new file +0
-0Quoted 8 lines
drivers/spi/nxp_fspi.c line 5
Quoted 6 lines
drivers/spi/nxp_fspi.c new file +5
-0@@ -0,0 +1,997 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* NXP FlexSPI(FSPI) controller driver. +* +* Copyright (c) 2019 Michael Walle <[email protected]> The file is ported from Linux.
Any particular reason of adding copyright?so what? the "original" copyright is mentioned. It is certainly not the case that there wasn't any changes. I get the feeling that you just want to have "your" NXP copyright here. If any, there should be the copyright of the original
spi-nxp-qspi.cdriver, which is not NXP. But instead NXP - lets say borrowed - much of its code for "their"spi-nxp-fspi.cand _dropped_ all former copyrights.
Quoted 2 lines
Quoted 1 line
Can you change this to Author/Ported-by?
Nope.
ping. there was already tested-by's and reviewd-by's.
Quoted 9 lines
-michael
Quoted 6 lines
Quoted 5 lines
drivers/spi/nxp_fspi.c new file +5
-0+* +* This driver was originally ported from the linux kernel v5.4-rc3, +which had +* the following notes: +* <snip>
btw the original copyright is here after the snip. FWIW i can move that one also to the top. but I certainly won't drop mine.
-michael
PATCH v2 1/2 spi: nxp_fspi: new driver for the FlexSPI controller
Quoted 11 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Monday, December 16, 2019 6:50 PM
To: Priyanka Jain <[email protected]>; Jagan Teki <[email protected]>; Vignesh R <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v2 1/2] spi:nxp_fspi: new driver for the FlexSPI controller
Quoted 106 lines
Hi Priyanka, Hi Jagan, Hi Vingesh,
Am 2019-11-29 08:49, schrieb Michael Walle:
Quoted 102 lines
Am 2019-11-29 06:03, schrieb Priyanka Jain:
Quoted 82 lines
Quoted 82 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Walle
Sent: Saturday, November 2, 2019 11:56 PM
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] spi:nxp_fspi: new driver for the FlexSPI controllerThis 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).
Signed-off-by Michael Walle <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
changes since v1:
- fixed typo, thanks Jagandrivers/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.cdrivers/spi/Kconfig index renamed from drivers/spi/Kconfig +0
-0
7be867d5b6..ad20309df8100644drivers/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 onMACH_PIC32drivers/spi/Makefile index renamed from drivers/spi/Makefile +0
-0
ae4f2958f8..52462e19a3100644drivers/spi/Makefile +0
-0@@ -43,6 +43,7 @@ obj-$(CONFIG_MSCC_BB_SPI) += mscc_bb_spi.oobj-$(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 diff --git
a/drivers/spi/nxp_fspi.cb/drivers/spi/nxp_fspi.cnew file mode 100644 index 0000000000..b808418eb6drivers/spi/nxp_fspi.c new file +0
-0Quoted 8 lines
drivers/spi/nxp_fspi.c line 5
Quoted 6 lines
drivers/spi/nxp_fspi.c new file +5
-0@@ -0,0 +1,997 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* NXP FlexSPI(FSPI) controller driver. +* +* Copyright (c) 2019 Michael Walle <[email protected]> The file is ported from Linux.
Any particular reason of adding copyright?so what? the "original" copyright is mentioned. It is certainly not the case that there wasn't any changes. I get the feeling that you just want to have "your" NXP copyright here. If any, there should be the copyright of the original
spi-nxp-qspi.cdriver, which is not NXP. But instead NXP - lets say borrowed - much of its code for "their"spi-nxp-fspi.cand _dropped_ all former copyrights.Quoted 1 line
Can you change this to Author/Ported-by?
Nope.
I am not asking you to drop copyright.
It's a query to understand what value you are adding to the existing Linux driver. The process that I follow for all copyright additions in case things are not very explicit.
Quoted 10 lines
ping. there was already tested-by's and reviewd-by's.
Quoted 8 lines
-michael
Quoted 5 lines
Quoted 5 lines
drivers/spi/nxp_fspi.c new file +5
-0+* +* This driver was originally ported from the linux kernel +v5.4-rc3, which had +* the following notes: +*
Quoted 4 lines
Quoted 1 line
Quoted 1 line
<snip>
btw the original copyright is here after the snip. FWIW i can move that one also to the top. but I certainly won't drop mine.
Please pull in original copyright to the top as well.
Quoted 2 lines
-michael
-Priyanka