aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/patches-3.14/070-net-phy-move-PHY-software-reset.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-11-27 18:26:00 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-11-27 18:26:00 +0000
commitd870349db657b14524a035a05cacbe829fc44530 (patch)
tree06ad07dfc746e7bd08e21189bd73fb9cbd99bc82 /target/linux/generic/patches-3.14/070-net-phy-move-PHY-software-reset.patch
parentd145ef383a83f0002328935ce847e949e3079eb4 (diff)
downloadmaster-187ad058-d870349db657b14524a035a05cacbe829fc44530.tar.gz
master-187ad058-d870349db657b14524a035a05cacbe829fc44530.tar.bz2
master-187ad058-d870349db657b14524a035a05cacbe829fc44530.zip
kernel: backport patches for overriding PHY reset to 3.14
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43409 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic/patches-3.14/070-net-phy-move-PHY-software-reset.patch')
-rw-r--r--target/linux/generic/patches-3.14/070-net-phy-move-PHY-software-reset.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/target/linux/generic/patches-3.14/070-net-phy-move-PHY-software-reset.patch b/target/linux/generic/patches-3.14/070-net-phy-move-PHY-software-reset.patch
new file mode 100644
index 0000000000..007a7aad3d
--- /dev/null
+++ b/target/linux/generic/patches-3.14/070-net-phy-move-PHY-software-reset.patch
@@ -0,0 +1,71 @@
+commit 797ac07137d9ae8572008e21e6123a9ae17dae50
+Author: Florian Fainelli <f.fainelli@gmail.com>
+Date: Mon Feb 17 13:34:02 2014 -0800
+
+ net: phy: move PHY software reset to genphy_soft_reset
+
+ As pointed out by Shaohui, this function is generic for 10/100/1000
+ PHYs, but 10G PHYs might have a slightly different reset sequence which
+ prevents most of them from using this function.
+
+ Move the BMCR_RESET based software resent sequence to
+ genphy_soft_reset() in preparation for allowing PHY drivers to implement
+ a soft_reset() callback.
+
+ Reported-by: Shaohui Xie <Shaohui.Xie@freescale.com>
+ Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+ Signed-off-by: David S. Miller <davem@davemloft.net>
+
+--- a/drivers/net/phy/phy_device.c
++++ b/drivers/net/phy/phy_device.c
+@@ -539,11 +539,7 @@ int phy_init_hw(struct phy_device *phyde
+ if (!phydev->drv || !phydev->drv->config_init)
+ return 0;
+
+- ret = phy_write(phydev, MII_BMCR, BMCR_RESET);
+- if (ret < 0)
+- return ret;
+-
+- ret = phy_poll_reset(phydev);
++ ret = genphy_soft_reset(phydev);
+ if (ret < 0)
+ return ret;
+
+@@ -1029,6 +1025,27 @@ static int gen10g_read_status(struct phy
+ return 0;
+ }
+
++/**
++ * genphy_soft_reset - software reset the PHY via BMCR_RESET bit
++ * @phydev: target phy_device struct
++ *
++ * Description: Perform a software PHY reset using the standard
++ * BMCR_RESET bit and poll for the reset bit to be cleared.
++ *
++ * Returns: 0 on success, < 0 on failure
++ */
++int genphy_soft_reset(struct phy_device *phydev)
++{
++ int ret;
++
++ ret = phy_write(phydev, MII_BMCR, BMCR_RESET);
++ if (ret < 0)
++ return ret;
++
++ return phy_poll_reset(phydev);
++}
++EXPORT_SYMBOL(genphy_soft_reset);
++
+ static int genphy_config_init(struct phy_device *phydev)
+ {
+ int val;
+--- a/include/linux/phy.h
++++ b/include/linux/phy.h
+@@ -616,6 +616,7 @@ int genphy_update_link(struct phy_device
+ int genphy_read_status(struct phy_device *phydev);
+ int genphy_suspend(struct phy_device *phydev);
+ int genphy_resume(struct phy_device *phydev);
++int genphy_soft_reset(struct phy_device *phydev);
+ void phy_driver_unregister(struct phy_driver *drv);
+ void phy_drivers_unregister(struct phy_driver *drv, int n);
+ int phy_driver_register(struct phy_driver *new_driver);