Add support for Microchip CoreSPI Controller
Subsystems (4)
v2 cover Add support for Microchip CoreSPI Controller
This patch series adds support for the Microchip FPGA CoreSPI "soft" IP and documents its device tree bindings.
As preparation, the existing Microchip SPI driver is renamed to clearly indicate that it supports only the Microchip PolarFire SoC "hard" controller. Although it was originally named with the expectation that it might also cover the FPGA CoreSPI "soft" IP, the register layouts differ significantly, so separate drivers are required.
changes in v2
--------------
- Moved compatible strings into an enum and kept alphabetical order
- Replaced .remove_new callback with .remove
- Dropped unused variable reported by kernel test robot
- Updated CoreSPI drivers commit message to include the 8-bit frame size restriction
Prajna Rajendra Kumar (3):
spi: microchip: rename driver file and internal identifiers
spi: dt-binding: document Microchip CoreSPI
spi: add support for microchip "soft" spi controller
.../bindings/spi/microchip,mpfs-spi.yaml | 70 +- drivers/spi/Kconfig | 12 +- drivers/spi/Makefile | 1 + drivers/spi/spi-microchip-core.c | 581 ++++++---------- drivers/spi/spi-mpfs.c | 626 ++++++++++++++++++ 5 files changed, 905 insertions(+), 385 deletions(-) create mode 100644 drivers/spi/spi-mpfs.c
Signature · 1 line
2.25.1
PATCH v2 1/3 spi: microchip: rename driver file and internal identifiers
The spi-microchip-core.c driver provides support for the Microchip PolarFire SoC (MPFS) "hard" SPI controller. It was originally named "core" with the expectation that it might also cover Microchip's CoreSPI "soft" IP, but that never materialized.
The CoreSPI IP cannot be supported by this driver because its register layout differs substantially from the MPFS SPI controller. In practice most of the code would need to be replaced to handle those differences so keeping the drivers separate is the simpler approach.
The file and internal symbols are renamed to reflect MPFS support and to free up "spi-microchip-core.c" for CoreSPI driver.
---
drivers/spi/Kconfig | 19 +-
drivers/spi/Makefile | 2 +-
.../spi/{spi-microchip-core.c => spi-mpfs.c} | 207 +++++++++---------
3 files changed, 115 insertions(+), 113 deletions(-)
rename drivers/spi/{spi-microchip-core.c => spi-mpfs.c} (68%)drivers/spi/Kconfig +10 -9
@@ -706,15 +706,6 @@ config SPI_MESON_SPIFC This enables master mode support for the SPIFC (SPI flash controller) available in Amlogic Meson SoCs. -config SPI_MICROCHIP_CORE - tristate "Microchip FPGA SPI controllers" - depends on SPI_MASTER - help - This enables the SPI driver for Microchip FPGA SPI controllers. - Say Y or M here if you want to use the "hard" controllers on - PolarFire SoC. - If built as a module, it will be called spi-microchip-core. - config SPI_MICROCHIP_CORE_QSPI tristate "Microchip FPGA QSPI controllers" depends on SPI_MASTER
@@ -871,6 +862,16 @@ config SPI_PL022 controller. If you have an embedded system with an AMBA(R) bus and a PL022 controller, say Y or M here. +config SPI_POLARFIRE_SOC + + tristate "Microchip FPGA SPI controllers" + depends on SPI_MASTER && ARCH_MICROCHIP + help + This enables the SPI driver for Microchip FPGA SPI controllers. + Say Y or M here if you want to use the "hard" controllers on + PolarFire SoC. + If built as a module, it will be called spi-mpfs. + config SPI_PPC4xx tristate "PPC4xx SPI Controller" depends on PPC32 && 4xx
drivers/spi/Makefile +1 -1
@@ -86,7 +86,6 @@ obj-$(CONFIG_SPI_LOONGSON_PLATFORM) += spi-loongson-plat.o obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o obj-$(CONFIG_SPI_MESON_SPICC) += spi-meson-spicc.o obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o -obj-$(CONFIG_SPI_MICROCHIP_CORE) += spi-microchip-core.o obj-$(CONFIG_SPI_MICROCHIP_CORE_QSPI) += spi-microchip-core-qspi.o obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
@@ -97,6 +96,7 @@ obj-$(CONFIG_SPI_MTK_NOR) += spi-mtk-nor.o obj-$(CONFIG_SPI_MTK_SNFI) += spi-mtk-snfi.o obj-$(CONFIG_SPI_MXIC) += spi-mxic.o obj-$(CONFIG_SPI_MXS) += spi-mxs.o +obj-$(CONFIG_SPI_POLARFIRE_SOC) += spi-mpfs.o obj-$(CONFIG_SPI_WPCM_FIU) += spi-wpcm-fiu.o obj-$(CONFIG_SPI_NPCM_FIU) += spi-npcm-fiu.o obj-$(CONFIG_SPI_NPCM_PSPI) += spi-npcm-pspi.o
drivers/spi/spi-mpfs.c renamed from drivers/spi/spi-microchip-core.c +104 -103
496 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 2/3 spi: dt-binding: document Microchip CoreSPI
In reply to Prajna Rajendra KumarAdd device tree bindings for Microchip's CoreSPI controller.
CoreSPI is a "soft" IP core intended for FPGA implementations. Its configurations are set in Libero. These properties represent non-discoverable configurations determined by Verilog parameters to the IP.
--- .../bindings/spi/microchip,mpfs-spi.yaml | 70 ++++++++++++++++++- 1 file changed, 68 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/spi/microchip,mpfs-spi.yaml +68 -2
@@ -21,11 +21,13 @@ properties: - microchip,mpfs-qspi - microchip,pic64gx-qspi - const: microchip,coreqspi-rtl-v2 - - const: microchip,coreqspi-rtl-v2 # FPGA QSPI + - enum: + - microchip,coreqspi-rtl-v2 # FPGA QSPI + - microchip,corespi-rtl-v5 # FPGA CoreSPI + - microchip,mpfs-spi - items: - const: microchip,pic64gx-spi - const: microchip,mpfs-spi - - const: microchip,mpfs-spi reg: maxItems: 1
@@ -39,6 +41,45 @@ properties: clocks: maxItems: 1 + microchip,apb-datawidth: + description: APB bus data width in bits. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [8, 16, 32] + default: 8 + + microchip,frame-size: + description: | + Number of bits per SPI frame, as configured in Libero. + In Motorola and TI modes, this corresponds directly + to the requested frame size. For NSC mode this is set + to 9 + the required data frame size. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 4 + maximum: 32 + default: 8 + + microchip,protocol-configuration: + description: CoreSPI protocol selection. Determines operating mode + $ref: /schemas/types.yaml#/definitions/string + enum: + - motorola + - ti + - nsc + default: motorola + + microchip,motorola-mode: + description: Motorola SPI mode selection + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + default: 3 + + microchip,ssel-active: + description: | + Keep SSEL asserted between frames when using the Motorola protocol. + When present, the controller keeps SSEL active across contiguous + transfers and deasserts only when the overall transfer completes. + type: boolean + required: - compatible - reg
@@ -71,6 +112,31 @@ allOf: num-cs: maximum: 1 + - if: + properties: + compatible: + contains: + const: microchip,corespi-rtl-v5 + then: + properties: + num-cs: + minimum: 1 + maximum: 8 + default: 8 + + fifo-depth: + minimum: 1 + maximum: 32 + default: 4 + + else: + properties: + microchip,apb-datawidth: false + microchip,frame-size: false + microchip,protocol-configuration: false + microchip,motorola-mode: false + microchip,ssel-active: false + unevaluatedProperties: false examples:
Signature · 1 line
2.25.1
PATCH v2 3/3 spi: add support for microchip "soft" spi controller
In reply to Prajna Rajendra KumarIntroduce driver support for the Microchip FPGA CoreSPI IP.
This driver supports only Motorola SPI mode and frame size of 8-bits. TI/NSC modes and wider frame sizes are not currently supported.
--- drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-microchip-core.c | 442 +++++++++++++++++++++++++++++++ 3 files changed, 452 insertions(+) create mode 100644 drivers/spi/spi-microchip-core.c
drivers/spi/Kconfig +9 -0
@@ -706,6 +706,15 @@ config SPI_MESON_SPIFC This enables master mode support for the SPIFC (SPI flash controller) available in Amlogic Meson SoCs. +config SPI_MICROCHIP_CORE + tristate "Microchip FPGA SPI controllers" + depends on SPI_MASTER + help + This enables the SPI driver for Microchip FPGA SPI controllers. + Say Y or M here if you want to use the "soft" controllers on + PolarFire SoC. + If built as a module, it will be called spi-microchip-core. + config SPI_MICROCHIP_CORE_QSPI tristate "Microchip FPGA QSPI controllers" depends on SPI_MASTER
drivers/spi/Makefile +1 -0
@@ -86,6 +86,7 @@ obj-$(CONFIG_SPI_LOONGSON_PLATFORM) += spi-loongson-plat.o obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o obj-$(CONFIG_SPI_MESON_SPICC) += spi-meson-spicc.o obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o +obj-$(CONFIG_SPI_MICROCHIP_CORE) += spi-microchip-core.o obj-$(CONFIG_SPI_MICROCHIP_CORE_QSPI) += spi-microchip-core-qspi.o obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
drivers/spi/spi-microchip-core.c new file +442 -0
442 lines not on this page · raw message
Signature · 1 line
2.25.1
Mark Brown
maintainerRe: [PATCH v2 3/3] spi: add support for microchip "soft" spi controller
drivers/spi/Kconfig config SPI_MESON_SPIFC · line 711
Quoted 8 lines · Prajna Rajendra Kumar
drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-microchip-core.c | 442 +++++++++++++++++++++++++++++++ 3 files changed, 452 insertions(+)drivers/spi/Kconfig +3
-0+config SPI_MICROCHIP_CORE + tristate "Microchip FPGA SPI controllers" + depends on SPI_MASTER
Reusing the same filename and config symbol is almost certainly going to create issues and confusion for people upgrading their kernel or doing backports. Perhaps CoreSPI instead?
Re: [PATCH v2 3/3] spi: add support for microchip "soft" spi controller
Quoted 7 lines · Mark Brown
Quoted 4 lines · Prajna Rajendra Kumar
drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-microchip-core.c | 442 +++++++++++++++++++++++++++++++ 3 files changed, 452 insertions(+)
Quoted 7 lines
drivers/spi/Kconfig config SPI_MESON_SPIFC · line 711
Quoted 3 lines
drivers/spi/Kconfig +3
-0+config SPI_MICROCHIP_CORE + tristate "Microchip FPGA SPI controllers" + depends on SPI_MASTERReusing the same filename and config symbol is almost certainly going to create issues and confusion for people upgrading their kernel or doing backports. Perhaps CoreSPI instead?
The qspi driver (which is shared between SoC and FPGA IP) uses SPI_MICROCHIP_CORE_QSPI, so probably SPI_MICROCHIP_CORE_SPI should be used here. Prajna?
Re: [PATCH v2 3/3] spi: add support for microchip "soft" spi controller
Quoted 13 lines · Conor Dooley
Quoted 12 lines · Mark Brown
drivers/spi/Kconfig config SPI_MESON_SPIFC · line 711
Quoted 7 lines · Prajna Rajendra Kumar
drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-microchip-core.c | 442 +++++++++++++++++++++++++++++++ 3 files changed, 452 insertions(+)drivers/spi/Kconfig +3
-0+config SPI_MICROCHIP_CORE + tristate "Microchip FPGA SPI controllers" + depends on SPI_MASTERReusing the same filename and config symbol is almost certainly going to create issues and confusion for people upgrading their kernel or doing backports. Perhaps CoreSPI instead?
Quoted 3 lines
The qspi driver (which is shared between SoC and FPGA IP) uses
SPI_MICROCHIP_CORE_QSPI, so probablySPI_MICROCHIP_CORE_SPIshould be used here. Prajna?
Hi Mark, Conor,
Thanks for the feedback. I’ll update the filename and config symbol to use SPI_MICROCHIP_CORE_SPI in the next version.
Best regards,
Prajna