Skip to contentSkip to conversation

Add SPI module for StarFive JH7110 SoC

PATCH Superseded William Qiu 4 participants 16 messages Jul 13, 2023 – Jul 24, 2023

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add SPI module for StarFive JH7110 SoC

Hi,

This patchset adds initial rudimentary support for the StarFive SPI controller. And this driver will be used in StarFive's VisionFive 2 board. The first patch constrain minItems of clocks for JH7110 SPI and Patch 2 adds support for StarFive JH7110 SPI.

Changes v1->v2:
- Rebaed to v6.5rc1.
- Submitted reference file separately.
- Dropped 'status' node as it was 'okay' by default.
- Dropped Co-developed-by message.

The patch series is based on v6.5rc1.

William Qiu (3):
dt-bindings: spi: add reference file to YAML
dt-bindings: spi: constrain minItems of clocks and clock-names
riscv: dts: starfive: Add spi node for JH7110 SoC

 .../devicetree/bindings/spi/spi-pl022.yaml    | 11 ++-
 .../jh7110-starfive-visionfive-2.dtsi         | 50 ++++++++++
 arch/riscv/boot/dts/starfive/jh7110.dtsi      | 98 +++++++++++++++++++
 3 files changed, 156 insertions(+), 3 deletions(-)

--
2.34.1

#1 lore raw

PATCH v2 1/3 dt-bindings: spi: add reference file to YAML

Add primecell.yaml as a refereence file to YAML.

---
 Documentation/devicetree/bindings/spi/spi-pl022.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/spi/spi-pl022.yaml +1 -0
index 91e540a92faf..5e5a704a766e 100644
@@ -11,6 +11,7 @@ maintainers:
 
 allOf:
   - $ref: spi-controller.yaml#
+  - $ref: /schemas/arm/primecell.yaml#
 
 # We need a select here so we don't match all nodes with 'arm,primecell'
 select:
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: spi: add reference file to YAML

Quoted 1 line · William Qiu

Add primecell.yaml as a refereence file to YAML.

This we see from the diff, but why you are doing it? Please provide rationale and answer to "why" in your commits.

Also typo: reference.

Quoted 11 lines
---
 Documentation/devicetree/bindings/spi/spi-pl022.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/spi/spi-pl022.yaml +0 -0
index 91e540a92faf..5e5a704a766e 100644

Documentation/devicetree/bindings/spi/spi-pl022.yaml maintainers: · line 17

Quoted 7 lines
Documentation/devicetree/bindings/spi/spi-pl022.yaml +1 -0
@@ -11,6 +11,7 @@ maintainers:
 
 allOf:
   - $ref: spi-controller.yaml#
+  - $ref: /schemas/arm/primecell.yaml#
 
 # We need a select here so we don't match all nodes with 'arm,primecell'
 select:

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH v2 1/3] dt-bindings: spi: add reference file to YAML

Quoted 24 lines · Krzysztof Kozlowski
Quoted 1 line · William Qiu

Add primecell.yaml as a refereence file to YAML.

This we see from the diff, but why you are doing it? Please provide rationale and answer to "why" in your commits.

Also typo: reference.

Quoted 16 lines
---
 Documentation/devicetree/bindings/spi/spi-pl022.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/spi/spi-pl022.yaml +1 -0
index 91e540a92faf..5e5a704a766e 100644
@@ -11,6 +11,7 @@ maintainers:
 
 allOf:
   - $ref: spi-controller.yaml#
+  - $ref: /schemas/arm/primecell.yaml#
 
Quoted 6 lines

Documentation/devicetree/bindings/spi/spi-pl022.yaml maintainers: · line 17

Quoted 2 lines
Documentation/devicetree/bindings/spi/spi-pl022.yaml +0 -0
 # We need a select here so we don't match all nodes with 'arm,primecell'
 select:

Best regards,
Krzysztof

I will explain it in next version.

Best regards,
William

#4 lore raw

PATCH v2 2/3 dt-bindings: spi: constrain minItems of clocks and clock-names

In reply to William Qiu

The SPI controller only need apb_pclk clock to work properly on JH7110 SoC, so there add minItems whose value is equal to 1. Other platforms do not have this constraint.

---
 Documentation/devicetree/bindings/spi/spi-pl022.yaml | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/spi/spi-pl022.yaml +7 -3
index 5e5a704a766e..42bb34c39971 100644
@@ -35,12 +35,16 @@ properties:
     maxItems: 1
 
   clocks:
+    minItems: 1
     maxItems: 2
 
   clock-names:
-    items:
-      - const: sspclk
-      - const: apb_pclk
+    oneOf:
+      - items:
+          - const: apb_pclk
+      - items:
+          - const: sspclk
+          - const: apb_pclk
 
   pl022,autosuspend-delay:
     description: delay in ms following transfer completion before the
Signature · 1 line
2.34.1
Reviewed-by on v2 2/3
#5 lore raw

Re: [PATCH v2 2/3] dt-bindings: spi: constrain minItems of clocks and clock-names

Quoted 6 lines · William Qiu

The SPI controller only need apb_pclk clock to work properly on JH7110 SoC, so there add minItems whose value is equal to 1. Other platforms do not have this constraint.

---

Best regards,
Krzysztof

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

maintainer
#6 lore raw

Re: [PATCH v2 2/3] dt-bindings: spi: constrain minItems of clocks and clock-names

In reply to William Qiu
Quoted 3 lines · William Qiu

The SPI controller only need apb_pclk clock to work properly on JH7110 SoC, so there add minItems whose value is equal to 1. Other platforms do not have this constraint.

Presumably this means that this is some variant of the usual pl022 IP, or that the clock is in fact present but is not modelled in your DT?

#7 lore raw

Re: [PATCH v2 2/3] dt-bindings: spi: constrain minItems of clocks and clock-names

Quoted 7 lines · Mark Brown
Quoted 3 lines · William Qiu

The SPI controller only need apb_pclk clock to work properly on JH7110 SoC, so there add minItems whose value is equal to 1. Other platforms do not have this constraint.

Presumably this means that this is some variant of the usual pl022 IP,

Hm, in such case this could mean we need dedicated compatible.

Quoted 1 line

or that the clock is in fact present but is not modelled in your DT?

Best regards,
Krzysztof

maintainer
#8 lore raw

Re: [PATCH v2 2/3] dt-bindings: spi: constrain minItems of clocks and clock-names

Quoted 10 lines · Krzysztof Kozlowski
Quoted 7 lines · Mark Brown
Quoted 3 lines · William Qiu

The SPI controller only need apb_pclk clock to work properly on JH7110 SoC, so there add minItems whose value is equal to 1. Other platforms do not have this constraint.

Presumably this means that this is some variant of the usual pl022 IP,

Hm, in such case this could mean we need dedicated compatible.

Yes, indeed.

maintainer
#9 lore raw

Re: [PATCH v2 2/3] dt-bindings: spi: constrain minItems of clocks and clock-names

In reply to Krzysztof Kozlowski
Quoted 10 lines · Krzysztof Kozlowski
Quoted 7 lines · Mark Brown
Quoted 3 lines · William Qiu

The SPI controller only need apb_pclk clock to work properly on JH7110 SoC, so there add minItems whose value is equal to 1. Other platforms do not have this constraint.

Presumably this means that this is some variant of the usual pl022 IP,

Hm, in such case this could mean we need dedicated compatible.

Except the vendor in the ID registers should be different if the IP is modified.

I suspect that PCLK and SSPCLK are tied to the same clock source. There must be an SSPCLK because that is the one used to clock the SPI bus and we need to know the frequency of it.

Rob

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#10 lore raw

Re: [PATCH v2 2/3] dt-bindings: spi: constrain minItems of clocks and clock-names

Quoted 12 lines · Rob Herring
Quoted 10 lines · Krzysztof Kozlowski
Quoted 7 lines · Mark Brown
Quoted 3 lines · William Qiu

The SPI controller only need apb_pclk clock to work properly on JH7110 SoC, so there add minItems whose value is equal to 1. Other platforms do not have this constraint.

Presumably this means that this is some variant of the usual pl022 IP,

Hm, in such case this could mean we need dedicated compatible.

Quoted 8 lines

Except the vendor in the ID registers should be different if the IP is modified.

I suspect that PCLK and SSPCLK are tied to the same clock source. There must be an SSPCLK because that is the one used to clock the SPI bus and we need to know the frequency of it.

Rob

After communicating with colleagues in SoC FE, I learned that PCLK and SSPCLK were homologous on JH7110. He said that SSPCLK would divide the frequency internally anyway, and there was no need for external part frequency, so he directly gave them together.

So, should I call this clock ssp_apb or keep it SSPCLK?

Best regards,
William

maintainer
#11 lore raw

Re: [PATCH v2 2/3] dt-bindings: spi: constrain minItems of clocks and clock-names

Quoted 6 lines · William Qiu
Quoted 3 lines · Rob Herring

I suspect that PCLK and SSPCLK are tied to the same clock source. There must be an SSPCLK because that is the one used to clock the SPI bus and we need to know the frequency of it.

Quoted 6 lines

After communicating with colleagues in SoC FE, I learned that PCLK and SSPCLK were homologous on JH7110. He said that SSPCLK would divide the frequency internally anyway, and there was no need for external part frequency, so he directly gave them together.

So, should I call this clock ssp_apb or keep it SSPCLK?

I'd expect this to be handled in the DTS for the SoC - connect both clocks the binding requires to whatever the upstream clock is, it's not clear to me that any binding change is required.

#12 lore raw

Re: [PATCH v2 2/3] dt-bindings: spi: constrain minItems of clocks and clock-names

Quoted 12 lines · Mark Brown
Quoted 10 lines · William Qiu
Quoted 3 lines · Rob Herring

