Skip to contentSkip to conversation

csky: dts: Add NationalChip GX6605S

PATCH In review Andreas Färber 2 participants 4 messages Jun 25, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 csky: dts: Add NationalChip GX6605S

Add Device Trees for NationalChip GX6605S SoC (based on CK610 CPU) and its dev board. GxLoader expects as filename gx6605s.dtb, so keep that. The bootargs are prepared to boot from USB and to output to serial.

Compatibles for the SoC and board are left out for now.

---
 arch/csky/boot/dts/gx6605s.dts  | 104 ++++++++++++++++++++++++++++++++++++++++
 arch/csky/boot/dts/gx6605s.dtsi |  82 +++++++++++++++++++++++++++++++
 2 files changed, 186 insertions(+)
 create mode 100644 arch/csky/boot/dts/gx6605s.dts
 create mode 100644 arch/csky/boot/dts/gx6605s.dtsi
arch/csky/boot/dts/gx6605s.dts new file +104 -0
new file mode 100644
index 000000000000..f7511024ec6f
@@ -0,0 +1,104 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause */
+/*
+ * GX6605S dev board
+ *
+ * Copyright (c) 2019 Andreas Färber
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+
+#include "gx6605s.dtsi"
+
+/ {
+	model = "Nationalchip GX6605S";
+
+	aliases {
+		serial0 = &uart;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 root=/dev/sda2 rw rootwait";
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@10000000 {
+		device_type = "memory";
+		reg = <0x10000000 0x04000000>;
+	};
+
+	dummy_apb_clk: dummy-apb-clk {
+		compatible = "fixed-clock";
+		clock-frequency = <24000000>; /* guesstimate */
+		#clock-cells = <0>;
+	};
+
+	buttons {
+		compatible = "gpio-keys-polled";
+		poll-interval = <100>;
+		autorepeat;
+
+		button5 {
+			label = "button5";
+			linux,code = <103>;
+			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
+		};
+
+		button6 {
+			label = "button6";
+			linux,code = <106>;
+			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
+		};
+
+		button7 {
+			label = "button7";
+			linux,code = <28>;
+			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+		};
+
+		button8 {
+			label = "button8";
+			linux,code = <105>;
+			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+		};
+
+		button9 {
+			label = "button9";
+			linux,code = <108>;
+			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led0 {
+			label = "led10";
+			gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "heartbeat";
+		};
+
+		led1 {
+			label = "led11";
+			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "timer";
+		};
+
+		led2 {
+			label = "led12";
+			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "default-on";
+		};
+
+		led3 {
+			label = "led13";
+			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "default-on";
+		};
+	};
+};
+
+&timer0 {
+		clocks = <&dummy_apb_clk>;
+};
arch/csky/boot/dts/gx6605s.dtsi new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
2.16.4
maintainer
#1 lore raw

Thx for the patch. No need seperate part into dtsi, just follow:
https://lore.kernel.org/linux-csky/[email protected]/T/#u

Quoted 216 lines · Andreas Färber

Add Device Trees for NationalChip GX6605S SoC (based on CK610 CPU) and its dev board. GxLoader expects as filename gx6605s.dtb, so keep that. The bootargs are prepared to boot from USB and to output to serial.

Compatibles for the SoC and board are left out for now.

---
 arch/csky/boot/dts/gx6605s.dts  | 104 ++++++++++++++++++++++++++++++++++++++++
 arch/csky/boot/dts/gx6605s.dtsi |  82 +++++++++++++++++++++++++++++++
 2 files changed, 186 insertions(+)
 create mode 100644 arch/csky/boot/dts/gx6605s.dts
 create mode 100644 arch/csky/boot/dts/gx6605s.dtsi
