diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-05-30 17:38:22 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2013-05-30 17:38:22 +0000 |
commit | 111bea7cd3387d475fd76c0ebd9470ae7a66b0a9 (patch) | |
tree | 1b8b42bd219d11eb57ecbb3ed27c5996fa3d5955 /target/linux/generic/files/drivers/net/phy/ar8216.c | |
parent | 133498bac5ac96ffeeafbdbcd711b980e1df927a (diff) | |
download | upstream-111bea7cd3387d475fd76c0ebd9470ae7a66b0a9.tar.gz upstream-111bea7cd3387d475fd76c0ebd9470ae7a66b0a9.tar.bz2 upstream-111bea7cd3387d475fd76c0ebd9470ae7a66b0a9.zip |
generic: ar8216: add get_port_link callback
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36797 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic/files/drivers/net/phy/ar8216.c')
-rw-r--r-- | target/linux/generic/files/drivers/net/phy/ar8216.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 6f836d7920..bc36efc3a8 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -88,8 +88,12 @@ struct ar8xxx_priv { struct switch_dev dev; struct mii_bus *mii_bus; struct phy_device *phy; + u32 (*read)(struct ar8xxx_priv *priv, int reg); void (*write)(struct ar8xxx_priv *priv, int reg, u32 val); + + int (*get_port_link)(unsigned port); + const struct net_device_ops *ndo_old; struct net_device_ops ndo; struct mutex reg_mutex; @@ -480,12 +484,21 @@ ar8216_read_port_link(struct ar8xxx_priv *priv, int port, link->aneg = !!(status & AR8216_PORT_STATUS_LINK_AUTO); if (link->aneg) { link->link = !!(status & AR8216_PORT_STATUS_LINK_UP); - if (!link->link) - return; } else { link->link = true; + + if (priv->get_port_link) { + int err; + + err = priv->get_port_link(port); + if (err >= 0) + link->link = !!err; + } } + if (!link->link) + return; + link->duplex = !!(status & AR8216_PORT_STATUS_DUPLEX); link->tx_flow = !!(status & AR8216_PORT_STATUS_TXFLOW); link->rx_flow = !!(status & AR8216_PORT_STATUS_RXFLOW); @@ -1058,6 +1071,8 @@ ar8327_hw_config_pdata(struct ar8xxx_priv *priv, if (!pdata) return -EINVAL; + priv->get_port_link = pdata->get_port_link; + data = &priv->chip_data.ar8327; data->port0_status = ar8327_get_port_init_status(&pdata->port0_cfg); |