Skip to contentSkip to conversation

ARM: sun9i: Enable extra uarts, leds and i2c controllers

PATCH New Chen-Yu Tsai 2 participants 8 messages Oct 31, 2014

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

v2 cover ARM: sun9i: Enable extra uarts, leds and i2c controllers

Hi,

This series enables the uart and i2c controller found on the A80 Optimus board's gpio expansion header, as well as 2 out of 3 onboard LEDs. The last LED needs R_PIO support.

This series contains only changes to the dtsi and dts files, and is based on Maxime's pinctrl driver series. The patches should be self-explanatory.

Changes since v1:

- Dropped a80_ prefix on the led labels
- Fixed mapping for leds to pins, previously led2 and led4 were reversed.
- Use dash instead of underscore in led-pins DT node name

Cheers,
ChenYu

Chen-Yu Tsai (6):
ARM: dts: sun9i: Add i2c controller nodes to a80 dtsi
ARM: dts: sun9i: Add i2c3 pinmux setting for A80 SoC
ARM: dts: sun9i: Enable i2c3 on A80 Optimus board
ARM: dts: sun9i: Add GPIO LEDs for A80 Optimus board
ARM: dts: sun9i: Add uart4 pinmux setting for A80 SoC
ARM: dts: sun9i: Enable uart4 for A80 Optimus board

 arch/arm/boot/dts/sun9i-a80-optimus.dts | 51 ++++++++++++++++++++++++
 arch/arm/boot/dts/sun9i-a80.dtsi        | 69 +++++++++++++++++++++++++++++++++
 2 files changed, 120 insertions(+)
Signature · 1 line
2.1.1
#1 lore raw

PATCH v2 1/6 ARM: dts: sun9i: Add i2c controller nodes to a80 dtsi

The A80 has 5 i2c controllers in the main processor block.

---
 arch/arm/boot/dts/sun9i-a80.dtsi | 55 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
arch/arm/boot/dts/sun9i-a80.dtsi +55 -0
index da680cf..3ec727d 100644
@@ -426,6 +426,61 @@
 			status = "disabled";
 		};
 
+		i2c0: i2c at 07002800 {
+			compatible = "allwinner,sun6i-a31-i2c";
+			reg = <0x07002800 0x400>;
+			interrupts = <0 6 4>;
+			clocks = <&apb1_gates 0>;
+			resets = <&apb1_resets 0>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		i2c1: i2c at 07002c00 {
+			compatible = "allwinner,sun6i-a31-i2c";
+			reg = <0x07002c00 0x400>;
+			interrupts = <0 7 4>;
+			clocks = <&apb1_gates 1>;
+			resets = <&apb1_resets 1>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		i2c2: i2c at 07003000 {
+			compatible = "allwinner,sun6i-a31-i2c";
+			reg = <0x07003000 0x400>;
+			interrupts = <0 8 4>;
+			clocks = <&apb1_gates 2>;
+			resets = <&apb1_resets 2>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		i2c3: i2c at 07003400 {
+			compatible = "allwinner,sun6i-a31-i2c";
+			reg = <0x07003400 0x400>;
+			interrupts = <0 9 4>;
+			clocks = <&apb1_gates 3>;
+			resets = <&apb1_resets 3>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		i2c4: i2c at 07003800 {
+			compatible = "allwinner,sun6i-a31-i2c";
+			reg = <0x07003800 0x400>;
+			interrupts = <0 10 4>;
+			clocks = <&apb1_gates 4>;
+			resets = <&apb1_resets 4>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
 		r_wdt: watchdog at 08001000 {
 			compatible = "allwinner,sun6i-a31-wdt";
 			reg = <0x08001000 0x20>;
Signature · 1 line
2.1.1
#2 lore raw

PATCH v2 2/6 ARM: dts: sun9i: Add i2c3 pinmux setting for A80 SoC

In reply to Chen-Yu Tsai

i2c3 has only one possible pinmux setting on the A80 SoC.

---
 arch/arm/boot/dts/sun9i-a80.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/sun9i-a80.dtsi +7 -0
index 3ec727d..0a1f1a8 100644
@@ -352,6 +352,13 @@
 			#size-cells = <0>;
 			#gpio-cells = <3>;
 
+			i2c3_pins_a: i2c3 at 0 {
+				allwinner,pins = "PG10", "PG11";
+				allwinner,function = "i2c3";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
 			uart0_pins_a: uart0 at 0 {
 				allwinner,pins = "PH12", "PH13";
 				allwinner,function = "uart0";
Signature · 1 line
2.1.1
#3 lore raw

PATCH v2 3/6 ARM: dts: sun9i: Enable i2c3 on A80 Optimus board

In reply to Chen-Yu Tsai

i2c3 is exposed on the GPIO extension header. Enable it so we can use it.

Also enable internal pull-ups on the pins, as they don't seem to have external pull-up resistors.

---
 arch/arm/boot/dts/sun9i-a80-optimus.dts | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/sun9i-a80-optimus.dts +13 -0
index 5d9bc80..955436a 100644
@@ -59,10 +59,23 @@
 	};
 
 	soc {
+		pio: pinctrl at 06000800 {
+			i2c3_pins_a: i2c3 at 0 {
+				/* Enable internal pull-up */
+				allwinner,pull = <1>;
+			};
+		};
+
 		uart0: serial at 07000000 {
 			pinctrl-names = "default";
 			pinctrl-0 = <&uart0_pins_a>;
 			status = "okay";
 		};
+
+		i2c3: i2c at 07003400 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&i2c3_pins_a>;
+			status = "okay";
+		};
 	};
 };
Signature · 1 line
2.1.1
#4 lore raw

PATCH v2 4/6 ARM: dts: sun9i: Add GPIO LEDs for A80 Optimus board

In reply to Chen-Yu Tsai

The A80 Optimus board has 3 usable LEDs that are controlled via GPIO.

This patch adds support for 2 of them which are driver by GPIOs in the main pin controller. The remaining one uses GPIO from the R_PIO controller, which we don't support yet.

---
 arch/arm/boot/dts/sun9i-a80-optimus.dts | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
arch/arm/boot/dts/sun9i-a80-optimus.dts +27 -0
index 955436a..87b1355 100644
@@ -64,6 +64,13 @@
 				/* Enable internal pull-up */
 				allwinner,pull = <1>;
 			};
+
+			led_pins_optimus: led-pins at 0 {
+				allwinner,pins = "PH0", "PH1";
+				allwinner,function = "gpio_out";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
 		};
 
 		uart0: serial at 07000000 {
@@ -78,4 +85,24 @@
 			status = "okay";
 		};
 	};
+
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&led_pins_optimus>;
+
+		/* The LED names match those found on the board */
+
+		led2 {
+			label = "optimus:led2:usr";
+			gpios = <&pio 7 1 0>;
+		};
+
+		/* led3 is on PM15, in R_PIO */
+
+		led4 {
+			label = "optimus:led4:usr";
+			gpios = <&pio 7 0 0>;
+		};
+	};
 };
Signature · 1 line
2.1.1
#5 lore raw

PATCH v2 5/6 ARM: dts: sun9i: Add uart4 pinmux setting for A80 SoC

In reply to Chen-Yu Tsai

uart4 only has one possible pinmux setting on the A80 SoC.

---
 arch/arm/boot/dts/sun9i-a80.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/sun9i-a80.dtsi +7 -0
index 0a1f1a8..494714f 100644
@@ -365,6 +365,13 @@
 				allwinner,drive = <0>;
 				allwinner,pull = <0>;
 			};
