summaryrefslogtreecommitdiff
path: root/target/linux/generic/files
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-11-19 20:17:43 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-11-19 20:17:43 +0000
commit20baeb55954eb896071e76410e574ee44239c40b (patch)
tree5adbe9e5e9f2a1b1facf13b08503d7462b4303e6 /target/linux/generic/files
parent37fefea79b74e6017becfb20caf6e0fa70649170 (diff)
downloadmtk-20170518-20baeb55954eb896071e76410e574ee44239c40b.zip
mtk-20170518-20baeb55954eb896071e76410e574ee44239c40b.tar.gz
mtk-20170518-20baeb55954eb896071e76410e574ee44239c40b.tar.bz2
ar8216: introduce fixup_phys callback in ar8xxx_chip
Move phy fixup code from the chip-specific hw_init functions into a fixup_phys callback. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43330
Diffstat (limited to 'target/linux/generic/files')
-rw-r--r--target/linux/generic/files/drivers/net/phy/ar8216.c15
1 files changed, 13 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 276932b..3673612 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -80,6 +80,7 @@ struct ar8xxx_chip {
int (*atu_flush)(struct ar8xxx_priv *priv);
void (*vtu_flush)(struct ar8xxx_priv *priv);
void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vid, u32 port_mask);
+ void (*fixup_phys)(struct ar8xxx_priv *priv);
const struct ar8xxx_mib_desc *mib_decs;
unsigned num_mibs;
@@ -1636,10 +1637,10 @@ ar8327_hw_init(struct ar8xxx_priv *priv)
ar8327_leds_init(priv);
+ priv->chip->fixup_phys(priv);
+
bus = priv->mii_bus;
for (i = 0; i < AR8XXX_NUM_PHYS; i++) {
- ar8327_phy_fixup(priv, i);
-
/* start aneg on the PHY */
mdiobus_write(bus, i, MII_ADVERTISE, ADVERTISE_ALL |
ADVERTISE_PAUSE_CAP |
@@ -1816,6 +1817,15 @@ ar8327_setup_port(struct ar8xxx_priv *priv, int port, u32 members)
priv->write(priv, AR8327_REG_PORT_LOOKUP(port), t);
}
+static void
+ar8327_fixup_phys(struct ar8xxx_priv *priv)
+{
+ int i;
+
+ for (i = 0; i < AR8XXX_NUM_PHYS; i++)
+ ar8327_phy_fixup(priv, i);
+}
+
static const struct ar8xxx_chip ar8327_chip = {
.caps = AR8XXX_CAP_GIGE | AR8XXX_CAP_MIB_COUNTERS,
.hw_init = ar8327_hw_init,
@@ -1827,6 +1837,7 @@ static const struct ar8xxx_chip ar8327_chip = {
.atu_flush = ar8327_atu_flush,
.vtu_flush = ar8327_vtu_flush,
.vtu_load_vlan = ar8327_vtu_load_vlan,
+ .fixup_phys = ar8327_fixup_phys,
.num_mibs = ARRAY_SIZE(ar8236_mibs),
.mib_decs = ar8236_mibs,