Message ID | 20250209220646.1090868-3-alexander.sverdlin@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | arm64 support for Milk-V Duo Module 01 EVB | expand |
On Sun, Feb 09, 2025 at 11:06:27PM +0100, Alexander Sverdlin wrote: > Make the peripheral device tree re-usable on ARM64 platform by splitting it > into CPU-core specific and peripheral parts. > > Add SOC_PERIPHERAL_IRQ() macro which explicitly maps peripheral nubering > into "plic" interrupt-controller numbering. > > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> > --- > arch/riscv/boot/dts/sophgo/cv181x.dtsi | 2 +- > arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 313 ++++++++++++++++++ > arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 305 +---------------- > 3 files changed, 317 insertions(+), 303 deletions(-) > create mode 100644 arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi > > diff --git a/arch/riscv/boot/dts/sophgo/cv181x.dtsi b/arch/riscv/boot/dts/sophgo/cv181x.dtsi > index 5fd14dd1b14f..bbdb30653e9a 100644 > --- a/arch/riscv/boot/dts/sophgo/cv181x.dtsi > +++ b/arch/riscv/boot/dts/sophgo/cv181x.dtsi > @@ -11,7 +11,7 @@ soc { > emmc: mmc@4300000 { > compatible = "sophgo,cv1800b-dwcmshc"; > reg = <0x4300000 0x1000>; > - interrupts = <34 IRQ_TYPE_LEVEL_HIGH>; > + interrupts = <SOC_PERIPHERAL_IRQ(18) IRQ_TYPE_LEVEL_HIGH>; > clocks = <&clk CLK_AXI4_EMMC>, > <&clk CLK_EMMC>; > clock-names = "core", "bus"; > diff --git a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi > new file mode 100644 > index 000000000000..53834b0658b2 > --- /dev/null > +++ b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi > @@ -0,0 +1,313 @@ > +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > +/* > + * Copyright (C) 2023 Jisheng Zhang <jszhang@kernel.org> > + * Copyright (C) 2023 Inochi Amaoto <inochiama@outlook.com> > + */ > + Split the cpu into a separate file and hold the cv18xx.dtsi to hold the peripheral. Also define the SOC_PERIPHERAL_IRQ in the cpu file, so you can get less change. > +#include <dt-bindings/clock/sophgo,cv1800.h> > +#include <dt-bindings/gpio/gpio.h> > +#include <dt-bindings/interrupt-controller/irq.h> > + > +/ { > + osc: oscillator { > + compatible = "fixed-clock"; > + clock-output-names = "osc_25m"; > + #clock-cells = <0>; > + }; > + > + soc { > + compatible = "simple-bus"; > + #address-cells = <1>; > + #size-cells = <1>; You also needs ranges here. > + > + clk: clock-controller@3002000 { > + reg = <0x03002000 0x1000>; > + clocks = <&osc>; > + #clock-cells = <1>; > + }; > + [...] > + dmac: dma-controller@4330000 { > + compatible = "snps,axi-dma-1.01a"; > + reg = <0x04330000 0x1000>; > + interrupts = <SOC_PERIPHERAL_IRQ(13) IRQ_TYPE_LEVEL_HIGH>; > + clocks = <&clk CLK_SDMA_AXI>, <&clk CLK_SDMA_AXI>; > + clock-names = "core-clk", "cfgr-clk"; > + #dma-cells = <1>; > + dma-channels = <8>; > + snps,block-size = <1024 1024 1024 1024 > + 1024 1024 1024 1024>; > + snps,priority = <0 1 2 3 4 5 6 7>; > + snps,dma-masters = <2>; > + snps,data-width = <4>; > + status = "disabled"; > + }; > + }; > +}; > diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi > index c18822ec849f..57a01b71aa67 100644 > --- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi > +++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi > @@ -4,9 +4,9 @@ > * Copyright (C) 2023 Inochi Amaoto <inochiama@outlook.com> > */ > > -#include <dt-bindings/clock/sophgo,cv1800.h> > -#include <dt-bindings/gpio/gpio.h> > -#include <dt-bindings/interrupt-controller/irq.h> > +#define SOC_PERIPHERAL_IRQ(nr) ((nr) + 16) > + > +#include "cv18xx-periph.dtsi" > > / { > #address-cells = <1>; > @@ -41,310 +41,11 @@ cpu0_intc: interrupt-controller { > }; > }; > > - osc: oscillator { > - compatible = "fixed-clock"; > - clock-output-names = "osc_25m"; > - #clock-cells = <0>; > - }; > - > soc { > - compatible = "simple-bus"; > interrupt-parent = <&plic>; > - #address-cells = <1>; > - #size-cells = <1>; > dma-noncoherent; Move this into new cpu file. > ranges; > > - clk: clock-controller@3002000 { > - reg = <0x03002000 0x1000>; > - clocks = <&osc>; > - #clock-cells = <1>; > - }; > - > - gpio0: gpio@3020000 { > - compatible = "snps,dw-apb-gpio"; > - reg = <0x3020000 0x1000>; > - #address-cells = <1>; > - #size-cells = <0>; > - > - porta: gpio-controller@0 { > - compatible = "snps,dw-apb-gpio-port"; > - gpio-controller; > - #gpio-cells = <2>; > - ngpios = <32>; > - reg = <0>; > - interrupt-controller; > - #interrupt-cells = <2>; > - interrupts = <60 IRQ_TYPE_LEVEL_HIGH>; > - }; > - }; > - > - gpio1: gpio@3021000 { > - compatible = "snps,dw-apb-gpio"; > - reg = <0x3021000 0x1000>; > - #address-cells = <1>; > - #size-cells = <0>; > - > - portb: gpio-controller@0 { > - compatible = "snps,dw-apb-gpio-port"; > - gpio-controller; > - #gpio-cells = <2>; > - ngpios = <32>; > - reg = <0>; > - interrupt-controller; > - #interrupt-cells = <2>; > - interrupts = <61 IRQ_TYPE_LEVEL_HIGH>; > - }; > - }; > - > - gpio2: gpio@3022000 { > - compatible = "snps,dw-apb-gpio"; > - reg = <0x3022000 0x1000>; > - #address-cells = <1>; > - #size-cells = <0>; > - > - portc: gpio-controller@0 { > - compatible = "snps,dw-apb-gpio-port"; > - gpio-controller; > - #gpio-cells = <2>; > - ngpios = <32>; > - reg = <0>; > - interrupt-controller; > - #interrupt-cells = <2>; > - interrupts = <62 IRQ_TYPE_LEVEL_HIGH>; > - }; > - }; > - > - gpio3: gpio@3023000 { > - compatible = "snps,dw-apb-gpio"; > - reg = <0x3023000 0x1000>; > - #address-cells = <1>; > - #size-cells = <0>; > - > - portd: gpio-controller@0 { > - compatible = "snps,dw-apb-gpio-port"; > - gpio-controller; > - #gpio-cells = <2>; > - ngpios = <32>; > - reg = <0>; > - interrupt-controller; > - #interrupt-cells = <2>; > - interrupts = <63 IRQ_TYPE_LEVEL_HIGH>; > - }; > - }; > - > - saradc: adc@30f0000 { > - compatible = "sophgo,cv1800b-saradc"; > - reg = <0x030f0000 0x1000>; > - clocks = <&clk CLK_SARADC>; > - interrupts = <100 IRQ_TYPE_LEVEL_HIGH>; > - #address-cells = <1>; > - #size-cells = <0>; > - status = "disabled"; > - > - channel@0 { > - reg = <0>; > - }; > - > - channel@1 { > - reg = <1>; > - }; > - > - channel@2 { > - reg = <2>; > - }; > - }; > - > - i2c0: i2c@4000000 { > - compatible = "snps,designware-i2c"; > - reg = <0x04000000 0x10000>; > - #address-cells = <1>; > - #size-cells = <0>; > - clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C0>; > - clock-names = "ref", "pclk"; > - interrupts = <49 IRQ_TYPE_LEVEL_HIGH>; > - status = "disabled"; > - }; > - > - i2c1: i2c@4010000 { > - compatible = "snps,designware-i2c"; > - reg = <0x04010000 0x10000>; > - #address-cells = <1>; > - #size-cells = <0>; > - clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C1>; > - clock-names = "ref", "pclk"; > - interrupts = <50 IRQ_TYPE_LEVEL_HIGH>; > - status = "disabled"; > - }; > - > - i2c2: i2c@4020000 { > - compatible = "snps,designware-i2c"; > - reg = <0x04020000 0x10000>; > - #address-cells = <1>; > - #size-cells = <0>; > - clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C2>; > - clock-names = "ref", "pclk"; > - interrupts = <51 IRQ_TYPE_LEVEL_HIGH>; > - status = "disabled"; > - }; > - > - i2c3: i2c@4030000 { > - compatible = "snps,designware-i2c"; > - reg = <0x04030000 0x10000>; > - #address-cells = <1>; > - #size-cells = <0>; > - clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C3>; > - clock-names = "ref", "pclk"; > - interrupts = <52 IRQ_TYPE_LEVEL_HIGH>; > - status = "disabled"; > - }; > - > - i2c4: i2c@4040000 { > - compatible = "snps,designware-i2c"; > - reg = <0x04040000 0x10000>; > - #address-cells = <1>; > - #size-cells = <0>; > - clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C4>; > - clock-names = "ref", "pclk"; > - interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; > - status = "disabled"; > - }; > - > - uart0: serial@4140000 { > - compatible = "snps,dw-apb-uart"; > - reg = <0x04140000 0x100>; > - interrupts = <44 IRQ_TYPE_LEVEL_HIGH>; > - clocks = <&clk CLK_UART0>, <&clk CLK_APB_UART0>; > - clock-names = "baudclk", "apb_pclk"; > - reg-shift = <2>; > - reg-io-width = <4>; > - status = "disabled"; > - }; > - > - uart1: serial@4150000 { > - compatible = "snps,dw-apb-uart"; > - reg = <0x04150000 0x100>; > - interrupts = <45 IRQ_TYPE_LEVEL_HIGH>; > - clocks = <&clk CLK_UART1>, <&clk CLK_APB_UART1>; > - clock-names = "baudclk", "apb_pclk"; > - reg-shift = <2>; > - reg-io-width = <4>; > - status = "disabled"; > - }; > - > - uart2: serial@4160000 { > - compatible = "snps,dw-apb-uart"; > - reg = <0x04160000 0x100>; > - interrupts = <46 IRQ_TYPE_LEVEL_HIGH>; > - clocks = <&clk CLK_UART2>, <&clk CLK_APB_UART2>; > - clock-names = "baudclk", "apb_pclk"; > - reg-shift = <2>; > - reg-io-width = <4>; > - status = "disabled"; > - }; > - > - uart3: serial@4170000 { > - compatible = "snps,dw-apb-uart"; > - reg = <0x04170000 0x100>; > - interrupts = <47 IRQ_TYPE_LEVEL_HIGH>; > - clocks = <&clk CLK_UART3>, <&clk CLK_APB_UART3>; > - clock-names = "baudclk", "apb_pclk"; > - reg-shift = <2>; > - reg-io-width = <4>; > - status = "disabled"; > - }; > - > - spi0: spi@4180000 { > - compatible = "snps,dw-apb-ssi"; > - reg = <0x04180000 0x10000>; > - #address-cells = <1>; > - #size-cells = <0>; > - clocks = <&clk CLK_SPI>, <&clk CLK_APB_SPI0>; > - clock-names = "ssi_clk", "pclk"; > - interrupts = <54 IRQ_TYPE_LEVEL_HIGH>; > - status = "disabled"; > - }; > - > - spi1: spi@4190000 { > - compatible = "snps,dw-apb-ssi"; > - reg = <0x04190000 0x10000>; > - #address-cells = <1>; > - #size-cells = <0>; > - clocks = <&clk CLK_SPI>, <&clk CLK_APB_SPI1>; > - clock-names = "ssi_clk", "pclk"; > - interrupts = <55 IRQ_TYPE_LEVEL_HIGH>; > - status = "disabled"; > - }; > - > - spi2: spi@41a0000 { > - compatible = "snps,dw-apb-ssi"; > - reg = <0x041a0000 0x10000>; > - #address-cells = <1>; > - #size-cells = <0>; > - clocks = <&clk CLK_SPI>, <&clk CLK_APB_SPI2>; > - clock-names = "ssi_clk", "pclk"; > - interrupts = <56 IRQ_TYPE_LEVEL_HIGH>; > - status = "disabled"; > - }; > - > - spi3: spi@41b0000 { > - compatible = "snps,dw-apb-ssi"; > - reg = <0x041b0000 0x10000>; > - #address-cells = <1>; > - #size-cells = <0>; > - clocks = <&clk CLK_SPI>, <&clk CLK_APB_SPI3>; > - clock-names = "ssi_clk", "pclk"; > - interrupts = <57 IRQ_TYPE_LEVEL_HIGH>; > - status = "disabled"; > - }; > - > - uart4: serial@41c0000 { > - compatible = "snps,dw-apb-uart"; > - reg = <0x041c0000 0x100>; > - interrupts = <48 IRQ_TYPE_LEVEL_HIGH>; > - clocks = <&clk CLK_UART4>, <&clk CLK_APB_UART4>; > - clock-names = "baudclk", "apb_pclk"; > - reg-shift = <2>; > - reg-io-width = <4>; > - status = "disabled"; > - }; > - > - sdhci0: mmc@4310000 { > - compatible = "sophgo,cv1800b-dwcmshc"; > - reg = <0x4310000 0x1000>; > - interrupts = <36 IRQ_TYPE_LEVEL_HIGH>; > - clocks = <&clk CLK_AXI4_SD0>, > - <&clk CLK_SD0>; > - clock-names = "core", "bus"; > - status = "disabled"; > - }; > - > - sdhci1: mmc@4320000 { > - compatible = "sophgo,cv1800b-dwcmshc"; > - reg = <0x4320000 0x1000>; > - interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; > - clocks = <&clk CLK_AXI4_SD1>, > - <&clk CLK_SD1>; > - clock-names = "core", "bus"; > - status = "disabled"; > - }; > - > - dmac: dma-controller@4330000 { > - compatible = "snps,axi-dma-1.01a"; > - reg = <0x04330000 0x1000>; > - interrupts = <29 IRQ_TYPE_LEVEL_HIGH>; > - clocks = <&clk CLK_SDMA_AXI>, <&clk CLK_SDMA_AXI>; > - clock-names = "core-clk", "cfgr-clk"; > - #dma-cells = <1>; > - dma-channels = <8>; > - snps,block-size = <1024 1024 1024 1024 > - 1024 1024 1024 1024>; > - snps,priority = <0 1 2 3 4 5 6 7>; > - snps,dma-masters = <2>; > - snps,data-width = <4>; > - status = "disabled"; > - }; > - > plic: interrupt-controller@70000000 { > reg = <0x70000000 0x4000000>; > interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>; > -- > 2.48.1 >
On 09/02/2025 23:06, Alexander Sverdlin wrote: > Make the peripheral device tree re-usable on ARM64 platform by splitting it > into CPU-core specific and peripheral parts. > > Add SOC_PERIPHERAL_IRQ() macro which explicitly maps peripheral nubering > into "plic" interrupt-controller numbering. > > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> > --- > arch/riscv/boot/dts/sophgo/cv181x.dtsi | 2 +- > arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 313 ++++++++++++++++++ > arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 305 +---------------- > 3 files changed, 317 insertions(+), 303 deletions(-) > create mode 100644 arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi > > diff --git a/arch/riscv/boot/dts/sophgo/cv181x.dtsi b/arch/riscv/boot/dts/sophgo/cv181x.dtsi > index 5fd14dd1b14f..bbdb30653e9a 100644 > --- a/arch/riscv/boot/dts/sophgo/cv181x.dtsi > +++ b/arch/riscv/boot/dts/sophgo/cv181x.dtsi > @@ -11,7 +11,7 @@ soc { > emmc: mmc@4300000 { > compatible = "sophgo,cv1800b-dwcmshc"; > reg = <0x4300000 0x1000>; > - interrupts = <34 IRQ_TYPE_LEVEL_HIGH>; > + interrupts = <SOC_PERIPHERAL_IRQ(18) IRQ_TYPE_LEVEL_HIGH>; > clocks = <&clk CLK_AXI4_EMMC>, > <&clk CLK_EMMC>; > clock-names = "core", "bus"; > diff --git a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi > new file mode 100644 > index 000000000000..53834b0658b2 > --- /dev/null > +++ b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi > @@ -0,0 +1,313 @@ > +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > +/* > + * Copyright (C) 2023 Jisheng Zhang <jszhang@kernel.org> > + * Copyright (C) 2023 Inochi Amaoto <inochiama@outlook.com> > + */ > + > +#include <dt-bindings/clock/sophgo,cv1800.h> > +#include <dt-bindings/gpio/gpio.h> > +#include <dt-bindings/interrupt-controller/irq.h> > + > +/ { > + osc: oscillator { > + compatible = "fixed-clock"; I really doubt that external oscillator is a peripheral. This is either part of board or the SoC. > + clock-output-names = "osc_25m"; > + #clock-cells = <0>; > + }; > + > + soc { > + compatible = "simple-bus"; > + #address-cells = <1>; > + #size-cells = <1>; No, override by phandle/label instead of duplicating SoC. Best regards, Krzysztof
Thanks for quick review Krzysztof! On Mon, 2025-02-10 at 09:43 +0100, Krzysztof Kozlowski wrote: > On 09/02/2025 23:06, Alexander Sverdlin wrote: > > Make the peripheral device tree re-usable on ARM64 platform by splitting it > > into CPU-core specific and peripheral parts. > > > > Add SOC_PERIPHERAL_IRQ() macro which explicitly maps peripheral nubering > > into "plic" interrupt-controller numbering. > > > > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> > > --- > > arch/riscv/boot/dts/sophgo/cv181x.dtsi | 2 +- > > arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 313 ++++++++++++++++++ > > arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 305 +---------------- ^^^^^^^^^^^ [1] > > --- /dev/null > > +++ b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi > > @@ -0,0 +1,313 @@ > > +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > > +/* > > + * Copyright (C) 2023 Jisheng Zhang <jszhang@kernel.org> > > + * Copyright (C) 2023 Inochi Amaoto <inochiama@outlook.com> > > + */ > > + > > +#include <dt-bindings/clock/sophgo,cv1800.h> > > +#include <dt-bindings/gpio/gpio.h> > > +#include <dt-bindings/interrupt-controller/irq.h> > > + > > +/ { > > + osc: oscillator { > > + compatible = "fixed-clock"; > > I really doubt that external oscillator is a peripheral. This is either > part of board or the SoC. This is actually a problem of the original cv18xx.dtsi [1]. Do you think I need to fix it as part of my series? This would touch all the pure RiscV boards (using CV18xx SoCs, not SG200x SoCs), which I could avoid otherwise.
Hi Krzysztof! On Mon, 2025-02-10 at 09:43 +0100, Krzysztof Kozlowski wrote: > > diff --git a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi > > new file mode 100644 > > index 000000000000..53834b0658b2 > > --- /dev/null > > +++ b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi > > @@ -0,0 +1,313 @@ > > +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > > +/* > > + * Copyright (C) 2023 Jisheng Zhang <jszhang@kernel.org> > > + * Copyright (C) 2023 Inochi Amaoto <inochiama@outlook.com> > > + */ > > + > > +#include <dt-bindings/clock/sophgo,cv1800.h> > > +#include <dt-bindings/gpio/gpio.h> > > +#include <dt-bindings/interrupt-controller/irq.h> > > + > > +/ { > > + osc: oscillator { > > + compatible = "fixed-clock"; > > I really doubt that external oscillator is a peripheral. This is either > part of board or the SoC. > > > > + clock-output-names = "osc_25m"; > > + #clock-cells = <0>; > > + }; > > + > > + soc { > > + compatible = "simple-bus"; > > + #address-cells = <1>; > > + #size-cells = <1>; > > No, override by phandle/label instead of duplicating SoC. Is this one critical? Otherwise I struggle in v2 to both keep SOC_PERIPHERAL_IRQ() in [a new] cv18xx-cpu.dtsi and reference &soc from cv18xx-cpu.dtsi. It's kind of circular-dependency.
On 10/02/2025 15:26, Alexander Sverdlin wrote: > Hi Krzysztof! > > On Mon, 2025-02-10 at 09:43 +0100, Krzysztof Kozlowski wrote: >>> diff --git a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi >>> new file mode 100644 >>> index 000000000000..53834b0658b2 >>> --- /dev/null >>> +++ b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi >>> @@ -0,0 +1,313 @@ >>> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) >>> +/* >>> + * Copyright (C) 2023 Jisheng Zhang <jszhang@kernel.org> >>> + * Copyright (C) 2023 Inochi Amaoto <inochiama@outlook.com> >>> + */ >>> + >>> +#include <dt-bindings/clock/sophgo,cv1800.h> >>> +#include <dt-bindings/gpio/gpio.h> >>> +#include <dt-bindings/interrupt-controller/irq.h> >>> + >>> +/ { >>> + osc: oscillator { >>> + compatible = "fixed-clock"; >> >> I really doubt that external oscillator is a peripheral. This is either >> part of board or the SoC. >> >> >>> + clock-output-names = "osc_25m"; >>> + #clock-cells = <0>; >>> + }; >>> + >>> + soc { >>> + compatible = "simple-bus"; >>> + #address-cells = <1>; >>> + #size-cells = <1>; >> >> No, override by phandle/label instead of duplicating SoC. > > Is this one critical? Otherwise I struggle in v2 to both keep Yes, because duplicated definition is both pain and confusing. It is IMO semantically not correct - there is only one soc, not two SoCs. If you have two, then you miss proper unit address. > SOC_PERIPHERAL_IRQ() in [a new] cv18xx-cpu.dtsi and reference &soc SOC_PERIPHERAL_IRQ() does not belong here, but to the base DTSI for your arch. I would rather recommend not to create fake DTSI structure reflecting some arbitrary choice. cv18xx-cpu.dtsi is not better - for example type of interrupts are rather arch or GIC specific, not the CPU. Unless you meant something else by CPU, but then it is getting more confusing. Look how others, e.g. Renesas, defines it - no problem overriding soc, no problem with SOC_PERIPHERAL_IRQ(). > from cv18xx-cpu.dtsi. It's kind of circular-dependency. > Best regards, Krzysztof
On 10/02/2025 14:45, Alexander Sverdlin wrote: > Thanks for quick review Krzysztof! > > On Mon, 2025-02-10 at 09:43 +0100, Krzysztof Kozlowski wrote: >> On 09/02/2025 23:06, Alexander Sverdlin wrote: >>> Make the peripheral device tree re-usable on ARM64 platform by splitting it >>> into CPU-core specific and peripheral parts. >>> >>> Add SOC_PERIPHERAL_IRQ() macro which explicitly maps peripheral nubering >>> into "plic" interrupt-controller numbering. >>> >>> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> >>> --- >>> arch/riscv/boot/dts/sophgo/cv181x.dtsi | 2 +- >>> arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 313 ++++++++++++++++++ >>> arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 305 +---------------- > ^^^^^^^^^^^ > [1] > >>> --- /dev/null >>> +++ b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi >>> @@ -0,0 +1,313 @@ >>> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) >>> +/* >>> + * Copyright (C) 2023 Jisheng Zhang <jszhang@kernel.org> >>> + * Copyright (C) 2023 Inochi Amaoto <inochiama@outlook.com> >>> + */ >>> + >>> +#include <dt-bindings/clock/sophgo,cv1800.h> >>> +#include <dt-bindings/gpio/gpio.h> >>> +#include <dt-bindings/interrupt-controller/irq.h> >>> + >>> +/ { >>> + osc: oscillator { >>> + compatible = "fixed-clock"; >> >> I really doubt that external oscillator is a peripheral. This is either >> part of board or the SoC. > > This is actually a problem of the original cv18xx.dtsi [1]. Do you think > I need to fix it as part of my series? This would touch all the pure > RiscV boards (using CV18xx SoCs, not SG200x SoCs), which I could avoid > otherwise. You are moving the node out of cv18xx.dtsi, so you can move it to final place for example. But I do not insist, because I also do not know the final (truly correct) place - don't know the hardware here. Best regards, Krzysztof
Hi Krzysztof! On Tue, 2025-02-11 at 09:08 +0100, Krzysztof Kozlowski wrote: > > > > +/ { > > > > + osc: oscillator { > > > > + compatible = "fixed-clock"; > > > > > > I really doubt that external oscillator is a peripheral. This is either > > > part of board or the SoC. > > > > This is actually a problem of the original cv18xx.dtsi [1]. Do you think > > I need to fix it as part of my series? This would touch all the pure > > RiscV boards (using CV18xx SoCs, not SG200x SoCs), which I could avoid > > otherwise. > > You are moving the node out of cv18xx.dtsi, so you can move it to final > place for example. But I do not insist, because I also do not know the > final (truly correct) place - don't know the hardware here. Fortunately, problem disappeared by itself in v2 [1], now I don't touch it any longer and only move CPU and int controller into corresponding SoCs, so the oscillator falls into "could be coded as a fixed-clock in the SoC DTSI" cathegory of the coding style. Link: https://lore.kernel.org/soc/20250210220951.1248533-2-alexander.sverdlin@gmail.com/
diff --git a/arch/riscv/boot/dts/sophgo/cv181x.dtsi b/arch/riscv/boot/dts/sophgo/cv181x.dtsi index 5fd14dd1b14f..bbdb30653e9a 100644 --- a/arch/riscv/boot/dts/sophgo/cv181x.dtsi +++ b/arch/riscv/boot/dts/sophgo/cv181x.dtsi @@ -11,7 +11,7 @@ soc { emmc: mmc@4300000 { compatible = "sophgo,cv1800b-dwcmshc"; reg = <0x4300000 0x1000>; - interrupts = <34 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <SOC_PERIPHERAL_IRQ(18) IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk CLK_AXI4_EMMC>, <&clk CLK_EMMC>; clock-names = "core", "bus"; diff --git a/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi new file mode 100644 index 000000000000..53834b0658b2 --- /dev/null +++ b/arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi @@ -0,0 +1,313 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2023 Jisheng Zhang <jszhang@kernel.org> + * Copyright (C) 2023 Inochi Amaoto <inochiama@outlook.com> + */ + +#include <dt-bindings/clock/sophgo,cv1800.h> +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/interrupt-controller/irq.h> + +/ { + osc: oscillator { + compatible = "fixed-clock"; + clock-output-names = "osc_25m"; + #clock-cells = <0>; + }; + + soc { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + + clk: clock-controller@3002000 { + reg = <0x03002000 0x1000>; + clocks = <&osc>; + #clock-cells = <1>; + }; + + gpio0: gpio@3020000 { + compatible = "snps,dw-apb-gpio"; + reg = <0x3020000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + porta: gpio-controller@0 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <32>; + reg = <0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <SOC_PERIPHERAL_IRQ(44) IRQ_TYPE_LEVEL_HIGH>; + }; + }; + + gpio1: gpio@3021000 { + compatible = "snps,dw-apb-gpio"; + reg = <0x3021000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + portb: gpio-controller@0 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <32>; + reg = <0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <SOC_PERIPHERAL_IRQ(45) IRQ_TYPE_LEVEL_HIGH>; + }; + }; + + gpio2: gpio@3022000 { + compatible = "snps,dw-apb-gpio"; + reg = <0x3022000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + portc: gpio-controller@0 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <32>; + reg = <0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <SOC_PERIPHERAL_IRQ(46) IRQ_TYPE_LEVEL_HIGH>; + }; + }; + + gpio3: gpio@3023000 { + compatible = "snps,dw-apb-gpio"; + reg = <0x3023000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + portd: gpio-controller@0 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <32>; + reg = <0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <SOC_PERIPHERAL_IRQ(47) IRQ_TYPE_LEVEL_HIGH>; + }; + }; + + saradc: adc@30f0000 { + compatible = "sophgo,cv1800b-saradc"; + reg = <0x030f0000 0x1000>; + clocks = <&clk CLK_SARADC>; + interrupts = <SOC_PERIPHERAL_IRQ(84) IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + + channel@0 { + reg = <0>; + }; + + channel@1 { + reg = <1>; + }; + + channel@2 { + reg = <2>; + }; + }; + + i2c0: i2c@4000000 { + compatible = "snps,designware-i2c"; + reg = <0x04000000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C0>; + clock-names = "ref", "pclk"; + interrupts = <SOC_PERIPHERAL_IRQ(33) IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + + i2c1: i2c@4010000 { + compatible = "snps,designware-i2c"; + reg = <0x04010000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C1>; + clock-names = "ref", "pclk"; + interrupts = <SOC_PERIPHERAL_IRQ(34) IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + + i2c2: i2c@4020000 { + compatible = "snps,designware-i2c"; + reg = <0x04020000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C2>; + clock-names = "ref", "pclk"; + interrupts = <SOC_PERIPHERAL_IRQ(35) IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + + i2c3: i2c@4030000 { + compatible = "snps,designware-i2c"; + reg = <0x04030000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C3>; + clock-names = "ref", "pclk"; + interrupts = <SOC_PERIPHERAL_IRQ(36) IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + + i2c4: i2c@4040000 { + compatible = "snps,designware-i2c"; + reg = <0x04040000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C4>; + clock-names = "ref", "pclk"; + interrupts = <SOC_PERIPHERAL_IRQ(37) IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + + uart0: serial@4140000 { + compatible = "snps,dw-apb-uart"; + reg = <0x04140000 0x100>; + interrupts = <SOC_PERIPHERAL_IRQ(28) IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk CLK_UART0>, <&clk CLK_APB_UART0>; + clock-names = "baudclk", "apb_pclk"; + reg-shift = <2>; + reg-io-width = <4>; + status = "disabled"; + }; + + uart1: serial@4150000 { + compatible = "snps,dw-apb-uart"; + reg = <0x04150000 0x100>; + interrupts = <SOC_PERIPHERAL_IRQ(29) IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk CLK_UART1>, <&clk CLK_APB_UART1>; + clock-names = "baudclk", "apb_pclk"; + reg-shift = <2>; + reg-io-width = <4>; + status = "disabled"; + }; + + uart2: serial@4160000 { + compatible = "snps,dw-apb-uart"; + reg = <0x04160000 0x100>; + interrupts = <SOC_PERIPHERAL_IRQ(30) IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk CLK_UART2>, <&clk CLK_APB_UART2>; + clock-names = "baudclk", "apb_pclk"; + reg-shift = <2>; + reg-io-width = <4>; + status = "disabled"; + }; + + uart3: serial@4170000 { + compatible = "snps,dw-apb-uart"; + reg = <0x04170000 0x100>; + interrupts = <SOC_PERIPHERAL_IRQ(31) IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk CLK_UART3>, <&clk CLK_APB_UART3>; + clock-names = "baudclk", "apb_pclk"; + reg-shift = <2>; + reg-io-width = <4>; + status = "disabled"; + }; + + spi0: spi@4180000 { + compatible = "snps,dw-apb-ssi"; + reg = <0x04180000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&clk CLK_SPI>, <&clk CLK_APB_SPI0>; + clock-names = "ssi_clk", "pclk"; + interrupts = <SOC_PERIPHERAL_IRQ(38) IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + + spi1: spi@4190000 { + compatible = "snps,dw-apb-ssi"; + reg = <0x04190000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&clk CLK_SPI>, <&clk CLK_APB_SPI1>; + clock-names = "ssi_clk", "pclk"; + interrupts = <SOC_PERIPHERAL_IRQ(39) IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + + spi2: spi@41a0000 { + compatible = "snps,dw-apb-ssi"; + reg = <0x041a0000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&clk CLK_SPI>, <&clk CLK_APB_SPI2>; + clock-names = "ssi_clk", "pclk"; + interrupts = <SOC_PERIPHERAL_IRQ(40) IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + + spi3: spi@41b0000 { + compatible = "snps,dw-apb-ssi"; + reg = <0x041b0000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&clk CLK_SPI>, <&clk CLK_APB_SPI3>; + clock-names = "ssi_clk", "pclk"; + interrupts = <SOC_PERIPHERAL_IRQ(41) IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + + uart4: serial@41c0000 { + compatible = "snps,dw-apb-uart"; + reg = <0x041c0000 0x100>; + interrupts = <SOC_PERIPHERAL_IRQ(32) IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk CLK_UART4>, <&clk CLK_APB_UART4>; + clock-names = "baudclk", "apb_pclk"; + reg-shift = <2>; + reg-io-width = <4>; + status = "disabled"; + }; + + sdhci0: mmc@4310000 { + compatible = "sophgo,cv1800b-dwcmshc"; + reg = <0x4310000 0x1000>; + interrupts = <SOC_PERIPHERAL_IRQ(20) IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk CLK_AXI4_SD0>, + <&clk CLK_SD0>; + clock-names = "core", "bus"; + status = "disabled"; + }; + + sdhci1: mmc@4320000 { + compatible = "sophgo,cv1800b-dwcmshc"; + reg = <0x4320000 0x1000>; + interrupts = <SOC_PERIPHERAL_IRQ(22) IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk CLK_AXI4_SD1>, + <&clk CLK_SD1>; + clock-names = "core", "bus"; + status = "disabled"; + }; + + dmac: dma-controller@4330000 { + compatible = "snps,axi-dma-1.01a"; + reg = <0x04330000 0x1000>; + interrupts = <SOC_PERIPHERAL_IRQ(13) IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk CLK_SDMA_AXI>, <&clk CLK_SDMA_AXI>; + clock-names = "core-clk", "cfgr-clk"; + #dma-cells = <1>; + dma-channels = <8>; + snps,block-size = <1024 1024 1024 1024 + 1024 1024 1024 1024>; + snps,priority = <0 1 2 3 4 5 6 7>; + snps,dma-masters = <2>; + snps,data-width = <4>; + status = "disabled"; + }; + }; +}; diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi index c18822ec849f..57a01b71aa67 100644 --- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi +++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi @@ -4,9 +4,9 @@ * Copyright (C) 2023 Inochi Amaoto <inochiama@outlook.com> */ -#include <dt-bindings/clock/sophgo,cv1800.h> -#include <dt-bindings/gpio/gpio.h> -#include <dt-bindings/interrupt-controller/irq.h> +#define SOC_PERIPHERAL_IRQ(nr) ((nr) + 16) + +#include "cv18xx-periph.dtsi" / { #address-cells = <1>; @@ -41,310 +41,11 @@ cpu0_intc: interrupt-controller { }; }; - osc: oscillator { - compatible = "fixed-clock"; - clock-output-names = "osc_25m"; - #clock-cells = <0>; - }; - soc { - compatible = "simple-bus"; interrupt-parent = <&plic>; - #address-cells = <1>; - #size-cells = <1>; dma-noncoherent; ranges; - clk: clock-controller@3002000 { - reg = <0x03002000 0x1000>; - clocks = <&osc>; - #clock-cells = <1>; - }; - - gpio0: gpio@3020000 { - compatible = "snps,dw-apb-gpio"; - reg = <0x3020000 0x1000>; - #address-cells = <1>; - #size-cells = <0>; - - porta: gpio-controller@0 { - compatible = "snps,dw-apb-gpio-port"; - gpio-controller; - #gpio-cells = <2>; - ngpios = <32>; - reg = <0>; - interrupt-controller; - #interrupt-cells = <2>; - interrupts = <60 IRQ_TYPE_LEVEL_HIGH>; - }; - }; - - gpio1: gpio@3021000 { - compatible = "snps,dw-apb-gpio"; - reg = <0x3021000 0x1000>; - #address-cells = <1>; - #size-cells = <0>; - - portb: gpio-controller@0 { - compatible = "snps,dw-apb-gpio-port"; - gpio-controller; - #gpio-cells = <2>; - ngpios = <32>; - reg = <0>; - interrupt-controller; - #interrupt-cells = <2>; - interrupts = <61 IRQ_TYPE_LEVEL_HIGH>; - }; - }; - - gpio2: gpio@3022000 { - compatible = "snps,dw-apb-gpio"; - reg = <0x3022000 0x1000>; - #address-cells = <1>; - #size-cells = <0>; - - portc: gpio-controller@0 { - compatible = "snps,dw-apb-gpio-port"; - gpio-controller; - #gpio-cells = <2>; - ngpios = <32>; - reg = <0>; - interrupt-controller; - #interrupt-cells = <2>; - interrupts = <62 IRQ_TYPE_LEVEL_HIGH>; - }; - }; - - gpio3: gpio@3023000 { - compatible = "snps,dw-apb-gpio"; - reg = <0x3023000 0x1000>; - #address-cells = <1>; - #size-cells = <0>; - - portd: gpio-controller@0 { - compatible = "snps,dw-apb-gpio-port"; - gpio-controller; - #gpio-cells = <2>; - ngpios = <32>; - reg = <0>; - interrupt-controller; - #interrupt-cells = <2>; - interrupts = <63 IRQ_TYPE_LEVEL_HIGH>; - }; - }; - - saradc: adc@30f0000 { - compatible = "sophgo,cv1800b-saradc"; - reg = <0x030f0000 0x1000>; - clocks = <&clk CLK_SARADC>; - interrupts = <100 IRQ_TYPE_LEVEL_HIGH>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - - channel@0 { - reg = <0>; - }; - - channel@1 { - reg = <1>; - }; - - channel@2 { - reg = <2>; - }; - }; - - i2c0: i2c@4000000 { - compatible = "snps,designware-i2c"; - reg = <0x04000000 0x10000>; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C0>; - clock-names = "ref", "pclk"; - interrupts = <49 IRQ_TYPE_LEVEL_HIGH>; - status = "disabled"; - }; - - i2c1: i2c@4010000 { - compatible = "snps,designware-i2c"; - reg = <0x04010000 0x10000>; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C1>; - clock-names = "ref", "pclk"; - interrupts = <50 IRQ_TYPE_LEVEL_HIGH>; - status = "disabled"; - }; - - i2c2: i2c@4020000 { - compatible = "snps,designware-i2c"; - reg = <0x04020000 0x10000>; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C2>; - clock-names = "ref", "pclk"; - interrupts = <51 IRQ_TYPE_LEVEL_HIGH>; - status = "disabled"; - }; - - i2c3: i2c@4030000 { - compatible = "snps,designware-i2c"; - reg = <0x04030000 0x10000>; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C3>; - clock-names = "ref", "pclk"; - interrupts = <52 IRQ_TYPE_LEVEL_HIGH>; - status = "disabled"; - }; - - i2c4: i2c@4040000 { - compatible = "snps,designware-i2c"; - reg = <0x04040000 0x10000>; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&clk CLK_I2C>, <&clk CLK_APB_I2C4>; - clock-names = "ref", "pclk"; - interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; - status = "disabled"; - }; - - uart0: serial@4140000 { - compatible = "snps,dw-apb-uart"; - reg = <0x04140000 0x100>; - interrupts = <44 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk CLK_UART0>, <&clk CLK_APB_UART0>; - clock-names = "baudclk", "apb_pclk"; - reg-shift = <2>; - reg-io-width = <4>; - status = "disabled"; - }; - - uart1: serial@4150000 { - compatible = "snps,dw-apb-uart"; - reg = <0x04150000 0x100>; - interrupts = <45 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk CLK_UART1>, <&clk CLK_APB_UART1>; - clock-names = "baudclk", "apb_pclk"; - reg-shift = <2>; - reg-io-width = <4>; - status = "disabled"; - }; - - uart2: serial@4160000 { - compatible = "snps,dw-apb-uart"; - reg = <0x04160000 0x100>; - interrupts = <46 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk CLK_UART2>, <&clk CLK_APB_UART2>; - clock-names = "baudclk", "apb_pclk"; - reg-shift = <2>; - reg-io-width = <4>; - status = "disabled"; - }; - - uart3: serial@4170000 { - compatible = "snps,dw-apb-uart"; - reg = <0x04170000 0x100>; - interrupts = <47 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk CLK_UART3>, <&clk CLK_APB_UART3>; - clock-names = "baudclk", "apb_pclk"; - reg-shift = <2>; - reg-io-width = <4>; - status = "disabled"; - }; - - spi0: spi@4180000 { - compatible = "snps,dw-apb-ssi"; - reg = <0x04180000 0x10000>; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&clk CLK_SPI>, <&clk CLK_APB_SPI0>; - clock-names = "ssi_clk", "pclk"; - interrupts = <54 IRQ_TYPE_LEVEL_HIGH>; - status = "disabled"; - }; - - spi1: spi@4190000 { - compatible = "snps,dw-apb-ssi"; - reg = <0x04190000 0x10000>; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&clk CLK_SPI>, <&clk CLK_APB_SPI1>; - clock-names = "ssi_clk", "pclk"; - interrupts = <55 IRQ_TYPE_LEVEL_HIGH>; - status = "disabled"; - }; - - spi2: spi@41a0000 { - compatible = "snps,dw-apb-ssi"; - reg = <0x041a0000 0x10000>; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&clk CLK_SPI>, <&clk CLK_APB_SPI2>; - clock-names = "ssi_clk", "pclk"; - interrupts = <56 IRQ_TYPE_LEVEL_HIGH>; - status = "disabled"; - }; - - spi3: spi@41b0000 { - compatible = "snps,dw-apb-ssi"; - reg = <0x041b0000 0x10000>; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&clk CLK_SPI>, <&clk CLK_APB_SPI3>; - clock-names = "ssi_clk", "pclk"; - interrupts = <57 IRQ_TYPE_LEVEL_HIGH>; - status = "disabled"; - }; - - uart4: serial@41c0000 { - compatible = "snps,dw-apb-uart"; - reg = <0x041c0000 0x100>; - interrupts = <48 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk CLK_UART4>, <&clk CLK_APB_UART4>; - clock-names = "baudclk", "apb_pclk"; - reg-shift = <2>; - reg-io-width = <4>; - status = "disabled"; - }; - - sdhci0: mmc@4310000 { - compatible = "sophgo,cv1800b-dwcmshc"; - reg = <0x4310000 0x1000>; - interrupts = <36 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk CLK_AXI4_SD0>, - <&clk CLK_SD0>; - clock-names = "core", "bus"; - status = "disabled"; - }; - - sdhci1: mmc@4320000 { - compatible = "sophgo,cv1800b-dwcmshc"; - reg = <0x4320000 0x1000>; - interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk CLK_AXI4_SD1>, - <&clk CLK_SD1>; - clock-names = "core", "bus"; - status = "disabled"; - }; - - dmac: dma-controller@4330000 { - compatible = "snps,axi-dma-1.01a"; - reg = <0x04330000 0x1000>; - interrupts = <29 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk CLK_SDMA_AXI>, <&clk CLK_SDMA_AXI>; - clock-names = "core-clk", "cfgr-clk"; - #dma-cells = <1>; - dma-channels = <8>; - snps,block-size = <1024 1024 1024 1024 - 1024 1024 1024 1024>; - snps,priority = <0 1 2 3 4 5 6 7>; - snps,dma-masters = <2>; - snps,data-width = <4>; - status = "disabled"; - }; - plic: interrupt-controller@70000000 { reg = <0x70000000 0x4000000>; interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
Make the peripheral device tree re-usable on ARM64 platform by splitting it into CPU-core specific and peripheral parts. Add SOC_PERIPHERAL_IRQ() macro which explicitly maps peripheral nubering into "plic" interrupt-controller numbering. Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> --- arch/riscv/boot/dts/sophgo/cv181x.dtsi | 2 +- arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi | 313 ++++++++++++++++++ arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 305 +---------------- 3 files changed, 317 insertions(+), 303 deletions(-) create mode 100644 arch/riscv/boot/dts/sophgo/cv18xx-periph.dtsi