I suspect that PCLK and SSPCLK are tied to the same clock source. There must be an SSPCLK because that is the one used to clock the SPI bus and we need to know the frequency of it.

After communicating with colleagues in SoC FE, I learned that PCLK and SSPCLK were homologous on JH7110. He said that SSPCLK would divide the frequency internally anyway, and there was no need for external part frequency, so he directly gave them together.

Quoted 5 lines
Quoted 1 line

So, should I call this clock ssp_apb or keep it SSPCLK?

I'd expect this to be handled in the DTS for the SoC - connect both clocks the binding requires to whatever the upstream clock is, it's not clear to me that any binding change is required.

You mean binding two clocks, with the same clock source? Then there is no need to modify YAML.

Best regards,
William

maintainer
#13 lore raw

Re: [PATCH v2 2/3] dt-bindings: spi: constrain minItems of clocks and clock-names

Quoted 8 lines · William Qiu
Quoted 6 lines · Mark Brown
Quoted 4 lines · William Qiu

After communicating with colleagues in SoC FE, I learned that PCLK and SSPCLK were homologous on JH7110. He said that SSPCLK would divide the frequency internally anyway, and there was no need for external part frequency, so he directly gave them together.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

So, should I call this clock ssp_apb or keep it SSPCLK?

I'd expect this to be handled in the DTS for the SoC - connect both clocks the binding requires to whatever the upstream clock is, it's not clear to me that any binding change is required.

You mean binding two clocks, with the same clock source? Then there is no need to modify YAML.

Yes, exactly.

#14 lore raw

PATCH v2 3/3 riscv: dts: starfive: Add spi node for JH7110 SoC

In reply to William Qiu

Add spi node for JH7110 SoC.

---
 .../jh7110-starfive-visionfive-2.dtsi         | 50 ++++++++++
 arch/riscv/boot/dts/starfive/jh7110.dtsi      | 98 +++++++++++++++++++
 2 files changed, 148 insertions(+)
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +50 -0
index fa0061eb33a7..ae3f39c33d3c 100644
@@ -143,6 +143,18 @@ &i2c6 {
 	status = "okay";
 };
 
+&spi0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi0_pins>;
+	status = "okay";
+
+	spi_dev0: flash@0 {
+		compatible = "rohm,dh2228fv";
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+	};
+};
+
 &sysgpio {
 	i2c0_pins: i2c0-0 {
 		i2c-pins {
@@ -200,6 +212,44 @@ GPOEN_SYS_I2C6_DATA,
 		};
 	};
 
+	spi0_pins: spi0-0 {
+		mosi-pins {
+			pinmux = <GPIOMUX(52, GPOUT_SYS_SPI0_TXD,
+					      GPOEN_ENABLE,
+					      GPI_NONE)>;
+			bias-disable;
+			input-disable;
+			input-schmitt-disable;
+		};
+
+		miso-pins {
+			pinmux = <GPIOMUX(53, GPOUT_LOW,
+					      GPOEN_DISABLE,
+					      GPI_SYS_SPI0_RXD)>;
+			bias-pull-up;
+			input-enable;
+			input-schmitt-enable;
+		};
+
+		sck-pins {
+			pinmux = <GPIOMUX(48, GPOUT_SYS_SPI0_CLK,
+					      GPOEN_ENABLE,
+					      GPI_SYS_SPI0_CLK)>;
+			bias-disable;
+			input-disable;
+			input-schmitt-disable;
+		};
+
+		ss-pins {
+			pinmux = <GPIOMUX(48, GPOUT_SYS_SPI0_FSS,
+					      GPOEN_ENABLE,
+					      GPI_SYS_SPI0_FSS)>;
+			bias-disable;
+			input-disable;
+			input-schmitt-disable;
+		};
+	};
+
 	uart0_pins: uart0-0 {
 		tx-pins {
 			pinmux = <GPIOMUX(5, GPOUT_SYS_UART0_TX,
arch/riscv/boot/dts/starfive/jh7110.dtsi +98 -0

110 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer
#15 lore raw

Re: (subset) [PATCH v2 0/3] Add SPI module for StarFive JH7110 SoC

In reply to William Qiu
Quoted 5 lines · William Qiu

This patchset adds initial rudimentary support for the StarFive SPI controller. And this driver will be used in StarFive's VisionFive 2 board. The first patch constrain minItems of clocks for JH7110 SPI and Patch 2 adds support for StarFive JH7110 SPI.

Quoted 7 lines

Changes v1->v2:
- Rebaed to v6.5rc1.
- Submitted reference file separately.
- Dropped 'status' node as it was 'okay' by default.
- Dropped Co-developed-by message.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/3] dt-bindings: spi: add reference file to YAML

      commit: 8858babff615ee366bf570c1facfbd0845dd924e

[2/3] dt-bindings: spi: constrain minItems of clocks and clock-names
(no commit info)

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark