diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-03-15 16:06:25 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2013-03-15 16:06:25 +0000 |
commit | 5503686f69810dd42993cf339f98a6bfa4752581 (patch) | |
tree | 20ac17f9386959a5cafbb07e6a3a1e77572611cf /target/linux | |
parent | 44ce8dac888ab9311d0fbdfdb563b90f33ae10df (diff) | |
download | upstream-5503686f69810dd42993cf339f98a6bfa4752581.tar.gz upstream-5503686f69810dd42993cf339f98a6bfa4752581.tar.bz2 upstream-5503686f69810dd42993cf339f98a6bfa4752581.zip |
generic: ar8216: add ar8xxx_start helper
Move switch starting code into a separate function.
This makes it usable from other places.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 36049
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/generic/files/drivers/net/phy/ar8216.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 9889698b07..f1b7436247 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -1914,6 +1914,28 @@ ar8xxx_probe_switch(struct ar8xxx_priv *priv) } static int +ar8xxx_start(struct ar8xxx_priv *priv) +{ + int ret; + + priv->init = true; + + ret = priv->chip->hw_init(priv); + if (ret) + return ret; + + ret = ar8xxx_sw_reset_switch(&priv->dev); + if (ret) + return ret; + + priv->init = false; + + ar8xxx_mib_start(priv); + + return 0; +} + +static int ar8xxx_phy_config_init(struct phy_device *phydev) { struct ar8xxx_priv *priv = phydev->priv; @@ -1938,13 +1960,7 @@ ar8xxx_phy_config_init(struct phy_device *phydev) return 0; } - priv->init = true; - - ret = priv->chip->hw_init(priv); - if (ret) - return ret; - - ret = ar8xxx_sw_reset_switch(&priv->dev); + ret = ar8xxx_start(priv); if (ret) return ret; @@ -1956,10 +1972,6 @@ ar8xxx_phy_config_init(struct phy_device *phydev) dev->eth_mangle_tx = ar8216_mangle_tx; } - priv->init = false; - - ar8xxx_mib_start(priv); - return 0; } |