[PATCH] ARM: dts: sun8i: v40: bananapi-m2-berry: Fix ethernet node

2020-11-02 Thread Pablo Greco
Ethernet PHY on BananaPi M2 Berry provides RX and TX delays. Fix ethernet
node to reflect that fact.

Fixes: 27e81e1970a8 ("ARM: dts: sun8i: v40: bananapi-m2-berry: Enable GMAC 
ethernet controller")
Signed-off-by: Pablo Greco 
---
 arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 15c22b06fc4b..3ab6f47cea4f 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -120,7 +120,7 @@
pinctrl-names = "default";
pinctrl-0 = <_rgmii_pins>;
phy-handle = <>;
-   phy-mode = "rgmii";
+   phy-mode = "rgmii-id";
phy-supply = <_dc1sw>;
status = "okay";
 };
-- 
2.18.4



[PATCH] ARM: dts: sun8i: r40: bananapi-m2-berry: Fix dcdc1 regulator

2020-11-02 Thread Pablo Greco
DCDC1 regulator powers many different subsystems. While some of them can
work at 3.0 V, some of them can not. For example, VCC-HDMI can only work
between 3.24 V and 3.36 V. According to OS images provided by the board
manufacturer this regulator should be set to 3.3 V.

Set DCDC1 and DCDC1SW to 3.3 V in order to fix this.