arch/csky/boot/dts/gx6605s.dts new file +104 -0
new file mode 100644
index 000000000000..f7511024ec6f
@@ -0,0 +1,104 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause */
+/*
+ * GX6605S dev board
+ *
+ * Copyright (c) 2019 Andreas Färber
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+
+#include "gx6605s.dtsi"
+
+/ {
+       model = "Nationalchip GX6605S";
+
+       aliases {
+               serial0 = &uart;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8 root=/dev/sda2 rw rootwait";
+               stdout-path = "serial0:115200n8";
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x04000000>;
+       };
+
+       dummy_apb_clk: dummy-apb-clk {
+               compatible = "fixed-clock";
+               clock-frequency = <24000000>; /* guesstimate */
+               #clock-cells = <0>;
+       };
+
+       buttons {
+               compatible = "gpio-keys-polled";
+               poll-interval = <100>;
+               autorepeat;
+
+               button5 {
+                       label = "button5";
+                       linux,code = <103>;
+                       gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
+               };
+
+               button6 {
+                       label = "button6";
+                       linux,code = <106>;
+                       gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
+               };
+
+               button7 {
+                       label = "button7";
+                       linux,code = <28>;
+                       gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+               };
+
+               button8 {
+                       label = "button8";
+                       linux,code = <105>;
+                       gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+               };
+
+               button9 {
+                       label = "button9";
+                       linux,code = <108>;
+                       gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led0 {
+                       label = "led10";
+                       gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1 {
+                       label = "led11";
+                       gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "timer";
+               };
+
+               led2 {
+                       label = "led12";
+                       gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "default-on";
+               };
+
+               led3 {
+                       label = "led13";
+                       gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "default-on";
+               };
+       };
+};
+
+&timer0 {
+               clocks = <&dummy_apb_clk>;
+};
arch/csky/boot/dts/gx6605s.dtsi new file +82 -1
new file mode 100644
index 000000000000..956af5674add
@@ -0,0 +1,82 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause */
+/*
+ * NationalChip GX6605S SoC
+ *
+ * Copyright (c) 2019 Andreas Färber
+ */
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu0: cpu@0 {
+                       device_type = "cpu";
+                       compatible = "csky,ck610";
+                       reg = <0>;
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               interrupt-parent = <&intc>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               timer0: timer@20a000 {
+                       compatible = "csky,gx6605s-timer";
+                       reg = <0x0020a000 0x400>;
+                       clocks = <&dummy_apb_clk>;
+                       interrupts = <10>;
+               };
+
+               gpio: gpio@305000 {
+                       compatible = "wd,mbl-gpio";
+                       reg-names = "dirout", "dat", "set", "clr";
+                       reg = <0x00305000 0x4>,
+                             <0x00305004 0x4>,
+                             <0x00305008 0x4>,
+                             <0x0030500c 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
+
+               uart: serial@403000 {
+                       compatible = "ns16550a";
+                       reg = <0x00403000 0x400>;
+                       interrupts = <15>;
+                       clock-frequency = <29491200>;
+                       reg-shift = <2>;
+                       reg-io-width = <1>;
+               };
+
+               intc: interrupt-controller@500000 {
+                       compatible = "csky,gx6605s-intc";
+                       reg = <0x00500000 0x400>;
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+               };
+
+               ehci_hcd: usb@900000 {
+                       compatible = "generic-ehci";
+                       reg = <0x00900000 0x400>;
+                       interrupts = <59>;
+               };
+
+               ohci_hcd0: usb@a00000 {
+                       compatible = "generic-ohci";
+                       reg = <0x00a00000 0x400>;
+                       interrupts = <58>;
+               };
+
+               ohci_hcd1: usb@b00000 {
+                       compatible = "generic-ohci";
+                       reg = <0x00b00000 0x400>;
+                       interrupts = <57>;
+               };
+       };
+};
--

2.16.4

Signature · 4 lines
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/
#2 lore raw

Am 25.06.19 um 02:45 schrieb Guo Ren:

Quoted 1 line

Thx for the patch. No need seperate part into dtsi,

Sorry, I know from many arm contributions that using a .dtsi is the right thing here. It logically separates the chip from the board, even if there's only one evaluation board currently. Think about set-top boxes that someone might author a .dts for - they should be able to reuse the .dtsi for the SoC rather than copy it.

Quoted 2 lines

just follow:
https://lore.kernel.org/linux-csky/[email protected]/T/#u

Thanks for that pointer! I still think my node names are cleaner and also the structure of keeping clocks and gpio users outside of /soc. I see the value you use is 27 MHz, will try it tomorrow. I see you use nice KEY_ constants, whereas I just took the raw values from the dtb.

I notice that your patch doesn't have any Copyright header, how should I credit you in the resulting combined patch? I would then also add your SoB from the patch you linked to.

More comments inline...

Quoted 21 lines · Andreas Färber
Quoted 20 lines

Add Device Trees for NationalChip GX6605S SoC (based on CK610 CPU) and its dev board. GxLoader expects as filename gx6605s.dtb, so keep that. The bootargs are prepared to boot from USB and to output to serial.

Compatibles for the SoC and board are left out for now.

---
 arch/csky/boot/dts/gx6605s.dts  | 104 ++++++++++++++++++++++++++++++++++++++++
 arch/csky/boot/dts/gx6605s.dtsi |  82 +++++++++++++++++++++++++++++++
 2 files changed, 186 insertions(+)
 create mode 100644 arch/csky/boot/dts/gx6605s.dts
 create mode 100644 arch/csky/boot/dts/gx6605s.dtsi
arch/csky/boot/dts/gx6605s.dts new file +0 -0
new file mode 100644
index 000000000000..f7511024ec6f

[...]

Quoted 5 lines

arch/csky/boot/dts/gx6605s.dts line 77

Quoted 5 lines
arch/csky/boot/dts/gx6605s.dts new file +5 -0
+       leds {
+               compatible = "gpio-leds";
+
+               led0 {
+                       label = "led10";

I forgot to align the numbering here. The label matches the GPIO and what is printed on the board.

Quoted 2 lines

arch/csky/boot/dts/gx6605s.dts line 79

Quoted 2 lines
arch/csky/boot/dts/gx6605s.dts new file +2 -0
+                       gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";

This green one stops blinking and stays on.

Quoted 6 lines

arch/csky/boot/dts/gx6605s.dts line 85

Quoted 6 lines
arch/csky/boot/dts/gx6605s.dts new file +6 -0
+               };
+
+               led1 {
+                       label = "led11";
+                       gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "timer";

This red one keeps blinking after the panic.

Quoted 4 lines
Quoted 4 lines
arch/csky/boot/dts/gx6605s.dts new file +4 -0
+               };
+
+               led2 {
+                       label = "led12";
Quoted 8 lines

arch/csky/boot/dts/gx6605s.dts line 97

Quoted 8 lines
arch/csky/boot/dts/gx6605s.dts new file +8 -0
+                       gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "default-on";
+               };
+
+               led3 {
+                       label = "led13";
+                       gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "default-on";

These two remain off. So I wonder whether the GPIO polarity is wrong? In the example usb.img the gpio-leds module is not loaded by default, so maybe it wasn't noticed before?

Also, many arm boards use more complex LED labels with multiple parts separated by colon, like "boardname:name:function" or so.

Quoted 2 lines
Quoted 2 lines
arch/csky/boot/dts/gx6605s.dts new file +2 -0
+               };
+       };

[...]

Quoted 29 lines
Quoted 29 lines
arch/csky/boot/dts/gx6605s.dtsi new file +23 -0
new file mode 100644
index 000000000000..956af5674add
@@ -0,0 +1,82 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause */
+/*
+ * NationalChip GX6605S SoC
+ *
+ * Copyright (c) 2019 Andreas Färber
+ */
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu0: cpu@0 {
+                       device_type = "cpu";
+                       compatible = "csky,ck610";
+                       reg = <0>;
+               };
+       };
+
+       soc {
Quoted 8 lines

arch/csky/boot/dts/gx6605s.dtsi line 31

Quoted 8 lines
arch/csky/boot/dts/gx6605s.dtsi new file +8 -0
+               compatible = "simple-bus";
+               interrupt-parent = <&intc>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               timer0: timer@20a000 {
+                       compatible = "csky,gx6605s-timer";

The reason I left out the compatible for the SoC/board is that it looks unclean to me that you're using a "csky," vendor prefix for interrupt controller and timer instead of a new "nationalchip," prefix for the SoC vendor. Did I miss some reasoning for that, or did that slip through patch review?

Being the first board we'd need to create a new YAML file to document them, I assume. Not sure what the best scope (=name) would be here.

Quoted 4 lines
Quoted 4 lines
arch/csky/boot/dts/gx6605s.dtsi new file +4 -0
+                       reg = <0x0020a000 0x400>;
+                       clocks = <&dummy_apb_clk>;
+                       interrupts = <10>;
+               };

[...]

Quoted 2 lines

arch/csky/boot/dts/gx6605s.dtsi line 58

Quoted 2 lines
arch/csky/boot/dts/gx6605s.dtsi new file +2 -0
+               intc: interrupt-controller@500000 {
+                       compatible = "csky,gx6605s-intc";

Here's the other SoC compatible.

Quoted 4 lines

arch/csky/boot/dts/gx6605s.dtsi line 62

Quoted 4 lines
arch/csky/boot/dts/gx6605s.dtsi new file +4 -0
+                       reg = <0x00500000 0x400>;
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+               };

[snip]

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
maintainer
#3 lore raw

Hi Andreas,

Quoted 9 lines · Andreas Färber

Am 25.06.19 um 02:45 schrieb Guo Ren:

Quoted 1 line

Thx for the patch. No need seperate part into dtsi,

Sorry, I know from many arm contributions that using a .dtsi is the right thing here. It logically separates the chip from the board, even if there's only one evaluation board currently. Think about set-top boxes that someone might author a .dts for - they should be able to reuse the .dtsi for the SoC rather than copy it.

gx6605s.dts is simple now, it's unnecessary to seperate it into two pieces. Other things from you is all OK for me.

Quoted 4 lines
Quoted 3 lines

just follow:
https://lore.kernel.org/linux-csky/[email protected]/T/#u

Quoted 8 lines

Thanks for that pointer! I still think my node names are cleaner and also the structure of keeping clocks and gpio users outside of /soc. I see the value you use is 27 MHz, will try it tomorrow. I see you use nice KEY_ constants, whereas I just took the raw values from the dtb.

I notice that your patch doesn't have any Copyright header, how should I credit you in the resulting combined patch? I would then also add your SoB from the patch you linked to.

Copyright could be the same in arch/csky/kernel/setup.c or add yours in addition.

Quoted 25 lines

More comments inline...

Quoted 21 lines · Andreas Färber
Quoted 20 lines

Add Device Trees for NationalChip GX6605S SoC (based on CK610 CPU) and its dev board. GxLoader expects as filename gx6605s.dtb, so keep that. The bootargs are prepared to boot from USB and to output to serial.

Compatibles for the SoC and board are left out for now.

---
 arch/csky/boot/dts/gx6605s.dts  | 104 ++++++++++++++++++++++++++++++++++++++++
 arch/csky/boot/dts/gx6605s.dtsi |  82 +++++++++++++++++++++++++++++++
 2 files changed, 186 insertions(+)
 create mode 100644 arch/csky/boot/dts/gx6605s.dts
 create mode 100644 arch/csky/boot/dts/gx6605s.dtsi
arch/csky/boot/dts/gx6605s.dts new file +0 -0
new file mode 100644
index 000000000000..f7511024ec6f

[...]

Quoted 8 lines
Quoted 5 lines

arch/csky/boot/dts/gx6605s.dts line 77

Quoted 5 lines
arch/csky/boot/dts/gx6605s.dts new file +5 -0
+       leds {
+               compatible = "gpio-leds";
+
+               led0 {
+                       label = "led10";

I forgot to align the numbering here. The label matches the GPIO and what is printed on the board.

leds and button is so specific, that's is just a example. You could keep your own style in the dts.

Quoted 5 lines
Quoted 3 lines

arch/csky/boot/dts/gx6605s.dts line 79

Quoted 3 lines
arch/csky/boot/dts/gx6605s.dts new file +2 -0
+                       gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";

This green one stops blinking and stays on.

Seems there is no driver for it.

Quoted 10 lines
Quoted 7 lines

arch/csky/boot/dts/gx6605s.dts line 85

Quoted 7 lines
arch/csky/boot/dts/gx6605s.dts new file +6 -0
+               };
+
+               led1 {
+                       label = "led11";
+                       gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "timer";

This red one keeps blinking after the panic.

Quoted 16 lines
Quoted 4 lines
Quoted 4 lines
arch/csky/boot/dts/gx6605s.dts new file +4 -0
+               };
+
+               led2 {
+                       label = "led12";
Quoted 8 lines

arch/csky/boot/dts/gx6605s.dts line 97

Quoted 8 lines
arch/csky/boot/dts/gx6605s.dts new file +8 -0
+                       gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "default-on";
+               };
+
+               led3 {
+                       label = "led13";
+                       gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "default-on";

These two remain off. So I wonder whether the GPIO polarity is wrong? In the example usb.img the gpio-leds module is not loaded by default, so maybe it wasn't noticed before?

I try this 1 years ago in linux-4.9 and it need verifying.

Quoted 3 lines

Also, many arm boards use more complex LED labels with multiple parts separated by colon, like "boardname:name:function" or so.

Name is Ok for me as long as it's correct.

Quoted 39 lines
Quoted 3 lines
Quoted 3 lines
arch/csky/boot/dts/gx6605s.dts new file +2 -0
+               };
+       };

[...]

Quoted 35 lines
Quoted 35 lines
arch/csky/boot/dts/gx6605s.dtsi new file +29 -0
new file mode 100644
index 000000000000..956af5674add
@@ -0,0 +1,82 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause */
+/*
+ * NationalChip GX6605S SoC
+ *
+ * Copyright (c) 2019 Andreas Färber
+ */
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu0: cpu@0 {
+                       device_type = "cpu";
+                       compatible = "csky,ck610";
+                       reg = <0>;
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               interrupt-parent = <&intc>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
Quoted 8 lines
Quoted 2 lines

arch/csky/boot/dts/gx6605s.dtsi line 31

Quoted 2 lines
arch/csky/boot/dts/gx6605s.dtsi new file +2 -0
+               timer0: timer@20a000 {
+                       compatible = "csky,gx6605s-timer";

The reason I left out the compatible for the SoC/board is that it looks unclean to me that you're using a "csky," vendor prefix for interrupt controller and timer instead of a new "nationalchip," prefix for the SoC vendor. Did I miss some reasoning for that, or did that slip through patch review?

csky is my current company and nationalchip is my prior company. The gx6605s is belong to nationachip and gx6605s use csky 610 as its CPU.

Quoted 8 lines

Being the first board we'd need to create a new YAML file to document them, I assume. Not sure what the best scope (=name) would be here.

Quoted 4 lines

arch/csky/boot/dts/gx6605s.dtsi line 35

Quoted 4 lines
arch/csky/boot/dts/gx6605s.dtsi new file +4 -0
+                       reg = <0x0020a000 0x400>;
+                       clocks = <&dummy_apb_clk>;
+                       interrupts = <10>;
+               };
Quoted 5 lines

[...]

Quoted 2 lines

arch/csky/boot/dts/gx6605s.dtsi line 58

Quoted 2 lines
arch/csky/boot/dts/gx6605s.dtsi new file +2 -0
+               intc: interrupt-controller@500000 {
+                       compatible = "csky,gx6605s-intc";

Here's the other SoC compatible.

It's defined in irqchip/irq-csky-apb-intc.c.

Signature · 4 lines
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/