501-MIPS-ath79-add-mac-argument-to-ath79_register_wmac.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. --- a/arch/mips/ath79/dev-wmac.c
  2. +++ b/arch/mips/ath79/dev-wmac.c
  3. @@ -15,6 +15,7 @@
  4. #include <linux/init.h>
  5. #include <linux/delay.h>
  6. #include <linux/irq.h>
  7. +#include <linux/etherdevice.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/ath9k_platform.h>
  10. @@ -22,6 +23,7 @@
  11. #include <asm/mach-ath79/ar71xx_regs.h>
  12. #include "dev-wmac.h"
  13. +static u8 ath79_wmac_mac[ETH_ALEN];
  14. static struct ath9k_platform_data ath79_wmac_data;
  15. static struct resource ath79_wmac_resources[] = {
  16. @@ -162,7 +164,7 @@ static void qca955x_wmac_setup(void)
  17. ath79_wmac_data.is_clk_25mhz = true;
  18. }
  19. -void __init ath79_register_wmac(u8 *cal_data)
  20. +void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr)
  21. {
  22. if (soc_is_ar913x())
  23. ar913x_wmac_setup();
  24. @@ -179,5 +181,10 @@ void __init ath79_register_wmac(u8 *cal_
  25. memcpy(ath79_wmac_data.eeprom_data, cal_data,
  26. sizeof(ath79_wmac_data.eeprom_data));
  27. + if (mac_addr) {
  28. + memcpy(ath79_wmac_mac, mac_addr, sizeof(ath79_wmac_mac));
  29. + ath79_wmac_data.macaddr = ath79_wmac_mac;
  30. + }
  31. +
  32. platform_device_register(&ath79_wmac_device);
  33. }
  34. --- a/arch/mips/ath79/dev-wmac.h
  35. +++ b/arch/mips/ath79/dev-wmac.h
  36. @@ -12,6 +12,6 @@
  37. #ifndef _ATH79_DEV_WMAC_H
  38. #define _ATH79_DEV_WMAC_H
  39. -void ath79_register_wmac(u8 *cal_data);
  40. +void ath79_register_wmac(u8 *cal_data, u8 *mac_addr);
  41. #endif /* _ATH79_DEV_WMAC_H */
  42. --- a/arch/mips/ath79/mach-db120.c
  43. +++ b/arch/mips/ath79/mach-db120.c
  44. @@ -128,7 +128,7 @@ static void __init db120_setup(void)
  45. ath79_register_spi(&db120_spi_data, db120_spi_info,
  46. ARRAY_SIZE(db120_spi_info));
  47. ath79_register_usb();
  48. - ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET);
  49. + ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET, NULL);
  50. db120_pci_init(art + DB120_PCIE_CALDATA_OFFSET);
  51. }
  52. --- a/arch/mips/ath79/mach-ap121.c
  53. +++ b/arch/mips/ath79/mach-ap121.c
  54. @@ -85,7 +85,7 @@ static void __init ap121_setup(void)
  55. ath79_register_spi(&ap121_spi_data, ap121_spi_info,
  56. ARRAY_SIZE(ap121_spi_info));
  57. ath79_register_usb();
  58. - ath79_register_wmac(cal_data);
  59. + ath79_register_wmac(cal_data, NULL);
  60. }
  61. MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board",