arm: tegra: Fix broken boardinfo support in NCT
[linux-3.10.git] / arch / arm / mach-tegra / include / mach / nct.h
1 /*
2  * arch/arm/mach-tegra/include/mach/nct.h
3  *
4  * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19  */
20
21 #ifndef __MACH_TEGRA_NCT_H
22 #define __MACH_TEGRA_NCT_H
23
24 #include <linux/platform_data/tegra_emc.h>
25
26 #define NCT_MAGIC_ID            0x7443566E /* "nVCt" */
27
28 #define NCT_FORMAT_VERSION      0x00010000 /* 0xMMMMNNNN (VMMMM.NNNN) */
29
30 #define NCT_ENTRY_OFFSET        0x4000
31 #define MAX_NCT_ENTRY           512
32 #define MAX_NCT_DATA_SIZE       1024
33
34 #define NVIDIA_OUI      0x00044B
35
36 enum nct_id_type {
37         NCT_ID_START = 0,
38         NCT_ID_SERIAL_NUMBER = NCT_ID_START,
39         NCT_ID_WIFI_MAC_ADDR,
40         NCT_ID_BT_ADDR,
41         NCT_ID_CM_ID,
42         NCT_ID_LBH_ID,
43         NCT_ID_FACTORY_MODE,
44         NCT_ID_RAMDUMP,
45         NCT_ID_TEST,
46         NCT_ID_BOARD_INFO,
47         NCT_ID_GPS_ID,
48         NCT_ID_LCD_ID,
49         NCT_ID_ACCELEROMETER_ID,
50         NCT_ID_COMPASS_ID,
51         NCT_ID_GYROSCOPE_ID,
52         NCT_ID_LIGHT_ID,
53         NCT_ID_CHARGER_ID,
54         NCT_ID_TOUCH_ID,
55         NCT_ID_FUELGAUGE_ID,
56         NCT_ID_MEMTABLE,
57         NCT_ID_MEMTABLE_END = NCT_ID_MEMTABLE + TEGRA_EMC_MAX_FREQS - 1,
58         NCT_ID_END = NCT_ID_MEMTABLE_END,
59         NCT_ID_DISABLED = 0xEEEE,
60         NCT_ID_MAX = 0xFFFF
61 };
62
63 struct nct_serial_number_type {
64         char sn[30];
65 };
66
67 struct nct_wifi_mac_addr_type {
68         u8 addr[6];
69 };
70
71 struct nct_bt_addr_type {
72         u8 addr[6];
73 };
74
75 struct nct_cm_id_type {
76         u16 id;
77 };
78
79 struct nct_lbh_id_type {
80         u16 id;
81 };
82
83 struct nct_factory_mode_type {
84         u32 flag;
85 };
86
87 struct nct_ramdump_type {
88         u32 flag;
89 };
90
91 struct nct_board_info_type {
92         u32 proc_board_id;
93         u32 proc_sku;
94         u32 proc_fab;
95         u32 pmu_board_id;
96         u32 pmu_sku;
97         u32 pmu_fab;
98         u32 display_board_id;
99         u32 display_sku;
100         u32 display_fab;
101 };
102
103 union nct_tegra_emc_table_type {
104         struct tegra12_emc_table        tegra12_emc_table;
105 } __packed;
106
107
108 union nct_item_type {
109         struct nct_serial_number_type   serial_number;
110         struct nct_wifi_mac_addr_type   wifi_mac_addr;
111         struct nct_bt_addr_type         bt_addr;
112         struct nct_cm_id_type           cm_id;
113         struct nct_lbh_id_type          lbh_id;
114         struct nct_factory_mode_type    factory_mode;
115         struct nct_ramdump_type         ramdump;
116         struct nct_board_info_type      board_info;
117         struct nct_lbh_id_type          gps_id;
118         struct nct_lbh_id_type          lcd_id;
119         struct nct_lbh_id_type          accelerometer_id;
120         struct nct_lbh_id_type          compass_id;
121         struct nct_lbh_id_type          gyroscope_id;
122         struct nct_lbh_id_type          light_id;
123         struct nct_lbh_id_type          charger_id;
124         struct nct_lbh_id_type          touch_id;
125         u8      fuelgauge_id[MAX_NCT_DATA_SIZE];
126         union nct_tegra_emc_table_type  tegra_emc_table;
127         u8      u8[MAX_NCT_DATA_SIZE];
128         u16     u16[MAX_NCT_DATA_SIZE/2];
129         u32     u32[MAX_NCT_DATA_SIZE/4];
130 } __packed;
131
132 struct nct_entry_type {
133         u32 index;
134         u32 reserved[2];
135         union nct_item_type data;
136         u32 checksum;
137 };
138
139 struct nct_part_head_type {
140         u32 magicId;
141         u32 vendorId;
142         u32 productId;
143         u32 version;
144         u32 revision;
145 };
146
147 extern int tegra_nct_read_item(u32 index, union nct_item_type *buf);
148 extern int tegra_nct_is_init(void);
149
150 #endif /* __MACH_TEGRA_NCT_H */