blob: 2d381a97c070ebcd53b98e858ae1e65b47da3679 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* arch/arm/mach-msm/htc_wifi_nvs.c
2 *
3 * Code to extract WiFi calibration information from ATAG set up
4 * by the bootloader.
5 *
6 * Copyright (C) 2008 Google, Inc.
7 * Author: Dmitry Shmidt <dimitrysh@google.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 */
19
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/platform_device.h>
23
24#include <asm/setup.h>
25
26/* configuration tags specific to msm */
27#define ATAG_MSM_WIFI 0x57494649 /* MSM WiFi */
28
29#define MAX_NVS_SIZE 0x800U
30static unsigned char wifi_nvs_ram[MAX_NVS_SIZE];
31
32unsigned char *get_wifi_nvs_ram( void )
33{
34 return( wifi_nvs_ram );
35}
36EXPORT_SYMBOL(get_wifi_nvs_ram);
37
38static int __init parse_tag_msm_wifi(const struct tag *tag)
39{
40 unsigned char *dptr = (unsigned char *)(&tag->u);
41 unsigned size;
42
43 size = min((tag->hdr.size - 2) * sizeof(__u32), MAX_NVS_SIZE);
44#ifdef ATAG_MSM_WIFI_DEBUG
45 unsigned i;
46
47 printk("WiFi Data size = %d , 0x%x\n", tag->hdr.size, tag->hdr.tag);
48 for (i = 0; i < size; i++)
49 printk("%02x ", *dptr++);
50#endif
51 memcpy( (void *)wifi_nvs_ram, (void *)dptr, size );
52 return 0;
53}
54
55__tagtable(ATAG_MSM_WIFI, parse_tag_msm_wifi);