htcleo: wifi: Load the real MAC address from SPL if running SD build on WM.

Thank for Savan's help.
Refer to 3c64a1c16f
This commit is contained in:
tytung 2011-09-08 00:36:00 +08:00
parent c26ad4782d
commit 9c8917c035
3 changed files with 33 additions and 7 deletions

View File

@ -28,6 +28,8 @@
#include <linux/crc32.h>
#include <linux/io.h>
#include "board-htcleo.h"
#define NVS_MAX_SIZE 0x800U
#define NVS_MACADDR_SIZE 0x1AU
#define WLAN_SKB_BUF_NUM 16
@ -131,6 +133,21 @@ static int parse_tag_msm_wifi(void)
return 0;
}
static int parse_tag_msm_wifi_from_spl(void)
{
uint32_t id1, id2, id3, id4, id5, id6;
uint32_t id_base = 0xFC028; //real mac offset found in spl for haret.exe on WM
id1 = readl(MSM_SPLHOOD_BASE + id_base + 0x0);
id2 = readl(MSM_SPLHOOD_BASE + id_base + 0x1);
id3 = readl(MSM_SPLHOOD_BASE + id_base + 0x2);
id4 = readl(MSM_SPLHOOD_BASE + id_base + 0x3);
id5 = readl(MSM_SPLHOOD_BASE + id_base + 0x4);
id6 = readl(MSM_SPLHOOD_BASE + id_base + 0x5);
sprintf(nvs_mac_addr, "macaddr=%2x:%2x:%2x:%2x:%2x:%2x\n", id1 & 0xff, id2 & 0xff, id3 & 0xff, id4 & 0xff, id5 & 0xff, id6 & 0xff);
pr_info("Device Real Wifi Mac Address: %s\n", nvs_mac_addr);
return 0;
}
static unsigned wifi_get_nvs_size( void )
{
unsigned len;
@ -171,7 +188,11 @@ static int wifi_calibration_read_proc(char *page, char **start, off_t off,
static int __init wifi_nvs_init(void)
{
pr_info("%s\n", __func__);
parse_tag_msm_wifi();
if (htcleo_is_nand_boot()) {
parse_tag_msm_wifi();
} else {
parse_tag_msm_wifi_from_spl();
}
wifi_calibration = create_proc_entry("calibration", 0444, NULL);
if (wifi_calibration != NULL) {
wifi_calibration->size = wifi_get_nvs_size();

View File

@ -159,9 +159,9 @@
#define MSM_SPI_PHYS 0xA1200000
#define MSM_SPI_SIZE SZ_4K
#define MSM_TCSR_BASE IOMEM(0xF8008000)
#define MSM_TCSR_PHYS 0xA8700000
#define MSM_TCSR_SIZE SZ_4K
#define MSM_TCSR_BASE IOMEM(0xF8008000)
#define MSM_TCSR_PHYS 0xA8700000
#define MSM_TCSR_SIZE SZ_4K
#endif
// Originally this does not need to be defined,
@ -177,3 +177,8 @@
#endif
#define MSM_RAM_CONSOLE_SIZE 0x00040000
// For reading the real WiFi MAC address
#define MSM_SPLHOOD_BASE IOMEM(0xF9200000)
#define MSM_SPLHOOD_PHYS 0x0
#define MSM_SPLHOOD_SIZE SZ_1M

View File

@ -90,9 +90,9 @@ static struct map_desc msm_io_desc[] __initdata = {
},
#endif
{
.virtual = (unsigned long) MSM_SHARED_RAM_BASE,
.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS),
.length = MSM_SHARED_RAM_SIZE,
.virtual = (unsigned long) MSM_SPLHOOD_BASE,
.pfn = __phys_to_pfn(MSM_SPLHOOD_PHYS),
.length = MSM_SPLHOOD_SIZE,
.type = MT_DEVICE,
},
MSM_DEVICE(SDC2),