riscv: sophgo: cv18xx: dts rework, part 1
Subsystems (3)
Inochi Amaoto
maintainercover riscv: sophgo: cv18xx: dts rework, part 1
It is a hard time to maintain cv18xx/sg200x device tree file, as it uses something that dts override, shared peripheral header and something hard to migrate arm64 arch. So it is time to rework the device tree file and reduce potential problems.
The part 1 change mainly focus on the format of the current dts file, and try to make them easy to understand and adpat for the arm64 arch.
Inochi Amaoto (4):
riscv: dts: sophgo: Move all soc specific device into soc dtsi file
riscv: dts: sophgo: Move riscv cpu definition to a separate file
riscv: dts: sophgo: rename header file cv18xx.dtsi to cv180x.dtsi
riscv: dts: sopgho: use SOC_PERIPHERAL_IRQ to calculate interrupt
number
arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 43 ++++++---
arch/riscv/boot/dts/sophgo/cv180x-cpus.dtsi | 36 +++++++
.../dts/sophgo/{cv18xx.dtsi => cv180x.dtsi} | 95 +++++--------------
arch/riscv/boot/dts/sophgo/cv1812h.dtsi | 43 ++++++---
arch/riscv/boot/dts/sophgo/cv181x.dtsi | 2 +-
arch/riscv/boot/dts/sophgo/sg2002.dtsi | 43 ++++++---
6 files changed, 149 insertions(+), 113 deletions(-)
create mode 100644 arch/riscv/boot/dts/sophgo/cv180x-cpus.dtsi
rename arch/riscv/boot/dts/sophgo/{cv18xx.dtsi => cv180x.dtsi} (75%)--
2.49.0
Inochi Amaoto
maintainerPATCH 1/4 riscv: dts: sophgo: Move all soc specific device into soc dtsi file
Although the cv1800b/cv1812h/sg2000/sg2002 share most peripherals, some basic peripherals, like clock, pinctrl, clint and plint, are not shared. These are caused by not only historical reason (plic, clint), but also the fact the device is not the same (clock, pinctrl).
It is good to override device compatible when the soc number is small, but now it is a burden for maintenance, and it is kind of annoyed to explain why using override. So it is time to move this out of the common peripheral header.
Move all soc related peripherla device from common peripheral header to the soc specific header to get rid of most compatible override.
--- arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 38 +++++++++++++++++-------- arch/riscv/boot/dts/sophgo/cv1812h.dtsi | 38 +++++++++++++++++-------- arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 22 -------------- arch/riscv/boot/dts/sophgo/sg2002.dtsi | 38 +++++++++++++++++-------- 4 files changed, 78 insertions(+), 58 deletions(-)
arch/riscv/boot/dts/sophgo/cv1800b.dtsi +26 -12
@@ -15,23 +15,37 @@ memory@80000000 { }; soc { + interrupt-parent = <&plic>; + dma-noncoherent; + pinctrl: pinctrl@3001000 { compatible = "sophgo,cv1800b-pinctrl"; reg = <0x03001000 0x1000>, <0x05027000 0x1000>; reg-names = "sys", "rtc"; }; + + clk: clock-controller@3002000 { + compatible = "sophgo,cv1800-clk"; + reg = <0x03002000 0x1000>; + clocks = <&osc>; + #clock-cells = <1>; + }; + + plic: interrupt-controller@70000000 { + compatible = "sophgo,cv1800b-plic", "thead,c900-plic"; + reg = <0x70000000 0x4000000>; + interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + riscv,ndev = <101>; + }; + + clint: timer@74000000 { + compatible = "sophgo,cv1800b-clint", "thead,c900-clint"; + reg = <0x74000000 0x10000>; + interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>; + }; }; }; - -&plic { - compatible = "sophgo,cv1800b-plic", "thead,c900-plic"; -}; - -&clint { - compatible = "sophgo,cv1800b-clint", "thead,c900-clint"; -}; - -&clk { - compatible = "sophgo,cv1800-clk"; -};
arch/riscv/boot/dts/sophgo/cv1812h.dtsi +26 -12
@@ -17,23 +17,37 @@ memory@80000000 { }; soc { + interrupt-parent = <&plic>; + dma-noncoherent; + pinctrl: pinctrl@3001000 { compatible = "sophgo,cv1812h-pinctrl"; reg = <0x03001000 0x1000>, <0x05027000 0x1000>; reg-names = "sys", "rtc"; }; + + clk: clock-controller@3002000 { + compatible = "sophgo,cv1810-clk"; + reg = <0x03002000 0x1000>; + clocks = <&osc>; + #clock-cells = <1>; + }; + + plic: interrupt-controller@70000000 { + compatible = "sophgo,cv1812h-plic", "thead,c900-plic"; + reg = <0x70000000 0x4000000>; + interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + riscv,ndev = <101>; + }; + + clint: timer@74000000 { + compatible = "sophgo,cv1812h-clint", "thead,c900-clint"; + reg = <0x74000000 0x10000>; + interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>; + }; }; }; - -&plic { - compatible = "sophgo,cv1812h-plic", "thead,c900-plic"; -}; - -&clint { - compatible = "sophgo,cv1812h-clint", "thead,c900-clint"; -}; - -&clk { - compatible = "sophgo,cv1810-clk"; -};
arch/riscv/boot/dts/sophgo/cv18xx.dtsi +0 -22
@@ -49,18 +49,10 @@ osc: oscillator { 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>;
@@ -344,19 +336,5 @@ dmac: dma-controller@4330000 { snps,data-width = <4>; status = "disabled"; }; - - plic: interrupt-controller@70000000 { - reg = <0x70000000 0x4000000>; - interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>; - interrupt-controller; - #address-cells = <0>; - #interrupt-cells = <2>; - riscv,ndev = <101>; - }; - - clint: timer@74000000 { - reg = <0x74000000 0x10000>; - interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>; - }; }; };
arch/riscv/boot/dts/sophgo/sg2002.dtsi +26 -12
@@ -17,27 +17,41 @@ memory@80000000 { }; soc { + interrupt-parent = <&plic>; + dma-noncoherent; + pinctrl: pinctrl@3001000 { compatible = "sophgo,sg2002-pinctrl"; reg = <0x03001000 0x1000>, <0x05027000 0x1000>; reg-names = "sys", "rtc"; }; + + clk: clock-controller@3002000 { + compatible = "sophgo,sg2000-clk"; + reg = <0x03002000 0x1000>; + clocks = <&osc>; + #clock-cells = <1>; + }; + + plic: interrupt-controller@70000000 { + compatible = "sophgo,sg2002-plic", "thead,c900-plic"; + reg = <0x70000000 0x4000000>; + interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + riscv,ndev = <101>; + }; + + clint: timer@74000000 { + compatible = "sophgo,sg2002-clint", "thead,c900-clint"; + reg = <0x74000000 0x10000>; + interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>; + }; }; }; -&plic { - compatible = "sophgo,sg2002-plic", "thead,c900-plic"; -}; - -&clint { - compatible = "sophgo,sg2002-clint", "thead,c900-clint"; -}; - -&clk { - compatible = "sophgo,sg2000-clk"; -}; - &sdhci0 { compatible = "sophgo,sg2002-dwcmshc"; };
Signature · 1 line
2.49.0
Re: [PATCH 1/4] riscv: dts: sophgo: Move all soc specific device into soc dtsi file
Hi Inochi!
Quoted 10 lines · Inochi Amaoto
Although the cv1800b/cv1812h/sg2000/sg2002 share most peripherals, some basic peripherals, like clock, pinctrl, clint and plint, are not shared. These are caused by not only historical reason (plic, clint), but also the fact the device is not the same (clock, pinctrl).
It is good to override device compatible when the soc number is small, but now it is a burden for maintenance, and it is kind of annoyed to explain why using override. So it is time to move this out of the common peripheral header.
Quoted 4 lines
Move all soc related peripherla device from common peripheral header to the soc specific header to get rid of most compatible override.
Signed-off-by Inochi Amaoto <[email protected]>
Quoted 6 lines
---
arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 38 +++++++++++++++++--------arch/riscv/boot/dts/sophgo/cv1812h.dtsi| 38 +++++++++++++++++-------- arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 22 -------------- arch/riscv/boot/dts/sophgo/sg2002.dtsi | 38 +++++++++++++++++--------4 files changed, 78 insertions(+), 58 deletions(-)
Signature · 1 line
Alexander Sverdlin.
Re: [PATCH 1/4] riscv: dts: sophgo: Move all soc specific device into soc dtsi file
In reply to Inochi AmaotoQuoted 6 lines · Inochi Amaoto
Although the cv1800b/cv1812h/sg2000/sg2002 share most peripherals, some basic peripherals, like clock, pinctrl, clint and plint, are not shared. These are caused by not only historical reason (plic, clint), but also the fact the device is not the same (clock, pinctrl).
It is good to override device compatible when the soc number is small,
~~~SoC, we usually
Quoted 5 lines
but now it is a burden for maintenance, and it is kind of annoyed to explain why using override. So it is time to move this out of the common peripheral header.
Move all soc related peripherla device from common peripheral header
~~~~~~~~~~typo, peripheral
Quoted 3 lines
to the soc specific header to get rid of most compatible override.
Signed-off-by Inochi Amaoto <[email protected]>
otherwise, looks good
Quoted 219 lines
--- arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 38 +++++++++++++++++-------- arch/riscv/boot/dts/sophgo/cv1812h.dtsi | 38 +++++++++++++++++-------- arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 22 -------------- arch/riscv/boot/dts/sophgo/sg2002.dtsi | 38 +++++++++++++++++-------- 4 files changed, 78 insertions(+), 58 deletions(-)arch/riscv/boot/dts/sophgo/cv1800b.dtsi +26
-12@@ -15,23 +15,37 @@ memory@80000000 { }; soc { + interrupt-parent = <&plic>; + dma-noncoherent; + pinctrl: pinctrl@3001000 { compatible = "sophgo,cv1800b-pinctrl"; reg = <0x03001000 0x1000>, <0x05027000 0x1000>; reg-names = "sys", "rtc"; }; + + clk: clock-controller@3002000 { + compatible = "sophgo,cv1800-clk"; + reg = <0x03002000 0x1000>; + clocks = <&osc>; + #clock-cells = <1>; + }; + + plic: interrupt-controller@70000000 { + compatible = "sophgo,cv1800b-plic", "thead,c900-plic"; + reg = <0x70000000 0x4000000>; + interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + riscv,ndev = <101>; + }; + + clint: timer@74000000 { + compatible = "sophgo,cv1800b-clint", "thead,c900-clint"; + reg = <0x74000000 0x10000>; + interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>; + }; }; }; - -&plic { - compatible = "sophgo,cv1800b-plic", "thead,c900-plic"; -}; - -&clint { - compatible = "sophgo,cv1800b-clint", "thead,c900-clint"; -}; - -&clk { - compatible = "sophgo,cv1800-clk"; -};arch/riscv/boot/dts/sophgo/cv1812h.dtsi +26
-12@@ -17,23 +17,37 @@ memory@80000000 { }; soc { + interrupt-parent = <&plic>; + dma-noncoherent; + pinctrl: pinctrl@3001000 { compatible = "sophgo,cv1812h-pinctrl"; reg = <0x03001000 0x1000>, <0x05027000 0x1000>; reg-names = "sys", "rtc"; }; + + clk: clock-controller@3002000 { + compatible = "sophgo,cv1810-clk"; + reg = <0x03002000 0x1000>; + clocks = <&osc>; + #clock-cells = <1>; + }; + + plic: interrupt-controller@70000000 { + compatible = "sophgo,cv1812h-plic", "thead,c900-plic"; + reg = <0x70000000 0x4000000>; + interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + riscv,ndev = <101>; + }; + + clint: timer@74000000 { + compatible = "sophgo,cv1812h-clint", "thead,c900-clint"; + reg = <0x74000000 0x10000>; + interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>; + }; }; }; - -&plic { - compatible = "sophgo,cv1812h-plic", "thead,c900-plic"; -}; - -&clint { - compatible = "sophgo,cv1812h-clint", "thead,c900-clint"; -}; - -&clk { - compatible = "sophgo,cv1810-clk"; -};arch/riscv/boot/dts/sophgo/cv18xx.dtsi +0
-22@@ -49,18 +49,10 @@ osc: oscillator { 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>;@@ -344,19 +336,5 @@ dmac: dma-controller@4330000 { snps,data-width = <4>; status = "disabled"; }; - - plic: interrupt-controller@70000000 { - reg = <0x70000000 0x4000000>; - interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>; - interrupt-controller; - #address-cells = <0>; - #interrupt-cells = <2>; - riscv,ndev = <101>; - }; - - clint: timer@74000000 { - reg = <0x74000000 0x10000>; - interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>; - }; }; };arch/riscv/boot/dts/sophgo/sg2002.dtsi +26
-12@@ -17,27 +17,41 @@ memory@80000000 { }; soc { + interrupt-parent = <&plic>; + dma-noncoherent; + pinctrl: pinctrl@3001000 { compatible = "sophgo,sg2002-pinctrl"; reg = <0x03001000 0x1000>, <0x05027000 0x1000>; reg-names = "sys", "rtc"; }; + + clk: clock-controller@3002000 { + compatible = "sophgo,sg2000-clk"; + reg = <0x03002000 0x1000>; + clocks = <&osc>; + #clock-cells = <1>; + }; + + plic: interrupt-controller@70000000 { + compatible = "sophgo,sg2002-plic", "thead,c900-plic"; + reg = <0x70000000 0x4000000>; + interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + riscv,ndev = <101>; + }; + + clint: timer@74000000 { + compatible = "sophgo,sg2002-clint", "thead,c900-clint"; + reg = <0x74000000 0x10000>; + interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>; + }; }; }; -&plic { - compatible = "sophgo,sg2002-plic", "thead,c900-plic"; -}; - -&clint { - compatible = "sophgo,sg2002-clint", "thead,c900-clint"; -}; - -&clk { - compatible = "sophgo,sg2000-clk"; -}; - &sdhci0 { compatible = "sophgo,sg2002-dwcmshc"; };Signature · 1 line
2.49.0
Signature · 1 line
Yixun Lan (dlan)
Inochi Amaoto
maintainerPATCH 2/4 riscv: dts: sophgo: Move riscv cpu definition to a separate file
In reply to Inochi AmaotoAs sg2000 and sg2002 can boot from an arm a53 core, it is not suitable to left the riscv cpu definition in the common peripheral header.
Move the riscv related device into a separate header file, so the arm subsystem can reuse the common peripheral header.
--- arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 1 + arch/riscv/boot/dts/sophgo/cv180x-cpus.dtsi | 36 +++++++++++++++++++++ arch/riscv/boot/dts/sophgo/cv1812h.dtsi | 1 + arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 29 ----------------- arch/riscv/boot/dts/sophgo/sg2002.dtsi | 1 + 5 files changed, 39 insertions(+), 29 deletions(-) create mode 100644 arch/riscv/boot/dts/sophgo/cv180x-cpus.dtsi
arch/riscv/boot/dts/sophgo/cv1800b.dtsi +1 -0
@@ -4,6 +4,7 @@ */ #include <dt-bindings/pinctrl/pinctrl-cv1800b.h> +#include "cv180x-cpus.dtsi" #include "cv18xx.dtsi" / {
arch/riscv/boot/dts/sophgo/cv180x-cpus.dtsi new file +36 -0
@@ -0,0 +1,36 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2023 Jisheng Zhang <[email protected]> + * Copyright (C) 2023 Inochi Amaoto <[email protected]> + */ + +/ { + cpus: cpus { + #address-cells = <1>; + #size-cells = <0>; + timebase-frequency = <25000000>; + + cpu0: cpu@0 { + compatible = "thead,c906", "riscv"; + device_type = "cpu"; + reg = <0>; + d-cache-block-size = <64>; + d-cache-sets = <512>; + d-cache-size = <65536>; + i-cache-block-size = <64>; + i-cache-sets = <128>; + i-cache-size = <32768>; + mmu-type = "riscv,sv39"; + riscv,isa = "rv64imafdc"; + riscv,isa-base = "rv64i"; + riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "zicntr", "zicsr", + "zifencei", "zihpm"; + + cpu0_intc: interrupt-controller { + compatible = "riscv,cpu-intc"; + interrupt-controller; + #interrupt-cells = <1>; + }; + }; + }; +};
arch/riscv/boot/dts/sophgo/cv1812h.dtsi +1 -0
@@ -5,6 +5,7 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/pinctrl/pinctrl-cv1812h.h> +#include "cv180x-cpus.dtsi" #include "cv18xx.dtsi" #include "cv181x.dtsi"
arch/riscv/boot/dts/sophgo/cv18xx.dtsi +0 -29
@@ -12,35 +12,6 @@ / { #address-cells = <1>; #size-cells = <1>; - cpus: cpus { - #address-cells = <1>; - #size-cells = <0>; - timebase-frequency = <25000000>; - - cpu0: cpu@0 { - compatible = "thead,c906", "riscv"; - device_type = "cpu"; - reg = <0>; - d-cache-block-size = <64>; - d-cache-sets = <512>; - d-cache-size = <65536>; - i-cache-block-size = <64>; - i-cache-sets = <128>; - i-cache-size = <32768>; - mmu-type = "riscv,sv39"; - riscv,isa = "rv64imafdc"; - riscv,isa-base = "rv64i"; - riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "zicntr", "zicsr", - "zifencei", "zihpm"; - - cpu0_intc: interrupt-controller { - compatible = "riscv,cpu-intc"; - interrupt-controller; - #interrupt-cells = <1>; - }; - }; - }; - osc: oscillator { compatible = "fixed-clock"; clock-output-names = "osc_25m";
arch/riscv/boot/dts/sophgo/sg2002.dtsi +1 -0
@@ -5,6 +5,7 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/pinctrl/pinctrl-sg2002.h> +#include "cv180x-cpus.dtsi" #include "cv18xx.dtsi" #include "cv181x.dtsi"
Signature · 1 line
2.49.0
Inochi Amaoto
maintainerPATCH 3/4 riscv: dts: sophgo: rename header file cv18xx.dtsi to cv180x.dtsi
In reply to Inochi AmaotoAs the cv18xx.dtsi serves as a common peripheral header for all riscv cv180x/cv181x/sg200x SoCs, it not cover the entire cv18xx series as there is cv182x and cv183x. So rename the header file to make it precise.
---
arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 2 +-
arch/riscv/boot/dts/sophgo/{cv18xx.dtsi => cv180x.dtsi} | 0
arch/riscv/boot/dts/sophgo/cv1812h.dtsi | 2 +-
arch/riscv/boot/dts/sophgo/sg2002.dtsi | 2 +-
4 files changed, 3 insertions(+), 3 deletions(-)
rename arch/riscv/boot/dts/sophgo/{cv18xx.dtsi => cv180x.dtsi} (100%)arch/riscv/boot/dts/sophgo/cv1800b.dtsi +1 -1
@@ -5,7 +5,7 @@ #include <dt-bindings/pinctrl/pinctrl-cv1800b.h> #include "cv180x-cpus.dtsi" -#include "cv18xx.dtsi" +#include "cv180x.dtsi" / { compatible = "sophgo,cv1800b";
arch/riscv/boot/dts/sophgo/cv180x.dtsi renamed from arch/riscv/boot/dts/sophgo/cv18xx.dtsi +0 -0
arch/riscv/boot/dts/sophgo/cv1812h.dtsi +1 -1
@@ -6,7 +6,7 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/pinctrl/pinctrl-cv1812h.h> #include "cv180x-cpus.dtsi" -#include "cv18xx.dtsi" +#include "cv180x.dtsi" #include "cv181x.dtsi" / {
arch/riscv/boot/dts/sophgo/sg2002.dtsi +1 -1
@@ -6,7 +6,7 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/pinctrl/pinctrl-sg2002.h> #include "cv180x-cpus.dtsi" -#include "cv18xx.dtsi" +#include "cv180x.dtsi" #include "cv181x.dtsi" / {
Signature · 1 line
2.49.0
Re: [PATCH 3/4] riscv: dts: sophgo: rename header file cv18xx.dtsi to cv180x.dtsi
Hi Inochi!
Quoted 2 lines · Inochi Amaoto
As the
cv18xx.dtsiserves as a common peripheral header for all riscv cv180x/cv181x/sg200x SoCs, it not cover the entire cv18xx
^
doesQuoted 4 lines
series as there is cv182x and cv183x. So rename the header file to make it precise.
Signed-off-by Inochi Amaoto <[email protected]>
Quoted 7 lines
---
arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 2 +-arch/riscv/boot/dts/sophgo/{cv18xx.dtsi=>cv180x.dtsi} | 0 arch/riscv/boot/dts/sophgo/cv1812h.dtsi | 2 +- arch/riscv/boot/dts/sophgo/sg2002.dtsi | 2 +-4 files changed, 3 insertions(+), 3 deletions(-)rename
arch/riscv/boot/dts/sophgo/{cv18xx.dtsi=>cv180x.dtsi} (100%)
Signature · 1 line
Alexander Sverdlin.
Inochi Amaoto
maintainerPATCH 4/4 riscv: dts: sopgho: use SOC_PERIPHERAL_IRQ to calculate interrupt number
In reply to Inochi AmaotoSince riscv and arm architecture use different interrupt definitions, use a macro SOC_PERIPHERAL_IRQ mask this difference.
--- arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 2 ++ arch/riscv/boot/dts/sophgo/cv180x.dtsi | 44 ++++++++++++------------- arch/riscv/boot/dts/sophgo/cv1812h.dtsi | 2 ++ arch/riscv/boot/dts/sophgo/cv181x.dtsi | 2 +- arch/riscv/boot/dts/sophgo/sg2002.dtsi | 2 ++ 5 files changed, 29 insertions(+), 23 deletions(-)
arch/riscv/boot/dts/sophgo/cv1800b.dtsi +2 -0
@@ -3,6 +3,8 @@ * Copyright (C) 2023 Jisheng Zhang <[email protected]> */ +#define SOC_PERIPHERAL_IRQ(nr) ((nr) + 16) + #include <dt-bindings/pinctrl/pinctrl-cv1800b.h> #include "cv180x-cpus.dtsi" #include "cv180x.dtsi"
arch/riscv/boot/dts/sophgo/cv180x.dtsi +22 -22
176 lines not on this page · raw message
arch/riscv/boot/dts/sophgo/cv1812h.dtsi +2 -0
@@ -3,6 +3,8 @@ * Copyright (C) 2023 Inochi Amaoto <[email protected]> */ +#define SOC_PERIPHERAL_IRQ(nr) ((nr) + 16) + #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/pinctrl/pinctrl-cv1812h.h> #include "cv180x-cpus.dtsi"
arch/riscv/boot/dts/sophgo/cv181x.dtsi +1 -1
@@ -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";
arch/riscv/boot/dts/sophgo/sg2002.dtsi +2 -0
@@ -3,6 +3,8 @@ * Copyright (C) 2024 Thomas Bonnefille <[email protected]> */ +#define SOC_PERIPHERAL_IRQ(nr) ((nr) + 16) + #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/pinctrl/pinctrl-sg2002.h> #include "cv180x-cpus.dtsi"
Signature · 1 line
2.49.0
Quoted 10 lines · Inochi Amaoto
It is a hard time to maintain cv18xx/sg200x device tree file, as it uses something that dts override, shared peripheral header and something hard to migrate arm64 arch. So it is time to rework the device tree file and reduce potential problems.
The part 1 change mainly focus on the format of the current dts file, and try to make them easy to understand and adpat for the arm64 arch.
[...]
Applied to for-next, thanks!
[1/4] riscv: dts: sophgo: Move all soc specific device into soc dtsi file
https://github.com/sophgo/linux/commit/e07daed2a1577ec5b9eafcfa0b690d4082661024 [2/4] riscv: dts: sophgo: Move riscv cpu definition to a separate file https://github.com/sophgo/linux/commit/4f6d5f22f94db169b58809de57db2fe95ce3fa35 [3/4] riscv: dts: sophgo: rename header file cv18xx.dtsi to cv180x.dtsi https://github.com/sophgo/linux/commit/4a7f2bba7bdb2d3afbca8d40268503d32868c325 [4/4] riscv: dts: sopgho: use SOC_PERIPHERAL_IRQ to calculate interrupt number https://github.com/sophgo/linux/commit/53cf91b37246948935de7147d09ae6a98070400f
Thanks,
Inochi