arm/ixp4xx: Add the IXP4xx Ethernet driver.

svn path=/dists/trunk/linux-2.6/; revision=7665
This commit is contained in:
Martin Michlmayr 2006-10-31 10:37:03 +00:00
parent 6533cf571a
commit c85d3b6b20
7 changed files with 3230 additions and 0 deletions

View File

@ -794,6 +794,10 @@ CONFIG_CICADA_PHY=m
#
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
CONFIG_IXP4XX_QMGR=m
CONFIG_IXP4XX_NPE=m
CONFIG_IXP4XX_FW_LOAD=y
CONFIG_IXP4XX_MAC=m
# CONFIG_HAPPYMEAL is not set
# CONFIG_SUNGEM is not set
# CONFIG_CASSINI is not set

1
debian/changelog vendored
View File

@ -25,6 +25,7 @@ linux-2.6 (2.6.18-4) UNRELEASED; urgency=low
* arm/ixp4xx: Add clocksource for Intel IXP4xx platforms.
* audit: fix missing ifdefs in syscall classes hookup for generic targets
* arm: Enable CONFIG_AUDIT=y again.
* arm/ixp4xx: Add the IXP4xx Ethernet driver.
[ maximilian attems ]
* Add netpoll leak fix.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
---
drivers/net/ixp4xx/ixp4xx_qmgr.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- linux-ixp4xx.orig/drivers/net/ixp4xx/ixp4xx_qmgr.c 2006-10-15 18:52:35.000000000 +0200
+++ linux-ixp4xx/drivers/net/ixp4xx/ixp4xx_qmgr.c 2006-10-15 18:54:32.000000000 +0200
@@ -107,7 +107,7 @@ static int get_free_qspace(struct qm_qmg
return -1;
}
-static inline int log2(int x)
+static inline int _log2(int x)
{
int r=0;
while(x>>=1)
@@ -127,7 +127,7 @@ static inline int log2(int x)
*/
static int conf_q_regs(struct qm_queue *queue)
{
- int bsize = log2(queue->len/16);
+ int bsize = _log2(queue->len/16);
int baddr = queue->addr + IX_QMGR_QCFG_SIZE;
/* +2, because baddr is in words and not in bytes */
@@ -141,8 +141,8 @@ void queue_set_watermarks(struct qm_queu
u32 val;
/* calculate the register values
* 0->0, 1->1, 2->2, 4->3, 8->4 16->5...*/
- ne = log2(ne<<1) & 0x7;
- nf = log2(nf<<1) & 0x7;
+ ne = _log2(ne<<1) & 0x7;
+ nf = _log2(nf<<1) & 0x7;
/* Mask out old watermarks */
val = queue_read_cfg_reg(queue) & ~0xfc000000;

View File

@ -0,0 +1,57 @@
Index: linux-2.6.18/include/asm-arm/arch-ixp4xx/platform.h
===================================================================
--- linux-2.6.18.orig/include/asm-arm/arch-ixp4xx/platform.h 2006-10-25 04:42:17.000000000 -0700
+++ linux-2.6.18/include/asm-arm/arch-ixp4xx/platform.h 2006-10-25 04:42:17.000000000 -0700
@@ -100,6 +100,7 @@
int phy_id; /* ID of the connected PHY (PCB/platform dependent) */
int rxq_id; /* Queue ID of the RX-free q*/
int txq_id; /* Where to push the outgoing packets */
+ unsigned char hwaddr[6]; /* Desired hardware address */
};
Index: linux-2.6.18/drivers/net/ixp4xx/mac_driver.c
===================================================================
--- linux-2.6.18.orig/drivers/net/ixp4xx/mac_driver.c 2006-10-25 04:42:17.000000000 -0700
+++ linux-2.6.18/drivers/net/ixp4xx/mac_driver.c 2006-10-25 04:42:17.000000000 -0700
@@ -189,6 +189,21 @@
}
mac->rxq_pkt += RX_QUEUE_PREFILL;
+ /* printk(KERN_INFO "...Platform MAC=0x%02x%02x%02x%02x%02x%02x\n",
+ mac->plat->hwaddr[0],
+ mac->plat->hwaddr[1],
+ mac->plat->hwaddr[2],
+ mac->plat->hwaddr[3],
+ mac->plat->hwaddr[4],
+ mac->plat->hwaddr[5]
+ ); */
+ if (is_zero_ether_addr(mac->plat->hwaddr)) {
+ random_ether_addr(dev->dev_addr);
+ dev->dev_addr[5] = mac->plat->phy_id;
+ }
+ else
+ memcpy(dev->dev_addr, mac->plat->hwaddr, 6);
+
mac_init(mac);
npe_mh_set_rxqid(npe, mac->plat, RX_DONE_QID);
mac_set_uniaddr(dev);
@@ -434,9 +449,15 @@
* following commands:
* "ip link set address 02:03:04:04:04:01 dev eth0"
* "ifconfig eth0 hw ether 02:03:04:04:04:07"
- */
- random_ether_addr(dev->dev_addr);
- dev->dev_addr[5] = plat->phy_id;
+ */
+/* Note: moved to ixmac_open to allow notifiers to run for compiled in modules
+ if (is_zero_ether_addr(plat->hwaddr)) {
+ random_ether_addr(dev->dev_addr);
+ dev->dev_addr[5] = plat->phy_id;
+ }
+ else
+ memcpy(dev->dev_addr, plat->hwaddr, 6);
+*/
printk(KERN_INFO IXMAC_NAME " driver " IXMAC_VERSION
": %s on %s with PHY[%d] initialized\n",

View File

@ -0,0 +1,41 @@
Index: linux-2.6.18/arch/arm/mach-ixp4xx/nslu2-setup.c
===================================================================
--- linux-2.6.18.orig/arch/arm/mach-ixp4xx/nslu2-setup.c 2006-10-01 23:12:35.000000000 +0200
+++ linux-2.6.18/arch/arm/mach-ixp4xx/nslu2-setup.c 2006-10-01 23:12:40.000000000 +0200
@@ -139,6 +139,28 @@
.resource = nslu2_uart_resources,
};
+static struct resource res_mac0 = {
+ .start = IXP4XX_EthB_BASE_PHYS,
+ .end = IXP4XX_EthB_BASE_PHYS + 0x1ff,
+ .flags = IORESOURCE_MEM,
+};
+
+static struct mac_plat_info plat_mac0 = {
+ .npe_id = 1,
+ .phy_id = 1,
+ .eth_id = 0,
+ .rxq_id = 27,
+ .txq_id = 24,
+};
+
+static struct platform_device mac0 = {
+ .name = "ixp4xx_mac",
+ .id = 0,
+ .dev.platform_data = &plat_mac0,
+ .num_resources = 1,
+ .resource = &res_mac0,
+};
+
static struct platform_device *nslu2_devices[] __initdata = {
&nslu2_i2c_controller,
&nslu2_flash,
@@ -146,6 +168,7 @@
#ifdef CONFIG_LEDS_IXP4XX
&nslu2_leds,
#endif
+ &mac0
};
static void nslu2_power_off(void)

View File

@ -15,3 +15,7 @@
+ bugfix/audit-syscalls.patch
+ bugfix/net-r8169-no_mac_adress_change.patch
+ bugfix/x86-64-c3_timer.patch
+ features/arm/nslu2-setup-mac.patch
+ features/arm/ixp4xx-0.2.1-driver.patch
+ features/arm/ixp4xx-net-driver-fix-qmgr.patch
+ features/arm/ixp4xx-net-driver-improve-mac-handling.patch