bcm53xx: switch USB 3.0 PHY DT description to use MDIO bus
authorRafał Miłecki <rafal@milecki.pl>
Sat, 28 Jul 2018 19:37:46 +0000 (21:37 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Sat, 28 Jul 2018 19:46:08 +0000 (21:46 +0200)
USB 3.0 PHY is attached to the MDIO bus and should be supported
(accessed) as a MDIO device. This wasn't known initially which resulted
in writing driver that was working with MDIO bus (using some magic
values) without knowing it.

This commit updates DT to properly describe MDIO & USB 3.0 PHY and
enables required kernel drivers.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
target/linux/bcm53xx/config-4.14
target/linux/bcm53xx/patches-4.14/038-v4.19-0001-ARM-dts-BCM5301X-Make-USB-3.0-PHY-use-MDIO-PHY-drive.patch [new file with mode: 0644]

index c9371aca343b9f7c6b6fc4dde88b216dc681cf52..e6f578c6ddef975e350c93dd131a96271aa9126f 100644 (file)
@@ -227,9 +227,11 @@ CONFIG_LIBFDT=y
 CONFIG_LOCK_SPIN_ON_OWNER=y
 CONFIG_LZO_COMPRESS=y
 CONFIG_LZO_DECOMPRESS=y
-# CONFIG_MDIO_BCM_IPROC is not set
+CONFIG_MDIO_BCM_IPROC=y
 CONFIG_MDIO_BUS=y
+CONFIG_MDIO_BUS_MUX=y
 # CONFIG_MDIO_BUS_MUX_BCM_IPROC is not set
+CONFIG_MDIO_BUS_MUX_MMIOREG=y
 CONFIG_MDIO_DEVICE=y
 CONFIG_MFD_SYSCON=y
 CONFIG_MIGHT_HAVE_CACHE_L2X0=y
diff --git a/target/linux/bcm53xx/patches-4.14/038-v4.19-0001-ARM-dts-BCM5301X-Make-USB-3.0-PHY-use-MDIO-PHY-drive.patch b/target/linux/bcm53xx/patches-4.14/038-v4.19-0001-ARM-dts-BCM5301X-Make-USB-3.0-PHY-use-MDIO-PHY-drive.patch
new file mode 100644 (file)
index 0000000..226109c
--- /dev/null
@@ -0,0 +1,456 @@
+From 37f6130ec39fe14e923d472746a51e6f06f761b7 Mon Sep 17 00:00:00 2001
+From: Vivek Unune <npcomplete13@gmail.com>
+Date: Mon, 9 Apr 2018 18:31:53 -0400
+Subject: [PATCH] ARM: dts: BCM5301X: Make USB 3.0 PHY use MDIO PHY driver
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Currently, the USB 3.0 PHY in bcm5301x.dtsi uses platform driver which
+requires register range "ccb-mii" <0x18003000 0x1000>. This range
+overlaps with MDIO cmd and param registers (<0x18003000 0x8>).
+Essentially, the platform driver partly acts like a MDIO bus driver,
+hence to use of this register range.
+
+In some Northstar devices like Linksys EA9500, secondary switch is
+connected via external MDIO. The only way to access and configure the
+external switch is via MDIO bus. When we enable the MDIO bus in it's
+current state, the MDIO bus and any child buses fail to register because
+of the register range overlap.
+
+On Northstar, the USB 3.0 PHY is connected at address 0x10 on the
+internal MDIO bus. This change moves the usb3_phy node and makes it a
+child node of internal MDIO bus.
+
+Thanks to Rafał Miłecki's commit af850e14a7ae ("phy: bcm-ns-usb3: add
+MDIO driver using proper bus layer") the same USB 3.0 platform driver
+can now act as USB 3.0 PHY MDIO driver.
+
+Tested on Linksys Panamera (EA9500)
+
+Signed-off-by: Vivek Unune <npcomplete13@gmail.com>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+---
+ arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts        |  4 +++
+ arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts        |  4 +++
+ arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts  |  4 +++
+ arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts    |  4 +++
+ arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts       |  4 +++
+ arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts       |  4 +++
+ arch/arm/boot/dts/bcm4708-netgear-r6250.dts        |  4 +++
+ arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts     |  4 +++
+ arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts      |  4 +++
+ arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts        |  4 +++
+ arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts |  4 +++
+ arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts  |  4 +++
+ arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts      |  4 +++
+ arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts      |  4 +++
+ arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts |  4 +++
+ arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts        |  4 +++
+ arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts  |  4 +++
+ arch/arm/boot/dts/bcm4709-linksys-ea9200.dts       |  4 +++
+ arch/arm/boot/dts/bcm4709-netgear-r7000.dts        |  4 +++
+ arch/arm/boot/dts/bcm4709-netgear-r8000.dts        |  4 +++
+ arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts  |  4 +++
+ arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts      |  4 +++
+ arch/arm/boot/dts/bcm47094-linksys-panamera.dts    |  4 +++
+ arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts      |  4 +++
+ arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts      |  4 +++
+ arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts      |  4 +++
+ arch/arm/boot/dts/bcm47094-netgear-r8500.dts       |  4 +++
+ arch/arm/boot/dts/bcm47094.dtsi                    |  7 +++--
+ arch/arm/boot/dts/bcm5301x.dtsi                    | 35 +++++++++++++++++-----
+ arch/arm/boot/dts/bcm94708.dts                     |  4 +++
+ arch/arm/boot/dts/bcm94709.dts                     |  4 +++
+ arch/arm/boot/dts/bcm953012er.dts                  |  4 +++
+ arch/arm/boot/dts/bcm953012hr.dts                  |  4 +++
+ arch/arm/boot/dts/bcm953012k.dts                   |  4 +++
+ 34 files changed, 159 insertions(+), 11 deletions(-)
+
+--- a/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts
++++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts
+@@ -90,3 +90,7 @@
+               };
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts
++++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts
+@@ -80,3 +80,7 @@
+               };
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts
++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts
+@@ -146,3 +146,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts
++++ b/arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts
+@@ -38,3 +38,7 @@
+               };
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts
++++ b/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts
+@@ -57,3 +57,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts
++++ b/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts
+@@ -64,3 +64,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4708-netgear-r6250.dts
++++ b/arch/arm/boot/dts/bcm4708-netgear-r6250.dts
+@@ -91,3 +91,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts
++++ b/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts
+@@ -83,3 +83,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts
++++ b/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts
+@@ -158,3 +158,7 @@
+               };
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts
++++ b/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts
+@@ -74,3 +74,7 @@
+               };
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts
++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts
+@@ -118,3 +118,7 @@
+               };
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts
++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts
+@@ -104,3 +104,7 @@
+               };
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts
++++ b/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts
+@@ -57,3 +57,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts
++++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts
+@@ -105,3 +105,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts
++++ b/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts
+@@ -99,3 +99,7 @@
+ &usb2 {
+       vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>;
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts
++++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts
+@@ -62,3 +62,7 @@
+               };
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts
++++ b/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts
+@@ -127,3 +127,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts
++++ b/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts
+@@ -39,3 +39,7 @@
+               };
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4709-netgear-r7000.dts
++++ b/arch/arm/boot/dts/bcm4709-netgear-r7000.dts
+@@ -101,3 +101,7 @@
+ &usb3 {
+       vcc-gpio = <&chipcommon 0 GPIO_ACTIVE_HIGH>;
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4709-netgear-r8000.dts
++++ b/arch/arm/boot/dts/bcm4709-netgear-r8000.dts
+@@ -182,3 +182,7 @@
+ &usb3 {
+       vcc-gpio = <&chipcommon 0 GPIO_ACTIVE_HIGH>;
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts
++++ b/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts
+@@ -104,3 +104,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts
++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts
+@@ -115,3 +115,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
+@@ -33,3 +33,7 @@
+               };
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts
++++ b/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts
+@@ -60,3 +60,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts
++++ b/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts
+@@ -60,3 +60,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts
++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts
+@@ -100,3 +100,7 @@
+ &spi_nor {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47094-netgear-r8500.dts
++++ b/arch/arm/boot/dts/bcm47094-netgear-r8500.dts
+@@ -91,3 +91,7 @@
+               };
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm47094.dtsi
++++ b/arch/arm/boot/dts/bcm47094.dtsi
+@@ -7,9 +7,10 @@
+ #include "bcm4708.dtsi"
+ / {
+-      usb3_phy: usb3-phy {
+-              compatible = "brcm,ns-bx-usb3-phy";
+-      };
++};
++
++&usb3_phy {
++      compatible = "brcm,ns-bx-usb3-phy";
+ };
+ &uart0 {
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -154,13 +154,6 @@
+               clock-names = "phy-ref-clk";
+       };
+-      usb3_phy: usb3-phy {
+-              compatible = "brcm,ns-ax-usb3-phy";
+-              reg = <0x18105000 0x1000>, <0x18003000 0x1000>;
+-              reg-names = "dmp", "ccb-mii";
+-              #phy-cells = <0>;
+-      };
+-
+       axi@18000000 {
+               compatible = "brcm,bus-axi";
+               reg = <0x18000000 0x1000>;
+@@ -359,7 +352,33 @@
+               reg = <0x18003000 0x8>;
+               #size-cells = <1>;
+               #address-cells = <0>;
+-              status = "disabled";
++      };
++
++      mdio-bus-mux {
++              compatible = "mdio-mux-mmioreg";
++              mdio-parent-bus = <&mdio>;
++              #address-cells = <1>;
++              #size-cells = <0>;
++              reg = <0x18003000 0x4>;
++              mux-mask = <0x200>;
++
++              mdio@0 {
++                      reg = <0x0>;
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++
++                      usb3_phy: usb3-phy@10 {
++                              compatible = "brcm,ns-ax-usb3-phy";
++                              reg = <0x10>;
++                              usb3-dmp-syscon = <&usb3_dmp>;
++                              #phy-cells = <0>;
++                              status = "disabled";
++                      };
++              };
++      };
++
++      usb3_dmp: syscon@18105000 {
++              reg = <0x18105000 0x1000>;
+       };
+       i2c0: i2c@18009000 {
+--- a/arch/arm/boot/dts/bcm94708.dts
++++ b/arch/arm/boot/dts/bcm94708.dts
+@@ -42,3 +42,7 @@
+               reg = <0x00000000 0x08000000>;
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm94709.dts
++++ b/arch/arm/boot/dts/bcm94709.dts
+@@ -42,3 +42,7 @@
+               reg = <0x00000000 0x08000000>;
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm953012er.dts
++++ b/arch/arm/boot/dts/bcm953012er.dts
+@@ -90,3 +90,7 @@
+               };
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm953012hr.dts
++++ b/arch/arm/boot/dts/bcm953012hr.dts
+@@ -95,3 +95,7 @@
+               reg = <0x00700000 0x00900000>;
+       };
+ };
++
++&usb3_phy {
++      status = "okay";
++};
+--- a/arch/arm/boot/dts/bcm953012k.dts
++++ b/arch/arm/boot/dts/bcm953012k.dts
+@@ -113,3 +113,7 @@
+ &uart1 {
+       status = "okay";
+ };
++
++&usb3_phy {
++      status = "okay";
++};