1 From 7645a459feb02f7aae4c3a5724b7800495d1b659 Mon Sep 17 00:00:00 2001
2 From: Bobby Powers <bobbypowers@gmail.com>
3 Date: Wed, 28 Oct 2009 22:41:31 -0400
4 Subject: [PATCH] [ARM] smsc911x: Verdex Pro support
6 Basically Joseph Kortje's patch, cleaned up to apply to Linus's
7 tree. Some of the smsc911x.c had been applied already
9 Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
11 drivers/net/smsc911x.c | 50 +++++++++++++++++++++++++++++++++++++--------
12 drivers/net/smsc911x.h | 2 +-
13 include/linux/smsc911x.h | 11 ++++++++++
14 3 files changed, 53 insertions(+), 10 deletions(-)
16 --- a/drivers/net/smsc911x.c
17 +++ b/drivers/net/smsc911x.c
18 @@ -1189,7 +1189,7 @@ static int smsc911x_open(struct net_devi
20 "Timed out waiting for EEPROM busy bit to clear");
22 - smsc911x_reg_write(pdata, GPIO_CFG, 0x70070000);
23 + smsc911x_reg_write(pdata, GPIO_CFG, GPIO_CFG_LED1_EN_ | GPIO_CFG_LED2_EN_ | (1 << 20));
25 /* The soft reset above cleared the device's MAC address,
26 * restore it from local copy (set in probe) */
27 @@ -1201,8 +1201,8 @@ static int smsc911x_open(struct net_devi
28 smsc911x_reg_write(pdata, INT_EN, 0);
29 smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF);
31 - /* Set interrupt deassertion to 100uS */
32 - intcfg = ((10 << 24) | INT_CFG_IRQ_EN_);
33 + /* Set interrupt deassertion to 22*10uS */
34 + intcfg = ((22 << 24) | INT_CFG_IRQ_EN_);
36 if (pdata->config.irq_polarity) {
37 SMSC_TRACE(IFUP, "irq polarity: active high");
38 @@ -1228,7 +1228,7 @@ static int smsc911x_open(struct net_devi
39 temp |= INT_EN_SW_INT_EN_;
40 smsc911x_reg_write(pdata, INT_EN, temp);
45 if (pdata->software_irq_signal)
47 @@ -1946,6 +1946,38 @@ static int __devexit smsc911x_drv_remove
51 +static inline unsigned int is_gumstix_oui(u8 *addr)
53 + return (addr[0] == 0x00 && addr[1] == 0x15 && addr[2] == 0xC9);
57 + * gen_serial_ether_addr - Generate software assigned Ethernet address
58 + * based on the system_serial number
59 + * @addr: Pointer to a six-byte array containing the Ethernet address
61 + * Generate an Ethernet address (MAC) that is not multicast
62 + * and has the local assigned bit set, keyed on the system_serial
64 +static inline void gen_serial_ether_addr(u8 *addr)
66 + static u8 ether_serial_digit = 0;
67 + addr [0] = system_serial_high >> 8;
68 + addr [1] = system_serial_high;
69 + addr [2] = system_serial_low >> 24;
70 + addr [3] = system_serial_low >> 16;
71 + addr [4] = system_serial_low >> 8;
72 + addr [5] = (system_serial_low & 0xc0) | /* top bits are from system serial */
73 + (1 << 4) | /* 2 bits identify interface type 1=ether, 2=usb, 3&4 undef */
74 + ((ether_serial_digit++) & 0x0f); /* 15 possible interfaces of each type */
76 + if(!is_gumstix_oui(addr))
78 + addr [0] &= 0xfe; /* clear multicast bit */
79 + addr [0] |= 0x02; /* set local assignment bit (IEEE802) */
83 static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
85 struct net_device *dev;
86 @@ -2082,11 +2114,11 @@ static int __devinit smsc911x_drv_probe(
88 "Mac Address is read from LAN911x EEPROM");
90 - /* eeprom values are invalid, generate random MAC */
91 - random_ether_addr(dev->dev_addr);
92 - smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
94 - "MAC Address is set to random_ether_addr");
95 + /* eeprom values are invalid, generate MAC from serial number */
96 + gen_serial_ether_addr(dev->dev_addr);
97 + smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
99 + "MAC Address is derived from system serial number");