2019-04-12 10:34:25

by Pablo Greco

[permalink] [raw]
Subject: [PATCH v2 0/6] ARM: dts: sun8i: v40 Rewrite BPi M2 Berry DTS based on BPi M2 Ultra

BPi M2 Berry is a trimmed down version of the BPi M2 Ultra, completely
software compatible.

Changes include:
- 2GiB -> 1GiB
- no eMMC
- no onboard microphone
- no IR
- no blue LED
- no charging (and power jack to USB)
- dropped USB2 and connect USB1 to a 4-port HUB.

Changes since v1:
- Split into smaller patches

Pablo Greco (6):
ARM: dts: sun8i: v40: bananapi-m2-berry: Sort device node
dereferences.
ARM: dts: sun8i: v40: bananapi-m2-berry: Enable GMAC ethernet
controller
ARM: dts: sun8i: v40: bananapi-m2-berry: Enable HDMI output
ARM: dts: sun8i: v40: bananapi-m2-berry: Enable AHCI
ARM: dts: sun8i: v40: bananapi-m2-berry: Fix WiFi regulator
definitions
ARM: dts: sun8i: v40: bananapi-m2-berry: Add Bluetooth device node

arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 144 ++++++++++++++++++++--
1 file changed, 131 insertions(+), 13 deletions(-)

--
1.8.3.1


2019-04-12 10:34:39

by Pablo Greco

[permalink] [raw]
Subject: [PATCH v2 1/6] ARM: dts: sun8i: v40: bananapi-m2-berry: Sort device node dereferences.

The device node dereferences are out of order, sort them.

Signed-off-by: Pablo Greco <[email protected]>
---
arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 36 +++++++++++------------
1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
index bf97f62..f05cabd 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -105,6 +105,24 @@

#include "axp22x.dtsi"

+&mmc0 {
+ vmmc-supply = <&reg_dcdc1>;
+ bus-width = <4>;
+ cd-gpios = <&pio 7 13 GPIO_ACTIVE_LOW>; /* PH13 */
+ status = "okay";
+};
+
+&mmc1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc1_pg_pins>;
+ vmmc-supply = <&reg_dldo2>;
+ vqmmc-supply = <&reg_dldo1>;
+ mmc-pwrseq = <&wifi_pwrseq>;
+ bus-width = <4>;
+ non-removable;
+ status = "okay";
+};
+
&reg_aldo3 {
regulator-always-on;
regulator-min-microvolt = <2700000>;
@@ -152,24 +170,6 @@
regulator-name = "vcc-wifi";
};

-&mmc0 {
- vmmc-supply = <&reg_dcdc1>;
- bus-width = <4>;
- cd-gpios = <&pio 7 13 GPIO_ACTIVE_LOW>; /* PH13 */
- status = "okay";
-};
-
-&mmc1 {
- pinctrl-names = "default";
- pinctrl-0 = <&mmc1_pg_pins>;
- vmmc-supply = <&reg_dldo2>;
- vqmmc-supply = <&reg_dldo1>;
- mmc-pwrseq = <&wifi_pwrseq>;
- bus-width = <4>;
- non-removable;
- status = "okay";
-};
-
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pb_pins>;
--
1.8.3.1

2019-04-12 10:34:41

by Pablo Greco

[permalink] [raw]
Subject: [PATCH v2 3/6] ARM: dts: sun8i: v40: bananapi-m2-berry: Enable HDMI output

This patch adds the hdmi nodes to the Bananapi M2 Berry, the same way it
was done to the Bananapi M2 Ultra

Signed-off-by: Pablo Greco <[email protected]>
---
arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 29 +++++++++++++++++++++++
1 file changed, 29 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
index 0d79e91..2a5b80b 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -58,6 +58,17 @@
stdout-path = "serial0:115200n8";
};

+ connector {
+ compatible = "hdmi-connector";
+ type = "a";
+
+ port {
+ hdmi_con_in: endpoint {
+ remote-endpoint = <&hdmi_out_con>;
+ };
+ };
+ };
+
leds {
compatible = "gpio-leds";

@@ -88,6 +99,10 @@
};
};

+&de {
+ status = "okay";
+};
+
&ehci1 {
/* Terminus Tech FE 1.1s 4-port USB 2.0 hub here */
status = "okay";
@@ -109,6 +124,16 @@
};
};

+&hdmi {
+ status = "okay";
+};
+
+&hdmi_out {
+ hdmi_out_con: endpoint {
+ remote-endpoint = <&hdmi_con_in>;
+ };
+};
+
&i2c0 {
status = "okay";

@@ -200,6 +225,10 @@
regulator-name = "vcc-wifi";
};

+&tcon_tv0 {
+ status = "okay";
+};
+
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pb_pins>;
--
1.8.3.1

2019-04-12 10:34:48

by Pablo Greco

[permalink] [raw]
Subject: [PATCH v2 6/6] ARM: dts: sun8i: v40: bananapi-m2-berry: Add Bluetooth device node

Since the bananapi-m2-ultra and the bananapi-m2-berry have the same
WiFi/Bluetooth, add the required nodes to the bananapi-m2-berry.

Signed-off-by: Pablo Greco <[email protected]>
---
arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 26 +++++++++++++++++++++++
1 file changed, 26 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
index 78f4a1a..3d0bb7e 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -96,6 +96,8 @@
wifi_pwrseq: wifi_pwrseq {
compatible = "mmc-pwrseq-simple";
reset-gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
+ clocks = <&ccu CLK_OUTA>;
+ clock-names = "ext_clock";
};
};

@@ -171,6 +173,11 @@
status = "okay";
};

+&pio {
+ pinctrl-names = "default";
+ pinctrl-0 = <&clk_out_a_pin>;
+};
+
&reg_aldo2 {
regulator-always-on;
regulator-min-microvolt = <2500000>;
@@ -268,6 +275,25 @@
status = "okay";
};

+&uart3 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart3_pg_pins>, <&uart3_rts_cts_pg_pins>;
+ uart-has-rtscts;
+ status = "okay";
+
+ bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ clocks = <&ccu CLK_OUTA>;
+ clock-names = "lpo";
+ vbat-supply = <&reg_dldo2>;
+ vddio-supply = <&reg_dldo1>;
+ device-wakeup-gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
+ /* TODO host wake line connected to PMIC GPIO pins */
+ shutdown-gpios = <&pio 7 12 GPIO_ACTIVE_HIGH>; /* PH12 */
+ max-speed = <1500000>;
+ };
+};
+
&usbphy {
usb1_vbus-supply = <&reg_vcc5v0>;
status = "okay";
--
1.8.3.1

2019-04-12 10:34:52

by Pablo Greco

[permalink] [raw]
Subject: [PATCH v2 5/6] ARM: dts: sun8i: v40: bananapi-m2-berry: Fix WiFi regulator definitions

Just like was done for the bananapi-m2-ultra, add the second wifi/bt
regulator and mark both as always-on.

Signed-off-by: Pablo Greco <[email protected]>
---
arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
index c37c7ab..78f4a1a 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -225,12 +225,27 @@
regulator-name = "vcc-wifi-io";
};

+/*
+ * Our WiFi chip needs both DLDO2 and DLDO3 to be powered at the same
+ * time, with the two being in sync, to be able to meet maximum power
+ * consumption during transmits. Since this is not really supported
+ * right now, just use the two as always on, and we will fix it later.
+ */
+
&reg_dldo2 {
+ regulator-always-on;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vcc-wifi";
};

+&reg_dldo3 {
+ regulator-always-on;
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-name = "vcc-wifi-2";
+};
+
&reg_dldo4 {
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
--
1.8.3.1

2019-04-12 10:36:54

by Pablo Greco

[permalink] [raw]
Subject: [PATCH v2 2/6] ARM: dts: sun8i: v40: bananapi-m2-berry: Enable GMAC ethernet controller

Just like the Bananapi M2 Ultra, the Bananapi M2 Berry has a Realtek
RTL8211E RGMII PHY tied to the GMAC.
The PMIC's DC1SW output provides power for the PHY, while the ALDO2
output provides I/O voltages on both sides.

Signed-off-by: Pablo Greco <[email protected]>
---
arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 30 +++++++++++++++++++++++
1 file changed, 30 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
index f05cabd..0d79e91 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -50,6 +50,7 @@
compatible = "sinovoip,bpi-m2-berry", "allwinner,sun8i-r40";

aliases {
+ ethernet0 = &gmac;
serial0 = &uart0;
};

@@ -92,6 +93,22 @@
status = "okay";
};

+&gmac {
+ pinctrl-names = "default";
+ pinctrl-0 = <&gmac_rgmii_pins>;
+ phy-handle = <&phy1>;
+ phy-mode = "rgmii";
+ phy-supply = <&reg_dc1sw>;
+ status = "okay";
+};
+
+&gmac_mdio {
+ phy1: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+};
+
&i2c0 {
status = "okay";

@@ -123,6 +140,13 @@
status = "okay";
};

+&reg_aldo2 {
+ regulator-always-on;
+ regulator-min-microvolt = <2500000>;
+ regulator-max-microvolt = <2500000>;
+ regulator-name = "vcc-pa";
+};
+
&reg_aldo3 {
regulator-always-on;
regulator-min-microvolt = <2700000>;
@@ -130,6 +154,12 @@
regulator-name = "avcc";
};

+&reg_dc1sw {
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3000000>;
+ regulator-name = "vcc-gmac-phy";
+};
+
&reg_dcdc1 {
regulator-always-on;
regulator-min-microvolt = <3000000>;
--
1.8.3.1

2019-04-12 10:37:04

by Pablo Greco

[permalink] [raw]
Subject: [PATCH v2 4/6] ARM: dts: sun8i: v40: bananapi-m2-berry: Enable AHCI

Just like the Bananapi M2 Ultra, enable the ahci controller and
the two regulators needed to activate it.

Signed-off-by: Pablo Greco <[email protected]>
---
arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
index 2a5b80b..c37c7ab 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -99,6 +99,12 @@
};
};

+&ahci {
+ ahci-supply = <&reg_dldo4>;
+ phy-supply = <&reg_eldo3>;
+ status = "okay";
+};
+
&de {
status = "okay";
};
@@ -225,6 +231,18 @@
regulator-name = "vcc-wifi";
};

+&reg_dldo4 {
+ regulator-min-microvolt = <2500000>;
+ regulator-max-microvolt = <2500000>;
+ regulator-name = "vdd2v5-sata";
+};
+
+&reg_eldo3 {
+ regulator-min-microvolt = <1200000>;
+ regulator-max-microvolt = <1200000>;
+ regulator-name = "vdd1v2-sata";
+};
+
&tcon_tv0 {
status = "okay";
};
--
1.8.3.1

2019-04-15 07:53:02

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH v2 1/6] ARM: dts: sun8i: v40: bananapi-m2-berry: Sort device node dereferences.

On Fri, Apr 12, 2019 at 07:33:00AM -0300, Pablo Greco wrote:
> The device node dereferences are out of order, sort them.
>
> Signed-off-by: Pablo Greco <[email protected]>

Applied, thanks!
Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Attachments:
(No filename) (301.00 B)
signature.asc (235.00 B)
Download all attachments

2019-04-15 07:54:15

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH v2 2/6] ARM: dts: sun8i: v40: bananapi-m2-berry: Enable GMAC ethernet controller

On Fri, Apr 12, 2019 at 07:33:01AM -0300, Pablo Greco wrote:
> Just like the Bananapi M2 Ultra, the Bananapi M2 Berry has a Realtek
> RTL8211E RGMII PHY tied to the GMAC.
> The PMIC's DC1SW output provides power for the PHY, while the ALDO2
> output provides I/O voltages on both sides.
>
> Signed-off-by: Pablo Greco <[email protected]>
> ---
> arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 30 +++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> index f05cabd..0d79e91 100644
> --- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> +++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> @@ -50,6 +50,7 @@
> compatible = "sinovoip,bpi-m2-berry", "allwinner,sun8i-r40";
>
> aliases {
> + ethernet0 = &gmac;
> serial0 = &uart0;
> };
>
> @@ -92,6 +93,22 @@
> status = "okay";
> };
>
> +&gmac {
> + pinctrl-names = "default";
> + pinctrl-0 = <&gmac_rgmii_pins>;
> + phy-handle = <&phy1>;
> + phy-mode = "rgmii";
> + phy-supply = <&reg_dc1sw>;
> + status = "okay";
> +};
> +
> +&gmac_mdio {
> + phy1: ethernet-phy@1 {
> + compatible = "ethernet-phy-ieee802.3-c22";
> + reg = <1>;
> + };
> +};
> +
> &i2c0 {
> status = "okay";
>
> @@ -123,6 +140,13 @@
> status = "okay";
> };
>
> +&reg_aldo2 {
> + regulator-always-on;
> + regulator-min-microvolt = <2500000>;
> + regulator-max-microvolt = <2500000>;
> + regulator-name = "vcc-pa";
> +};
> +

If this one provides power to the pins, it should be tied to the PIO
node.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Attachments:
(No filename) (1.70 kB)
signature.asc (235.00 B)
Download all attachments

2019-04-16 10:48:18

by Pablo Greco

[permalink] [raw]
Subject: Re: [PATCH v2 2/6] ARM: dts: sun8i: v40: bananapi-m2-berry: Enable GMAC ethernet controller


El 15/4/19 a las 04:53, Maxime Ripard escribió:
> On Fri, Apr 12, 2019 at 07:33:01AM -0300, Pablo Greco wrote:
>> Just like the Bananapi M2 Ultra, the Bananapi M2 Berry has a Realtek
>> RTL8211E RGMII PHY tied to the GMAC.
>> The PMIC's DC1SW output provides power for the PHY, while the ALDO2
>> output provides I/O voltages on both sides.
>>
>> Signed-off-by: Pablo Greco <[email protected]>
>> ---
>> arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 30 +++++++++++++++++++++++
>> 1 file changed, 30 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
>> index f05cabd..0d79e91 100644
>> --- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
>> +++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
>> @@ -50,6 +50,7 @@
>> compatible = "sinovoip,bpi-m2-berry", "allwinner,sun8i-r40";
>>
>> aliases {
>> + ethernet0 = &gmac;
>> serial0 = &uart0;
>> };
>>
>> @@ -92,6 +93,22 @@
>> status = "okay";
>> };
>>
>> +&gmac {
>> + pinctrl-names = "default";
>> + pinctrl-0 = <&gmac_rgmii_pins>;
>> + phy-handle = <&phy1>;
>> + phy-mode = "rgmii";
>> + phy-supply = <&reg_dc1sw>;
>> + status = "okay";
>> +};
>> +
>> +&gmac_mdio {
>> + phy1: ethernet-phy@1 {
>> + compatible = "ethernet-phy-ieee802.3-c22";
>> + reg = <1>;
>> + };
>> +};
>> +
>> &i2c0 {
>> status = "okay";
>>
>> @@ -123,6 +140,13 @@
>> status = "okay";
>> };
>>
>> +&reg_aldo2 {
>> + regulator-always-on;
>> + regulator-min-microvolt = <2500000>;
>> + regulator-max-microvolt = <2500000>;
>> + regulator-name = "vcc-pa";
>> +};
>> +
> If this one provides power to the pins, it should be tied to the PIO
> node.
In that case, I should fix the bananapi-m2-ultra the same way. Do you
prefer me to add those fixes to this series?
Or is it better to apply this like it is, and I fix both together in a
separated series?
> Maxime
>
> --
> Maxime Ripard, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
Pablo.

2019-04-16 13:02:29

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH v2 2/6] ARM: dts: sun8i: v40: bananapi-m2-berry: Enable GMAC ethernet controller

65;5600;1c
On Tue, Apr 16, 2019 at 07:47:09AM -0300, Pablo Sebasti?n Greco wrote:
>
> El 15/4/19 a las 04:53, Maxime Ripard escribi?:
> > On Fri, Apr 12, 2019 at 07:33:01AM -0300, Pablo Greco wrote:
> > > Just like the Bananapi M2 Ultra, the Bananapi M2 Berry has a Realtek
> > > RTL8211E RGMII PHY tied to the GMAC.
> > > The PMIC's DC1SW output provides power for the PHY, while the ALDO2
> > > output provides I/O voltages on both sides.
> > >
> > > Signed-off-by: Pablo Greco <[email protected]>
> > > ---
> > > arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 30 +++++++++++++++++++++++
> > > 1 file changed, 30 insertions(+)
> > >
> > > diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> > > index f05cabd..0d79e91 100644
> > > --- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> > > +++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> > > @@ -50,6 +50,7 @@
> > > compatible = "sinovoip,bpi-m2-berry", "allwinner,sun8i-r40";
> > >
> > > aliases {
> > > + ethernet0 = &gmac;
> > > serial0 = &uart0;
> > > };
> > >
> > > @@ -92,6 +93,22 @@
> > > status = "okay";
> > > };
> > >
> > > +&gmac {
> > > + pinctrl-names = "default";
> > > + pinctrl-0 = <&gmac_rgmii_pins>;
> > > + phy-handle = <&phy1>;
> > > + phy-mode = "rgmii";
> > > + phy-supply = <&reg_dc1sw>;
> > > + status = "okay";
> > > +};
> > > +
> > > +&gmac_mdio {
> > > + phy1: ethernet-phy@1 {
> > > + compatible = "ethernet-phy-ieee802.3-c22";
> > > + reg = <1>;
> > > + };
> > > +};
> > > +
> > > &i2c0 {
> > > status = "okay";
> > >
> > > @@ -123,6 +140,13 @@
> > > status = "okay";
> > > };
> > >
> > > +&reg_aldo2 {
> > > + regulator-always-on;
> > > + regulator-min-microvolt = <2500000>;
> > > + regulator-max-microvolt = <2500000>;
> > > + regulator-name = "vcc-pa";
> > > +};
> > > +
> > If this one provides power to the pins, it should be tied to the PIO
> > node.
>
> In that case, I should fix the bananapi-m2-ultra the same way. Do you prefer
> me to add those fixes to this series?

If you have that board, then please add that yep.

> Or is it better to apply this like it is, and I fix both together in a
> separated series?

No, please resend a new version.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Attachments:
(No filename) (2.38 kB)
signature.asc (235.00 B)
Download all attachments

2019-04-16 14:35:46

by Jagan Teki

[permalink] [raw]
Subject: Re: [linux-sunxi] [PATCH v2 4/6] ARM: dts: sun8i: v40: bananapi-m2-berry: Enable AHCI

On Fri, Apr 12, 2019 at 4:03 PM Pablo Greco <[email protected]> wrote:
>
> Just like the Bananapi M2 Ultra, enable the ahci controller and
> the two regulators needed to activate it.
>
> Signed-off-by: Pablo Greco <[email protected]>
> ---

Reviewed-by: Jagan Teki <[email protected]>