Fixes: 23edc168bd98 ("ARM: dts: sun8i: Add board dts file for Banana Pi M2 
Berry")
Fixes: 27e81e1970a8 ("ARM: dts: sun8i: v40: bananapi-m2-berry: Enable GMAC 
ethernet controller")
Signed-off-by: Pablo Greco 
---
 arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 10 +-
 1 file changed, 5 insertions(+), 5 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 3ab6f47cea4f..47954551f573 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -198,16 +198,16 @@
 };
 
 _dc1sw {
-   regulator-min-microvolt = <300>;
-   regulator-max-microvolt = <300>;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
regulator-name = "vcc-gmac-phy";
 };
 
 _dcdc1 {
regulator-always-on;
-   regulator-min-microvolt = <300>;
-   regulator-max-microvolt = <300>;
-   regulator-name = "vcc-3v0";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-name = "vcc-3v3";
 };
 
 _dcdc2 {
-- 
2.18.4



[PATCH] ARM: dts: sun7i: bananapi: Enable RGMII RX/TX delay on Ethernet PHY

2020-11-02 Thread Pablo Greco
The Ethernet PHY on the Bananapi M1 has the RX and TX delays enabled on
the PHY, using pull-ups on the RXDLY and TXDLY pins.

Fix the phy-mode description to correct reflect this so that the
implementation doesn't reconfigure the delays incorrectly. This
happened with commit bbc4d71d6354 ("net: phy: realtek: fix rtl8211e
rx/tx delay config").

Fixes: 8a5b272fbf44 ("ARM: dts: sun7i: Add Banana Pi board")
Signed-off-by: Pablo Greco 
---
 arch/arm/boot/dts/sun7i-a20-bananapi.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sun7i-a20-bananapi.dts 
b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
index bb3987e101c2..0b3d9ae75650 100644
--- a/arch/arm/boot/dts/sun7i-a20-bananapi.dts
+++ b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
@@ -132,7 +132,7 @@
pinctrl-names = "default";
pinctrl-0 = <_rgmii_pins>;
phy-handle = <>;
-   phy-mode = "rgmii";
+   phy-mode = "rgmii-id";
phy-supply = <_gmac_3v3>;
status = "okay";
 };
-- 
2.18.4



[PATCH] ARM: dts: sun8i: v40: bananapi-m2-berry: Fix ethernet node

2020-10-31 Thread Pablo Greco
Ethernet PHY on BananaPi M2 Berry provides RX and TX delays. Fix ethernet
node to reflect that fact.

Fixes: 27e81e1970a8 ("ARM: dts: sun8i: v40: bananapi-m2-berry: Enable GMAC 
ethernet controller")
Signed-off-by: Pablo Greco 
---
 arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 15c22b06fc4b..3ab6f47cea4f 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -120,7 +120,7 @@
pinctrl-names = "default";
pinctrl-0 = <_rgmii_pins>;
phy-handle = <>;
-   phy-mode = "rgmii";
+   phy-mode = "rgmii-id";
phy-supply = <_dc1sw>;
status = "okay";
 };
-- 
2.18.4



[PATCH] ARM: dts: sun7i: bananapi: Enable RGMII RX/TX delay on Ethernet PHY

2020-10-31 Thread Pablo Greco
The Ethernet PHY on the Bananapi M1 has the RX and TX delays enabled on
the PHY, using pull-ups on the RXDLY and TXDLY pins.

Fix the phy-mode description to correct reflect this so that the
implementation doesn't reconfigure the delays incorrectly. This
happened with commit bbc4d71d6354 ("net: phy: realtek: fix rtl8211e
rx/tx delay config").

Fixes: 8a5b272fbf44 ("ARM: dts: sun7i: Add Banana Pi board")
Signed-off-by: Pablo Greco 
---
 arch/arm/boot/dts/sun7i-a20-bananapi.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sun7i-a20-bananapi.dts 
b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
index bb3987e101c2..0b3d9ae75650 100644
--- a/arch/arm/boot/dts/sun7i-a20-bananapi.dts
+++ b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
@@ -132,7 +132,7 @@
pinctrl-names = "default";
pinctrl-0 = <_rgmii_pins>;
phy-handle = <>;
-   phy-mode = "rgmii";
+   phy-mode = "rgmii-id";
phy-supply = <_gmac_3v3>;
status = "okay";
 };
-- 
2.18.4



[PATCH] ARM: dts: sun8i: r40: bananapi-m2-berry: Fix dcdc1 regulator

2020-10-31 Thread Pablo Greco
DCDC1 regulator powers many different subsystems. While some of them can
work at 3.0 V, some of them can not. For example, VCC-HDMI can only work
between 3.24 V and 3.36 V. According to OS images provided by the board
manufacturer this regulator should be set to 3.3 V.

Set DCDC1 and DCDC1SW to 3.3 V in order to fix this.

Fixes: 23edc168bd98 ("ARM: dts: sun8i: Add board dts file for Banana Pi M2 
Berry")
Fixes: 27e81e1970a8 ("ARM: dts: sun8i: v40: bananapi-m2-berry: Enable GMAC 
ethernet controller")
Signed-off-by: Pablo Greco 
---
 arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 10 +-
 1 file changed, 5 insertions(+), 5 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 3ab6f47cea4f..47954551f573 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -198,16 +198,16 @@
 };
 
 _dc1sw {
-   regulator-min-microvolt = <300>;
-   regulator-max-microvolt = <300>;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
regulator-name = "vcc-gmac-phy";
 };
 
 _dcdc1 {
regulator-always-on;
-   regulator-min-microvolt = <300>;
-   regulator-max-microvolt = <300>;
-   regulator-name = "vcc-3v0";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-name = "vcc-3v3";
 };
 
 _dcdc2 {
-- 
2.18.4



[PATCH] ARM: dts: sun8i: r40: bananapi-m2-ultra: Remove regulator-always-on

2019-05-03 Thread Pablo Greco
Now that the regulators are tied to the GPIO bank, we can remove the
unneeded regulator-always-on in reg_aldo2

Signed-off-by: Pablo Greco 
---
 arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts 
b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
index 699579d..42d62d1 100644
--- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
+++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
@@ -210,7 +210,6 @@
 };
 
 _aldo2 {
-   regulator-always-on;
regulator-min-microvolt = <250>;
regulator-max-microvolt = <250>;
regulator-name = "vcc-pa";
-- 
1.8.3.1



[PATCH v6 4/5] ARM: dts: sun8i: v40: bananapi-m2-berry: Enable AHCI

2019-05-02 Thread Pablo Greco
Just like the Bananapi M2 Ultra, enable the ahci controller and
the two regulators needed to activate it.

Reviewed-by: Jagan Teki 
Signed-off-by: Pablo Greco 
---
 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 1f4f51f9..461683c 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-supply = <_dldo4>;
+   phy-supply = <_eldo3>;
+   status = "okay";
+};
+
  {
status = "okay";
 };
@@ -233,6 +239,18 @@
regulator-name = "vcc-wifi";
 };
 
+_dldo4 {
+   regulator-min-microvolt = <250>;
+   regulator-max-microvolt = <250>;
+   regulator-name = "vdd2v5-sata";
+};
+
+_eldo3 {
+   regulator-min-microvolt = <120>;
+   regulator-max-microvolt = <120>;
+   regulator-name = "vdd1v2-sata";
+};
+
 _tv0 {
status = "okay";
 };
-- 
1.8.3.1



[PATCH v6 5/5] ARM: dts: sun8i: v40: bananapi-m2-berry: Add Bluetooth device node

2019-05-02 Thread Pablo Greco
The AP6212 is based on the Broadcom BCM43430 or BCM43438. The WiFi side
identifies as BCM43430, while the Bluetooth side identifies as BCM43438.

The Bluetooth side is connected to UART3 in a 4 wire configuration. Same
as the WiFi side, due to being the same chip and package, DLDO1 and
DLDO2 regulator outputs from the PMIC provide overall power via VBAT and
I/O power via VDDIO. The CLK_OUT_A clock output from the SoC provides
the LPO low power clock at 32.768 kHz.

This patch enables Bluetooth on this board, and also adds the missing
LPO clock on the WiFi side. There is also a PCM connection for
Bluetooth, but this is not covered here.

The LPO clock is fed from CLK_OUT_A, which needs to be muxed on pin
PI12. This can be represented in multiple ways. This patch puts the
pinctrl property in the pin controller node. This is due to limitations
in Linux, where pinmux settings, even the same one, can not be shared
by multiple devices. Thus we cannot put it in both the WiFi and
Bluetooth device nodes. Putting it the CCU node is another option, but
Linux's CCU driver does not handle pinctrl. Also the pin controller is
guaranteed to be initialized after the CCU, when clocks are available.
And any other devices that use muxed pins are guaranteed to be
initialized after the pin controller. Thus having the CLK_OUT_A pinmux
reference be in the pin controller node is a good choice without having
to deal with implementation issues.

Signed-off-by: Pablo Greco 
---
 arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 38 +++
 1 file changed, 38 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 461683c..15c22b0 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 = < 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
+   clocks = < CLK_OUTA>;
+   clock-names = "ext_clock";
};
 };
 
