mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-21 03:55:06 +00:00
generic: ar8216: add get_port_link callback
Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 36797
This commit is contained in:
parent
3467b17e69
commit
c170d3c3e4
@ -88,8 +88,12 @@ struct ar8xxx_priv {
|
|||||||
struct switch_dev dev;
|
struct switch_dev dev;
|
||||||
struct mii_bus *mii_bus;
|
struct mii_bus *mii_bus;
|
||||||
struct phy_device *phy;
|
struct phy_device *phy;
|
||||||
|
|
||||||
u32 (*read)(struct ar8xxx_priv *priv, int reg);
|
u32 (*read)(struct ar8xxx_priv *priv, int reg);
|
||||||
void (*write)(struct ar8xxx_priv *priv, int reg, u32 val);
|
void (*write)(struct ar8xxx_priv *priv, int reg, u32 val);
|
||||||
|
|
||||||
|
int (*get_port_link)(unsigned port);
|
||||||
|
|
||||||
const struct net_device_ops *ndo_old;
|
const struct net_device_ops *ndo_old;
|
||||||
struct net_device_ops ndo;
|
struct net_device_ops ndo;
|
||||||
struct mutex reg_mutex;
|
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);
|
link->aneg = !!(status & AR8216_PORT_STATUS_LINK_AUTO);
|
||||||
if (link->aneg) {
|
if (link->aneg) {
|
||||||
link->link = !!(status & AR8216_PORT_STATUS_LINK_UP);
|
link->link = !!(status & AR8216_PORT_STATUS_LINK_UP);
|
||||||
if (!link->link)
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
link->link = true;
|
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->duplex = !!(status & AR8216_PORT_STATUS_DUPLEX);
|
||||||
link->tx_flow = !!(status & AR8216_PORT_STATUS_TXFLOW);
|
link->tx_flow = !!(status & AR8216_PORT_STATUS_TXFLOW);
|
||||||
link->rx_flow = !!(status & AR8216_PORT_STATUS_RXFLOW);
|
link->rx_flow = !!(status & AR8216_PORT_STATUS_RXFLOW);
|
||||||
@ -1058,6 +1071,8 @@ ar8327_hw_config_pdata(struct ar8xxx_priv *priv,
|
|||||||
if (!pdata)
|
if (!pdata)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
priv->get_port_link = pdata->get_port_link;
|
||||||
|
|
||||||
data = &priv->chip_data.ar8327;
|
data = &priv->chip_data.ar8327;
|
||||||
|
|
||||||
data->port0_status = ar8327_get_port_init_status(&pdata->port0_cfg);
|
data->port0_status = ar8327_get_port_init_status(&pdata->port0_cfg);
|
||||||
|
@ -78,6 +78,8 @@ struct ar8327_platform_data {
|
|||||||
struct ar8327_port_cfg port0_cfg;
|
struct ar8327_port_cfg port0_cfg;
|
||||||
struct ar8327_port_cfg port6_cfg;
|
struct ar8327_port_cfg port6_cfg;
|
||||||
struct ar8327_led_cfg *led_cfg;
|
struct ar8327_led_cfg *led_cfg;
|
||||||
|
|
||||||
|
int (*get_port_link)(unsigned port);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* AR8216_PLATFORM_H */
|
#endif /* AR8216_PLATFORM_H */
|
Loading…
Reference in New Issue
Block a user