Advertisement
Guest User

Untitled

a guest
Sep 11th, 2011
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.61 KB | None | 0 0
  1. Subject: htcleo: wifi: Load the real MAC address from SPL if running SD build on WM.
  2.  
  3. Thank for Savan's help.
  4. Refer to https://gitorious.org/2-6-32-photon/testing/commit/3c64a1c16fd17ba892e76170cd54b9719dd72c37
  5. ---
  6. arch/arm/mach-msm/board-htcleo-wifi-nvs.c       |   23 ++++++++++++++++++++++-
  7.  arch/arm/mach-msm/include/mach/msm_iomap-8x50.h |   11 ++++++++---
  8.  arch/arm/mach-msm/io.c                          |    6 +++---
  9.  3 files changed, 33 insertions(+), 7 deletions(-)
  10.  
  11. diff --git a/arch/arm/mach-msm/board-htcleo-wifi-nvs.c b/arch/arm/mach-msm/board-htcleo-wifi-nvs.c
  12. index ee9ad39..7865b6d 100644
  13. --- a/arch/arm/mach-msm/board-htcleo-wifi-nvs.c
  14. +++ b/arch/arm/mach-msm/board-htcleo-wifi-nvs.c
  15. @@ -28,6 +28,8 @@
  16.  #include <linux/crc32.h>
  17.  #include <linux/io.h>
  18.  
  19. +#include "board-htcleo.h"
  20. +
  21.  #define NVS_MAX_SIZE       0x800U
  22.  #define NVS_MACADDR_SIZE   0x1AU
  23.  #define WLAN_SKB_BUF_NUM   16
  24. @@ -131,6 +133,21 @@ static int parse_tag_msm_wifi(void)
  25.     return 0;
  26.  }
  27.  
  28. +static int parse_tag_msm_wifi_from_spl(void)
  29. +{
  30. +   uint32_t id1, id2, id3, id4, id5, id6;
  31. +   uint32_t id_base = 0xFC028; //real mac offset found in spl for haret.exe on WM
  32. +   id1 = readl(MSM_SPLHOOD_BASE + id_base + 0x0);
  33. +   id2 = readl(MSM_SPLHOOD_BASE + id_base + 0x1);
  34. +   id3 = readl(MSM_SPLHOOD_BASE + id_base + 0x2);
  35. +   id4 = readl(MSM_SPLHOOD_BASE + id_base + 0x3);
  36. +   id5 = readl(MSM_SPLHOOD_BASE + id_base + 0x4);
  37. +   id6 = readl(MSM_SPLHOOD_BASE + id_base + 0x5);
  38. +   sprintf(nvs_mac_addr, "macaddr=%2x:%2x:%2x:%2x:%2x:%2x\n", id1 & 0xff, id2 & 0xff, id3 & 0xff, id4 & 0xff, id5 & 0xff, id6 & 0xff);
  39. +   pr_info("Device Real Wifi Mac Address: %s\n", nvs_mac_addr);
  40. +   return 0;
  41. +}
  42. +
  43.  static unsigned wifi_get_nvs_size( void )
  44.  {
  45.     unsigned len;
  46. @@ -171,7 +188,11 @@ static int wifi_calibration_read_proc(char *page, char **start, off_t off,
  47.  static int __init wifi_nvs_init(void)
  48.  {
  49.     pr_info("%s\n", __func__);
  50. -   parse_tag_msm_wifi();
  51. +   if (htcleo_is_nand_boot()) {
  52. +       parse_tag_msm_wifi();
  53. +   } else {
  54. +       parse_tag_msm_wifi_from_spl();
  55. +   }
  56.     wifi_calibration = create_proc_entry("calibration", 0444, NULL);
  57.     if (wifi_calibration != NULL) {
  58.         wifi_calibration->size = wifi_get_nvs_size();
  59. diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
  60. index 32289fd..1a50517 100644
  61. --- a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
  62. +++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
  63. @@ -159,9 +159,9 @@
  64.  #define MSM_SPI_PHYS          0xA1200000
  65.  #define MSM_SPI_SIZE          SZ_4K
  66.  
  67. -#define MSM_TCSR_BASE  IOMEM(0xF8008000)
  68. -#define MSM_TCSR_PHYS  0xA8700000
  69. -#define MSM_TCSR_SIZE  SZ_4K
  70. +#define MSM_TCSR_BASE         IOMEM(0xF8008000)
  71. +#define MSM_TCSR_PHYS         0xA8700000
  72. +#define MSM_TCSR_SIZE         SZ_4K
  73.  #endif
  74.  
  75.  // Originally this does not need to be defined,
  76. @@ -177,3 +177,8 @@
  77.  #endif
  78.  #define MSM_RAM_CONSOLE_SIZE   0x00040000
  79.  
  80. +// For reading the real WiFi MAC address
  81. +#define MSM_SPLHOOD_BASE     IOMEM(0xF9200000)
  82. +#define MSM_SPLHOOD_PHYS     0x0
  83. +#define MSM_SPLHOOD_SIZE     SZ_1M
  84. +
  85. diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
  86. index c032741..e4b89c5 100644
  87. --- a/arch/arm/mach-msm/io.c
  88. +++ b/arch/arm/mach-msm/io.c
  89. @@ -90,9 +90,9 @@ static struct map_desc msm_io_desc[] __initdata = {
  90.     },
  91.  #endif
  92.     {
  93. -       .virtual =  (unsigned long) MSM_SHARED_RAM_BASE,
  94. -       .pfn =      __phys_to_pfn(MSM_SHARED_RAM_PHYS),
  95. -       .length =   MSM_SHARED_RAM_SIZE,
  96. +       .virtual =  (unsigned long) MSM_SPLHOOD_BASE,
  97. +       .pfn =      __phys_to_pfn(MSM_SPLHOOD_PHYS),
  98. +       .length =   MSM_SPLHOOD_SIZE,
  99.         .type =     MT_DEVICE,
  100.     },
  101.     MSM_DEVICE(SDC2),
  102. --
  103. 1.7.4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement