Add basic SPI support on TH1520
Subsystems (4)
v2 cover Add basic SPI support on TH1520
Implemented basic SPI support for TH1520 SoC. There are two SPIs reserved on the LicheePi4A, one on the SPI Flash pads that are blanked out on the back, and one on the pins. I implemented the one connected to the pad.
It is using a fixed clock of 396MHz. The address and clock frequency was referenced from the TH1520 System Reference Manual [1].
I have tested this on the LicheePi4A.
Changes made in v2:
- Changed from single patch file to a patchset by splitting the single commit into dt-bindings, driver and the devicetree.
Kanak Shilledar (3):
dt-bindings: spi: snps,dw-apb-ssi.yaml: update compatible property
spi: dw-mmio: update dw_spi_mmio_of_match struct with thead
riscv: dts: thead: add basic spi node
.../devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 4 ++++ .../boot/dts/thead/th1520-beaglev-ahead.dts | 9 +++++++++ .../boot/dts/thead/th1520-lichee-module-4a.dtsi | 4 ++++ .../riscv/boot/dts/thead/th1520-lichee-pi-4a.dts | 5 +++++ arch/riscv/boot/dts/thead/th1520.dtsi | 16 ++++++++++++++++ drivers/spi/spi-dw-mmio.c | 1 + 6 files changed, 39 insertions(+)
base-commit: 6ba59ff4227927d3a8530fc2973b80e94b54d58f
Signature · 1 line
2.45.2
PATCH v2 1/3 dt-bindings: spi: snps,dw-apb-ssi.yaml: update compatible property
updated compatible property to include "thead,th1520-spi" for the TH1520 SoC SPI Controller.
---
Changes in v2:
- Separated from a single patch file
--- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +4 -0
@@ -88,6 +88,10 @@ properties: - renesas,r9a06g032-spi # RZ/N1D - renesas,r9a06g033-spi # RZ/N1S - const: renesas,rzn1-spi # RZ/N1 + - description: T-HEAD TH1520 SoC SPI Controller + items: + - const: thead,th1520-spi + - const: snps,dw-apb-ssi reg: minItems: 1
Signature · 1 line
2.45.2
Re: [PATCH v2 1/3] dt-bindings: spi: snps,dw-apb-ssi.yaml: update compatible property
On Mon, Jul 01, 2024 at 05:43:52PM +0530, Kanak Shilledar wrote:
$subject: dt-bindings: spi: snps,dw-apb-ssi.yaml: update compatible property
Mark likes SPI bindings to be worked "spi: dt-bindings: ...", but additionally I think the subject should say something like "add support for T-Head th1520" or similar, what you've got is pretty generic. Not requesting a respin for that alone, maybe Mark will grab it as-is.
Thanks,
Conor.
Quoted 29 lines
updated compatible property to include "thead,th1520-spi" for the TH1520 SoC SPI Controller.
Signed-off-by Kanak Shilledar <[email protected]>---
Changes in v2:
- Separated from a single patch file--- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +4
-0@@ -88,6 +88,10 @@ properties: - renesas,r9a06g032-spi # RZ/N1D - renesas,r9a06g033-spi # RZ/N1S - const: renesas,rzn1-spi # RZ/N1 + - description: T-HEAD TH1520 SoC SPI Controller + items: + - const: thead,th1520-spi + - const: snps,dw-apb-ssi reg: minItems: 1Signature · 1 line
2.45.2
PATCH v2 2/3 spi: dw-mmio: update dw_spi_mmio_of_match struct with thead
In reply to Kanak Shilledarupdated the struct of_device_id dw_spi_mmio_of_match to include the updated compatible value for TH1520 SoC ("thead,th1520-spi") to initialize with dw_spi_pssi_init().
---
Changes in v2:
- Separated from a single patch file.
--- drivers/spi/spi-dw-mmio.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-dw-mmio.c +1 -0
@@ -419,6 +419,7 @@ static const struct of_device_id dw_spi_mmio_of_match[] = { { .compatible = "microchip,sparx5-spi", dw_spi_mscc_sparx5_init}, { .compatible = "canaan,k210-spi", dw_spi_canaan_k210_init}, { .compatible = "amd,pensando-elba-spi", .data = dw_spi_elba_init}, + { .compatible = "thead,th1520-spi", .data = dw_spi_pssi_init}, { /* end of table */} };MODULE_DEVICE_TABLE (of, dw_spi_mmio_of_match);
Signature · 1 line
2.45.2
Re: [PATCH v2 2/3] spi: dw-mmio: update dw_spi_mmio_of_match struct with thead
Hi Kanak,
Quoted 17 lines · Kanak Shilledar
updated the struct
of_device_iddw_spi_mmio_of_matchto include the updated compatible value for TH1520 SoC ("thead,th1520-spi") to initialize withdw_spi_pssi_init().Signed-off-by Kanak Shilledar <[email protected]>---
Changes in v2:
- Separated from a single patch file.--- drivers/spi/spi-dw-mmio.c | 1 + 1 file changed, 1 insertion(+)drivers/spi/spi-dw-mmio.c +0
-0
drivers/spi/spi-dw-mmio.c static const struct of_device_id dw_spi_mmio_of_match[] = { · line 422
Quoted 4 lines
drivers/spi/spi-dw-mmio.c +1
-0@@ -419,6 +419,7 @@ static const struct of_device_id dw_spi_mmio_of_match[] = { { .compatible = "microchip,sparx5-spi", dw_spi_mscc_sparx5_init}, { .compatible = "canaan,k210-spi", dw_spi_canaan_k210_init}, { .compatible = "amd,pensando-elba-spi", .data = dw_spi_elba_init}, + { .compatible = "thead,th1520-spi", .data = dw_spi_pssi_init},
Your binding requires snps,dw-apb-ssi as a fallback compatible string, which is already supported by this driver and uses the same match data. So you don't need this patch; its only effect is to make the kernel larger.
Regards,
Samuel
Quoted 3 lines
drivers/spi/spi-dw-mmio.c +0
-0{/* end of table */ } };MODULE_DEVICE_TABLE (of, dw_spi_mmio_of_match);
Re: [PATCH v2 2/3] spi: dw-mmio: update dw_spi_mmio_of_match struct with thead
Hi folks
Quoted 15 lines · Samuel Holland
Hi Kanak,
Quoted 12 lines · Kanak Shilledar
updated the struct
of_device_iddw_spi_mmio_of_matchto include the updated compatible value for TH1520 SoC ("thead,th1520-spi") to initialize withdw_spi_pssi_init().Signed-off-by Kanak Shilledar <[email protected]>---
Changes in v2:
- Separated from a single patch file.--- drivers/spi/spi-dw-mmio.c | 1 + 1 file changed, 1 insertion(+)
Quoted 13 lines
drivers/spi/spi-dw-mmio.c static const struct of_device_id dw_spi_mmio_of_match[] = { · line 422
Quoted 9 lines
drivers/spi/spi-dw-mmio.c +1
-0@@ -419,6 +419,7 @@ static const struct of_device_id dw_spi_mmio_of_match[] = { { .compatible = "microchip,sparx5-spi", dw_spi_mscc_sparx5_init}, { .compatible = "canaan,k210-spi", dw_spi_canaan_k210_init}, { .compatible = "amd,pensando-elba-spi", .data = dw_spi_elba_init}, + { .compatible = "thead,th1520-spi", .data = dw_spi_pssi_init},Your binding requires snps,dw-apb-ssi as a fallback compatible string, which is already supported by this driver and uses the same match data. So you don't need this patch; its only effect is to make the kernel larger.
Agree with Samuel comment. Indeed there is no point in adding the vendor-specific device-name supported in the driver if the fallback compatible works as-is.
From that perspective we shouldn't have merged in the patch adding the Renesas RZN1 SPI device name support, since the generic fallback compatible works for it. On the contrary the Microsemi Ocelot/Jaguar2 SoC SPI DT-bindings shouldn't have been defined with the generic fallback compatible since should the device be bound via the generic name it won't work as expected.
Although, it's better to hear out what Rob, Conor or Krzysztof think about this.
-Serge(y)
Quoted 8 lines
Regards,
SamuelQuoted 3 lines
drivers/spi/spi-dw-mmio.c +0
-0{/* end of table */ } };MODULE_DEVICE_TABLE (of, dw_spi_mmio_of_match);
Re: [PATCH v2 2/3] spi: dw-mmio: update dw_spi_mmio_of_match struct with thead
Quoted 32 lines · Serge Semin
Hi folks
Quoted 15 lines · Samuel Holland
Hi Kanak,
Quoted 12 lines · Kanak Shilledar
updated the struct
of_device_iddw_spi_mmio_of_matchto include the updated compatible value for TH1520 SoC ("thead,th1520-spi") to initialize withdw_spi_pssi_init().Signed-off-by Kanak Shilledar <[email protected]>---
Changes in v2:
- Separated from a single patch file.--- drivers/spi/spi-dw-mmio.c | 1 + 1 file changed, 1 insertion(+)Quoted 13 lines
drivers/spi/spi-dw-mmio.c static const struct of_device_id dw_spi_mmio_of_match[] = { · line 422
Quoted 9 lines
drivers/spi/spi-dw-mmio.c +1
-0@@ -419,6 +419,7 @@ static const struct of_device_id dw_spi_mmio_of_match[] = { { .compatible = "microchip,sparx5-spi", dw_spi_mscc_sparx5_init}, { .compatible = "canaan,k210-spi", dw_spi_canaan_k210_init}, { .compatible = "amd,pensando-elba-spi", .data = dw_spi_elba_init}, + { .compatible = "thead,th1520-spi", .data = dw_spi_pssi_init},Your binding requires snps,dw-apb-ssi as a fallback compatible string, which is already supported by this driver and uses the same match data. So you don't need this patch; its only effect is to make the kernel larger.
Quoted 3 lines
Agree with Samuel comment. Indeed there is no point in adding the vendor-specific device-name supported in the driver if the fallback compatible works as-is.
FWIW, Mark picked up the binding alone so I think there's nothing for Kanak to do here & the driver patch should just be forgotten about :)
Quoted 9 lines
Quoted 1 line
From that perspective we shouldn't have merged in the patch adding the
Renesas RZN1 SPI device name support, since the generic fallback compatible works for it. On the contrary the Microsemi Ocelot/Jaguar2 SoC SPI DT-bindings shouldn't have been defined with the generic fallback compatible since should the device be bound via the generic name it won't work as expected.
Although, it's better to hear out what Rob, Conor or Krzysztof think about this.
I agree with what you've written. If the fallback works identically, then the specific compatible shouldn't be added here. And if the fallback will cause the device to misbehave (or not behave at all), then it should not have been added.
I'm not sure if the Microsemi stuff is in the "won't work {,properly}" camp or in the "will work in a limited fashion" camp. The latter would be suitable for a fallback, the former not.
Cheers,
Conor.
Re: [PATCH v2 2/3] spi: dw-mmio: update dw_spi_mmio_of_match struct with thead
Hi,
So, I will drop this patch.
In the next version (i.e. v2) of this patchset, do I need to include the dt-binding patch as it is already in for-next.
I am waiting for comments on the devicetree files before sending the v2 (if required).
Thanks and Regards,
Kanak Shilledar
Quoted 62 lines · Conor Dooley
Quoted 32 lines · Serge Semin
Hi folks
Quoted 15 lines · Samuel Holland
Hi Kanak,
Quoted 12 lines · Kanak Shilledar
updated the struct
of_device_iddw_spi_mmio_of_matchto include the updated compatible value for TH1520 SoC ("thead,th1520-spi") to initialize withdw_spi_pssi_init().Signed-off-by Kanak Shilledar <[email protected]>---
Changes in v2:
- Separated from a single patch file.--- drivers/spi/spi-dw-mmio.c | 1 + 1 file changed, 1 insertion(+)Quoted 13 lines
drivers/spi/spi-dw-mmio.c static const struct of_device_id dw_spi_mmio_of_match[] = { · line 422
Quoted 9 lines
drivers/spi/spi-dw-mmio.c +1
-0@@ -419,6 +419,7 @@ static const struct of_device_id dw_spi_mmio_of_match[] = { { .compatible = "microchip,sparx5-spi", dw_spi_mscc_sparx5_init}, { .compatible = "canaan,k210-spi", dw_spi_canaan_k210_init}, { .compatible = "amd,pensando-elba-spi", .data = dw_spi_elba_init}, + { .compatible = "thead,th1520-spi", .data = dw_spi_pssi_init},Your binding requires snps,dw-apb-ssi as a fallback compatible string, which is already supported by this driver and uses the same match data. So you don't need this patch; its only effect is to make the kernel larger.
Quoted 3 lines
Agree with Samuel comment. Indeed there is no point in adding the vendor-specific device-name supported in the driver if the fallback compatible works as-is.
FWIW, Mark picked up the binding alone so I think there's nothing for Kanak to do here & the driver patch should just be forgotten about :)
Quoted 9 lines
Quoted 1 line
From that perspective we shouldn't have merged in the patch adding the
Renesas RZN1 SPI device name support, since the generic fallback compatible works for it. On the contrary the Microsemi Ocelot/Jaguar2 SoC SPI DT-bindings shouldn't have been defined with the generic fallback compatible since should the device be bound via the generic name it won't work as expected.
Although, it's better to hear out what Rob, Conor or Krzysztof think about this.
I agree with what you've written. If the fallback works identically, then the specific compatible shouldn't be added here. And if the fallback will cause the device to misbehave (or not behave at all), then it should not have been added.
I'm not sure if the Microsemi stuff is in the "won't work {,properly}" camp or in the "will work in a limited fashion" camp. The latter would be suitable for a fallback, the former not.Cheers,
Conor.
Re: [PATCH v2 2/3] spi: dw-mmio: update dw_spi_mmio_of_match struct with thead
Quoted 4 lines · Kanak Shilledar
Hi,
So, I will drop this patch.
In the next version (i.e. v2) of this patchset, do I need to include the dt-binding patch as it is already in for-next.
No, you do not need to include the binding.
Quoted 2 lines
I am waiting for comments on the devicetree files before sending the v2 (if required).
I'll try to look at that today, not super sure if I wanna pick up more patches for that platform with "fixed-clock"s, but I'll comment that on the dts patch itself.
Cheers,
Conor.
Re: [PATCH v2 2/3] spi: dw-mmio: update dw_spi_mmio_of_match struct with thead
Quoted 8 lines · Conor Dooley
Quoted 4 lines · Kanak Shilledar
Hi,
So, I will drop this patch.
In the next version (i.e. v2) of this patchset, do I need to include the dt-binding patch as it is already in for-next.No, you do not need to include the binding.
Alright thanks for the clarification!
Quoted 9 lines
Quoted 2 lines
I am waiting for comments on the devicetree files before sending the v2 (if required).
I'll try to look at that today, not super sure if I wanna pick up more patches for that platform with "fixed-clock"s, but I'll comment that on the dts patch itself.
Cheers,
Conor.
Cheers,
Kanak Shilledar
PATCH v2 3/3 riscv: dts: thead: add basic spi node
In reply to Kanak Shilledarcreated spi0 node with fixed clock. the spi0 node uses synopsis designware driver and has the following compatible "snps,dw-apb-ssi". the spi0 node is connected to a SPI NOR flash pad which is left unpopulated on the back side of the board.
---
Changes in v2:
- Separated from a single patch file
--- .../boot/dts/thead/th1520-beaglev-ahead.dts | 9 +++++++++ .../boot/dts/thead/th1520-lichee-module-4a.dtsi | 4 ++++ .../riscv/boot/dts/thead/th1520-lichee-pi-4a.dts | 5 +++++ arch/riscv/boot/dts/thead/th1520.dtsi | 16 ++++++++++++++++ 4 files changed, 34 insertions(+)
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +9 -0
@@ -17,6 +17,7 @@ aliases { gpio1 = &gpio1; gpio2 = &gpio2; gpio3 = &gpio3; + spi0 = &spi0; serial0 = &uart0; serial1 = &uart1; serial2 = &uart2;
@@ -52,6 +53,10 @@ &sdhci_clk { clock-frequency = <198000000>; }; +&spi_clk { + clock-frequency = <396000000>; +}; + &uart_sclk { clock-frequency = <100000000>; };
@@ -79,3 +84,7 @@ &sdio0 { &uart0 { status = "okay"; }; + +&spi0 { + status = "okay"; +};
arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi +4 -0
@@ -33,6 +33,10 @@ &sdhci_clk { clock-frequency = <198000000>; }; +&spi_clk { + clock-frequency = <396000000>; +}; + &uart_sclk { clock-frequency = <100000000>; };
arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts +5 -0
@@ -14,6 +14,7 @@ aliases { gpio1 = &gpio1; gpio2 = &gpio2; gpio3 = &gpio3; + spi0 = &spi0; serial0 = &uart0; serial1 = &uart1; serial2 = &uart2;
@@ -30,3 +31,7 @@ chosen { &uart0 { status = "okay"; }; + +&spi0 { + status = "okay"; +};
arch/riscv/boot/dts/thead/th1520.dtsi +16 -0
@@ -140,6 +140,12 @@ apb_clk: apb-clk-clock { #clock-cells = <0>; }; + spi_clk: spi-clock { + compatible = "fixed-clock"; + clock-output-names = "spi_clk"; + #clock-cells = <0>; + }; + uart_sclk: uart-sclk-clock { compatible = "fixed-clock"; clock-output-names = "uart_sclk";
@@ -183,6 +189,16 @@ clint: timer@ffdc000000 { <&cpu3_intc 3>, <&cpu3_intc 7>; }; + spi0: spi@ffe700c000 { + compatible = "thead,th1520-spi", "snps,dw-apb-ssi"; + reg = <0xff 0xe700c000 0x0 0x1000>; + interrupts = <54 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&spi_clk>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + uart0: serial@ffe7014000 { compatible = "snps,dw-apb-uart"; reg = <0xff 0xe7014000 0x0 0x100>;
Signature · 1 line
2.45.2
Re: [PATCH v2 3/3] riscv: dts: thead: add basic spi node
Kanak, Drew,
Quoted 6 lines · Kanak Shilledar
created spi0 node with fixed clock. the spi0 node uses synopsis designware driver and has the following compatible "snps,dw-apb-ssi". the spi0 node is connected to a SPI NOR flash pad which is left unpopulated on the back side of the board.
Quoted 8 lines
Signed-off-by Kanak Shilledar <[email protected]>---
Changes in v2:
- Separated from a single patch file--- .../boot/dts/thead/th1520-beaglev-ahead.dts | 9 +++++++++ .../boot/dts/thead/th1520-lichee-module-4a.dtsi | 4 ++++ .../riscv/boot/dts/thead/th1520-lichee-pi-4a.dts | 5 +++++
Didn't you say there was a flash on one of these two boards?
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts aliases { · line 20
Quoted 12 lines
arch/riscv/boot/dts/thead/th1520.dtsi | 16 ++++++++++++++++ 4 files changed, 34 insertions(+)arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +1
-0@@ -17,6 +17,7 @@ aliases { gpio1 = &gpio1; gpio2 = &gpio2; gpio3 = &gpio3; + spi0 = &spi0;
"spi" would sort after "serial".
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdhci_clk { · line 58
Quoted 10 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +3
-0serial0 = &uart0; serial1 = &uart1; serial2 = &uart2;@@ -52,6 +53,10 @@ &sdhci_clk { clock-frequency = <198000000>; }; +&spi_clk { + clock-frequency = <396000000>; +};
I'm pretty sceptical about adding more of these fixed clocks, rather than waiting for the clock driver. Drew, what do you think? Should we just add one more to your fixup list or would you rather delay? Guess it depends on how long more you think that clock driver is likely to take.
Thanks,
Conor.
Quoted 84 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +5
-0+ &uart_sclk { clock-frequency = <100000000>; };@@ -79,3 +84,7 @@ &sdio0 { &uart0 { status = "okay"; }; + +&spi0 { + status = "okay"; +};arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi +4
-0@@ -33,6 +33,10 @@ &sdhci_clk { clock-frequency = <198000000>; }; +&spi_clk { + clock-frequency = <396000000>; +}; + &uart_sclk { clock-frequency = <100000000>; };arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts +5
-0@@ -14,6 +14,7 @@ aliases { gpio1 = &gpio1; gpio2 = &gpio2; gpio3 = &gpio3; + spi0 = &spi0; serial0 = &uart0; serial1 = &uart1; serial2 = &uart2;@@ -30,3 +31,7 @@ chosen { &uart0 { status = "okay"; }; + +&spi0 { + status = "okay"; +};arch/riscv/boot/dts/thead/th1520.dtsi +16
-0@@ -140,6 +140,12 @@ apb_clk: apb-clk-clock { #clock-cells = <0>; }; + spi_clk: spi-clock { + compatible = "fixed-clock"; + clock-output-names = "spi_clk"; + #clock-cells = <0>; + }; + uart_sclk: uart-sclk-clock { compatible = "fixed-clock"; clock-output-names = "uart_sclk";@@ -183,6 +189,16 @@ clint: timer@ffdc000000 { <&cpu3_intc 3>, <&cpu3_intc 7>; }; + spi0: spi@ffe700c000 { + compatible = "thead,th1520-spi", "snps,dw-apb-ssi"; + reg = <0xff 0xe700c000 0x0 0x1000>; + interrupts = <54 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&spi_clk>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + uart0: serial@ffe7014000 { compatible = "snps,dw-apb-uart"; reg = <0xff 0xe7014000 0x0 0x100>;Signature · 1 line
2.45.2
Re: [PATCH v2 3/3] riscv: dts: thead: add basic spi node
Hi
Quoted 19 lines · Conor Dooley
Kanak, Drew,
Quoted 6 lines · Kanak Shilledar
created spi0 node with fixed clock. the spi0 node uses synopsis designware driver and has the following compatible "snps,dw-apb-ssi". the spi0 node is connected to a SPI NOR flash pad which is left unpopulated on the back side of the board.
Quoted 8 lines
Signed-off-by Kanak Shilledar <[email protected]>---
Changes in v2:
- Separated from a single patch file--- .../boot/dts/thead/th1520-beaglev-ahead.dts | 9 +++++++++ .../boot/dts/thead/th1520-lichee-module-4a.dtsi | 4 ++++ .../riscv/boot/dts/thead/th1520-lichee-pi-4a.dts | 5 +++++
Quoted 1 line
Didn't you say there was a flash on one of these two boards?
Yes, there is a SPI nor flash pad left unpopulated on the bottom side
of the LicheePi 4a
carrier board. https://wiki.sipeed.com/hardware/en/lichee/th1520/lpi4a/2_unbox.html#Board-hardware-overview
notice the reserved pad in the bottom part of the image.
Quoted 14 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts aliases { · line 20
Quoted 12 lines
arch/riscv/boot/dts/thead/th1520.dtsi | 16 ++++++++++++++++ 4 files changed, 34 insertions(+)arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +1
-0@@ -17,6 +17,7 @@ aliases { gpio1 = &gpio1; gpio2 = &gpio2; gpio3 = &gpio3; + spi0 = &spi0;"spi" would sort after "serial".
i will fix that.
Quoted 16 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdhci_clk { · line 58
Quoted 10 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +3
-0serial0 = &uart0; serial1 = &uart1; serial2 = &uart2;@@ -52,6 +53,10 @@ &sdhci_clk { clock-frequency = <198000000>; }; +&spi_clk { + clock-frequency = <396000000>; +};I'm pretty sceptical about adding more of these fixed clocks, rather than waiting for the clock driver. Drew, what do you think? Should we just add one more to your fixup list or would you rather delay? Guess it depends on how long more you think that clock driver is likely to take.
Quoted 3 lines
Thanks,
Conor.
Thanks and Regards,
Kanak Shilledar
Quoted 84 lines
Quoted 84 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +5
-0+ &uart_sclk { clock-frequency = <100000000>; };@@ -79,3 +84,7 @@ &sdio0 { &uart0 { status = "okay"; }; + +&spi0 { + status = "okay"; +};arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi +4
-0@@ -33,6 +33,10 @@ &sdhci_clk { clock-frequency = <198000000>; }; +&spi_clk { + clock-frequency = <396000000>; +}; + &uart_sclk { clock-frequency = <100000000>; };arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts +5
-0@@ -14,6 +14,7 @@ aliases { gpio1 = &gpio1; gpio2 = &gpio2; gpio3 = &gpio3; + spi0 = &spi0; serial0 = &uart0; serial1 = &uart1; serial2 = &uart2;@@ -30,3 +31,7 @@ chosen { &uart0 { status = "okay"; }; + +&spi0 { + status = "okay"; +};arch/riscv/boot/dts/thead/th1520.dtsi +16
-1@@ -140,6 +140,12 @@ apb_clk: apb-clk-clock { #clock-cells = <0>; }; + spi_clk: spi-clock { + compatible = "fixed-clock"; + clock-output-names = "spi_clk"; + #clock-cells = <0>; + }; + uart_sclk: uart-sclk-clock { compatible = "fixed-clock"; clock-output-names = "uart_sclk";@@ -183,6 +189,16 @@ clint: timer@ffdc000000 { <&cpu3_intc 3>, <&cpu3_intc 7>; }; + spi0: spi@ffe700c000 { + compatible = "thead,th1520-spi", "snps,dw-apb-ssi"; + reg = <0xff 0xe700c000 0x0 0x1000>; + interrupts = <54 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&spi_clk>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + uart0: serial@ffe7014000 { compatible = "snps,dw-apb-uart"; reg = <0xff 0xe7014000 0x0 0x100>; --2.45.2
Re: [PATCH v2 3/3] riscv: dts: thead: add basic spi node
Quoted 22 lines · Kanak Shilledar
Hi
Quoted 19 lines · Conor Dooley
Kanak, Drew,
Quoted 14 lines · Kanak Shilledar
created spi0 node with fixed clock. the spi0 node uses synopsis designware driver and has the following compatible "snps,dw-apb-ssi". the spi0 node is connected to a SPI NOR flash pad which is left unpopulated on the back side of the board.
Signed-off-by Kanak Shilledar <[email protected]>---
Changes in v2:
- Separated from a single patch file--- .../boot/dts/thead/th1520-beaglev-ahead.dts | 9 +++++++++ .../boot/dts/thead/th1520-lichee-module-4a.dtsi | 4 ++++ .../riscv/boot/dts/thead/th1520-lichee-pi-4a.dts | 5 +++++
Quoted 5 lines
Quoted 1 line
Didn't you say there was a flash on one of these two boards?
Yes, there is a SPI nor flash pad left unpopulated on the bottom side
of the LicheePi 4a
carrier board. https://wiki.sipeed.com/hardware/en/lichee/th1520/lpi4a/2_unbox.html#Board-hardware-overview
notice the reserved pad in the bottom part of the image.
Ah right, unpopulated. That makes sense, thanks.
Drew Fustini
Acked-byRe: [PATCH v2 3/3] riscv: dts: thead: add basic spi node
In reply to Conor DooleyQuoted 42 lines · Conor Dooley
Kanak, Drew,
Quoted 6 lines · Kanak Shilledar
created spi0 node with fixed clock. the spi0 node uses synopsis designware driver and has the following compatible "snps,dw-apb-ssi". the spi0 node is connected to a SPI NOR flash pad which is left unpopulated on the back side of the board.
Quoted 8 lines
Signed-off-by Kanak Shilledar <[email protected]>---
Changes in v2:
- Separated from a single patch file--- .../boot/dts/thead/th1520-beaglev-ahead.dts | 9 +++++++++ .../boot/dts/thead/th1520-lichee-module-4a.dtsi | 4 ++++ .../riscv/boot/dts/thead/th1520-lichee-pi-4a.dts | 5 +++++Didn't you say there was a flash on one of these two boards?
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts aliases { · line 20
Quoted 12 lines
arch/riscv/boot/dts/thead/th1520.dtsi | 16 ++++++++++++++++ 4 files changed, 34 insertions(+)arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +1
-0@@ -17,6 +17,7 @@ aliases { gpio1 = &gpio1; gpio2 = &gpio2; gpio3 = &gpio3; + spi0 = &spi0;"spi" would sort after "serial".
Quoted 7 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +0
-0serial0 = &uart0; serial1 = &uart1; serial2 = &uart2;@@ -52,6 +53,10 @@ &sdhci_clk { clock-frequency = <198000000>; };
Quoted 8 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdhci_clk { · line 58
Quoted 3 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +3
-0+&spi_clk { + clock-frequency = <396000000>; +};I'm pretty sceptical about adding more of these fixed clocks, rather than waiting for the clock driver. Drew, what do you think? Should we just add one more to your fixup list or would you rather delay? Guess it depends on how long more you think that clock driver is likely to take.
I think the clk driver [1] is in good shape but it has not been reviewed by the clk maintainer yet. Thus it is hard to predict any timeline for it getting merged.
SPI support doesn't require any driver changes so I'd be inclined to allow the fixed clock in this case. It will be simple to change it over to a real clock once the clk driver is upstream.
Thanks,
Drew
Re: [PATCH v2 3/3] riscv: dts: thead: add basic spi node
Quoted 56 lines · Drew Fustini
Quoted 42 lines · Conor Dooley
Kanak, Drew,
Quoted 6 lines · Kanak Shilledar
created spi0 node with fixed clock. the spi0 node uses synopsis designware driver and has the following compatible "snps,dw-apb-ssi". the spi0 node is connected to a SPI NOR flash pad which is left unpopulated on the back side of the board.
Quoted 8 lines
Signed-off-by Kanak Shilledar <[email protected]>---
Changes in v2:
- Separated from a single patch file--- .../boot/dts/thead/th1520-beaglev-ahead.dts | 9 +++++++++ .../boot/dts/thead/th1520-lichee-module-4a.dtsi | 4 ++++ .../riscv/boot/dts/thead/th1520-lichee-pi-4a.dts | 5 +++++Didn't you say there was a flash on one of these two boards?
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts aliases { · line 20
Quoted 12 lines
arch/riscv/boot/dts/thead/th1520.dtsi | 16 ++++++++++++++++ 4 files changed, 34 insertions(+)arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +1
-0@@ -17,6 +17,7 @@ aliases { gpio1 = &gpio1; gpio2 = &gpio2; gpio3 = &gpio3; + spi0 = &spi0;"spi" would sort after "serial".
Quoted 7 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +0
-0serial0 = &uart0; serial1 = &uart1; serial2 = &uart2;@@ -52,6 +53,10 @@ &sdhci_clk { clock-frequency = <198000000>; };Quoted 8 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdhci_clk { · line 58
Quoted 3 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +3
-0+&spi_clk { + clock-frequency = <396000000>; +};I'm pretty sceptical about adding more of these fixed clocks, rather than waiting for the clock driver. Drew, what do you think? Should we just add one more to your fixup list or would you rather delay? Guess it depends on how long more you think that clock driver is likely to take.
I think the clk driver [1] is in good shape but it has not been reviewed by the clk maintainer yet. Thus it is hard to predict any timeline for it getting merged.
Quoted 8 lines
SPI support doesn't require any driver changes so I'd be inclined to allow the fixed clock in this case. It will be simple to change it over to a real clock once the clk driver is upstream.
Acked-by Drew Fustini <[email protected]>Thanks,
Drew
Sorry, I meant to include the link to the most recent clk series:
https://lore.kernel.org/linux-riscv/[email protected]/
-Drew
Re: [PATCH v2 3/3] riscv: dts: thead: add basic spi node
Quoted 23 lines
Quoted 23 lines
Quoted 10 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts aliases { · line 20
Quoted 7 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +1
-0@@ -17,6 +17,7 @@ aliases { gpio1 = &gpio1; gpio2 = &gpio2; gpio3 = &gpio3; + spi0 = &spi0;"spi" would sort after "serial".
Quoted 8 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts aliases { · line 23
Quoted 3 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +0
-0serial0 = &uart0; serial1 = &uart1; serial2 = &uart2;I'm pretty sceptical about adding more of these fixed clocks, rather than waiting for the clock driver. Drew, what do you think? Should we just add one more to your fixup list or would you rather delay? Guess it depends on how long more you think that clock driver is likely to take.
I think the clk driver [1] is in good shape but it has not been reviewed by the clk maintainer yet. Thus it is hard to predict any timeline for it getting merged.
Quoted 5 lines
Quoted 5 lines
SPI support doesn't require any driver changes so I'd be inclined to allow the fixed clock in this case. It will be simple to change it over to a real clock once the clk driver is upstream.
Acked-by Drew Fustini <[email protected]>
Alright! I do the suggested edits and send a new patch.
Quoted 7 lines
Quoted 2 lines
Thanks,
DrewSorry, I meant to include the link to the most recent clk series:
https://lore.kernel.org/linux-riscv/[email protected]/-Drew
Thanks and Regards,
Kanak Shilledar
Mark Brown
maintainerRe: (subset) [PATCH v2 0/3] Add basic SPI support on TH1520
In reply to Kanak ShilledarQuoted 8 lines · Kanak Shilledar
Implemented basic SPI support for TH1520 SoC. There are two SPIs reserved on the LicheePi4A, one on the SPI Flash pads that are blanked out on the back, and one on the pins. I implemented the one connected to the pad.
It is using a fixed clock of 396MHz. The address and clock frequency was referenced from the TH1520 System Reference Manual [1].
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/3] dt-bindings: spi: snps,dw-apb-ssi.yaml: update compatible property
commit: 6c387fb263363347185bd7a213ad175c174d35dc
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