132-wrt300nv2_mac_fix.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --- a/arch/arm/mach-ixp4xx/wrt300nv2-setup.c
  2. +++ b/arch/arm/mach-ixp4xx/wrt300nv2-setup.c
  3. @@ -3,6 +3,7 @@
  4. *
  5. * Board setup for the Linksys WRT300N v2
  6. *
  7. + * Copyright (C) 2010 Alexandros C. Couloumbis <alex@ozo.com>
  8. * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
  9. *
  10. * based on coyote-setup.c:
  11. @@ -18,6 +19,7 @@
  12. #include <linux/tty.h>
  13. #include <linux/serial_8250.h>
  14. #include <linux/slab.h>
  15. +#include <linux/etherdevice.h>
  16. #include <asm/types.h>
  17. #include <asm/setup.h>
  18. @@ -79,7 +81,8 @@ static struct platform_device wrt300nv2_
  19. /* Built-in 10/100 Ethernet MAC interfaces */
  20. static struct eth_plat_info wrt300nv2_plat_eth[] = {
  21. {
  22. - .phy = -1,
  23. + .phy = IXP4XX_ETH_PHY_MAX_ADDR,
  24. + .phy_mask = 0x0F0000,
  25. .rxq = 3,
  26. .txreadyq = 20,
  27. }, {
  28. @@ -112,6 +115,10 @@ static struct platform_device *wrt300nv2
  29. static void __init wrt300nv2_init(void)
  30. {
  31. + uint8_t __iomem *f;
  32. + int offset = 0;
  33. + int i;
  34. +
  35. ixp4xx_sys_init();
  36. wrt300nv2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  37. @@ -121,6 +128,32 @@ static void __init wrt300nv2_init(void)
  38. *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
  39. platform_add_devices(wrt300nv2_devices, ARRAY_SIZE(wrt300nv2_devices));
  40. +
  41. + f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x60000);
  42. +
  43. + if (f) {
  44. + for (i = 0; i < 6; i++) {
  45. +#ifdef __ARMEB__
  46. + wrt300nv2_plat_eth[0].hwaddr[i] = readb(f + 0x5FFA0 + i);
  47. + if (i == 5)
  48. + offset = 1;
  49. + wrt300nv2_plat_eth[1].hwaddr[i] = (wrt300nv2_plat_eth[0].hwaddr[i] + offset);
  50. +#else
  51. + wrt300nv2_plat_eth[0].hwaddr[i] = readb(f + 0x5FFA0 + (i^3));
  52. + if (i == 5)
  53. + offset = 1;
  54. + wrt300nv2_plat_eth[1].hwaddr[i] = (wrt300nv2_plat_eth[0].hwaddr[i] + offset);
  55. +#endif
  56. + }
  57. + iounmap(f);
  58. + }
  59. +
  60. + if (!(is_valid_ether_addr(wrt300nv2_plat_eth[0].hwaddr)))
  61. + random_ether_addr(wrt300nv2_plat_eth[0].hwaddr);
  62. + if (!(is_valid_ether_addr(wrt300nv2_plat_eth[1].hwaddr))) {
  63. + memcpy(wrt300nv2_plat_eth[1].hwaddr, wrt300nv2_plat_eth[0].hwaddr, ETH_ALEN);
  64. + wrt300nv2_plat_eth[1].hwaddr[5] = (wrt300nv2_plat_eth[0].hwaddr[5] + 1);
  65. + }
  66. }
  67. #ifdef CONFIG_MACH_WRT300NV2