aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorChuanhong Guo <gch981213@gmail.com>2018-07-24 21:19:04 +0800
committerJohn Crispin <john@phrozen.org>2018-07-30 10:43:35 +0200
commitf593020a288bc38ed5f7d0ec6a3b70fa8f1e8bf6 (patch)
treefa9db210d8669e090bad468ffc6ee06edc27ade5 /target
parenta5fa6b3825c18058e6b2e5370041fa6cd9c81d12 (diff)
downloadupstream-f593020a288bc38ed5f7d0ec6a3b70fa8f1e8bf6.tar.gz
upstream-f593020a288bc38ed5f7d0ec6a3b70fa8f1e8bf6.tar.bz2
upstream-f593020a288bc38ed5f7d0ec6a3b70fa8f1e8bf6.zip
ath79: ag71xx: assert a switch reset if defined in dts.
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Diffstat (limited to 'target')
-rw-r--r--target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c
index f91144da6e..173c16a53d 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c
@@ -1218,6 +1218,7 @@ ag71xx_ar7240_probe(struct mdio_device *mdiodev)
struct mii_bus *mii = mdiodev->bus;
struct ar7240sw *as;
struct switch_dev *swdev;
+ struct reset_control *switch_reset;
u32 ctrl;
int phy_if_mode, err, i;
@@ -1231,6 +1232,14 @@ ag71xx_ar7240_probe(struct mdio_device *mdiodev)
swdev = &as->swdev;
+ switch_reset = devm_reset_control_get_optional(&mdiodev->dev, "switch");
+ if (switch_reset) {
+ reset_control_assert(switch_reset);
+ msleep(50);
+ reset_control_deassert(switch_reset);
+ msleep(200);
+ }
+
ctrl = ar7240sw_reg_read(mii, AR7240_REG_MASK_CTRL);
as->ver = (ctrl >> AR7240_MASK_CTRL_VERSION_S) &
AR7240_MASK_CTRL_VERSION_M;