Skip to contentSkip to conversation

enable hardware for Nanopi M1 & Nanopi M1 Plus

PATCH Applied Philipp Rossak 3 participants 16 messages Aug 30, 2017 – Sep 1, 2017

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover enable hardware for Nanopi M1 & Nanopi M1 Plus

From: Philipp Rossak <[email protected]>

This Patchseries enables the IR controller and the dwmac-sun8i on the Friendlyarm Nanopi M1 and Friendlyarm Nanopi M1 Plus boards. On the Nanopi M1 Plus additionally the BT/Wifi module is activated.

Philipp Rossak (7):
ARM: dts: sun8i: h3: nanopi-m1: Enable IR controller
ARM: dts: sun8i: h3: nanopi-m1-plus: Enable IR controller
ARM: dts: sun8i: h3: Enable dwmac-sun8i on the Nanopi M1 Plus
ARM: dts: sun8i: h3: Enable AP6212 WiFi on mmc1 on Nanopi M1 Plus
ARM: dts: sun8i: h3: Enable dwmac-sun8i on the Nanopi M1
ARM: dts: sun8i: h3: Adding UART3 RTS and CTS Pins
ARM: dts: sun8i: h3: Enable AP6212 BT on uart3 on Nanopi M1 Plus

 arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts | 80 +++++++++++++++++++++++++++
 arch/arm/boot/dts/sun8i-h3-nanopi-m1.dts      | 17 ++++++
 arch/arm/boot/dts/sunxi-h3-h5.dtsi            |  5 ++
 3 files changed, 102 insertions(+)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/7 ARM: dts: sun8i: h3: nanopi-m1: Enable IR controller

From: Philipp Rossak <[email protected]>

The Nanopi M1 has an onboard IR receiver.
This enables the onboard IR receiver subnode.

---
 arch/arm/boot/dts/sun8i-h3-nanopi-m1.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-m1.dts +6 -0
index ec63d10..3a2ccdb 100644
@@ -55,6 +55,12 @@
 	status = "okay";
 };
 
+&ir {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ir_pins_a>;
+	status = "okay";
+};
+
 &ohci1 {
 	status = "okay";
 };
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/7] ARM: dts: sun8i: h3: nanopi-m1: Enable IR controller

Quoted 6 lines · Philipp Rossak

From: Philipp Rossak <[email protected]>

The Nanopi M1 has an onboard IR receiver.
This enables the onboard IR receiver subnode.

Queued for 4.15, thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170830/fd692770/attachment.sig>
#3 lore raw

PATCH 2/7 ARM: dts: sun8i: h3: nanopi-m1-plus: Enable IR controller

In reply to Philipp Rossak

From: Philipp Rossak <[email protected]>

The Nanopi M1 Plus has an onboard IR receiver.
This enables the onboard IR receiver subnode.

---
 arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +6 -0
index 8ddd1b2..ece275b 100644
@@ -55,6 +55,12 @@
 	status = "okay";
 };
 
+&ir {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ir_pins_a>;
+	status = "okay";
+};
+
 &ohci1 {
 	status = "okay";
 };
Signature · 1 line
2.7.4
#4 lore raw

Re: [PATCH 2/7] ARM: dts: sun8i: h3: nanopi-m1-plus: Enable IR controller

Quoted 6 lines · Philipp Rossak

From: Philipp Rossak <[email protected]>

The Nanopi M1 Plus has an onboard IR receiver.
This enables the onboard IR receiver subnode.

Queued for 4.15, thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170830/4bf12397/attachment.sig>
#5 lore raw

PATCH 3/7 ARM: dts: sun8i: h3: Enable dwmac-sun8i on the Nanopi M1 Plus

In reply to Philipp Rossak

From: Philipp Rossak <[email protected]>

The dwmac-sun8i hardware is present on the Nanopi M1 Plus. It uses an external PHY.

---
 arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts | 32 +++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +32 -0
