1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * This file is part of wl1271
5 * Copyright (C) 2010 Nokia Corporation
7 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
13 #define GENERAL_SETTINGS_DRPW_LPD 0xc0
14 #define SCRATCH_ENABLE_LPD BIT(25)
16 #define WL1271_INI_MAX_SMART_REFLEX_PARAM 16
18 struct wl1271_ini_general_params
{
21 u8 clk_valid_on_wakeup
;
24 u8 tx_bip_fem_auto_detect
;
25 u8 tx_bip_fem_manufacturer
;
28 u8 srf1
[WL1271_INI_MAX_SMART_REFLEX_PARAM
];
29 u8 srf2
[WL1271_INI_MAX_SMART_REFLEX_PARAM
];
30 u8 srf3
[WL1271_INI_MAX_SMART_REFLEX_PARAM
];
33 #define WL128X_INI_MAX_SETTINGS_PARAM 4
35 struct wl128x_ini_general_params
{
38 u8 clk_valid_on_wakeup
;
40 u8 tcxo_settling_time
;
41 u8 tcxo_valid_on_wakeup
;
46 u8 tx_bip_fem_auto_detect
;
47 u8 tx_bip_fem_manufacturer
;
48 u8 general_settings
[WL128X_INI_MAX_SETTINGS_PARAM
];
50 u8 srf1
[WL1271_INI_MAX_SMART_REFLEX_PARAM
];
51 u8 srf2
[WL1271_INI_MAX_SMART_REFLEX_PARAM
];
52 u8 srf3
[WL1271_INI_MAX_SMART_REFLEX_PARAM
];
55 #define WL1271_INI_RSSI_PROCESS_COMPENS_SIZE 15
57 struct wl1271_ini_band_params_2
{
58 u8 rx_trace_insertion_loss
;
60 u8 rx_rssi_process_compens
[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE
];
63 #define WL1271_INI_CHANNEL_COUNT_2 14
65 struct wl128x_ini_band_params_2
{
66 u8 rx_trace_insertion_loss
;
67 u8 tx_trace_loss
[WL1271_INI_CHANNEL_COUNT_2
];
68 u8 rx_rssi_process_compens
[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE
];
71 #define WL1271_INI_RATE_GROUP_COUNT 6
73 struct wl1271_ini_fem_params_2
{
74 __le16 tx_bip_ref_pd_voltage
;
77 u8 tx_per_rate_pwr_limits_normal
[WL1271_INI_RATE_GROUP_COUNT
];
78 u8 tx_per_rate_pwr_limits_degraded
[WL1271_INI_RATE_GROUP_COUNT
];
79 u8 tx_per_rate_pwr_limits_extreme
[WL1271_INI_RATE_GROUP_COUNT
];
80 u8 tx_per_chan_pwr_limits_11b
[WL1271_INI_CHANNEL_COUNT_2
];
81 u8 tx_per_chan_pwr_limits_ofdm
[WL1271_INI_CHANNEL_COUNT_2
];
82 u8 tx_pd_vs_rate_offsets
[WL1271_INI_RATE_GROUP_COUNT
];
83 u8 tx_ibias
[WL1271_INI_RATE_GROUP_COUNT
];
84 u8 rx_fem_insertion_loss
;
85 u8 degraded_low_to_normal_thr
;
86 u8 normal_to_degraded_high_thr
;
89 #define WL128X_INI_RATE_GROUP_COUNT 7
90 /* low and high temperatures */
91 #define WL128X_INI_PD_VS_TEMPERATURE_RANGES 2
93 struct wl128x_ini_fem_params_2
{
94 __le16 tx_bip_ref_pd_voltage
;
97 u8 tx_per_rate_pwr_limits_normal
[WL128X_INI_RATE_GROUP_COUNT
];
98 u8 tx_per_rate_pwr_limits_degraded
[WL128X_INI_RATE_GROUP_COUNT
];
99 u8 tx_per_rate_pwr_limits_extreme
[WL128X_INI_RATE_GROUP_COUNT
];
100 u8 tx_per_chan_pwr_limits_11b
[WL1271_INI_CHANNEL_COUNT_2
];
101 u8 tx_per_chan_pwr_limits_ofdm
[WL1271_INI_CHANNEL_COUNT_2
];
102 u8 tx_pd_vs_rate_offsets
[WL128X_INI_RATE_GROUP_COUNT
];
103 u8 tx_ibias
[WL128X_INI_RATE_GROUP_COUNT
+ 1];
104 u8 tx_pd_vs_chan_offsets
[WL1271_INI_CHANNEL_COUNT_2
];
105 u8 tx_pd_vs_temperature
[WL128X_INI_PD_VS_TEMPERATURE_RANGES
];
106 u8 rx_fem_insertion_loss
;
107 u8 degraded_low_to_normal_thr
;
108 u8 normal_to_degraded_high_thr
;
111 #define WL1271_INI_CHANNEL_COUNT_5 35
112 #define WL1271_INI_SUB_BAND_COUNT_5 7
114 struct wl1271_ini_band_params_5
{
115 u8 rx_trace_insertion_loss
[WL1271_INI_SUB_BAND_COUNT_5
];
116 u8 tx_trace_loss
[WL1271_INI_SUB_BAND_COUNT_5
];
117 u8 rx_rssi_process_compens
[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE
];
120 struct wl128x_ini_band_params_5
{
121 u8 rx_trace_insertion_loss
[WL1271_INI_SUB_BAND_COUNT_5
];
122 u8 tx_trace_loss
[WL1271_INI_CHANNEL_COUNT_5
];
123 u8 rx_rssi_process_compens
[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE
];
126 struct wl1271_ini_fem_params_5
{
127 __le16 tx_bip_ref_pd_voltage
[WL1271_INI_SUB_BAND_COUNT_5
];
128 u8 tx_bip_ref_power
[WL1271_INI_SUB_BAND_COUNT_5
];
129 u8 tx_bip_ref_offset
[WL1271_INI_SUB_BAND_COUNT_5
];
130 u8 tx_per_rate_pwr_limits_normal
[WL1271_INI_RATE_GROUP_COUNT
];
131 u8 tx_per_rate_pwr_limits_degraded
[WL1271_INI_RATE_GROUP_COUNT
];
132 u8 tx_per_rate_pwr_limits_extreme
[WL1271_INI_RATE_GROUP_COUNT
];
133 u8 tx_per_chan_pwr_limits_ofdm
[WL1271_INI_CHANNEL_COUNT_5
];
134 u8 tx_pd_vs_rate_offsets
[WL1271_INI_RATE_GROUP_COUNT
];
135 u8 tx_ibias
[WL1271_INI_RATE_GROUP_COUNT
];
136 u8 rx_fem_insertion_loss
[WL1271_INI_SUB_BAND_COUNT_5
];
137 u8 degraded_low_to_normal_thr
;
138 u8 normal_to_degraded_high_thr
;
141 struct wl128x_ini_fem_params_5
{
142 __le16 tx_bip_ref_pd_voltage
[WL1271_INI_SUB_BAND_COUNT_5
];
143 u8 tx_bip_ref_power
[WL1271_INI_SUB_BAND_COUNT_5
];
144 u8 tx_bip_ref_offset
[WL1271_INI_SUB_BAND_COUNT_5
];
145 u8 tx_per_rate_pwr_limits_normal
[WL128X_INI_RATE_GROUP_COUNT
];
146 u8 tx_per_rate_pwr_limits_degraded
[WL128X_INI_RATE_GROUP_COUNT
];
147 u8 tx_per_rate_pwr_limits_extreme
[WL128X_INI_RATE_GROUP_COUNT
];
148 u8 tx_per_chan_pwr_limits_ofdm
[WL1271_INI_CHANNEL_COUNT_5
];
149 u8 tx_pd_vs_rate_offsets
[WL128X_INI_RATE_GROUP_COUNT
];
150 u8 tx_ibias
[WL128X_INI_RATE_GROUP_COUNT
];
151 u8 tx_pd_vs_chan_offsets
[WL1271_INI_CHANNEL_COUNT_5
];
152 u8 tx_pd_vs_temperature
[WL1271_INI_SUB_BAND_COUNT_5
*
153 WL128X_INI_PD_VS_TEMPERATURE_RANGES
];
154 u8 rx_fem_insertion_loss
[WL1271_INI_SUB_BAND_COUNT_5
];
155 u8 degraded_low_to_normal_thr
;
156 u8 normal_to_degraded_high_thr
;
159 /* NVS data structure */
160 #define WL1271_INI_NVS_SECTION_SIZE 468
162 /* We have four FEM module types: 0-RFMD, 1-TQS, 2-SKW, 3-TQS_HP */
163 #define WL1271_INI_FEM_MODULE_COUNT 4
166 * In NVS we only store two FEM module entries -
167 * FEM modules 0,2,3 are stored in entry 0
168 * FEM module 1 is stored in entry 1
170 #define WL12XX_NVS_FEM_MODULE_COUNT 2
172 #define WL12XX_FEM_TO_NVS_ENTRY(ini_fem_module) \
173 ((ini_fem_module) == 1 ? 1 : 0)
175 #define WL1271_INI_LEGACY_NVS_FILE_SIZE 800
177 struct wl1271_nvs_file
{
178 /* NVS section - must be first! */
179 u8 nvs
[WL1271_INI_NVS_SECTION_SIZE
];
182 struct wl1271_ini_general_params general_params
;
184 struct wl1271_ini_band_params_2 stat_radio_params_2
;
187 struct wl1271_ini_fem_params_2 params
;
189 } dyn_radio_params_2
[WL12XX_NVS_FEM_MODULE_COUNT
];
190 struct wl1271_ini_band_params_5 stat_radio_params_5
;
193 struct wl1271_ini_fem_params_5 params
;
195 } dyn_radio_params_5
[WL12XX_NVS_FEM_MODULE_COUNT
];
198 struct wl128x_nvs_file
{
199 /* NVS section - must be first! */
200 u8 nvs
[WL1271_INI_NVS_SECTION_SIZE
];
203 struct wl128x_ini_general_params general_params
;
204 u8 fem_vendor_and_options
;
205 struct wl128x_ini_band_params_2 stat_radio_params_2
;
208 struct wl128x_ini_fem_params_2 params
;
210 } dyn_radio_params_2
[WL12XX_NVS_FEM_MODULE_COUNT
];
211 struct wl128x_ini_band_params_5 stat_radio_params_5
;
214 struct wl128x_ini_fem_params_5 params
;
216 } dyn_radio_params_5
[WL12XX_NVS_FEM_MODULE_COUNT
];