+++ /dev/null
---- a/drivers/net/phy/mdio_bus.c
-+++ b/drivers/net/phy/mdio_bus.c
-@@ -131,6 +131,9 @@ static int mdio_bus_match(struct device
- struct phy_device *phydev = to_phy_device(dev);
- struct phy_driver *phydrv = to_phy_driver(drv);
-
-+ if (phydrv->detect)
-+ return (phydrv->detect(phydev->bus, phydev->addr));
-+
- return ((phydrv->phy_id & phydrv->phy_id_mask) ==
- (phydev->phy_id & phydrv->phy_id_mask));
- }
---- a/include/linux/phy.h
-+++ b/include/linux/phy.h
-@@ -319,6 +319,11 @@ struct phy_driver {
- u32 features;
- u32 flags;
-
-+ /* Called during discovery to test if the
-+ * device can attach to the bus, even if
-+ * phy id and mask do not match */
-+ bool (*detect)(struct mii_bus *bus, int addr);
-+
- /* Called to initialize the PHY,
- * including after a reset */
- int (*config_init)(struct phy_device *phydev);
+++ /dev/null
---- a/drivers/net/phy/Kconfig
-+++ b/drivers/net/phy/Kconfig
-@@ -60,6 +60,11 @@ config ICPLUS_PHY
- ---help---
- Currently supports the IP175C PHY.
-
-+config ADM6996_PHY
-+ tristate "Driver for ADM6996 switches"
-+ ---help---
-+ Currently supports the ADM6996F switch
-+
- config FIXED_PHY
- tristate "Drivers for PHY emulation on fixed speed/link"
- ---help---
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -12,4 +12,5 @@ obj-$(CONFIG_SMSC_PHY) += smsc.o
- obj-$(CONFIG_VITESSE_PHY) += vitesse.o
- obj-$(CONFIG_BROADCOM_PHY) += broadcom.o
- obj-$(CONFIG_ICPLUS_PHY) += icplus.o
-+obj-$(CONFIG_ADM6996_PHY) += adm6996.o
- obj-$(CONFIG_FIXED_PHY) += fixed.o
+++ /dev/null
---- a/drivers/net/phy/phy_device.c
-+++ b/drivers/net/phy/phy_device.c
-@@ -44,6 +44,18 @@ static struct phy_driver genphy_driver;
- extern int mdio_bus_init(void);
- extern void mdio_bus_exit(void);
-
-+static int generic_receive_skb(struct sk_buff *skb)
-+{
-+ skb->protocol = eth_type_trans(skb, skb->dev);
-+ return netif_receive_skb(skb);
-+}
-+
-+static int generic_rx(struct sk_buff *skb)
-+{
-+ skb->protocol = eth_type_trans(skb, skb->dev);
-+ return netif_rx(skb);
-+}
-+
- struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
- {
- struct phy_device *dev;
-@@ -67,6 +79,8 @@ struct phy_device* phy_device_create(str
- dev->bus = bus;
-
- dev->state = PHY_DOWN;
-+ dev->netif_receive_skb = &generic_receive_skb;
-+ dev->netif_rx = &generic_rx;
-
- spin_lock_init(&dev->lock);
-
---- a/include/linux/phy.h
-+++ b/include/linux/phy.h
-@@ -289,6 +289,17 @@ struct phy_device {
- void (*adjust_link)(struct net_device *dev);
-
- void (*adjust_state)(struct net_device *dev);
-+
-+ /*
-+ * By default these point to the original functions
-+ * with the same name. adding them to the phy_device
-+ * allows the phy driver to override them for packet
-+ * mangling if the ethernet driver supports it
-+ * This is required to support some really horrible
-+ * switches such as the Marvell 88E6060
-+ */
-+ int (*netif_receive_skb)(struct sk_buff *skb);
-+ int (*netif_rx)(struct sk_buff *skb);
- };
- #define to_phy_device(d) container_of(d, struct phy_device, dev)
-
---- a/include/linux/netdevice.h
-+++ b/include/linux/netdevice.h
-@@ -426,6 +426,7 @@ struct net_device
- void *ax25_ptr; /* AX.25 specific data */
- struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
- assign before registering */
-+ void *phy_ptr; /* PHY device specific data */
-
- /*
- * Cache line mostly used on receive path (including eth_type_trans())
+++ /dev/null
---- a/drivers/net/phy/Kconfig
-+++ b/drivers/net/phy/Kconfig
-@@ -65,6 +65,12 @@ config ADM6996_PHY
- ---help---
- Currently supports the ADM6996F switch
-
-+config MVSWITCH_PHY
-+ tristate "Driver for Marvell switches"
-+ select VLAN_8021Q
-+ ---help---
-+ Currently supports the Marvell 88E6060 switch.
-+
- config FIXED_PHY
- tristate "Drivers for PHY emulation on fixed speed/link"
- ---help---
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -13,4 +13,5 @@ obj-$(CONFIG_VITESSE_PHY) += vitesse.o
- obj-$(CONFIG_BROADCOM_PHY) += broadcom.o
- obj-$(CONFIG_ICPLUS_PHY) += icplus.o
- obj-$(CONFIG_ADM6996_PHY) += adm6996.o
-+obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o
- obj-$(CONFIG_FIXED_PHY) += fixed.o
---- a/drivers/net/phy/mdio_bus.c
-+++ b/drivers/net/phy/mdio_bus.c
-@@ -35,6 +35,12 @@
- #include <asm/irq.h>
- #include <asm/uaccess.h>
-
-+static void mdio_dev_release(struct device *dev)
-+{
-+ /* nothing to do */
-+}
-+
-+
- /**
- * mdiobus_register - bring up all the PHYs on a given bus and attach them to bus
- * @bus: target mii_bus
-@@ -85,6 +91,7 @@ int mdiobus_register(struct mii_bus *bus
-
- phydev->dev.parent = bus->dev;
- phydev->dev.bus = &mdio_bus_type;
-+ phydev->dev.release = mdio_dev_release;
- snprintf(phydev->dev.bus_id, BUS_ID_SIZE, PHY_ID_FMT, bus->id, i);
-
- phydev->bus = bus;
+++ /dev/null
---- a/drivers/net/phy/mdio_bus.c
-+++ b/drivers/net/phy/mdio_bus.c
-@@ -132,6 +132,9 @@ static int mdio_bus_match(struct device
- struct phy_device *phydev = to_phy_device(dev);
- struct phy_driver *phydrv = to_phy_driver(drv);
-
-+ if (phydrv->detect)
-+ return (phydrv->detect(phydev->bus, phydev->addr));
-+
- return ((phydrv->phy_id & phydrv->phy_id_mask) ==
- (phydev->phy_id & phydrv->phy_id_mask));
- }
---- a/include/linux/phy.h
-+++ b/include/linux/phy.h
-@@ -325,6 +325,11 @@ struct phy_driver {
- u32 features;
- u32 flags;
-
-+ /* Called during discovery to test if the
-+ * device can attach to the bus, even if
-+ * phy id and mask do not match */
-+ bool (*detect)(struct mii_bus *bus, int addr);
-+
- /* Called to initialize the PHY,
- * including after a reset */
- int (*config_init)(struct phy_device *phydev);
+++ /dev/null
---- a/drivers/net/phy/Kconfig
-+++ b/drivers/net/phy/Kconfig
-@@ -65,6 +65,11 @@ config REALTEK_PHY
- ---help---
- Supports the Realtek 821x PHY.
-
-+config ADM6996_PHY
-+ tristate "Driver for ADM6996 switches"
-+ ---help---
-+ Currently supports the ADM6996F switch
-+
- config FIXED_PHY
- bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
- depends on PHYLIB=y
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -12,6 +12,7 @@ obj-$(CONFIG_SMSC_PHY) += smsc.o
- obj-$(CONFIG_VITESSE_PHY) += vitesse.o
- obj-$(CONFIG_BROADCOM_PHY) += broadcom.o
- obj-$(CONFIG_ICPLUS_PHY) += icplus.o
-+obj-$(CONFIG_ADM6996_PHY) += adm6996.o
- obj-$(CONFIG_REALTEK_PHY) += realtek.o
- obj-$(CONFIG_FIXED_PHY) += fixed.o
- obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
+++ /dev/null
---- a/drivers/net/phy/phy_device.c
-+++ b/drivers/net/phy/phy_device.c
-@@ -53,6 +53,18 @@ static void phy_device_release(struct de
- phy_device_free(to_phy_device(dev));
- }
-
-+static int generic_receive_skb(struct sk_buff *skb)
-+{
-+ skb->protocol = eth_type_trans(skb, skb->dev);
-+ return netif_receive_skb(skb);
-+}
-+
-+static int generic_rx(struct sk_buff *skb)
-+{
-+ skb->protocol = eth_type_trans(skb, skb->dev);
-+ return netif_rx(skb);
-+}
-+
- struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
- {
- struct phy_device *dev;
-@@ -78,6 +90,8 @@ struct phy_device* phy_device_create(str
- dev->bus = bus;
-
- dev->state = PHY_DOWN;
-+ dev->netif_receive_skb = &generic_receive_skb;
-+ dev->netif_rx = &generic_rx;
-
- mutex_init(&dev->lock);
-
---- a/include/linux/phy.h
-+++ b/include/linux/phy.h
-@@ -295,6 +295,17 @@ struct phy_device {
- void (*adjust_link)(struct net_device *dev);
-
- void (*adjust_state)(struct net_device *dev);
-+
-+ /*
-+ * By default these point to the original functions
-+ * with the same name. adding them to the phy_device
-+ * allows the phy driver to override them for packet
-+ * mangling if the ethernet driver supports it
-+ * This is required to support some really horrible
-+ * switches such as the Marvell 88E6060
-+ */
-+ int (*netif_receive_skb)(struct sk_buff *skb);
-+ int (*netif_rx)(struct sk_buff *skb);
- };
- #define to_phy_device(d) container_of(d, struct phy_device, dev)
-
---- a/include/linux/netdevice.h
-+++ b/include/linux/netdevice.h
-@@ -595,6 +595,7 @@ struct net_device
- void *ax25_ptr; /* AX.25 specific data */
- struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
- assign before registering */
-+ void *phy_ptr; /* PHY device specific data */
-
- /*
- * Cache line mostly used on receive path (including eth_type_trans())
+++ /dev/null
---- a/drivers/net/phy/Kconfig
-+++ b/drivers/net/phy/Kconfig
-@@ -70,6 +70,12 @@ config ADM6996_PHY
- ---help---
- Currently supports the ADM6996F switch
-
-+config MVSWITCH_PHY
-+ tristate "Driver for Marvell switches"
-+ select VLAN_8021Q
-+ ---help---
-+ Currently supports the Marvell 88E6060 switch.
-+
- config FIXED_PHY
- bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
- depends on PHYLIB=y
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -13,6 +13,7 @@ obj-$(CONFIG_VITESSE_PHY) += vitesse.o
- obj-$(CONFIG_BROADCOM_PHY) += broadcom.o
- obj-$(CONFIG_ICPLUS_PHY) += icplus.o
- obj-$(CONFIG_ADM6996_PHY) += adm6996.o
-+obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o
- obj-$(CONFIG_REALTEK_PHY) += realtek.o
- obj-$(CONFIG_FIXED_PHY) += fixed.o
- obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
---- a/drivers/net/phy/mdio_bus.c
-+++ b/drivers/net/phy/mdio_bus.c
-@@ -35,6 +35,12 @@
- #include <asm/irq.h>
- #include <asm/uaccess.h>
-
-+static void mdio_dev_release(struct device *dev)
-+{
-+ /* nothing to do */
-+}
-+
-+
- /**
- * mdiobus_register - bring up all the PHYs on a given bus and attach them to bus
- * @bus: target mii_bus
-@@ -85,6 +91,7 @@ int mdiobus_register(struct mii_bus *bus
-
- phydev->dev.parent = bus->dev;
- phydev->dev.bus = &mdio_bus_type;
-+ phydev->dev.release = mdio_dev_release;
- snprintf(phydev->dev.bus_id, BUS_ID_SIZE, PHY_ID_FMT, bus->id, i);
-
- phydev->bus = bus;