+
+			uart4_pins_a: uart4 at 0 {
+				allwinner,pins = "PG12", "PG13", "PG14", "PG15";
+				allwinner,function = "uart4";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
 		};
 
 		uart0: serial at 07000000 {
Signature · 1 line
2.1.1
#6 lore raw

PATCH v2 6/6 ARM: dts: sun9i: Enable uart4 for A80 Optimus board

In reply to Chen-Yu Tsai

The A80 Optimus board exposes uart4 on the GPIO expansion header. Enable it so we can use it.

Also enable the internal pull-ups, as there doesn't seem to be external pull-up resistors for pins on the expansion header.

---
 arch/arm/boot/dts/sun9i-a80-optimus.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/sun9i-a80-optimus.dts +11 -0
index 87b1355..506948f 100644
@@ -71,6 +71,11 @@
 				allwinner,drive = <0>;
 				allwinner,pull = <0>;
 			};
+
+			uart4_pins_a: uart4 at 0 {
+				/* Enable internal pull-up */
+				allwinner,pull = <1>;
+			};
 		};
 
 		uart0: serial at 07000000 {
@@ -79,6 +84,12 @@
 			status = "okay";
 		};
 
+		uart4: serial at 07001000 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&uart4_pins_a>;
+			status = "okay";
+		};
+
 		i2c3: i2c at 07003400 {
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c3_pins_a>;
Signature · 1 line
2.1.1
#7 lore raw

v2 cover ARM: sun9i: Enable extra uarts, leds and i2c controllers

In reply to Chen-Yu Tsai
Quoted 6 lines · Chen-Yu Tsai

Hi,

This series enables the uart and i2c controller found on the A80 Optimus board's gpio expansion header, as well as 2 out of 3 onboard LEDs. The last LED needs R_PIO support.

Quoted 8 lines

This series contains only changes to the dtsi and dts files, and is based on Maxime's pinctrl driver series. The patches should be self-explanatory.

Changes since v1:

- Dropped a80_ prefix on the led labels
- Fixed mapping for leds to pins, previously led2 and led4 were reversed.
- Use dash instead of underscore in led-pins DT node name

Merged, thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141031/f3709f90/attachment.sig>