diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-03-18 22:06:05 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2012-03-18 22:06:05 +0000 |
commit | baee093c4e8baab40b6d2027caf1e0734bb1127c (patch) | |
tree | 8beef7dfd3776c66c8f3e61d5508046dcd7ae186 /target | |
parent | e4682f031a25b4b8e108b9f08b6ca6c534e474f1 (diff) | |
download | upstream-baee093c4e8baab40b6d2027caf1e0734bb1127c.tar.gz upstream-baee093c4e8baab40b6d2027caf1e0734bb1127c.tar.bz2 upstream-baee093c4e8baab40b6d2027caf1e0734bb1127c.zip |
generic: ar8216: move ar8216_id_chip function
Also remove the inline annotation.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30995 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/generic/files/drivers/net/phy/ar8216.c | 103 |
1 files changed, 51 insertions, 52 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 0d42e27c49..4c5ddc31c3 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -145,57 +145,6 @@ ar8216_rmw(struct ar8216_priv *priv, int reg, u32 mask, u32 val) return v; } -static inline int -ar8216_id_chip(struct ar8216_priv *priv) -{ - u32 val; - u16 id; - int i; - - priv->chip = UNKNOWN; - - val = ar8216_mii_read(priv, AR8216_REG_CTRL); - if (val == ~0) - return -ENODEV; - - id = val & (AR8216_CTRL_REVISION | AR8216_CTRL_VERSION); - for (i = 0; i < AR8X16_PROBE_RETRIES; i++) { - u16 t; - - val = ar8216_mii_read(priv, AR8216_REG_CTRL); - if (val == ~0) - return -ENODEV; - - t = val & (AR8216_CTRL_REVISION | AR8216_CTRL_VERSION); - if (t != id) - return -ENODEV; - } - - switch (id) { - case 0x0101: - priv->chip = AR8216; - break; - case 0x0301: - priv->chip = AR8236; - break; - case 0x1000: - case 0x1001: - priv->chip = AR8316; - break; - default: - printk(KERN_DEBUG - "ar8216: Unknown Atheros device [ver=%d, rev=%d, phy_id=%04x%04x]\n", - (int)(id >> AR8216_CTRL_VERSION_S), - (int)(id & AR8216_CTRL_REVISION), - mdiobus_read(priv->phy->bus, priv->phy->addr, 2), - mdiobus_read(priv->phy->bus, priv->phy->addr, 3)); - - return -ENODEV; - } - - return 0; -} - static void ar8216_read_port_link(struct ar8216_priv *priv, int port, struct switch_port_link *link) @@ -810,7 +759,6 @@ ar8216_reset_switch(struct switch_dev *dev) return ar8216_hw_apply(dev); } - static const struct switch_dev_ops ar8216_sw_ops = { .attr_global = { .attr = ar8216_globals, @@ -834,6 +782,57 @@ static const struct switch_dev_ops ar8216_sw_ops = { }; static int +ar8216_id_chip(struct ar8216_priv *priv) +{ + u32 val; + u16 id; + int i; + + priv->chip = UNKNOWN; + + val = ar8216_mii_read(priv, AR8216_REG_CTRL); + if (val == ~0) + return -ENODEV; + + id = val & (AR8216_CTRL_REVISION | AR8216_CTRL_VERSION); + for (i = 0; i < AR8X16_PROBE_RETRIES; i++) { + u16 t; + + val = ar8216_mii_read(priv, AR8216_REG_CTRL); + if (val == ~0) + return -ENODEV; + + t = val & (AR8216_CTRL_REVISION | AR8216_CTRL_VERSION); + if (t != id) + return -ENODEV; + } + + switch (id) { + case 0x0101: + priv->chip = AR8216; + break; + case 0x0301: + priv->chip = AR8236; + break; + case 0x1000: + case 0x1001: + priv->chip = AR8316; + break; + default: + printk(KERN_DEBUG + "ar8216: Unknown Atheros device [ver=%d, rev=%d, phy_id=%04x%04x]\n", + (int)(id >> AR8216_CTRL_VERSION_S), + (int)(id & AR8216_CTRL_REVISION), + mdiobus_read(priv->phy->bus, priv->phy->addr, 2), + mdiobus_read(priv->phy->bus, priv->phy->addr, 3)); + + return -ENODEV; + } + + return 0; +} + +static int ar8216_config_init(struct phy_device *pdev) { struct ar8216_priv *priv = pdev->priv; |