1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-25 02:48:37 +02:00

atheros: added marvell switch driver

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11129 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
matteo 2008-05-13 00:10:45 +00:00
parent 73723cbc1d
commit fd481b734f
6 changed files with 218 additions and 0 deletions

View File

@ -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

View File

@ -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];

View File

@ -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);

View File

@ -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

View File

@ -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())

View File

@ -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;