1 /*
2  * This file is part of wl1271
3  *
4  * Copyright (C) 2010 Nokia Corporation
5  *
6  * Contact: Luciano Coelho <luciano.coelho@nokia.com>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  *
22  */
23 
24 #ifndef __INI_H__
25 #define __INI_H__
26 
27 #define WL1271_INI_MAX_SMART_REFLEX_PARAM 16
28 
29 struct wl1271_ini_general_params {
30 	u8 ref_clock;
31 	u8 settling_time;
32 	u8 clk_valid_on_wakeup;
33 	u8 dc2dc_mode;
34 	u8 dual_mode_select;
35 	u8 tx_bip_fem_auto_detect;
36 	u8 tx_bip_fem_manufacturer;
37 	u8 general_settings;
38 	u8 sr_state;
39 	u8 srf1[WL1271_INI_MAX_SMART_REFLEX_PARAM];
40 	u8 srf2[WL1271_INI_MAX_SMART_REFLEX_PARAM];
41 	u8 srf3[WL1271_INI_MAX_SMART_REFLEX_PARAM];
42 } __packed;
43 
44 #define WL1271_INI_RSSI_PROCESS_COMPENS_SIZE 15
45 
46 struct wl1271_ini_band_params_2 {
47 	u8 rx_trace_insertion_loss;
48 	u8 tx_trace_loss;
49 	u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
50 } __packed;
51 
52 #define WL1271_INI_RATE_GROUP_COUNT 6
53 #define WL1271_INI_CHANNEL_COUNT_2 14
54 
55 struct wl1271_ini_fem_params_2 {
56 	__le16 tx_bip_ref_pd_voltage;
57 	u8 tx_bip_ref_power;
58 	u8 tx_bip_ref_offset;
59 	u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT];
60 	u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT];
61 	u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT];
62 	u8 tx_per_chan_pwr_limits_11b[WL1271_INI_CHANNEL_COUNT_2];
63 	u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_2];
64 	u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT];
65 	u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT];
66 	u8 rx_fem_insertion_loss;
67 	u8 degraded_low_to_normal_thr;
68 	u8 normal_to_degraded_high_thr;
69 } __packed;
70 
71 #define WL1271_INI_CHANNEL_COUNT_5 35
72 #define WL1271_INI_SUB_BAND_COUNT_5 7
73 
74 struct wl1271_ini_band_params_5 {
75 	u8 rx_trace_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
76 	u8 tx_trace_loss[WL1271_INI_SUB_BAND_COUNT_5];
77 	u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
78 } __packed;
79 
80 struct wl1271_ini_fem_params_5 {
81 	__le16 tx_bip_ref_pd_voltage[WL1271_INI_SUB_BAND_COUNT_5];
82 	u8 tx_bip_ref_power[WL1271_INI_SUB_BAND_COUNT_5];
83 	u8 tx_bip_ref_offset[WL1271_INI_SUB_BAND_COUNT_5];
84 	u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT];
85 	u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT];
86 	u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT];
87 	u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_5];
88 	u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT];
89 	u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT];
90 	u8 rx_fem_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
91 	u8 degraded_low_to_normal_thr;
92 	u8 normal_to_degraded_high_thr;
93 } __packed;
94 
95 
96 /* NVS data structure */
97 #define WL1271_INI_NVS_SECTION_SIZE		     468
98 #define WL1271_INI_FEM_MODULE_COUNT                  2
99 
100 #define WL1271_INI_LEGACY_NVS_FILE_SIZE              800
101 
102 struct wl1271_nvs_file {
103 	/* NVS section */
104 	u8 nvs[WL1271_INI_NVS_SECTION_SIZE];
105 
106 	/* INI section */
107 	struct wl1271_ini_general_params general_params;
108 	u8 padding1;
109 	struct wl1271_ini_band_params_2 stat_radio_params_2;
110 	u8 padding2;
111 	struct {
112 		struct wl1271_ini_fem_params_2 params;
113 		u8 padding;
114 	} dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT];
115 	struct wl1271_ini_band_params_5 stat_radio_params_5;
116 	u8 padding3;
117 	struct {
118 		struct wl1271_ini_fem_params_5 params;
119 		u8 padding;
120 	} dyn_radio_params_5[WL1271_INI_FEM_MODULE_COUNT];
121 } __packed;
122 
123 #endif
124