arm64: exynos: Enable SPI for Exynos850
Subsystems (5)
Sam Protsenko
maintainerv2 cover arm64: exynos: Enable SPI for Exynos850
This series enables SPI for Exynos850 SoC. The summary:
1. Enable PDMA, it's needed for SPI (dts, clk)
2. Propagate SPI src clock rate change up to DIV clocks, to make it possible to change SPI frequency (clk driver)
3. Add SPI nodes to Exynos850 SoC dtsi
All SPI instances were tested using `spidev_test' tool in all 3 possible modes:
- Polling mode: xfer_size <= 32
- IRQ mode: 64 >= xfer_size >= 32
- DMA mode: xfer_size > 64
with 200 kHz ... 49.9 MHz SPI frequencies. The next 3 approaches were used:
1. Software loopback ('-l' option for `spidev_test' tool)
2. Hardware loopback (by connecting MISO line to MOSI)
3. By communicating with ATMega found on Sensors Mezzanine board [1], programmed to act as an SPI slave device
and all the transactions were additionally checked on my Logic Analyzer to make sure the SCK frequencies were actually correct.
This series is supposed to go via Krzysztof's tree. SPI driver additions and corresponding bindings will be submitted in a separate series and are independent from this one.
Changes in v2:
- Fixed indentation in clk patch to make checkpatch strict happy
- Ordered PDMA node by unit address
- Sorted pinctrl properties properly
[1] https://www.96boards.org/product/sensors-mezzanine/
[2] https://lore.kernel.org/all/[email protected]/
Sam Protsenko (3):
clk: samsung: exynos850: Propagate SPI IPCLK rate change
arm64: dts: exynos: Add PDMA node for Exynos850
arm64: dts: exynos: Add SPI nodes for Exynos850
arch/arm64/boot/dts/exynos/exynos850.dtsi | 64 +++++++++++++++++++++++ drivers/clk/samsung/clk-exynos850.c | 33 ++++++------ 2 files changed, 81 insertions(+), 16 deletions(-)
Signature · 1 line
2.39.2
Sam Protsenko
maintainerPATCH v2 1/3 clk: samsung: exynos850: Propagate SPI IPCLK rate change
When SPI transfer is being prepared, the spi-s3c64xx driver will call clk_set_rate() to change the rate of SPI source clock (IPCLK). But IPCLK is a gate (leaf) clock, so it must propagate the rate change up the clock tree, so that corresponding DIV clocks can actually change their divider values. Add CLK_SET_RATE_PARENT flag to corresponding clocks for all SPI instances in Exynos850 (spi_0, spi_1 and spi_2) to make it possible. This change involves next clocks:
usi_spi_0:
Clock Block Div range
--------------------------------------------
gout_spi0_ipclk CMU_PERI -
dout_peri_spi0 CMU_PERI /1..32
mout_peri_spi_user CMU_PERI -
dout_peri_ip CMU_TOP /1..16
usi_cmgp0:
Clock Block Div range
--------------------------------------------
gout_cmgp_usi0_ipclk CMU_CMGP -
dout_cmgp_usi0 CMU_CMGP /1..32
mout_cmgp_usi0 CMU_CMGP -
gout_clkcmu_cmgp_bus CMU_APM -
dout_apm_bus CMU_APM /1..8
usi_cmgp1:
Clock Block Div range
--------------------------------------------
gout_cmgp_usi1_ipclk CMU_CMGP -
dout_cmgp_usi1 CMU_CMGP /1..32
mout_cmgp_usi1 CMU_CMGP -
gout_clkcmu_cmgp_bus CMU_APM -
dout_apm_bus CMU_APM /1..8
With input clock of 400 MHz, this scheme provides next IPCLK rate range, for each SPI block:
SPI0: 781 kHz ... 400 MHz
SPI1/2: 1.6 MHz ... 400 MHzAccounting for internal /4 divider in SPI blocks, and because the max SPI frequency is limited at 50 MHz, it gives us next SPI SCK rates:
SPI0: 200 kHz ... 49.9 MHz
SPI1/2: 400 kHz ... 49.9 MHzWhich should cover all possible applications of SPI bus. Of course, setting SPI frequency to values as low as 500 kHz will also affect the common bus dividers (dout_apm_bus or dout_peri_ip), which in turn effectively lowers the rates for all leaf bus clocks derived from those dividers, like HSI2C and I3C clocks. But at least it gives the board designer a choice, whether to keep all clocks (SPI/HSI2C/I3C) at high frequencies, or make all those clocks have lower frequencies. Not propagating the rate change to those common dividers would limit this choice to "only high frequencies are allowed for SPI/HSI2C/I3C" option, making the common dividers useless. This decision follows the "Worse is better" approach, relying on the users/engineers to know the system internals when working with such low-level features, instead of trying to account for all possible use-cases.
---
Changes in v2:
- Fixed indentation to make checkpatch strict happy
drivers/clk/samsung/clk-exynos850.c | 33 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-)
drivers/clk/samsung/clk-exynos850.c +17 -16
@@ -605,7 +605,7 @@ static const struct samsung_div_clock apm_div_clks[] __initconst = {static const struct samsung_gate_clock apm_gate_clks[]__initconst = {GATE (CLK_GOUT_CLKCMU_CMGP_BUS ,"gout_clkcmu_cmgp_bus" ,"dout_apm_bus" , -CLK_CON_GAT_CLKCMU_CMGP_BUS ,21 ,0 ,0 ), +CLK_CON_GAT_CLKCMU_CMGP_BUS ,21 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_GOUT_CLKCMU_CHUB_BUS ,"gout_clkcmu_chub_bus" ,"mout_clkcmu_chub_bus" ,CLK_CON_GAT_GATE_CLKCMU_CHUB_BUS ,21 ,0 ,0 ),
@@ -974,19 +974,19 @@ static const struct samsung_fixed_rate_clock cmgp_fixed_clks[] __initconst = {static const struct samsung_mux_clock cmgp_mux_clks[]__initconst = {MUX (CLK_MOUT_CMGP_ADC ,"mout_cmgp_adc" , mout_cmgp_adc_p,CLK_CON_MUX_CLK_CMGP_ADC ,0 ,1 ), -MUX (CLK_MOUT_CMGP_USI0 ,"mout_cmgp_usi0" , mout_cmgp_usi0_p, -CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP0 ,0 ,1 ), -MUX (CLK_MOUT_CMGP_USI1 ,"mout_cmgp_usi1" , mout_cmgp_usi1_p, -CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP1 ,0 ,1 ), +MUX_F (CLK_MOUT_CMGP_USI0 ,"mout_cmgp_usi0" , mout_cmgp_usi0_p, +CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP0 ,0 ,1 ,CLK_SET_RATE_PARENT ,0 ), +MUX_F (CLK_MOUT_CMGP_USI1 ,"mout_cmgp_usi1" , mout_cmgp_usi1_p, +CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP1 ,0 ,1 ,CLK_SET_RATE_PARENT ,0 ), };static const struct samsung_div_clock cmgp_div_clks[]__initconst = {DIV (CLK_DOUT_CMGP_ADC ,"dout_cmgp_adc" ,"gout_clkcmu_cmgp_bus" ,CLK_CON_DIV_DIV_CLK_CMGP_ADC ,0 ,4 ), -DIV (CLK_DOUT_CMGP_USI0 ,"dout_cmgp_usi0" ,"mout_cmgp_usi0" , -CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP0 ,0 ,5 ), -DIV (CLK_DOUT_CMGP_USI1 ,"dout_cmgp_usi1" ,"mout_cmgp_usi1" , -CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP1 ,0 ,5 ), +DIV_F (CLK_DOUT_CMGP_USI0 ,"dout_cmgp_usi0" ,"mout_cmgp_usi0" , +CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP0 ,0 ,5 ,CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_CMGP_USI1 ,"dout_cmgp_usi1" ,"mout_cmgp_usi1" , +CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP1 ,0 ,5 ,CLK_SET_RATE_PARENT ,0 ), };static const struct samsung_gate_clock cmgp_gate_clks[]__initconst = {
@@ -1001,12 +1001,12 @@ static const struct samsung_gate_clock cmgp_gate_clks[] __initconst = { "gout_clkcmu_cmgp_bus", CLK_CON_GAT_GOUT_CMGP_GPIO_PCLK, 21, CLK_IGNORE_UNUSED, 0),GATE (CLK_GOUT_CMGP_USI0_IPCLK ,"gout_cmgp_usi0_ipclk" ,"dout_cmgp_usi0" , -CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_IPCLK ,21 ,0 ,0 ), +CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_IPCLK ,21 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_GOUT_CMGP_USI0_PCLK ,"gout_cmgp_usi0_pclk" ,"gout_clkcmu_cmgp_bus" ,CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_PCLK ,21 ,0 ,0 ),GATE (CLK_GOUT_CMGP_USI1_IPCLK ,"gout_cmgp_usi1_ipclk" ,"dout_cmgp_usi1" , -CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_IPCLK ,21 ,0 ,0 ), +CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_IPCLK ,21 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_GOUT_CMGP_USI1_PCLK ,"gout_cmgp_usi1_pclk" ,"gout_clkcmu_cmgp_bus" , CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_PCLK, 21, 0, 0),
@@ -1557,8 +1557,9 @@ static const struct samsung_mux_clock peri_mux_clks[] __initconst = { mout_peri_uart_user_p, PLL_CON0_MUX_CLKCMU_PERI_UART_USER, 4, 1),MUX (CLK_MOUT_PERI_HSI2C_USER ,"mout_peri_hsi2c_user" , mout_peri_hsi2c_user_p,PLL_CON0_MUX_CLKCMU_PERI_HSI2C_USER ,4 ,1 ), -MUX (CLK_MOUT_PERI_SPI_USER ,"mout_peri_spi_user" , mout_peri_spi_user_p, - PLL_CON0_MUX_CLKCMU_PERI_SPI_USER, 4, 1), +MUX_F (CLK_MOUT_PERI_SPI_USER ,"mout_peri_spi_user" , + mout_peri_spi_user_p,PLL_CON0_MUX_CLKCMU_PERI_SPI_USER ,4 ,1 , + CLK_SET_RATE_PARENT, 0), }; static const struct samsung_div_clock peri_div_clks[] __initconst = {
@@ -1568,8 +1569,8 @@ static const struct samsung_div_clock peri_div_clks[] __initconst = { CLK_CON_DIV_DIV_CLK_PERI_HSI2C_1, 0, 5),DIV (CLK_DOUT_PERI_HSI2C2 ,"dout_peri_hsi2c2" ,"gout_peri_hsi2c2" ,CLK_CON_DIV_DIV_CLK_PERI_HSI2C_2 ,0 ,5 ), -DIV (CLK_DOUT_PERI_SPI0 ,"dout_peri_spi0" ,"mout_peri_spi_user" , - CLK_CON_DIV_DIV_CLK_PERI_SPI_0, 0, 5), +DIV_F (CLK_DOUT_PERI_SPI0 ,"dout_peri_spi0" ,"mout_peri_spi_user" , + CLK_CON_DIV_DIV_CLK_PERI_SPI_0, 0, 5, CLK_SET_RATE_PARENT, 0), }; static const struct samsung_gate_clock peri_gate_clks[] __initconst = {
@@ -1611,7 +1612,7 @@ static const struct samsung_gate_clock peri_gate_clks[] __initconst = { "mout_peri_bus_user", CLK_CON_GAT_GOUT_PERI_PWM_MOTOR_PCLK, 21, 0, 0),GATE (CLK_GOUT_SPI0_IPCLK ,"gout_spi0_ipclk" ,"dout_peri_spi0" , -CLK_CON_GAT_GOUT_PERI_SPI_0_IPCLK ,21 ,0 ,0 ), +CLK_CON_GAT_GOUT_PERI_SPI_0_IPCLK ,21 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_GOUT_SPI0_PCLK ,"gout_spi0_pclk" ,"mout_peri_bus_user" ,CLK_CON_GAT_GOUT_PERI_SPI_0_PCLK ,21 ,0 ,0 ), GATE(CLK_GOUT_SYSREG_PERI_PCLK, "gout_sysreg_peri_pclk",
Signature · 1 line
2.39.2
Re: [PATCH v2 1/3] clk: samsung: exynos850: Propagate SPI IPCLK rate change
Hi, Sam,
Quoted 5 lines · Sam Protsenko
Which should cover all possible applications of SPI bus. Of course, setting SPI frequency to values as low as 500 kHz will also affect the common bus dividers (
dout_apm_busordout_peri_ip), which in turn effectively lowers the rates for all leaf bus clocks derived from those dividers, like HSI2C and I3C clocks. But at least it gives the board
Quoted 8 lines
designer a choice, whether to keep all clocks (SPI/HSI2C/I3C) at high frequencies, or make all those clocks have lower frequencies. Not propagating the rate change to those common dividers would limit this choice to "only high frequencies are allowed for SPI/HSI2C/I3C" option, making the common dividers useless. This decision follows the "Worse is better" approach, relying on the users/engineers to know the system internals when working with such low-level features, instead of trying to account for all possible use-cases.
Depending on clock frequencies in DT and on the order of probe, one may end up with SPI changing the frequency for I3C for example, there's no protection on that. The more conservative approach, to which I lean, is to propagate the clock just to the first divider, which is dedicated to the end note, thus you'll avoid such problems. I think this fine tuning that you allow is more suitable for downstream. Maybe this is more of a personal preference, I don't know. Curious what others think.
The patch is looking fine though, and if the approach is considered acceptable:
Krzysztof Kozlowski
AppliedRe: (subset) [PATCH v2 1/3] clk: samsung: exynos850: Propagate SPI IPCLK rate change
In reply to Sam ProtsenkoQuoted 9 lines · Sam Protsenko
When SPI transfer is being prepared, the spi-s3c64xx driver will call
clk_set_rate()to change the rate of SPI source clock (IPCLK). But IPCLK is a gate (leaf) clock, so it must propagate the rate change up the clock tree, so that corresponding DIV clocks can actually change their divider values. AddCLK_SET_RATE_PARENTflag to corresponding clocks for all SPI instances in Exynos850 (spi_0,spi_1andspi_2) to make it possible. This change involves next clocks:[...]
Applied, thanks!
[1/3] clk: samsung: exynos850: Propagate SPI IPCLK rate change
https://git.kernel.org/krzk/linux/c/67c15187d4910ee353374676d4dddf09d8cb227e
Best regards,
Signature · 1 line
Krzysztof Kozlowski <[email protected]>
Sam Protsenko
maintainerPATCH v2 2/3 arm64: dts: exynos: Add PDMA node for Exynos850
In reply to Sam ProtsenkoEnable PDMA node. It's needed for multiple peripheral modules, like SPI. Use "arm,pl330-broken-no-flushp" quirk, as otherwise SPI transfers in DMA mode often fail with error like this:
I/O Error: rx-1 tx-1 rx-f tx-f len-786 dma-1 res-(-5)
---
Changes in v2:
- Ordered PDMA node by unit address
arch/arm64/boot/dts/exynos/exynos850.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/exynos/exynos850.dtsi +10 -0
@@ -184,6 +184,16 @@ timer@10040000 { clock-names = "fin_pll", "mct"; }; + pdma0: dma-controller@120c0000 { + compatible = "arm,pl330", "arm,primecell"; + reg = <0x120c0000 0x1000>; + interrupts = <GIC_SPI 479 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cmu_core CLK_GOUT_PDMA_CORE_ACLK>; + clock-names = "apb_pclk"; + arm,pl330-broken-no-flushp; + #dma-cells = <1>; + }; + gic: interrupt-controller@12a01000 { compatible = "arm,gic-400"; #interrupt-cells = <3>;
Signature · 1 line
2.39.2
Krzysztof Kozlowski
AppliedRe: (subset) [PATCH v2 2/3] arm64: dts: exynos: Add PDMA node for Exynos850
Quoted 8 lines · Sam Protsenko
Enable PDMA node. It's needed for multiple peripheral modules, like SPI. Use "arm,pl330-broken-no-flushp" quirk, as otherwise SPI transfers in DMA mode often fail with error like this:
I/O Error: rx-1 tx-1 rx-f tx-f len-786 dma-1 res-(-5)[...]
Applied, thanks!
[2/3] arm64: dts: exynos: Add PDMA node for Exynos850
https://git.kernel.org/krzk/linux/c/c0fe557853f3d4b61c4e2e729061482f4da901db
Best regards,
Signature · 1 line
Krzysztof Kozlowski <[email protected]>
Sam Protsenko
maintainerPATCH v2 3/3 arm64: dts: exynos: Add SPI nodes for Exynos850
In reply to Sam ProtsenkoSome USI blocks can be configured as SPI controllers. Add corresponding SPI nodes to Exynos850 SoC device tree.
---
Changes in v2:
- Sorted pinctrl properties properly
arch/arm64/boot/dts/exynos/exynos850.dtsi | 54 +++++++++++++++++++++++ 1 file changed, 54 insertions(+)
arch/arm64/boot/dts/exynos/exynos850.dtsi +54 -0
@@ -738,6 +738,24 @@ usi_spi_0: usi@139400c0 { <&cmu_peri CLK_GOUT_SPI0_IPCLK>; clock-names = "pclk", "ipclk"; status = "disabled"; + + spi_0: spi@13940000 { + compatible = "samsung,exynos850-spi"; + reg = <0x13940000 0x30>; + interrupts = <GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&spi0_pins>; + pinctrl-names = "default"; + clocks = <&cmu_peri CLK_GOUT_SPI0_IPCLK>, + <&cmu_peri CLK_GOUT_SPI0_PCLK>; + clock-names = "spi_busclk0", "spi"; + samsung,spi-src-clk = <0>; + dmas = <&pdma0 5>, <&pdma0 4>; + dma-names = "tx", "rx"; + num-cs = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; }; usi_cmgp0: usi@11d000c0 {
@@ -779,6 +797,24 @@ serial_1: serial@11d00000 { clock-names = "uart", "clk_uart_baud0"; status = "disabled"; }; + + spi_1: spi@11d00000 { + compatible = "samsung,exynos850-spi"; + reg = <0x11d00000 0x30>; + interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&spi1_pins>; + pinctrl-names = "default"; + clocks = <&cmu_cmgp CLK_GOUT_CMGP_USI0_IPCLK>, + <&cmu_cmgp CLK_GOUT_CMGP_USI0_PCLK>; + clock-names = "spi_busclk0", "spi"; + samsung,spi-src-clk = <0>; + dmas = <&pdma0 12>, <&pdma0 13>; + dma-names = "tx", "rx"; + num-cs = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; }; usi_cmgp1: usi@11d200c0 {
@@ -820,6 +856,24 @@ serial_2: serial@11d20000 { clock-names = "uart", "clk_uart_baud0"; status = "disabled"; }; + + spi_2: spi@11d20000 { + compatible = "samsung,exynos850-spi"; + reg = <0x11d20000 0x30>; + interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&spi2_pins>; + pinctrl-names = "default"; + clocks = <&cmu_cmgp CLK_GOUT_CMGP_USI1_IPCLK>, + <&cmu_cmgp CLK_GOUT_CMGP_USI1_PCLK>; + clock-names = "spi_busclk0", "spi"; + samsung,spi-src-clk = <0>; + dmas = <&pdma0 14>, <&pdma0 15>; + dma-names = "tx", "rx"; + num-cs = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; }; }; };
Signature · 1 line
2.39.2
Re: [PATCH v2 3/3] arm64: dts: exynos: Add SPI nodes for Exynos850
Quoted 9 lines · Sam Protsenko
arch/arm64/boot/dts/exynos/exynos850.dtsi +1
-0@@ -738,6 +738,24 @@ usi_spi_0: usi@139400c0 { <&cmu_peri CLK_GOUT_SPI0_IPCLK>; clock-names = "pclk", "ipclk"; status = "disabled"; +
arch/arm64/boot/dts/exynos/exynos850.dtsi usi_spi_0: usi@139400c0 { · line 751
Quoted 10 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi +10
-0+ spi_0: spi@13940000 { + compatible = "samsung,exynos850-spi"; + reg = <0x13940000 0x30>; + interrupts = <GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&spi0_pins>; + pinctrl-names = "default"; + clocks = <&cmu_peri CLK_GOUT_SPI0_IPCLK>, + <&cmu_peri CLK_GOUT_SPI0_PCLK>; + clock-names = "spi_busclk0", "spi"; + samsung,spi-src-clk = <0>;
this optional property
arch/arm64/boot/dts/exynos/exynos850.dtsi usi_spi_0: usi@139400c0 { · line 754
Quoted 3 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi +3
-0+ dmas = <&pdma0 5>, <&pdma0 4>; + dma-names = "tx", "rx"; + num-cs = <1>;
and this one, are already defaults in the driver. Shall you remove them?
Quoted 5 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi +4
-0+ #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; };
Sam Protsenko
maintainerRe: [PATCH v2 3/3] arm64: dts: exynos: Add SPI nodes for Exynos850
Quoted 17 lines · Tudor Ambarus
Quoted 13 lines · Sam Protsenko
arch/arm64/boot/dts/exynos/exynos850.dtsi +5
-0@@ -738,6 +738,24 @@ usi_spi_0: usi@139400c0 { <&cmu_peri CLK_GOUT_SPI0_IPCLK>; clock-names = "pclk", "ipclk"; status = "disabled"; + + spi_0: spi@13940000 { + compatible = "samsung,exynos850-spi"; + reg = <0x13940000 0x30>; + interrupts = <GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>;
Quoted 9 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi usi_spi_0: usi@139400c0 { · line 751
Quoted 6 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi +6
-0+ pinctrl-0 = <&spi0_pins>; + pinctrl-names = "default"; + clocks = <&cmu_peri CLK_GOUT_SPI0_IPCLK>, + <&cmu_peri CLK_GOUT_SPI0_PCLK>; + clock-names = "spi_busclk0", "spi"; + samsung,spi-src-clk = <0>;this optional property
The reason this property is provided here despite being optional, is to avoid corresponding dev_warn() message from spi-s3c64xx.c driver:
if (of_property_read_u32(dev->of_node, "samsung,spi-src-clk", &temp)) {
dev_warn(dev, "spi bus clock parent not specified, using
clock at index 0 as parent\n");
The same usage (samsung,spi-src-clk = <0>) can be encountered in multiple other Exynos dts in arch/arm/ and arch/arm64/, and it's also used in bindings example. Probably for the same reason explained above. Even if dev_warn() is removed in the driver, I guess the older kernels will still print it if spi-src-clk is omitted. So I'd like to keep it here.
Quoted 6 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi usi_spi_0: usi@139400c0 { · line 754
Quoted 3 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi +3
-0+ dmas = <&pdma0 5>, <&pdma0 4>; + dma-names = "tx", "rx"; + num-cs = <1>;and this one, are already defaults in the driver. Shall you remove them?
For exactly the same reasoning as stated above, I'd like to keep this here to keep dmesg clean and tidy. Otherwise it prints this warning:
if (of_property_read_u32(dev->of_node, "num-cs", &temp)) {
dev_warn(dev, "number of chip select lines not specified,
assuming 1 chip select line\n");
And even if the warning is removed in the driver, older kernels will still print it.
Quoted 5 lines
Quoted 5 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi +4
-0+ #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; };
Tudor Ambarus
Reviewed-byRe: [PATCH v2 3/3] arm64: dts: exynos: Add SPI nodes for Exynos850
Quoted 10 lines · Sam Protsenko
Quoted 3 lines
Quoted 1 line
+ samsung,spi-src-clk = <0>;
this optional property
The reason this property is provided here despite being optional, is to avoid corresponding
dev_warn()message fromspi-s3c64xx.cdriver:if (
of_property_read_u32(dev->of_node, "samsung,spi-src-clk", &temp)) {
dev_warn(dev, "spi bus clock parent not specified, using
clock at index 0 as parent\n");
Quoted 6 lines
The same usage (samsung,spi-src-clk = <0>) can be encountered in multiple other Exynos dts in
arch/arm/andarch/arm64/, and it's also used in bindings example. Probably for the same reason explained above. Even ifdev_warn()is removed in the driver, I guess the older kernels will still print it if spi-src-clk is omitted. So I'd like to keep it here.
Yeah, I know. I proposed a patch switching to dev_dbg. If it's so annoying and implies adding superfluous properties to DT, maybe it is worth to add a fixes tag to the dev_dbg patch and backport it to stable kernels?
Your patch looks fine. I guess the vendor specific properties shall be last if you keep them, see:
https://www.kernel.org/doc/html/latest/devicetree/bindings/dts-coding-style.html#order-of-properties-in-device-node
If you remove the vendor properties or reorder them, one can add:
Re: [PATCH v2 3/3] arm64: dts: exynos: Add SPI nodes for Exynos850
In reply to Sam ProtsenkoQuoted 23 lines · Sam Protsenko
Some USI blocks can be configured as SPI controllers. Add corresponding SPI nodes to Exynos850 SoC device tree.
Signed-off-by Sam Protsenko <[email protected]>---
Changes in v2:
- Sorted pinctrl properties properlyarch/arm64/boot/dts/exynos/exynos850.dtsi | 54 +++++++++++++++++++++++ 1 file changed, 54 insertions(+)arch/arm64/boot/dts/exynos/exynos850.dtsi +4
-0@@ -738,6 +738,24 @@ usi_spi_0: usi@139400c0 { <&cmu_peri CLK_GOUT_SPI0_IPCLK>; clock-names = "pclk", "ipclk"; status = "disabled"; + + spi_0: spi@13940000 { + compatible = "samsung,exynos850-spi"; + reg = <0x13940000 0x30>;
arch/arm64/boot/dts/exynos/exynos850.dtsi usi_spi_0: usi@139400c0 { · line 754
Quoted 10 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi +10
-0+ interrupts = <GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&spi0_pins>; + pinctrl-names = "default"; + clocks = <&cmu_peri CLK_GOUT_SPI0_IPCLK>, + <&cmu_peri CLK_GOUT_SPI0_PCLK>; + clock-names = "spi_busclk0", "spi"; + samsung,spi-src-clk = <0>; + dmas = <&pdma0 5>, <&pdma0 4>; + dma-names = "tx", "rx"; + num-cs = <1>;
For the future: please keep properties sorted by name, so clocks+name, dmas+name, interrupts, pinctrl+name, more-or-less matching DTS coding style. address/size cells can go to the end.
Best regards,
Krzysztof
Sam Protsenko
maintainerRe: [PATCH v2 3/3] arm64: dts: exynos: Add SPI nodes for Exynos850
Quoted 31 lines · Krzysztof Kozlowski
Quoted 29 lines · Sam Protsenko
Some USI blocks can be configured as SPI controllers. Add corresponding SPI nodes to Exynos850 SoC device tree.
Signed-off-by Sam Protsenko <[email protected]>---
Changes in v2:
- Sorted pinctrl properties properlyarch/arm64/boot/dts/exynos/exynos850.dtsi | 54 +++++++++++++++++++++++ 1 file changed, 54 insertions(+)arch/arm64/boot/dts/exynos/exynos850.dtsi +10
-0@@ -738,6 +738,24 @@ usi_spi_0: usi@139400c0 { <&cmu_peri CLK_GOUT_SPI0_IPCLK>; clock-names = "pclk", "ipclk"; status = "disabled"; + + spi_0: spi@13940000 { + compatible = "samsung,exynos850-spi"; + reg = <0x13940000 0x30>; + interrupts = <GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&spi0_pins>; + pinctrl-names = "default"; + clocks = <&cmu_peri CLK_GOUT_SPI0_IPCLK>, + <&cmu_peri CLK_GOUT_SPI0_PCLK>; + clock-names = "spi_busclk0", "spi";
Quoted 9 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi usi_spi_0: usi@139400c0 { · line 754
Quoted 4 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi +4
-0+ samsung,spi-src-clk = <0>; + dmas = <&pdma0 5>, <&pdma0 4>; + dma-names = "tx", "rx"; + num-cs = <1>;For the future: please keep properties sorted by name, so clocks+name, dmas+name, interrupts, pinctrl+name, more-or-less matching DTS coding style. address/size cells can go to the end.
Noted, thanks! So IIUC, basically follow the order of properties described at [1], but keep the standard/common properties block sorted, and then keep vendor properties sorted, right?
[1] Documentation/devicetree/bindings/dts-coding-style.rst
Quoted 3 lines
Best regards,
Krzysztof
Krzysztof Kozlowski
AppliedRe: (subset) [PATCH v2 3/3] arm64: dts: exynos: Add SPI nodes for Exynos850
In reply to Sam ProtsenkoQuoted 4 lines · Sam Protsenko
Some USI blocks can be configured as SPI controllers. Add corresponding SPI nodes to Exynos850 SoC device tree.
Applied, thanks!
[3/3] arm64: dts: exynos: Add SPI nodes for Exynos850
https://git.kernel.org/krzk/linux/c/98473b0d78caa5502b7eee05553ee168f0b0b424
Best regards,
Signature · 1 line
Krzysztof Kozlowski <[email protected]>
Re: (subset) [PATCH v2 3/3] arm64: dts: exynos: Add SPI nodes for Exynos850
Quoted 11 lines · Krzysztof Kozlowski
Quoted 4 lines · Sam Protsenko
Some USI blocks can be configured as SPI controllers. Add corresponding SPI nodes to Exynos850 SoC device tree.
Applied, thanks!
[3/3] arm64: dts: exynos: Add SPI nodes for Exynos850
https://git.kernel.org/krzk/linux/c/98473b0d78caa5502b7eee05553ee168f0b0b424
And dropped. You did not test it.
For some time, all Samsung SoCs and its variants are expected not to introduce any new dtbs_check W=1 warnings. Several platforms, like all ARM64 Samsung SoCs, have already zero warnings, thus for such platforms it is extra easy for the submitter to validate DTS before posting a patch. The patch briefly looks like it is not conforming to this rule. Please confirm that you tested your patch and it does not introduce any new warnings (linux-next is decisive here).
Best regards,
Krzysztof
Sam Protsenko
maintainerRe: (subset) [PATCH v2 3/3] arm64: dts: exynos: Add SPI nodes for Exynos850
Quoted 9 lines · Krzysztof Kozlowski
Quoted 7 lines · Krzysztof Kozlowski
Quoted 4 lines · Sam Protsenko
Some USI blocks can be configured as SPI controllers. Add corresponding SPI nodes to Exynos850 SoC device tree.
Quoted 7 lines
Quoted 4 lines
Applied, thanks!
[3/3] arm64: dts: exynos: Add SPI nodes for Exynos850
https://git.kernel.org/krzk/linux/c/98473b0d78caa5502b7eee05553ee168f0b0b424And dropped. You did not test it.
Right. Forgot to re-test it after re-shuffling the clocks. Sorry for the hustle, I'll send v3 shortly.
Quoted 11 lines
For some time, all Samsung SoCs and its variants are expected not to introduce any new
dtbs_check W=1warnings. Several platforms, like all ARM64 Samsung SoCs, have already zero warnings, thus for such platforms it is extra easy for the submitter to validate DTS before posting a patch. The patch briefly looks like it is not conforming to this rule. Please confirm that you tested your patch and it does not introduce any new warnings (linux-next is decisive here).Best regards,
Krzysztof