Skip to content

Commit c94f134

Browse files
committed
Add support for Microchip CoreSPI Controller
Merge series from Prajna Rajendra Kumar <prajna.rajendrakumar@microchip.com>: 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.
2 parents af33092 + 059f545 commit c94f134

5 files changed

Lines changed: 635 additions & 115 deletions

File tree

Documentation/devicetree/bindings/spi/microchip,mpfs-spi.yaml

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ properties:
2121
- microchip,mpfs-qspi
2222
- microchip,pic64gx-qspi
2323
- const: microchip,coreqspi-rtl-v2
24-
- const: microchip,coreqspi-rtl-v2 # FPGA QSPI
24+
- enum:
25+
- microchip,coreqspi-rtl-v2 # FPGA QSPI
26+
- microchip,corespi-rtl-v5 # FPGA CoreSPI
27+
- microchip,mpfs-spi
2528
- items:
2629
- const: microchip,pic64gx-spi
2730
- const: microchip,mpfs-spi
28-
- const: microchip,mpfs-spi
2931

3032
reg:
3133
maxItems: 1
@@ -39,6 +41,45 @@ properties:
3941
clocks:
4042
maxItems: 1
4143

44+
microchip,apb-datawidth:
45+
description: APB bus data width in bits.
46+
$ref: /schemas/types.yaml#/definitions/uint32
47+
enum: [8, 16, 32]
48+
default: 8
49+
50+
microchip,frame-size:
51+
description: |
52+
Number of bits per SPI frame, as configured in Libero.
53+
In Motorola and TI modes, this corresponds directly
54+
to the requested frame size. For NSC mode this is set
55+
to 9 + the required data frame size.
56+
$ref: /schemas/types.yaml#/definitions/uint32
57+
minimum: 4
58+
maximum: 32
59+
default: 8
60+
61+
microchip,protocol-configuration:
62+
description: CoreSPI protocol selection. Determines operating mode
63+
$ref: /schemas/types.yaml#/definitions/string
64+
enum:
65+
- motorola
66+
- ti
67+
- nsc
68+
default: motorola
69+
70+
microchip,motorola-mode:
71+
description: Motorola SPI mode selection
72+
$ref: /schemas/types.yaml#/definitions/uint32
73+
enum: [0, 1, 2, 3]
74+
default: 3
75+
76+
microchip,ssel-active:
77+
description: |
78+
Keep SSEL asserted between frames when using the Motorola protocol.
79+
When present, the controller keeps SSEL active across contiguous
80+
transfers and deasserts only when the overall transfer completes.
81+
type: boolean
82+
4283
required:
4384
- compatible
4485
- reg
@@ -71,6 +112,31 @@ allOf:
71112
num-cs:
72113
maximum: 1
73114

115+
- if:
116+
properties:
117+
compatible:
118+
contains:
119+
const: microchip,corespi-rtl-v5
120+
then:
121+
properties:
122+
num-cs:
123+
minimum: 1
124+
maximum: 8
125+
default: 8
126+
127+
fifo-depth:
128+
minimum: 1
129+
maximum: 32
130+
default: 4
131+
132+
else:
133+
properties:
134+
microchip,apb-datawidth: false
135+
microchip,frame-size: false
136+
microchip,protocol-configuration: false
137+
microchip,motorola-mode: false
138+
microchip,ssel-active: false
139+
74140
unevaluatedProperties: false
75141

76142
examples:

drivers/spi/Kconfig

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -707,15 +707,6 @@ config SPI_MESON_SPIFC
707707
This enables master mode support for the SPIFC (SPI flash
708708
controller) available in Amlogic Meson SoCs.
709709

710-
config SPI_MICROCHIP_CORE
711-
tristate "Microchip FPGA SPI controllers"
712-
depends on SPI_MASTER
713-
help
714-
This enables the SPI driver for Microchip FPGA SPI controllers.
715-
Say Y or M here if you want to use the "hard" controllers on
716-
PolarFire SoC.
717-
If built as a module, it will be called spi-microchip-core.
718-
719710
config SPI_MICROCHIP_CORE_QSPI
720711
tristate "Microchip FPGA QSPI controllers"
721712
depends on SPI_MASTER
@@ -725,6 +716,15 @@ config SPI_MICROCHIP_CORE_QSPI
725716
PolarFire SoC.
726717
If built as a module, it will be called spi-microchip-core-qspi.
727718

719+
config SPI_MICROCHIP_CORE_SPI
720+
tristate "Microchip FPGA CoreSPI controller"
721+
depends on SPI_MASTER
722+
help
723+
This enables the SPI driver for Microchip FPGA CoreSPI controller.
724+
Say Y or M here if you want to use the "soft" controllers on
725+
PolarFire SoC.
726+
If built as a module, it will be called spi-microchip-core-spi.
727+
728728
config SPI_MT65XX
729729
tristate "MediaTek SPI controller"
730730
depends on ARCH_MEDIATEK || COMPILE_TEST
@@ -872,6 +872,16 @@ config SPI_PL022
872872
controller. If you have an embedded system with an AMBA(R)
873873
bus and a PL022 controller, say Y or M here.
874874

875+
config SPI_POLARFIRE_SOC
876+
877+
tristate "Microchip FPGA SPI controllers"
878+
depends on SPI_MASTER && ARCH_MICROCHIP
879+
help
880+
This enables the SPI driver for Microchip FPGA SPI controllers.
881+
Say Y or M here if you want to use the "hard" controllers on
882+
PolarFire SoC.
883+
If built as a module, it will be called spi-mpfs.
884+
875885
config SPI_PPC4xx
876886
tristate "PPC4xx SPI Controller"
877887
depends on PPC32 && 4xx

drivers/spi/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ obj-$(CONFIG_SPI_LOONGSON_PLATFORM) += spi-loongson-plat.o
8686
obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o
8787
obj-$(CONFIG_SPI_MESON_SPICC) += spi-meson-spicc.o
8888
obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o
89-
obj-$(CONFIG_SPI_MICROCHIP_CORE) += spi-microchip-core.o
9089
obj-$(CONFIG_SPI_MICROCHIP_CORE_QSPI) += spi-microchip-core-qspi.o
90+
obj-$(CONFIG_SPI_MICROCHIP_CORE_SPI) += spi-microchip-core-spi.o
9191
obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o
9292
obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
9393
obj-$(CONFIG_SPI_MPC52xx) += spi-mpc52xx.o
@@ -97,6 +97,7 @@ obj-$(CONFIG_SPI_MTK_NOR) += spi-mtk-nor.o
9797
obj-$(CONFIG_SPI_MTK_SNFI) += spi-mtk-snfi.o
9898
obj-$(CONFIG_SPI_MXIC) += spi-mxic.o
9999
obj-$(CONFIG_SPI_MXS) += spi-mxs.o
100+
obj-$(CONFIG_SPI_POLARFIRE_SOC) += spi-mpfs.o
100101
obj-$(CONFIG_SPI_WPCM_FIU) += spi-wpcm-fiu.o
101102
obj-$(CONFIG_SPI_NPCM_FIU) += spi-npcm-fiu.o
102103
obj-$(CONFIG_SPI_NPCM_PSPI) += spi-npcm-pspi.o

0 commit comments

Comments
 (0)