index ece275b..b9c6c27 100644
@@ -45,6 +45,20 @@
 / {
 	model = "FriendlyArm NanoPi M1 Plus";
 	compatible = "friendlyarm,nanopi-m1-plus", "allwinner,sun8i-h3";
+
+	aliases {
+		ethernet0 = &emac;
+	};
+
+	reg_gmac_3v3: gmac-3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "gmac-3v3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		startup-delay-us = <100000>;
+		enable-active-high;
+		gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
+	};
 };
 
 &ehci1 {
@@ -55,12 +69,30 @@
 	status = "okay";
 };
 
+&emac {
+	pinctrl-names = "default";
+	pinctrl-0 = <&emac_rgmii_pins>;
+	phy-supply = <&reg_gmac_3v3>;
+	phy-handle = <&ext_rgmii_phy>;
+	phy-mode = "rgmii";
+
+	allwinner,leds-active-low;
+	status = "okay";
+};
+
 &ir {
 	pinctrl-names = "default";
 	pinctrl-0 = <&ir_pins_a>;
 	status = "okay";
 };
 
+&mdio {
+	ext_rgmii_phy: ethernet-phy at 1 {
+		compatible = "ethernet-phy-ieee802.3-c22";
+		reg = <0>;
+	};
+};
+
 &ohci1 {
 	status = "okay";
 };
Signature · 1 line
2.7.4
#6 lore raw

Re: [PATCH 3/7] ARM: dts: sun8i: h3: Enable dwmac-sun8i on the Nanopi M1 Plus

Quoted 3 lines · Philipp Rossak

From: Philipp Rossak <[email protected]>

The dwmac-sun8i hardware is present on the Nanopi M1 Plus.

Support for this has been reverted. Please send this once it has been added again.

ChenYu

Quoted 3 lines

It uses an external PHY.

#7 lore raw

PATCH 4/7 ARM: dts: sun8i: h3: Enable AP6212 WiFi on mmc1 on Nanopi M1 Plus

In reply to Philipp Rossak

From: Philipp Rossak <[email protected]>

The WiFi side of the AP6212 WiFi/BT combo module is connected to mmc1. There are also GPIOs for enable and interrupts.

Enable WiFi on this board by enabling mmc1 and adding the power sequencing clocks and GPIO, as well as the chip's interrupt line.

---
 arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts | 35 +++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +35 -0
index b9c6c27..3054308 100644
@@ -48,6 +48,7 @@
 
 	aliases {
 		ethernet0 = &emac;
+		ethernet1 = &ap6212;
 	};
 
 	reg_gmac_3v3: gmac-3v3 {
@@ -59,6 +60,14 @@
 		enable-active-high;
 		gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
 	};
+
+	wifi_pwrseq: wifi_pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		pinctrl-names = "default";
+		pinctrl-0 = <&wifi_en_npi_m1p>;
+		reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
+	};
+
 };
 
 &ehci1 {
@@ -93,6 +102,25 @@
 	};
 };
 
+&mmc1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_pins_a>;
+	vmmc-supply = <&reg_vcc3v3>;
+	vqmmc-supply = <&reg_vcc3v3>;
+	mmc-pwrseq = <&wifi_pwrseq>;
+	bus-width = <4>;
+	non-removable;
+	status = "okay";
+
+	ap6212: sdio_wifi at 1 {
+		reg = <1>;
+		compatible = "brcm,bcm4329-fmac";
+		interrupt-parent = <&pio>;
+		interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 / EINT10 */
+		interrupt-names = "host-wake";
+	};
+};
+
 &ohci1 {
 	status = "okay";
 };
@@ -100,3 +128,10 @@
 &ohci2 {
 	status = "okay";
 };
+
+&r_pio {
+	wifi_en_npi_m1p: wifi_en_pin {
+		pins = "PL7";
+		function = "gpio_out";
+	};
+};
Signature · 1 line
2.7.4
#8 lore raw

Re: [PATCH 4/7] ARM: dts: sun8i: h3: Enable AP6212 WiFi on mmc1 on Nanopi M1 Plus

Hi,

Quoted 26 lines · Philipp Rossak

From: Philipp Rossak <[email protected]>

The WiFi side of the AP6212 WiFi/BT combo module is connected to mmc1. There are also GPIOs for enable and interrupts.

Enable WiFi on this board by enabling mmc1 and adding the power sequencing clocks and GPIO, as well as the chip's interrupt line.

