431-add_platform_eeprom_support_to_ath5k.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --- a/drivers/net/wireless/ath/ath5k/pci.c
  2. +++ b/drivers/net/wireless/ath/ath5k/pci.c
  3. @@ -21,6 +21,7 @@
  4. #include <linux/pci-aspm.h>
  5. #include <linux/etherdevice.h>
  6. #include <linux/module.h>
  7. +#include <linux/ath5k_platform.h>
  8. #include "../ath.h"
  9. #include "ath5k.h"
  10. #include "debug.h"
  11. @@ -72,7 +73,7 @@ static void ath5k_pci_read_cachesize(str
  12. }
  13. /*
  14. - * Read from eeprom
  15. + * Read from eeprom or platform_data
  16. */
  17. static bool
  18. ath5k_pci_eeprom_read(struct ath_common *common, u32 offset, u16 *data)
  19. @@ -80,6 +81,19 @@ ath5k_pci_eeprom_read(struct ath_common
  20. struct ath5k_hw *ah = (struct ath5k_hw *) common->ah;
  21. u32 status, timeout;
  22. + struct ath5k_platform_data *pdata = NULL;
  23. +
  24. + if (ah->pdev)
  25. + pdata = ah->pdev->dev.platform_data;
  26. +
  27. + if (pdata && pdata->eeprom_data && pdata->eeprom_data[61] == AR5K_EEPROM_MAGIC_VALUE) {
  28. + if (offset >= ATH5K_PLAT_EEP_MAX_WORDS)
  29. + return false;
  30. +
  31. + *data = pdata->eeprom_data[offset];
  32. + return true;
  33. + }
  34. +
  35. /*
  36. * Initialize EEPROM access
  37. */
  38. @@ -123,6 +137,16 @@ static int ath5k_pci_eeprom_read_mac(str
  39. u16 data;
  40. int octet;
  41. + struct ath5k_platform_data *pdata = NULL;
  42. +
  43. + if (ah->pdev)
  44. + pdata = ah->pdev->dev.platform_data;
  45. +
  46. + if (pdata && pdata->macaddr) {
  47. + memcpy(mac, pdata->macaddr, ETH_ALEN);
  48. + return 0;
  49. + }
  50. +
  51. AR5K_EEPROM_READ(0x20, data);
  52. for (offset = 0x1f, octet = 0, total = 0; offset >= 0x1d; offset--) {