diff options
author | Paul Sokolovsky <pmiscml@gmail.com> | 2008-02-16 00:22:08 +0000 |
---|---|---|
committer | Paul Sokolovsky <pmiscml@gmail.com> | 2008-02-16 00:22:08 +0000 |
commit | 77ee651d6e4de50054d3dd1498f835e5ad17dc69 (patch) | |
tree | 577a7d3cfe7aa024fe42eae3a20c8f490bcd27f7 /packages/linux/gumstix-kernel-2.6.21/serial-ether-addr.patch | |
parent | 122a4440127e4015df191e4204fd05e132cba3eb (diff) | |
parent | c774a4e441deac27ee040a701926f0324cc5cd19 (diff) |
merge of '195b07032d60a83bcce6ef3b56a7a95b75566dcd'
and '5298691784024e845135b17a0613495c22075e0d'
Diffstat (limited to 'packages/linux/gumstix-kernel-2.6.21/serial-ether-addr.patch')
-rw-r--r-- | packages/linux/gumstix-kernel-2.6.21/serial-ether-addr.patch | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/packages/linux/gumstix-kernel-2.6.21/serial-ether-addr.patch b/packages/linux/gumstix-kernel-2.6.21/serial-ether-addr.patch new file mode 100644 index 0000000000..3161472e90 --- /dev/null +++ b/packages/linux/gumstix-kernel-2.6.21/serial-ether-addr.patch @@ -0,0 +1,62 @@ +Index: linux-2.6.21gum/drivers/usb/gadget/ether.c +=================================================================== +--- linux-2.6.21gum.orig/drivers/usb/gadget/ether.c ++++ linux-2.6.21gum/drivers/usb/gadget/ether.c +@@ -2249,6 +2249,38 @@ static u8 __devinit nibble (unsigned cha + return 0; + } + ++static inline unsigned int is_gumstix_oui(u8 *addr) ++{ ++ return (addr[0] == 0x00 && addr[1] == 0x15 && addr[2] == 0xC9); ++} ++ ++/** ++ * gen_serial_ether_addr - Generate software assigned Ethernet address ++ * based on the system_serial number ++ * @addr: Pointer to a six-byte array containing the Ethernet address ++ * ++ * Generate an Ethernet address (MAC) that is not multicast ++ * and has the local assigned bit set, keyed on the system_serial ++ */ ++static inline void gen_serial_ether_addr(u8 *addr) ++{ ++ static u8 ether_serial_digit = 0; ++ addr [0] = system_serial_high >> 8; ++ addr [1] = system_serial_high; ++ addr [2] = system_serial_low >> 24; ++ addr [3] = system_serial_low >> 16; ++ addr [4] = system_serial_low >> 8; ++ addr [5] = (system_serial_low & 0xc0) | /* top bits are from system serial */ ++ (2 << 4) | /* 2 bits identify interface type 1=ether, 2=usb, 3&4 undef */ ++ ((ether_serial_digit++) & 0x0f); /* 15 possible interfaces of each type */ ++ ++ if(!is_gumstix_oui(addr)) ++ { ++ addr [0] &= 0xfe; /* clear multicast bit */ ++ addr [0] |= 0x02; /* set local assignment bit (IEEE802) */ ++ } ++} ++ + static int __devinit get_ether_addr(const char *str, u8 *dev_addr) + { + if (str) { +@@ -2266,8 +2298,16 @@ static int __devinit get_ether_addr(cons + if (is_valid_ether_addr (dev_addr)) + return 0; + } +- random_ether_addr(dev_addr); +- return 1; ++ if(system_serial_high | system_serial_low) ++ { ++ gen_serial_ether_addr(dev_addr); ++ return 0; ++ } ++ else ++ { ++ random_ether_addr(dev_addr); ++ return 1; ++ } + } + + static int __devinit |