kernel: update phy drivers for 4.9
[openwrt/staging/mkresin.git] / target / linux / generic / files / drivers / net / phy / mvswitch.c
index af73ec22a0d96cae8a1b01fd3d9bd0d31ef5938e..a20fce342edb5554225ba70fd1b5091388461141 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Marvell 88E6060 switch driver
- * Copyright (c) 2008 Felix Fietkau <nbd@openwrt.org>
+ * Copyright (c) 2008 Felix Fietkau <nbd@nbd.name>
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of the GNU General Public License v2 as published by the
@@ -50,13 +50,17 @@ struct mvswitch_priv {
 static inline u16
 r16(struct phy_device *phydev, int addr, int reg)
 {
-       return phydev->bus->read(phydev->bus, addr, reg);
+       struct mii_bus *bus = phydev->mdio.bus;
+
+       return bus->read(bus, addr, reg);
 }
 
 static inline void
 w16(struct phy_device *phydev, int addr, int reg, u16 val)
 {
-       phydev->bus->write(phydev->bus, addr, reg, val);
+       struct mii_bus *bus = phydev->mdio.bus;
+
+       bus->write(bus, addr, reg, val);
 }
 
 
@@ -173,7 +177,7 @@ mvswitch_mangle_rx(struct net_device *dev, struct sk_buff *skb)
        if (vlan == -1)
                return;
 
-       __vlan_hwaccel_put_tag(skb, vlan);
+       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan);
 }
 
 
@@ -307,9 +311,9 @@ mvswitch_config_init(struct phy_device *pdev)
 
 #ifdef HEADER_MODE
        dev->priv_flags |= IFF_NO_IP_ALIGN;
-       dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX;
+       dev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX;
 #else
-       dev->features |= NETIF_F_HW_VLAN_RX;
+       dev->features |= NETIF_F_HW_VLAN_CTAG_RX;
 #endif
 
        return 0;
@@ -388,12 +392,13 @@ mvswitch_probe(struct phy_device *pdev)
 static int
 mvswitch_fixup(struct phy_device *dev)
 {
+       struct mii_bus *bus = dev->mdio.bus;
        u16 reg;
 
-       if (dev->addr != 0x10)
+       if (dev->mdio.addr != 0x10)
                return 0;
 
-       reg = dev->bus->read(dev->bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK;
+       reg = bus->read(bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK;
        if (reg != MV_IDENT_VALUE)
                return 0;
 
@@ -413,14 +418,13 @@ static struct phy_driver mvswitch_driver = {
        .config_init    = &mvswitch_config_init,
        .config_aneg    = &mvswitch_config_aneg,
        .read_status    = &mvswitch_read_status,
-       .driver         = { .owner = THIS_MODULE,},
 };
 
 static int __init
 mvswitch_init(void)
 {
        phy_register_fixup_for_id(PHY_ANY_ID, mvswitch_fixup);
-       return phy_driver_register(&mvswitch_driver);
+       return phy_driver_register(&mvswitch_driver, THIS_MODULE);
 }
 
 static void __exit