diff options
author | Matteo Croce <matteo@openwrt.org> | 2008-05-13 00:10:45 +0000 |
---|---|---|
committer | Matteo Croce <matteo@openwrt.org> | 2008-05-13 00:10:45 +0000 |
commit | a1f7c05bbf540fc9f260b229a9caf58d5b42d088 (patch) | |
tree | b04d839a84aad7bdf62af36e1ec23c1f582bada6 | |
parent | 3b5902a54aa7b008a9496d5b0315de36017e94c8 (diff) | |
download | master-187ad058-a1f7c05bbf540fc9f260b229a9caf58d5b42d088.tar.gz master-187ad058-a1f7c05bbf540fc9f260b229a9caf58d5b42d088.tar.bz2 master-187ad058-a1f7c05bbf540fc9f260b229a9caf58d5b42d088.zip |
atheros: added marvell switch driver
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11129 3c298f89-4303-0410-b956-a3cf2f4a3e73
6 files changed, 218 insertions, 0 deletions
diff --git a/target/linux/atheros/config-2.6.25 b/target/linux/atheros/config-2.6.25 index 2408411f5e..2000410722 100644 --- a/target/linux/atheros/config-2.6.25 +++ b/target/linux/atheros/config-2.6.25 @@ -1,5 +1,6 @@ CONFIG_32BIT=y # CONFIG_64BIT is not set +# CONFIG_ADM6996_PHY is not set CONFIG_AR2313=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set @@ -166,6 +167,7 @@ CONFIG_MTD_REDBOOT_PARTS_READONLY=y # CONFIG_MTD_ROM is not set # CONFIG_MTD_SLRAM is not set CONFIG_MTD_SPIFLASH=y +CONFIG_MVSWITCH_PHY=y # CONFIG_NET_PCI is not set # CONFIG_NET_VENDOR_3COM is not set CONFIG_NEW_GPIO=y diff --git a/target/linux/atheros/patches-2.6.25/200-ar2313_enable_mvswitch.patch b/target/linux/atheros/patches-2.6.25/200-ar2313_enable_mvswitch.patch new file mode 100644 index 0000000000..1c7d7c2365 --- /dev/null +++ b/target/linux/atheros/patches-2.6.25/200-ar2313_enable_mvswitch.patch @@ -0,0 +1,38 @@ +Index: linux-2.6.25.1/drivers/net/ar2313/ar2313.c +=================================================================== +--- linux-2.6.25.1.orig/drivers/net/ar2313/ar2313.c 2008-05-13 00:49:39.000000000 +0200 ++++ linux-2.6.25.1/drivers/net/ar2313/ar2313.c 2008-05-13 00:49:42.000000000 +0200 +@@ -953,9 +953,9 @@ + ((status >> DMA_RX_LEN_SHIFT) & 0x3fff) - CRC_LEN); + + dev->stats.rx_bytes += skb->len; +- skb->protocol = eth_type_trans(skb, dev); ++ + /* pass the packet to upper layers */ +- netif_rx(skb); ++ sp->rx(skb); + + skb_new->dev = dev; + /* 16 bit align */ +@@ -1370,6 +1370,8 @@ + return PTR_ERR(phydev); + } + ++ sp->rx = phydev->netif_rx; ++ + /* mask with MAC supported features */ + phydev->supported &= (SUPPORTED_10baseT_Half + | SUPPORTED_10baseT_Full +Index: linux-2.6.25.1/drivers/net/ar2313/ar2313.h +=================================================================== +--- linux-2.6.25.1.orig/drivers/net/ar2313/ar2313.h 2008-05-13 00:49:39.000000000 +0200 ++++ linux-2.6.25.1/drivers/net/ar2313/ar2313.h 2008-05-13 00:49:42.000000000 +0200 +@@ -107,6 +107,8 @@ + */ + struct ar2313_private { + struct net_device *dev; ++ int (*rx)(struct sk_buff *skb); ++ + int version; + u32 mb[2]; + diff --git a/target/linux/generic-2.6/patches-2.6.25/610-phy_detect.patch b/target/linux/generic-2.6/patches-2.6.25/610-phy_detect.patch new file mode 100644 index 0000000000..454415341f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.25/610-phy_detect.patch @@ -0,0 +1,30 @@ +Index: linux-2.6.25.1/drivers/net/phy/mdio_bus.c +=================================================================== +--- linux-2.6.25.1.orig/drivers/net/phy/mdio_bus.c 2008-05-01 23:45:25.000000000 +0200 ++++ linux-2.6.25.1/drivers/net/phy/mdio_bus.c 2008-05-12 23:44:21.000000000 +0200 +@@ -132,6 +132,9 @@ + 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)); + } +Index: linux-2.6.25.1/include/linux/phy.h +=================================================================== +--- linux-2.6.25.1.orig/include/linux/phy.h 2008-05-01 23:45:25.000000000 +0200 ++++ linux-2.6.25.1/include/linux/phy.h 2008-05-12 23:44:21.000000000 +0200 +@@ -325,6 +325,11 @@ + 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); diff --git a/target/linux/generic-2.6/patches-2.6.25/620-phy_adm6996.patch b/target/linux/generic-2.6/patches-2.6.25/620-phy_adm6996.patch new file mode 100644 index 0000000000..10da7cf7ff --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.25/620-phy_adm6996.patch @@ -0,0 +1,28 @@ +Index: linux-2.6.25.1/drivers/net/phy/Kconfig +=================================================================== +--- linux-2.6.25.1.orig/drivers/net/phy/Kconfig 2008-05-01 23:45:25.000000000 +0200 ++++ linux-2.6.25.1/drivers/net/phy/Kconfig 2008-05-12 23:44:33.000000000 +0200 +@@ -65,6 +65,11 @@ + ---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 +Index: linux-2.6.25.1/drivers/net/phy/Makefile +=================================================================== +--- linux-2.6.25.1.orig/drivers/net/phy/Makefile 2008-05-01 23:45:25.000000000 +0200 ++++ linux-2.6.25.1/drivers/net/phy/Makefile 2008-05-12 23:44:50.000000000 +0200 +@@ -12,6 +12,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_REALTEK_PHY) += realtek.o + obj-$(CONFIG_FIXED_PHY) += fixed.o + obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic-2.6/patches-2.6.25/630-phy_packets.patch b/target/linux/generic-2.6/patches-2.6.25/630-phy_packets.patch new file mode 100644 index 0000000000..930139b556 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.25/630-phy_packets.patch @@ -0,0 +1,66 @@ +Index: linux-2.6.23.16/drivers/net/phy/phy_device.c +=================================================================== +--- linux-2.6.23.16.orig/drivers/net/phy/phy_device.c 2008-04-20 10:16:21.000000000 +0200 ++++ linux-2.6.23.16/drivers/net/phy/phy_device.c 2008-04-29 14:20:03.000000000 +0200 +@@ -44,6 +44,18 @@ + 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 @@ + dev->bus = bus; + + dev->state = PHY_DOWN; ++ dev->netif_receive_skb = &generic_receive_skb; ++ dev->netif_rx = &generic_rx; + + spin_lock_init(&dev->lock); + +Index: linux-2.6.23.16/include/linux/phy.h +=================================================================== +--- linux-2.6.23.16.orig/include/linux/phy.h 2008-04-20 10:16:21.000000000 +0200 ++++ linux-2.6.23.16/include/linux/phy.h 2008-04-20 10:17:58.000000000 +0200 +@@ -289,6 +289,17 @@ + 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) + +Index: linux-2.6.23.16/include/linux/netdevice.h +=================================================================== +--- linux-2.6.23.16.orig/include/linux/netdevice.h 2008-04-20 10:16:21.000000000 +0200 ++++ linux-2.6.23.16/include/linux/netdevice.h 2008-04-20 10:17:58.000000000 +0200 +@@ -426,6 +426,7 @@ + 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()) diff --git a/target/linux/generic-2.6/patches-2.6.25/640-mvswitch.patch b/target/linux/generic-2.6/patches-2.6.25/640-mvswitch.patch new file mode 100644 index 0000000000..1adcf0d411 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.25/640-mvswitch.patch @@ -0,0 +1,54 @@ +Index: linux-2.6.25.1/drivers/net/phy/Kconfig +=================================================================== +--- linux-2.6.25.1.orig/drivers/net/phy/Kconfig 2008-05-12 23:44:33.000000000 +0200 ++++ linux-2.6.25.1/drivers/net/phy/Kconfig 2008-05-12 23:45:33.000000000 +0200 +@@ -70,6 +70,12 @@ + ---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 +Index: linux-2.6.25.1/drivers/net/phy/Makefile +=================================================================== +--- linux-2.6.25.1.orig/drivers/net/phy/Makefile 2008-05-12 23:44:50.000000000 +0200 ++++ linux-2.6.25.1/drivers/net/phy/Makefile 2008-05-12 23:45:59.000000000 +0200 +@@ -13,6 +13,7 @@ + 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 +Index: linux-2.6.25.1/drivers/net/phy/mdio_bus.c +=================================================================== +--- linux-2.6.25.1.orig/drivers/net/phy/mdio_bus.c 2008-05-12 23:44:21.000000000 +0200 ++++ linux-2.6.25.1/drivers/net/phy/mdio_bus.c 2008-05-12 23:45:33.000000000 +0200 +@@ -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 @@ + + 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; |