diff options
author | juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-03-15 16:06:28 +0000 |
---|---|---|
committer | juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-03-15 16:06:28 +0000 |
commit | c6f0aff5c8e2fc638814ac1e4ffd28045c27d225 (patch) | |
tree | df5255d08a6b68c70c1c8b8f78d4a129d4d74846 /target | |
parent | 33d879aa19a0024908fd657e4373b46a22217e75 (diff) |
generic: ar8216: start AR8327 switch from the probe routine
The AR8327 switch gets its configuration from platform
data or from the device-tree. This allows to start it
from the probe routine. Doing so makes it usable with
ethernet drivers which only connects to the PHY device
when the ethernet interface is opened.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36050 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/generic/files/drivers/net/phy/ar8216.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index f1b743624..ccc074fde 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -1945,6 +1945,9 @@ ar8xxx_phy_config_init(struct phy_device *phydev) if (WARN_ON(!priv)) return -ENODEV; + if (chip_is_ar8327(priv)) + return 0; + priv->phy = phydev; if (phydev->addr != 0) { @@ -2103,6 +2106,8 @@ ar8xxx_phy_probe(struct phy_device *phydev) swdev->devname, swdev->name, dev_name(&priv->mii_bus->dev)); found: + priv->use_count++; + if (phydev->addr == 0) { if (ar8xxx_has_gige(priv)) { phydev->supported = SUPPORTED_1000baseT_Full; @@ -2111,6 +2116,14 @@ found: phydev->supported = SUPPORTED_100baseT_Full; phydev->advertising = ADVERTISED_100baseT_Full; } + + if (chip_is_ar8327(priv)) { + priv->phy = phydev; + + ret = ar8xxx_start(priv); + if (ret) + goto err_unregister_switch; + } } else { if (ar8xxx_has_gige(priv)) { phydev->supported |= SUPPORTED_1000baseT_Full; @@ -2119,7 +2132,6 @@ found: } phydev->priv = priv; - priv->use_count++; list_add(&priv->list, &ar8xxx_dev_list); @@ -2127,6 +2139,12 @@ found: return 0; +err_unregister_switch: + if (--priv->use_count) + goto unlock; + + unregister_switch(&priv->dev); + free_priv: ar8xxx_free(priv); unlock: |