Add hfcmulti mISDN driver
[openwrt.git] / target / linux / pxa / patches-2.6.21 / 015-smc-ether-addr.patch
1 Index: linux-2.6.21.7/drivers/net/smc91x.c
2 ===================================================================
3 --- linux-2.6.21.7.orig/drivers/net/smc91x.c
4 +++ linux-2.6.21.7/drivers/net/smc91x.c
5 @@ -1815,6 +1815,39 @@ static int __init smc_findirq(void __iom
6 return probe_irq_off(cookie);
7 }
8
9 +static inline unsigned int is_gumstix_oui(u8 *addr)
10 +{
11 + return (addr[0] == 0x00 && addr[1] == 0x15 && addr[2] == 0xC9);
12 +}
13 +
14 +/**
15 + * gen_serial_ether_addr - Generate software assigned Ethernet address
16 + * based on the system_serial number
17 + * @addr: Pointer to a six-byte array containing the Ethernet address
18 + *
19 + * Generate an Ethernet address (MAC) that is not multicast
20 + * and has the local assigned bit set, keyed on the system_serial
21 + */
22 +static inline void gen_serial_ether_addr(u8 *addr)
23 +{
24 + static u8 ether_serial_digit = 0;
25 + addr [0] = system_serial_high >> 8;
26 + addr [1] = system_serial_high;
27 + addr [2] = system_serial_low >> 24;
28 + addr [3] = system_serial_low >> 16;
29 + addr [4] = system_serial_low >> 8;
30 + addr [5] = (system_serial_low & 0xc0) | /* top bits are from system serial */
31 + (1 << 4) | /* 2 bits identify interface type 1=ether, 2=usb, 3&4 undef */
32 + ((ether_serial_digit++) & 0x0f); /* 15 possible interfaces of each type */
33 +
34 + if(!is_gumstix_oui(addr))
35 + {
36 + addr [0] &= 0xfe; /* clear multicast bit */
37 + addr [0] |= 0x02; /* set local assignment bit (IEEE802) */
38 + }
39 +}
40 +
41 +
42 /*
43 * Function: smc_probe(unsigned long ioaddr)
44 *
45 @@ -2032,15 +2065,13 @@ static int __init smc_probe(struct net_d
46 THROTTLE_TX_PKTS ? " [throttle_tx]" : "");
47
48 if (!is_valid_ether_addr(dev->dev_addr)) {
49 - printk("%s: Invalid ethernet MAC address. Please "
50 - "set using ifconfig\n", dev->name);
51 - } else {
52 + gen_serial_ether_addr(dev->dev_addr);
53 + }
54 /* Print the Ethernet address */
55 printk("%s: Ethernet addr: ", dev->name);
56 for (i = 0; i < 5; i++)
57 printk("%2.2x:", dev->dev_addr[i]);
58 printk("%2.2x\n", dev->dev_addr[5]);
59 - }
60
61 if (lp->phy_type == 0) {
62 PRINTK("%s: No PHY found\n", dev->name);
This page took 0.079253 seconds and 5 git commands to generate.