---
 arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts | 35 +++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +1 -0
index b9c6c27..3054308 100644
@@ -48,6 +48,7 @@
 
 	aliases {
 		ethernet0 = &emac;
+		ethernet1 = &ap6212;
 	};
 
 	reg_gmac_3v3: gmac-3v3 {

arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts line 67

Quoted 8 lines
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +5 -0
@@ -59,6 +60,14 @@
 		enable-active-high;
 		gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
 	};
+
+	wifi_pwrseq: wifi_pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		pinctrl-names = "default";
+		pinctrl-0 = <&wifi_en_npi_m1p>;

There's no need for pinctrl nodes when the pin is set to a GPIO.

Quoted 7 lines
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +3 -0
+		reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
+	};
+
 };
 
 &ehci1 {

arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts line 109

Quoted 8 lines
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +5 -0
@@ -93,6 +102,25 @@
 	};
 };
 
+&mmc1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_pins_a>;
+	vmmc-supply = <&reg_vcc3v3>;
+	vqmmc-supply = <&reg_vcc3v3>;

You don't need vqmmc in this case.

arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts line 115

Quoted 6 lines
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +6 -0
+	mmc-pwrseq = <&wifi_pwrseq>;
+	bus-width = <4>;
+	non-removable;
+	status = "okay";
+
+	ap6212: sdio_wifi at 1 {

You're sure you need a label here?

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170830/2ef1ada8/attachment.sig>
#9 lore raw

Re: [PATCH 4/7] ARM: dts: sun8i: h3: Enable AP6212 WiFi on mmc1 on Nanopi M1 Plus

Hi,
thanks for the feedback I will rework the patch.
Should I also update the sun8i-h3-bananapi-m2-plus.dts? It uses also the AP6212 and it is done in the same way like in this patch.

Am 30.08.2017 um 16:52 schrieb Maxime Ripard:

Quoted 70 lines

Hi,

Quoted 26 lines · Philipp Rossak

From: Philipp Rossak <[email protected]>

The WiFi side of the AP6212 WiFi/BT combo module is connected to mmc1. There are also GPIOs for enable and interrupts.

Enable WiFi on this board by enabling mmc1 and adding the power sequencing clocks and GPIO, as well as the chip's interrupt line.

---
  arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts | 35 +++++++++++++++++++++++++++
  1 file changed, 35 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +1 -0
index b9c6c27..3054308 100644
@@ -48,6 +48,7 @@
 
  	aliases {
  		ethernet0 = &emac;
+		ethernet1 = &ap6212;
  	};
 
  	reg_gmac_3v3: gmac-3v3 {

arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts line 67

Quoted 8 lines
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +5 -0
@@ -59,6 +60,14 @@
  		enable-active-high;
  		gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
  	};
+
+	wifi_pwrseq: wifi_pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		pinctrl-names = "default";
+		pinctrl-0 = <&wifi_en_npi_m1p>;

There's no need for pinctrl nodes when the pin is set to a GPIO.

Quoted 7 lines
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +3 -0
+		reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
+	};
+
  };
 
  &ehci1 {

arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts line 109

Quoted 8 lines
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +5 -0
@@ -93,6 +102,25 @@
  	};
  };
 
+&mmc1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_pins_a>;
+	vmmc-supply = <&reg_vcc3v3>;
+	vqmmc-supply = <&reg_vcc3v3>;

You don't need vqmmc in this case.

arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts line 115