@@ -172,6 +174,8 @@
 };
 
  {
+   pinctrl-names = "default";
+   pinctrl-0 = <_out_a_pin>;
vcc-pa-supply = <_aldo2>;
vcc-pc-supply = <_dcdc1>;
vcc-pd-supply = <_dcdc1>;
@@ -233,12 +237,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.
+ */
+
 _dldo2 {
+   regulator-always-on;
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
regulator-name = "vcc-wifi";
 };
 
+_dldo3 {
+   regulator-always-on;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-name = "vcc-wifi-2";
+};
+
 _dldo4 {
regulator-min-microvolt = <250>;
regulator-max-microvolt = <250>;
@@ -261,6 +280,25 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pg_pins>, <_rts_cts_pg_pins>;
+   uart-has-rtscts;
+   status = "okay";
+
+   bluetooth {
+   compatible = "brcm,bcm43438-bt";
+   clocks = < CLK_OUTA>;
+   clock-names = "lpo";
+   vbat-supply = <_dldo2>;
+   vddio-supply = <_dldo1>;
+   device-wakeup-gpios = < 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
+   /* TODO host wake line connected to PMIC GPIO pins */
+   shutdown-gpios = < 7 12 GPIO_ACTIVE_HIGH>; /* PH12 */
+   max-speed = <150>;
+   };
+};
+
  {
usb1_vbus-supply = <_vcc5v0>;
status = "okay";
-- 
1.8.3.1



[PATCH v6 3/5] ARM: dts: sun8i: v40: bananapi-m2-berry: Enable HDMI output

2019-05-02 Thread Pablo Greco
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 
---
 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 0dfde58..1f4f51f9 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 = <_out_con>;
+   };
+   };
+   };
+
leds {
compatible = "gpio-leds";
 
@@ -88,6 +99,10 @@
};
 };
 
+ {
+   status = "okay";
+};
+
  {
/* Terminus Tech FE 1.1s 4-port USB 2.0 hub here */
status = "okay";
@@ -109,6 +124,16 @@
};
 };
 
+ {
+   status = "okay";
+};
+
+_out {
+   hdmi_out_con: endpoint {
+   remote-endpoint = <_con_in>;
+   };
+};
+
  {
status = "okay";
 
@@ -208,6 +233,10 @@
regulator-name = "vcc-wifi";
 };
 
+_tv0 {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
1.8.3.1



[PATCH v3 6/7] ARM: dts: sun8i: v40: bananapi-m2-berry: Fix WiFi regulator definitions

2019-04-17 Thread Pablo Greco
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 
---
 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 40db082..6ada736 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -232,12 +232,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.
+ */
+
 _dldo2 {
+   regulator-always-on;
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
regulator-name = "vcc-wifi";
 };
 
+_dldo3 {
+   regulator-always-on;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-name = "vcc-wifi-2";
+};
+
 _dldo4 {
regulator-min-microvolt = <250>;
regulator-max-microvolt = <250>;
-- 
1.8.3.1



[PATCH v3 7/7] ARM: dts: sun8i: v40: bananapi-m2-berry: Add Bluetooth device node

2019-04-17 Thread Pablo Greco
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 
---
 arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 21 +
 1 file changed, 21 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 6ada736..e88eb43 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 = < 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
+   clocks = < CLK_OUTA>;
+   clock-names = "ext_clock";
};
 };
 
@@ -275,6 +277,25 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pg_pins>, <_rts_cts_pg_pins>;
+   uart-has-rtscts;
+   status = "okay";
+
+   bluetooth {
+   compatible = "brcm,bcm43438-bt";
+   clocks = < CLK_OUTA>;
+   clock-names = "lpo";
+   vbat-supply = <_dldo2>;
+   vddio-supply = <_dldo1>;
+   device-wakeup-gpios = < 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
+   /* TODO host wake line connected to PMIC GPIO pins */
+   shutdown-gpios = < 7 12 GPIO_ACTIVE_HIGH>; /* PH12 */
+   max-speed = <150>;
+   };
+};
+
  {
usb1_vbus-supply = <_vcc5v0>;
status = "okay";
-- 
1.8.3.1