summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Robinson <pbrobinson@gmail.com>2016-03-30 11:30:33 +0100
committerPeter Robinson <pbrobinson@gmail.com>2016-03-30 11:30:33 +0100
commit9be752be5717bbe31decfdbd1a9896e036954c19 (patch)
tree78ef5802149e877911aa03150646266b564fdd8d
parent47ad5d57a313b0613e1b6c477d6def9e06108188 (diff)
downloadkernel-9be752be5717bbe31decfdbd1a9896e036954c19.tar.gz
kernel-9be752be5717bbe31decfdbd1a9896e036954c19.tar.xz
kernel-9be752be5717bbe31decfdbd1a9896e036954c19.zip
Add ARMv7 mvebu fixes headed upstream, Minor ARMv7 cleanups
-rw-r--r--0001-ARM-mvebu-Correct-unit-address-for-linksys.patch32
-rw-r--r--0001-net-dsa-mv88e6xxx-Introduce-_mv88e6xxx_phy_page_-rea.patch95
-rw-r--r--0002-net-dsa-mv88e6xxx-Clear-the-PDOWN-bit-on-setup.patch104
-rw-r--r--kernel.spec36
-rw-r--r--revert-stmmac-Fix-eth0-No-PHY-found-regression.patch87
-rw-r--r--stmmac-fix-MDIO-settings.patch235
6 files changed, 253 insertions, 336 deletions
diff --git a/0001-ARM-mvebu-Correct-unit-address-for-linksys.patch b/0001-ARM-mvebu-Correct-unit-address-for-linksys.patch
new file mode 100644
index 000000000..ba0320c8e
--- /dev/null
+++ b/0001-ARM-mvebu-Correct-unit-address-for-linksys.patch
@@ -0,0 +1,32 @@
+From 0eebfe3b5ae99d3a825be8e45395cea478fd83d8 Mon Sep 17 00:00:00 2001
+From: Patrick Uiterwijk <patrick@puiterwijk.org>
+Date: Mon, 28 Mar 2016 21:30:41 +0000
+Subject: [PATCH] ARM: mvebu: Correct unit address for linksys
+
+The USB2 port for Armada 38x is defined to be at 58000, not at
+50000.
+
+Acked-by: Imre Kaloz <kaloz@openwrt.org>
+Cc: <stable@vger.kernel.org>
+Fixes: 2d0a7addbd10 ("ARM: Kirkwood: Add support for many Synology NAS devices")
+Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
+---
+ arch/arm/boot/dts/armada-385-linksys.dtsi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/armada-385-linksys.dtsi b/arch/arm/boot/dts/armada-385-linksys.dtsi
+index 3710755..85d2c37 100644
+--- a/arch/arm/boot/dts/armada-385-linksys.dtsi
++++ b/arch/arm/boot/dts/armada-385-linksys.dtsi
+@@ -117,7 +117,7 @@
+ };
+
+ /* USB part of the eSATA/USB 2.0 port */
+- usb@50000 {
++ usb@58000 {
+ status = "okay";
+ };
+
+--
+2.5.0
+
diff --git a/0001-net-dsa-mv88e6xxx-Introduce-_mv88e6xxx_phy_page_-rea.patch b/0001-net-dsa-mv88e6xxx-Introduce-_mv88e6xxx_phy_page_-rea.patch
new file mode 100644
index 000000000..b2c203f2c
--- /dev/null
+++ b/0001-net-dsa-mv88e6xxx-Introduce-_mv88e6xxx_phy_page_-rea.patch
@@ -0,0 +1,95 @@
+From cc4ee91d46158a4b43a03883ec36b77c03793e85 Mon Sep 17 00:00:00 2001
+From: Patrick Uiterwijk <patrick@puiterwijk.org>
+Date: Fri, 25 Mar 2016 23:05:10 +0000
+Subject: [PATCH 1/2] net: dsa: mv88e6xxx: Introduce
+ _mv88e6xxx_phy_page_{read,write}
+
+Add versions of the phy_page_read and _write functions to
+be used in a context where the SMI mutex is held.
+
+Tested-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
+Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
+Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
+---
+ drivers/net/dsa/mv88e6xxx.c | 49 +++++++++++++++++++++++++++++++++------------
+ 1 file changed, 36 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
+index fa086e0..86a2029 100644
+--- a/drivers/net/dsa/mv88e6xxx.c
++++ b/drivers/net/dsa/mv88e6xxx.c
+@@ -2264,6 +2264,38 @@ static void mv88e6xxx_bridge_work(struct work_struct *work)
+ mutex_unlock(&ps->smi_mutex);
+ }
+
++static int _mv88e6xxx_phy_page_write(struct dsa_switch *ds, int port, int page,
++ int reg, int val)
++{
++ int ret;
++
++ ret = _mv88e6xxx_phy_write_indirect(ds, port, 0x16, page);
++ if (ret < 0)
++ goto restore_page_0;
++
++ ret = _mv88e6xxx_phy_write_indirect(ds, port, reg, val);
++restore_page_0:
++ _mv88e6xxx_phy_write_indirect(ds, port, 0x16, 0x0);
++
++ return ret;
++}
++
++static int _mv88e6xxx_phy_page_read(struct dsa_switch *ds, int port, int page,
++ int reg)
++{
++ int ret;
++
++ ret = _mv88e6xxx_phy_write_indirect(ds, port, 0x16, page);
++ if (ret < 0)
++ goto restore_page_0;
++
++ ret = _mv88e6xxx_phy_read_indirect(ds, port, reg);
++restore_page_0:
++ _mv88e6xxx_phy_write_indirect(ds, port, 0x16, 0x0);
++
++ return ret;
++}
++
+ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port)
+ {
+ struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+@@ -2714,13 +2746,9 @@ int mv88e6xxx_phy_page_read(struct dsa_switch *ds, int port, int page, int reg)
+ int ret;
+
+ mutex_lock(&ps->smi_mutex);
+- ret = _mv88e6xxx_phy_write_indirect(ds, port, 0x16, page);
+- if (ret < 0)
+- goto error;
+- ret = _mv88e6xxx_phy_read_indirect(ds, port, reg);
+-error:
+- _mv88e6xxx_phy_write_indirect(ds, port, 0x16, 0x0);
++ ret = _mv88e6xxx_phy_page_read(ds, port, page, reg);
+ mutex_unlock(&ps->smi_mutex);
++
+ return ret;
+ }
+
+@@ -2731,14 +2759,9 @@ int mv88e6xxx_phy_page_write(struct dsa_switch *ds, int port, int page,
+ int ret;
+
+ mutex_lock(&ps->smi_mutex);
+- ret = _mv88e6xxx_phy_write_indirect(ds, port, 0x16, page);
+- if (ret < 0)
+- goto error;
+-
+- ret = _mv88e6xxx_phy_write_indirect(ds, port, reg, val);
+-error:
+- _mv88e6xxx_phy_write_indirect(ds, port, 0x16, 0x0);
++ ret = _mv88e6xxx_phy_page_write(ds, port, page, reg, val);
+ mutex_unlock(&ps->smi_mutex);
++
+ return ret;
+ }
+
+--
+2.5.0
+
diff --git a/0002-net-dsa-mv88e6xxx-Clear-the-PDOWN-bit-on-setup.patch b/0002-net-dsa-mv88e6xxx-Clear-the-PDOWN-bit-on-setup.patch
new file mode 100644
index 000000000..b35298a56
--- /dev/null
+++ b/0002-net-dsa-mv88e6xxx-Clear-the-PDOWN-bit-on-setup.patch
@@ -0,0 +1,104 @@
+From e95d5ac146d9da8a703a726fe70a9f4ac02ab8b2 Mon Sep 17 00:00:00 2001
+From: Patrick Uiterwijk <patrick@puiterwijk.org>
+Date: Fri, 25 Mar 2016 00:38:45 +0000
+Subject: [PATCH 2/2] net: dsa: mv88e6xxx: Clear the PDOWN bit on setup
+
+Some of the vendor-specific bootloaders set up this part
+of the initialization for us, so this was never added.
+However, since upstream bootloaders don't initialize the
+chip specifically, they leave the fiber MII's PDOWN flag
+set, which means that the CPU port doesn't connect.
+
+This patch checks whether this flag has been clear prior
+by something else, and if not make us clear it.
+
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
+---
+ drivers/net/dsa/mv88e6xxx.c | 36 ++++++++++++++++++++++++++++++++++++
+ drivers/net/dsa/mv88e6xxx.h | 8 ++++++++
+ 2 files changed, 44 insertions(+)
+
+diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
+index 86a2029..50454be 100644
+--- a/drivers/net/dsa/mv88e6xxx.c
++++ b/drivers/net/dsa/mv88e6xxx.c
+@@ -2296,6 +2296,25 @@ restore_page_0:
+ return ret;
+ }
+
++static int mv88e6xxx_power_on_serdes(struct dsa_switch *ds)
++{
++ int ret;
++
++ ret = _mv88e6xxx_phy_page_read(ds, REG_FIBER_SERDES, PAGE_FIBER_SERDES,
++ MII_BMCR);
++ if (ret < 0)
++ return ret;
++
++ if (ret & BMCR_PDOWN) {
++ ret &= ~BMCR_PDOWN;
++ ret = _mv88e6xxx_phy_page_write(ds, REG_FIBER_SERDES,
++ PAGE_FIBER_SERDES, MII_BMCR,
++ ret);
++ }
++
++ return ret;
++}
++
+ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port)
+ {
+ struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+@@ -2399,6 +2418,23 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port)
+ goto abort;
+ }
+
++ /* If this port is connected to a SerDes, make sure the SerDes is not
++ * powered down.
++ */
++ if (mv88e6xxx_6352_family(ds)) {
++ ret = _mv88e6xxx_reg_read(ds, REG_PORT(port), PORT_STATUS);
++ if (ret < 0)
++ goto abort;
++ ret &= PORT_STATUS_CMODE_MASK;
++ if ((ret == PORT_STATUS_CMODE_100BASE_X) ||
++ (ret == PORT_STATUS_CMODE_1000BASE_X) ||
++ (ret == PORT_STATUS_CMODE_SGMII)) {
++ ret = mv88e6xxx_power_on_serdes(ds);
++ if (ret < 0)
++ goto abort;
++ }
++ }
++
+ /* Port Control 2: don't force a good FCS, set the maximum frame size to
+ * 10240 bytes, disable 802.1q tags checking, don't discard tagged or
+ * untagged frames on this port, do a destination address lookup on all
+diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h
+index 9a038ab..26a424a 100644
+--- a/drivers/net/dsa/mv88e6xxx.h
++++ b/drivers/net/dsa/mv88e6xxx.h
+@@ -28,6 +28,10 @@
+ #define SMI_CMD_OP_45_READ_DATA_INC ((3 << 10) | SMI_CMD_BUSY)
+ #define SMI_DATA 0x01
+
++/* Fiber/SERDES Registers are located at SMI address F, page 1 */
++#define REG_FIBER_SERDES 0x0f
++#define PAGE_FIBER_SERDES 0x01
++
+ #define REG_PORT(p) (0x10 + (p))
+ #define PORT_STATUS 0x00
+ #define PORT_STATUS_PAUSE_EN BIT(15)
+@@ -45,6 +49,10 @@
+ #define PORT_STATUS_MGMII BIT(6) /* 6185 */
+ #define PORT_STATUS_TX_PAUSED BIT(5)
+ #define PORT_STATUS_FLOW_CTRL BIT(4)
++#define PORT_STATUS_CMODE_MASK 0x0f
++#define PORT_STATUS_CMODE_100BASE_X 0x8
++#define PORT_STATUS_CMODE_1000BASE_X 0x9
++#define PORT_STATUS_CMODE_SGMII 0xa
+ #define PORT_PCS_CTRL 0x01
+ #define PORT_PCS_CTRL_RGMII_DELAY_RXCLK BIT(15)
+ #define PORT_PCS_CTRL_RGMII_DELAY_TXCLK BIT(14)
+--
+2.5.0
+
diff --git a/kernel.spec b/kernel.spec
index 5d0a1cd58..131f167ef 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -497,29 +497,33 @@ Source5005: kbuild-AFTER_LINK.patch
# Standalone patches
-Patch451: lib-cpumask-Make-CPUMASK_OFFSTACK-usable-without-deb.patch
+Patch420: arm64-avoid-needing-console-to-enable-serial-console.patch
-Patch452: arm64-avoid-needing-console-to-enable-serial-console.patch
+Patch421: arm64-acpi-drop-expert-patch.patch
-# http://www.spinics.net/lists/netdev/msg369442.html
-#atch453 revert-stmmac-Fix-eth0-No-PHY-found-regression.patch
-#atch454 stmmac-fix-MDIO-settings.patch
+# http://www.spinics.net/lists/arm-kernel/msg490981.html
+Patch422: geekbox-v4-device-tree-support.patch
-Patch456: arm64-acpi-drop-expert-patch.patch
+# http://www.spinics.net/lists/arm-kernel/msg483898.html
+Patch423: Initial-AllWinner-A64-and-PINE64-support.patch
# http://patchwork.ozlabs.org/patch/587554/
-Patch457: ARM-tegra-usb-no-reset.patch
+Patch430: ARM-tegra-usb-no-reset.patch
-# http://www.spinics.net/lists/arm-kernel/msg490981.html
-Patch459: geekbox-v4-device-tree-support.patch
+# http://www.spinics.net/lists/linux-tegra/msg25152.html
+Patch431: Fix-tegra-to-use-stdout-path-for-serial-console.patch
-# http://www.spinics.net/lists/arm-kernel/msg483898.html
-Patch460: Initial-AllWinner-A64-and-PINE64-support.patch
+Patch432: arm-i.MX6-Utilite-device-dtb.patch
-# http://www.spinics.net/lists/linux-tegra/msg25152.html
-Patch461: Fix-tegra-to-use-stdout-path-for-serial-console.patch
+# mvebu usb fixes http://www.spinics.net/lists/arm-kernel/msg493305.html
+Patch433: 0001-ARM-mvebu-Correct-unit-address-for-linksys.patch
-Patch463: arm-i.MX6-Utilite-device-dtb.patch
+# mvebu DSA switch fixes
+# http://www.spinics.net/lists/netdev/msg370841.html http://www.spinics.net/lists/netdev/msg370842.html
+Patch434: 0001-net-dsa-mv88e6xxx-Introduce-_mv88e6xxx_phy_page_-rea.patch
+Patch435: 0002-net-dsa-mv88e6xxx-Clear-the-PDOWN-bit-on-setup.patch
+
+Patch460: lib-cpumask-Make-CPUMASK_OFFSTACK-usable-without-deb.patch
Patch466: input-kill-stupid-messages.patch
@@ -2151,6 +2155,10 @@ fi
#
#
%changelog
+* Wed Mar 30 2016 Peter Robinson <pbrobinson@fedoraproject.org>
+- Add ARMv7 mvebu fixes headed upstream
+- Minor ARMv7 cleanups
+
* Sun Mar 27 2016 Josh Boyer <jwboyer@fedoraproject.org> - 4.6.0-0.rc1.git0.1
- Linux v4.6-rc1
- Disable debugging options.
diff --git a/revert-stmmac-Fix-eth0-No-PHY-found-regression.patch b/revert-stmmac-Fix-eth0-No-PHY-found-regression.patch
deleted file mode 100644
index 68b9cd3ab..000000000
--- a/revert-stmmac-Fix-eth0-No-PHY-found-regression.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From 44f947bb8ef5f4add9f2d84e1ff53afd8f2f5537 Mon Sep 17 00:00:00 2001
-From: Peter Robinson <pbrobinson@gmail.com>
-Date: Wed, 16 Mar 2016 15:21:44 +0000
-Subject: [PATCH 1/2] Revert "stmmac: Fix 'eth0: No PHY found' regression"
-
-This reverts commit 88f8b1bb41c6208f81b6a480244533ded7b59493.
----
- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 11 ++++++++++-
- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 +--------
- include/linux/stmmac.h | 1 -
- 3 files changed, 11 insertions(+), 10 deletions(-)
-
-diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
-index efb54f3..0faf163 100644
---- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
-+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
-@@ -199,12 +199,21 @@ int stmmac_mdio_register(struct net_device *ndev)
- struct stmmac_priv *priv = netdev_priv(ndev);
- struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
- int addr, found;
-- struct device_node *mdio_node = priv->plat->mdio_node;
-+ struct device_node *mdio_node = NULL;
-+ struct device_node *child_node = NULL;
-
- if (!mdio_bus_data)
- return 0;
-
- if (IS_ENABLED(CONFIG_OF)) {
-+ for_each_child_of_node(priv->device->of_node, child_node) {
-+ if (of_device_is_compatible(child_node,
-+ "snps,dwmac-mdio")) {
-+ mdio_node = child_node;
-+ break;
-+ }
-+ }
-+
- if (mdio_node) {
- netdev_dbg(ndev, "FOUND MDIO subnode\n");
- } else {
-diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
-index 4514ba7..6a52fa1 100644
---- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
-+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
-@@ -110,7 +110,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
- struct device_node *np = pdev->dev.of_node;
- struct plat_stmmacenet_data *plat;
- struct stmmac_dma_cfg *dma_cfg;
-- struct device_node *child_node = NULL;
-
- plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
- if (!plat)
-@@ -141,19 +140,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
- plat->phy_node = of_node_get(np);
- }
-
-- for_each_child_of_node(np, child_node)
-- if (of_device_is_compatible(child_node, "snps,dwmac-mdio")) {
-- plat->mdio_node = child_node;
-- break;
-- }
--
- /* "snps,phy-addr" is not a standard property. Mark it as deprecated
- * and warn of its use. Remove this when phy node support is added.
- */
- if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0)
- dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n");
-
-- if ((plat->phy_node && !of_phy_is_fixed_link(np)) || !plat->mdio_node)
-+ if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name)
- plat->mdio_bus_data = NULL;
- else
- plat->mdio_bus_data =
-diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
-index 881a79d..eead8ab 100644
---- a/include/linux/stmmac.h
-+++ b/include/linux/stmmac.h
-@@ -100,7 +100,6 @@ struct plat_stmmacenet_data {
- int interface;
- struct stmmac_mdio_bus_data *mdio_bus_data;
- struct device_node *phy_node;
-- struct device_node *mdio_node;
- struct stmmac_dma_cfg *dma_cfg;
- int clk_csr;
- int has_gmac;
---
-2.5.0
-
diff --git a/stmmac-fix-MDIO-settings.patch b/stmmac-fix-MDIO-settings.patch
deleted file mode 100644
index 41fa928a4..000000000
--- a/stmmac-fix-MDIO-settings.patch
+++ /dev/null
@@ -1,235 +0,0 @@
-From d55a02f460ffd64a5ba7f331489af87edeebf8da Mon Sep 17 00:00:00 2001
-From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
-Date: Wed, 16 Mar 2016 10:38:49 +0100
-Subject: [PATCH 2/2] stmmac: fix MDIO settings
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Initially the phy_bus_name was added to manipulate the
-driver name but it was recently just used to manage the
-fixed-link and then to take some decision at run-time.
-So the patch uses the is_pseudo_fixed_link and removes
-the phy_bus_name variable not necessary anymore.
-
-The driver can manage the mdio registration by using phy-handle,
-dwmac-mdio and own parameter e.g. snps,phy-addr.
-This patch takes care about all these possible configurations
-and fixes the mdio registration in case of there is a real
-transceiver or a switch (that needs to be managed by using
-fixed-link).
-
-Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
-Reviewed-by: Andreas Färber <afaerber@suse.de>
-Tested-by: Frank Schäfer <fschaefer.oss@googlemail.com>
-Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org>
-Cc: Dinh Nguyen <dinh.linux@gmail.com>
-Cc: David S. Miller <davem@davemloft.net>
-Cc: Phil Reid <preid@electromag.com.au>
----
- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +--
- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 19 +----
- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 84 +++++++++++++++++-----
- include/linux/stmmac.h | 2 +-
- 4 files changed, 71 insertions(+), 45 deletions(-)
-
-diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
-index c21015b..389d7d0 100644
---- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
-+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
-@@ -271,7 +271,6 @@ static void stmmac_eee_ctrl_timer(unsigned long arg)
- */
- bool stmmac_eee_init(struct stmmac_priv *priv)
- {
-- char *phy_bus_name = priv->plat->phy_bus_name;
- unsigned long flags;
- bool ret = false;
-
-@@ -283,7 +282,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
- goto out;
-
- /* Never init EEE in case of a switch is attached */
-- if (phy_bus_name && (!strcmp(phy_bus_name, "fixed")))
-+ if (priv->phydev->is_pseudo_fixed_link)
- goto out;
-
- /* MAC core supports the EEE feature. */
-@@ -820,12 +819,8 @@ static int stmmac_init_phy(struct net_device *dev)
- phydev = of_phy_connect(dev, priv->plat->phy_node,
- &stmmac_adjust_link, 0, interface);
- } else {
-- if (priv->plat->phy_bus_name)
-- snprintf(bus_id, MII_BUS_ID_SIZE, "%s-%x",
-- priv->plat->phy_bus_name, priv->plat->bus_id);
-- else
-- snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x",
-- priv->plat->bus_id);
-+ snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x",
-+ priv->plat->bus_id);
-
- snprintf(phy_id_fmt, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id,
- priv->plat->phy_addr);
-diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
-index 0faf163..3f5512f 100644
---- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
-+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
-@@ -198,29 +198,12 @@ int stmmac_mdio_register(struct net_device *ndev)
- struct mii_bus *new_bus;
- struct stmmac_priv *priv = netdev_priv(ndev);
- struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
-+ struct device_node *mdio_node = priv->plat->mdio_node;
- int addr, found;
-- struct device_node *mdio_node = NULL;
-- struct device_node *child_node = NULL;
-
- if (!mdio_bus_data)
- return 0;
-
-- if (IS_ENABLED(CONFIG_OF)) {
-- for_each_child_of_node(priv->device->of_node, child_node) {
-- if (of_device_is_compatible(child_node,
-- "snps,dwmac-mdio")) {
-- mdio_node = child_node;
-- break;
-- }
-- }
--
-- if (mdio_node) {
-- netdev_dbg(ndev, "FOUND MDIO subnode\n");
-- } else {
-- netdev_warn(ndev, "No MDIO subnode found\n");
-- }
-- }
--
- new_bus = mdiobus_alloc();
- if (new_bus == NULL)
- return -ENOMEM;
-diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
-index 6a52fa1..190fb6d 100644
---- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
-+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
-@@ -96,6 +96,69 @@ static int dwmac1000_validate_ucast_entries(int ucast_entries)
- }
-
- /**
-+ * stmmac_dt_phy - parse device-tree driver parameters to allocate PHY resources
-+ * @plat: driver data platform structure
-+ * @np: device tree node
-+ * @dev: device pointer
-+ * Description:
-+ * The mdio bus will be allocated in case of a phy transceiver is on board;
-+ * it will be NULL if the fixed-link is configured.
-+ * If there is the "snps,dwmac-mdio" sub-node the mdio will be allocated
-+ * in any case (for DSA, mdio must be registered even if fixed-link).
-+ * The table below sums the supported configurations:
-+ * -------------------------------
-+ * snps,phy-addr | Y
-+ * -------------------------------
-+ * phy-handle | Y
-+ * -------------------------------
-+ * fixed-link | N
-+ * -------------------------------
-+ * snps,dwmac-mdio |
-+ * even if | Y
-+ * fixed-link |
-+ * -------------------------------
-+ *
-+ * It returns 0 in case of success otherwise -ENODEV.
-+ */
-+static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
-+ struct device_node *np, struct device *dev)
-+{
-+ bool mdio = true;
-+
-+ /* If phy-handle property is passed from DT, use it as the PHY */
-+ plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
-+ if (plat->phy_node)
-+ dev_dbg(dev, "Found phy-handle subnode\n");
-+
-+ /* If phy-handle is not specified, check if we have a fixed-phy */
-+ if (!plat->phy_node && of_phy_is_fixed_link(np)) {
-+ if ((of_phy_register_fixed_link(np) < 0))
-+ return -ENODEV;
-+
-+ dev_dbg(dev, "Found fixed-link subnode\n");
-+ plat->phy_node = of_node_get(np);
-+ mdio = false;
-+ }
-+
-+ /* If snps,dwmac-mdio is passed from DT, always register the MDIO */
-+ for_each_child_of_node(np, plat->mdio_node) {
-+ if (of_device_is_compatible(plat->mdio_node, "snps,dwmac-mdio"))
-+ break;
-+ }
-+
-+ if (plat->mdio_node) {
-+ dev_dbg(dev, "Found MDIO subnode\n");
-+ mdio = true;
-+ }
-+
-+ if (mdio)
-+ plat->mdio_bus_data =
-+ devm_kzalloc(dev, sizeof(struct stmmac_mdio_bus_data),
-+ GFP_KERNEL);
-+ return 0;
-+}
-+
-+/**
- * stmmac_probe_config_dt - parse device-tree driver parameters
- * @pdev: platform_device structure
- * @plat: driver data platform structure
-@@ -129,30 +192,15 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
- /* Default to phy auto-detection */
- plat->phy_addr = -1;
-
-- /* If we find a phy-handle property, use it as the PHY */
-- plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
--
-- /* If phy-handle is not specified, check if we have a fixed-phy */
-- if (!plat->phy_node && of_phy_is_fixed_link(np)) {
-- if ((of_phy_register_fixed_link(np) < 0))
-- return ERR_PTR(-ENODEV);
--
-- plat->phy_node = of_node_get(np);
-- }
--
- /* "snps,phy-addr" is not a standard property. Mark it as deprecated
- * and warn of its use. Remove this when phy node support is added.
- */
- if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0)
- dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n");
-
-- if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name)
-- plat->mdio_bus_data = NULL;
-- else
-- plat->mdio_bus_data =
-- devm_kzalloc(&pdev->dev,
-- sizeof(struct stmmac_mdio_bus_data),
-- GFP_KERNEL);
-+ /* To Configure PHY by using all device-tree supported properties */
-+ if (stmmac_dt_phy(plat, np, &pdev->dev))
-+ return ERR_PTR(-ENODEV);
-
- of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size);
-
-diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
-index eead8ab..8b1ff2b 100644
---- a/include/linux/stmmac.h
-+++ b/include/linux/stmmac.h
-@@ -94,12 +94,12 @@ struct stmmac_dma_cfg {
- };
-
- struct plat_stmmacenet_data {
-- char *phy_bus_name;
- int bus_id;
- int phy_addr;
- int interface;
- struct stmmac_mdio_bus_data *mdio_bus_data;
- struct device_node *phy_node;
-+ struct device_node *mdio_node;
- struct stmmac_dma_cfg *dma_cfg;
- int clk_csr;
- int has_gmac;
---
-2.5.0
-