ixp4xx: (Titan Wireless 2662) check for invalid/null MAC before assigning a random one

SVN-Revision: 21825
This commit is contained in:
Alexandros C. Couloumbis 2010-06-17 08:17:17 +00:00
parent 2dcfed2eff
commit ced9c58145

View file

@ -118,7 +118,7 @@
+subsys_initcall(tw2662_pci_init); +subsys_initcall(tw2662_pci_init);
--- /dev/null --- /dev/null
+++ b/arch/arm/mach-ixp4xx/tw2662-setup.c +++ b/arch/arm/mach-ixp4xx/tw2662-setup.c
@@ -0,0 +1,208 @@ @@ -0,0 +1,215 @@
+/* +/*
+ * arch/arm/mach-ixp4xx/tw2662-setup.c + * arch/arm/mach-ixp4xx/tw2662-setup.c
+ * + *
@ -302,15 +302,22 @@
+static void __init tw2662_init(void) +static void __init tw2662_init(void)
+{ +{
+ ixp4xx_sys_init(); + ixp4xx_sys_init();
+ int i;
+ +
+ tw2662_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); + tw2662_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
+ tw2662_flash_resource.end = + tw2662_flash_resource.end =
+ IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; + IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
+ +
+ platform_add_devices(tw2662_devices, ARRAY_SIZE(tw2662_devices)); + platform_add_devices(tw2662_devices, ARRAY_SIZE(tw2662_devices));
+ /* hack MACs as most of these boards have a broken eeprom */ +
+ random_ether_addr(tw2662_plat_eth[0].hwaddr); + for (i = 0; i < 6; i++)
+ random_ether_addr(tw2662_plat_eth[1].hwaddr); + if (tw2662_plat_eth[0].hwaddr[i] != 0x00)
+ break;
+ if (i == 6) {
+ /* hack MACs as most of these boards have a broken eeprom */
+ random_ether_addr(tw2662_plat_eth[0].hwaddr);
+ tw2662_plat_eth[1].hwaddr = (tw2662_plat_eth[0].hwaddr + 1);
+ }
+ +
+} +}
+ +