Quoted 6 lines
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +6 -0
+	mmc-pwrseq = <&wifi_pwrseq>;
+	bus-width = <4>;
+	non-removable;
+	status = "okay";
+
+	ap6212: sdio_wifi at 1 {

You're sure you need a label here?

Thanks!
Maxime

#10 lore raw

Re: [PATCH 4/7] ARM: dts: sun8i: h3: Enable AP6212 WiFi on mmc1 on Nanopi M1 Plus

Quoted 4 lines · Philipp Rossak

Hi,
thanks for the feedback I will rework the patch.
Should I also update the sun8i-h3-bananapi-m2-plus.dts? It uses also the AP6212 and it is done in the same way like in this patch.

Yes, please.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170901/c0d69e5c/attachment.sig>
#11 lore raw

PATCH 5/7 ARM: dts: sun8i: h3: Enable dwmac-sun8i on the Nanopi M1

In reply to Philipp Rossak

From: Philipp Rossak <[email protected]>

The dwmac-sun8i hardware is present on the Nanopi M1. It uses the internal PHY.

---
 arch/arm/boot/dts/sun8i-h3-nanopi-m1.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-m1.dts +11 -0
index 3a2ccdb..c77fbca 100644
@@ -45,6 +45,10 @@
 / {
 	model = "FriendlyArm NanoPi M1";
 	compatible = "friendlyarm,nanopi-m1", "allwinner,sun8i-h3";
+
+	aliases {
+		ethernet0 = &emac;
+	};
 };
 
 &ehci1 {
@@ -55,6 +59,13 @@
 	status = "okay";
 };
 
+&emac {
+	phy-handle = <&int_mii_phy>;
+	phy-mode = "mii";
+	allwinner,leds-active-low;
+	status = "okay";
+};
+
 &ir {
 	pinctrl-names = "default";
 	pinctrl-0 = <&ir_pins_a>;
Signature · 1 line
2.7.4
#12 lore raw

PATCH 6/7 ARM: dts: sun8i: h3: Adding UART3 RTS and CTS Pins

In reply to Philipp Rossak

From: Philipp Rossak <[email protected]>

This node adds the definition for the UART3 RTS and CTS Pins

That makes it able to use UART3 with RTS and CTS.

---
 arch/arm/boot/dts/sunxi-h3-h5.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/sunxi-h3-h5.dtsi +5 -0
index d38282b..7f750ef 100644
@@ -381,6 +381,11 @@
 				pins = "PA13", "PA14";
 				function = "uart3";
 			};
+
+			uart3_rts_cts_pins: uart3_rts_cts {
+				pins = "PA15", "PA16";
+				function = "uart3";
+			};
 		};
 
 		timer at 01c20c00 {
Signature · 1 line
2.7.4
#13 lore raw

Re: [PATCH 6/7] ARM: dts: sun8i: h3: Adding UART3 RTS and CTS Pins

Quoted 7 lines · Philipp Rossak

From: Philipp Rossak <[email protected]>

This node adds the definition for the UART3 RTS and CTS Pins

That makes it able to use UART3 with RTS and CTS.

Queued for 4.15, thanks

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170901/95b50807/attachment.sig>
#14 lore raw

PATCH 7/7 ARM: dts: sun8i: h3: Enable AP6212 BT on uart3 on Nanopi M1 Plus

In reply to Philipp Rossak

From: Philipp Rossak <[email protected]>

The BT side of the AP6212 WiFi/BT combo module is connected to uart3.

Enable BT on this board by enabling uart3 with using additionally the cts and rts pins.

---
 arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +7 -0
index 3054308..8c12419 100644
@@ -49,6 +49,7 @@
 	aliases {
 		ethernet0 = &emac;
 		ethernet1 = &ap6212;
+		serial1 = &uart3;
 	};
 
 	reg_gmac_3v3: gmac-3v3 {
@@ -135,3 +136,9 @@
 		function = "gpio_out";
 	};
 };
+
+&uart3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart3_pins>, <&uart3_rts_cts_pins>;
+	status = "okay";
+};
Signature · 1 line
2.7.4
#15 lore raw

Re: [PATCH 7/7] ARM: dts: sun8i: h3: Enable AP6212 BT on uart3 on Nanopi M1 Plus

Quoted 9 lines · Philipp Rossak

From: Philipp Rossak <[email protected]>

The BT side of the AP6212 WiFi/BT combo module is connected to uart3.

Enable BT on this board by enabling uart3 with using additionally the cts and rts pins.

I've queued this patch for 4.15, but...

arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts line 52

Quoted 13 lines
---
 arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts +1 -0
index 3054308..8c12419 100644
@@ -49,6 +49,7 @@
 	aliases {
 		ethernet0 = &emac;
 		ethernet1 = &ap6212;
+		serial1 = &uart3;

You'll also need an alias for serial 0 here. Can you send a follow up patch to do so?

Thanks!
Maxime

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