IXP4xx patches for NSLU2 and NAS100D
[openwrt/svn-archive/archive.git] / target / linux / ixp4xx-2.6 / patches / 133-ixp4xx-net-driver-improve-mac-handling.patch
1 Index: linux-2.6.19/include/asm-arm/arch-ixp4xx/platform.h
2 ===================================================================
3 --- linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/platform.h
4 +++ linux-2.6.19/include/asm-arm/arch-ixp4xx/platform.h
5 @@ -100,6 +100,7 @@ struct mac_plat_info {
6 int phy_id; /* ID of the connected PHY (PCB/platform dependent) */
7 int rxq_id; /* Queue ID of the RX-free q*/
8 int txq_id; /* Where to push the outgoing packets */
9 + unsigned char hwaddr[6]; /* Desired hardware address */
10 };
11
12
13 Index: linux-2.6.19/drivers/net/ixp4xx/mac_driver.c
14 ===================================================================
15 --- linux-2.6.19.orig/drivers/net/ixp4xx/mac_driver.c
16 +++ linux-2.6.19/drivers/net/ixp4xx/mac_driver.c
17 @@ -189,6 +189,24 @@ static int ixmac_open (struct net_device
18 }
19 mac->rxq_pkt += RX_QUEUE_PREFILL;
20
21 + /* printk(KERN_INFO "...Platform MAC=0x%02x%02x%02x%02x%02x%02x\n",
22 + mac->plat->hwaddr[0],
23 + mac->plat->hwaddr[1],
24 + mac->plat->hwaddr[2],
25 + mac->plat->hwaddr[3],
26 + mac->plat->hwaddr[4],
27 + mac->plat->hwaddr[5]
28 + ); */
29 + /* Only use platform or random if there's currently no device hw addr */
30 + if (is_zero_ether_addr(dev->dev_addr)) {
31 + if (is_zero_ether_addr(mac->plat->hwaddr)) {
32 + random_ether_addr(dev->dev_addr);
33 + dev->dev_addr[5] = mac->plat->phy_id;
34 + }
35 + else
36 + memcpy(dev->dev_addr, mac->plat->hwaddr, 6);
37 + }
38 +
39 mac_init(mac);
40 npe_mh_set_rxqid(npe, mac->plat, RX_DONE_QID);
41 mac_set_uniaddr(dev);
42 @@ -434,9 +452,15 @@ static int mac_probe(struct platform_dev
43 * following commands:
44 * "ip link set address 02:03:04:04:04:01 dev eth0"
45 * "ifconfig eth0 hw ether 02:03:04:04:04:07"
46 - */
47 - random_ether_addr(dev->dev_addr);
48 - dev->dev_addr[5] = plat->phy_id;
49 + */
50 +/* Note: moved to ixmac_open to allow notifiers to run for compiled in modules
51 + if (is_zero_ether_addr(plat->hwaddr)) {
52 + random_ether_addr(dev->dev_addr);
53 + dev->dev_addr[5] = plat->phy_id;
54 + }
55 + else
56 + memcpy(dev->dev_addr, plat->hwaddr, 6);
57 +*/
58
59 printk(KERN_INFO IXMAC_NAME " driver " IXMAC_VERSION
60 ": %s on %s with PHY[%d] initialized\n",