aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1251_boot.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1251_boot.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_boot.c106
1 files changed, 53 insertions, 53 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251_boot.c b/drivers/net/wireless/wl12xx/wl1251_boot.c
index c52a2085671..d8a155dc2fa 100644
--- a/drivers/net/wireless/wl12xx/wl1251_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1251_boot.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2008 Nokia Corporation 4 * Copyright (C) 2008 Nokia Corporation
5 * 5 *
@@ -28,37 +28,37 @@
28#include "wl1251_spi.h" 28#include "wl1251_spi.h"
29#include "wl1251_event.h" 29#include "wl1251_event.h"
30 30
31static void wl12xx_boot_enable_interrupts(struct wl12xx *wl) 31static void wl1251_boot_enable_interrupts(struct wl1251 *wl)
32{ 32{
33 enable_irq(wl->irq); 33 enable_irq(wl->irq);
34} 34}
35 35
36void wl12xx_boot_target_enable_interrupts(struct wl12xx *wl) 36void wl1251_boot_target_enable_interrupts(struct wl1251 *wl)
37{ 37{
38 wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_MASK, ~(wl->intr_mask)); 38 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_MASK, ~(wl->intr_mask));
39 wl12xx_reg_write32(wl, HI_CFG, HI_CFG_DEF_VAL); 39 wl1251_reg_write32(wl, HI_CFG, HI_CFG_DEF_VAL);
40} 40}
41 41
42int wl12xx_boot_soft_reset(struct wl12xx *wl) 42int wl1251_boot_soft_reset(struct wl1251 *wl)
43{ 43{
44 unsigned long timeout; 44 unsigned long timeout;
45 u32 boot_data; 45 u32 boot_data;
46 46
47 /* perform soft reset */ 47 /* perform soft reset */
48 wl12xx_reg_write32(wl, ACX_REG_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT); 48 wl1251_reg_write32(wl, ACX_REG_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT);
49 49
50 /* SOFT_RESET is self clearing */ 50 /* SOFT_RESET is self clearing */
51 timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME); 51 timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME);
52 while (1) { 52 while (1) {
53 boot_data = wl12xx_reg_read32(wl, ACX_REG_SLV_SOFT_RESET); 53 boot_data = wl1251_reg_read32(wl, ACX_REG_SLV_SOFT_RESET);
54 wl12xx_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data); 54 wl1251_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data);
55 if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0) 55 if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0)
56 break; 56 break;
57 57
58 if (time_after(jiffies, timeout)) { 58 if (time_after(jiffies, timeout)) {
59 /* 1.2 check pWhalBus->uSelfClearTime if the 59 /* 1.2 check pWhalBus->uSelfClearTime if the
60 * timeout was reached */ 60 * timeout was reached */
61 wl12xx_error("soft reset timeout"); 61 wl1251_error("soft reset timeout");
62 return -1; 62 return -1;
63 } 63 }
64 64
@@ -66,15 +66,15 @@ int wl12xx_boot_soft_reset(struct wl12xx *wl)
66 } 66 }
67 67
68 /* disable Rx/Tx */ 68 /* disable Rx/Tx */
69 wl12xx_reg_write32(wl, ENABLE, 0x0); 69 wl1251_reg_write32(wl, ENABLE, 0x0);
70 70
71 /* disable auto calibration on start*/ 71 /* disable auto calibration on start*/
72 wl12xx_reg_write32(wl, SPARE_A2, 0xffff); 72 wl1251_reg_write32(wl, SPARE_A2, 0xffff);
73 73
74 return 0; 74 return 0;
75} 75}
76 76
77int wl12xx_boot_init_seq(struct wl12xx *wl) 77int wl1251_boot_init_seq(struct wl1251 *wl)
78{ 78{
79 u32 scr_pad6, init_data, tmp, elp_cmd, ref_freq; 79 u32 scr_pad6, init_data, tmp, elp_cmd, ref_freq;
80 80
@@ -96,23 +96,23 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
96 }; 96 };
97 97
98 /* read NVS params */ 98 /* read NVS params */
99 scr_pad6 = wl12xx_reg_read32(wl, SCR_PAD6); 99 scr_pad6 = wl1251_reg_read32(wl, SCR_PAD6);
100 wl12xx_debug(DEBUG_BOOT, "scr_pad6 0x%x", scr_pad6); 100 wl1251_debug(DEBUG_BOOT, "scr_pad6 0x%x", scr_pad6);
101 101
102 /* read ELP_CMD */ 102 /* read ELP_CMD */
103 elp_cmd = wl12xx_reg_read32(wl, ELP_CMD); 103 elp_cmd = wl1251_reg_read32(wl, ELP_CMD);
104 wl12xx_debug(DEBUG_BOOT, "elp_cmd 0x%x", elp_cmd); 104 wl1251_debug(DEBUG_BOOT, "elp_cmd 0x%x", elp_cmd);
105 105
106 /* set the BB calibration time to be 300 usec (PLL_CAL_TIME) */ 106 /* set the BB calibration time to be 300 usec (PLL_CAL_TIME) */
107 ref_freq = scr_pad6 & 0x000000FF; 107 ref_freq = scr_pad6 & 0x000000FF;
108 wl12xx_debug(DEBUG_BOOT, "ref_freq 0x%x", ref_freq); 108 wl1251_debug(DEBUG_BOOT, "ref_freq 0x%x", ref_freq);
109 109
110 wl12xx_reg_write32(wl, PLL_CAL_TIME, 0x9); 110 wl1251_reg_write32(wl, PLL_CAL_TIME, 0x9);
111 111
112 /* 112 /*
113 * PG 1.2: set the clock buffer time to be 210 usec (CLK_BUF_TIME) 113 * PG 1.2: set the clock buffer time to be 210 usec (CLK_BUF_TIME)
114 */ 114 */
115 wl12xx_reg_write32(wl, CLK_BUF_TIME, 0x6); 115 wl1251_reg_write32(wl, CLK_BUF_TIME, 0x6);
116 116
117 /* 117 /*
118 * set the clock detect feature to work in the restart wu procedure 118 * set the clock detect feature to work in the restart wu procedure
@@ -120,18 +120,18 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
120 * (ELP_CFG_MODE[13:12]) 120 * (ELP_CFG_MODE[13:12])
121 */ 121 */
122 tmp = ((scr_pad6 & 0x0000FF00) << 4) | 0x00004000; 122 tmp = ((scr_pad6 & 0x0000FF00) << 4) | 0x00004000;
123 wl12xx_reg_write32(wl, ELP_CFG_MODE, tmp); 123 wl1251_reg_write32(wl, ELP_CFG_MODE, tmp);
124 124
125 /* PG 1.2: enable the BB PLL fix. Enable the PLL_LIMP_CLK_EN_CMD */ 125 /* PG 1.2: enable the BB PLL fix. Enable the PLL_LIMP_CLK_EN_CMD */
126 elp_cmd |= 0x00000040; 126 elp_cmd |= 0x00000040;
127 wl12xx_reg_write32(wl, ELP_CMD, elp_cmd); 127 wl1251_reg_write32(wl, ELP_CMD, elp_cmd);
128 128
129 /* PG 1.2: Set the BB PLL stable time to be 1000usec 129 /* PG 1.2: Set the BB PLL stable time to be 1000usec
130 * (PLL_STABLE_TIME) */ 130 * (PLL_STABLE_TIME) */
131 wl12xx_reg_write32(wl, CFG_PLL_SYNC_CNT, 0x20); 131 wl1251_reg_write32(wl, CFG_PLL_SYNC_CNT, 0x20);
132 132
133 /* PG 1.2: read clock request time */ 133 /* PG 1.2: read clock request time */
134 init_data = wl12xx_reg_read32(wl, CLK_REQ_TIME); 134 init_data = wl1251_reg_read32(wl, CLK_REQ_TIME);
135 135
136 /* 136 /*
137 * PG 1.2: set the clock request time to be ref_clk_settling_time - 137 * PG 1.2: set the clock request time to be ref_clk_settling_time -
@@ -141,35 +141,35 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
141 tmp = init_data - 0x21; 141 tmp = init_data - 0x21;
142 else 142 else
143 tmp = 0; 143 tmp = 0;
144 wl12xx_reg_write32(wl, CLK_REQ_TIME, tmp); 144 wl1251_reg_write32(wl, CLK_REQ_TIME, tmp);
145 145
146 /* set BB PLL configurations in RF AFE */ 146 /* set BB PLL configurations in RF AFE */
147 wl12xx_reg_write32(wl, 0x003058cc, 0x4B5); 147 wl1251_reg_write32(wl, 0x003058cc, 0x4B5);
148 148
149 /* set RF_AFE_REG_5 */ 149 /* set RF_AFE_REG_5 */
150 wl12xx_reg_write32(wl, 0x003058d4, 0x50); 150 wl1251_reg_write32(wl, 0x003058d4, 0x50);
151 151
152 /* set RF_AFE_CTRL_REG_2 */ 152 /* set RF_AFE_CTRL_REG_2 */
153 wl12xx_reg_write32(wl, 0x00305948, 0x11c001); 153 wl1251_reg_write32(wl, 0x00305948, 0x11c001);
154 154
155 /* 155 /*
156 * change RF PLL and BB PLL divider for VCO clock and adjust VCO 156 * change RF PLL and BB PLL divider for VCO clock and adjust VCO
157 * bais current(RF_AFE_REG_13) 157 * bais current(RF_AFE_REG_13)
158 */ 158 */
159 wl12xx_reg_write32(wl, 0x003058f4, 0x1e); 159 wl1251_reg_write32(wl, 0x003058f4, 0x1e);
160 160
161 /* set BB PLL configurations */ 161 /* set BB PLL configurations */
162 tmp = LUT[ref_freq][LUT_PARAM_INTEGER_DIVIDER] | 0x00017000; 162 tmp = LUT[ref_freq][LUT_PARAM_INTEGER_DIVIDER] | 0x00017000;
163 wl12xx_reg_write32(wl, 0x00305840, tmp); 163 wl1251_reg_write32(wl, 0x00305840, tmp);
164 164
165 /* set fractional divider according to Appendix C-BB PLL 165 /* set fractional divider according to Appendix C-BB PLL
166 * Calculations 166 * Calculations
167 */ 167 */
168 tmp = LUT[ref_freq][LUT_PARAM_FRACTIONAL_DIVIDER]; 168 tmp = LUT[ref_freq][LUT_PARAM_FRACTIONAL_DIVIDER];
169 wl12xx_reg_write32(wl, 0x00305844, tmp); 169 wl1251_reg_write32(wl, 0x00305844, tmp);
170 170
171 /* set the initial data for the sigma delta */ 171 /* set the initial data for the sigma delta */
172 wl12xx_reg_write32(wl, 0x00305848, 0x3039); 172 wl1251_reg_write32(wl, 0x00305848, 0x3039);
173 173
174 /* 174 /*
175 * set the accumulator attenuation value, calibration loop1 175 * set the accumulator attenuation value, calibration loop1
@@ -178,14 +178,14 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
178 */ 178 */
179 tmp = (LUT[ref_freq][LUT_PARAM_ATTN_BB] << 16) | 179 tmp = (LUT[ref_freq][LUT_PARAM_ATTN_BB] << 16) |
180 (LUT[ref_freq][LUT_PARAM_ALPHA_BB] << 12) | 0x1; 180 (LUT[ref_freq][LUT_PARAM_ALPHA_BB] << 12) | 0x1;
181 wl12xx_reg_write32(wl, 0x00305854, tmp); 181 wl1251_reg_write32(wl, 0x00305854, tmp);
182 182
183 /* 183 /*
184 * set the calibration stop time after holdoff time expires and set 184 * set the calibration stop time after holdoff time expires and set
185 * settling time HOLD_OFF_TIME_BB 185 * settling time HOLD_OFF_TIME_BB
186 */ 186 */
187 tmp = LUT[ref_freq][LUT_PARAM_STOP_TIME_BB] | 0x000A0000; 187 tmp = LUT[ref_freq][LUT_PARAM_STOP_TIME_BB] | 0x000A0000;
188 wl12xx_reg_write32(wl, 0x00305858, tmp); 188 wl1251_reg_write32(wl, 0x00305858, tmp);
189 189
190 /* 190 /*
191 * set BB PLL Loop filter capacitor3- BB_C3[2:0] and set BB PLL 191 * set BB PLL Loop filter capacitor3- BB_C3[2:0] and set BB PLL
@@ -193,7 +193,7 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
193 * BB_ILOOPF[7:3] 193 * BB_ILOOPF[7:3]
194 */ 194 */
195 tmp = LUT[ref_freq][LUT_PARAM_BB_PLL_LOOP_FILTER] | 0x00000030; 195 tmp = LUT[ref_freq][LUT_PARAM_BB_PLL_LOOP_FILTER] | 0x00000030;
196 wl12xx_reg_write32(wl, 0x003058f8, tmp); 196 wl1251_reg_write32(wl, 0x003058f8, tmp);
197 197
198 /* 198 /*
199 * set regulator output voltage for n divider to 199 * set regulator output voltage for n divider to
@@ -201,10 +201,10 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
201 * set BB PLL Loop filter capacitor2- BB_C2[7:5], set gain of BB 201 * set BB PLL Loop filter capacitor2- BB_C2[7:5], set gain of BB
202 * PLL auto-call to normal mode- BB_CALGAIN_3DB[8] 202 * PLL auto-call to normal mode- BB_CALGAIN_3DB[8]
203 */ 203 */
204 wl12xx_reg_write32(wl, 0x003058f0, 0x29); 204 wl1251_reg_write32(wl, 0x003058f0, 0x29);
205 205
206 /* enable restart wakeup sequence (ELP_CMD[0]) */ 206 /* enable restart wakeup sequence (ELP_CMD[0]) */
207 wl12xx_reg_write32(wl, ELP_CMD, elp_cmd | 0x1); 207 wl1251_reg_write32(wl, ELP_CMD, elp_cmd | 0x1);
208 208
209 /* restart sequence completed */ 209 /* restart sequence completed */
210 udelay(2000); 210 udelay(2000);
@@ -212,19 +212,19 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
212 return 0; 212 return 0;
213} 213}
214 214
215int wl12xx_boot_run_firmware(struct wl12xx *wl) 215int wl1251_boot_run_firmware(struct wl1251 *wl)
216{ 216{
217 int loop, ret; 217 int loop, ret;
218 u32 chip_id, interrupt; 218 u32 chip_id, interrupt;
219 219
220 wl->chip.op_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); 220 wl->chip.op_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT);
221 221
222 chip_id = wl12xx_reg_read32(wl, CHIP_ID_B); 222 chip_id = wl1251_reg_read32(wl, CHIP_ID_B);
223 223
224 wl12xx_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id); 224 wl1251_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id);
225 225
226 if (chip_id != wl->chip.id) { 226 if (chip_id != wl->chip.id) {
227 wl12xx_error("chip id doesn't match after firmware boot"); 227 wl1251_error("chip id doesn't match after firmware boot");
228 return -EIO; 228 return -EIO;
229 } 229 }
230 230
@@ -232,41 +232,41 @@ int wl12xx_boot_run_firmware(struct wl12xx *wl)
232 loop = 0; 232 loop = 0;
233 while (loop++ < INIT_LOOP) { 233 while (loop++ < INIT_LOOP) {
234 udelay(INIT_LOOP_DELAY); 234 udelay(INIT_LOOP_DELAY);
235 interrupt = wl12xx_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); 235 interrupt = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
236 236
237 if (interrupt == 0xffffffff) { 237 if (interrupt == 0xffffffff) {
238 wl12xx_error("error reading hardware complete " 238 wl1251_error("error reading hardware complete "
239 "init indication"); 239 "init indication");
240 return -EIO; 240 return -EIO;
241 } 241 }
242 /* check that ACX_INTR_INIT_COMPLETE is enabled */ 242 /* check that ACX_INTR_INIT_COMPLETE is enabled */
243 else if (interrupt & wl->chip.intr_init_complete) { 243 else if (interrupt & wl->chip.intr_init_complete) {
244 wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_ACK, 244 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_ACK,
245 wl->chip.intr_init_complete); 245 wl->chip.intr_init_complete);
246 break; 246 break;
247 } 247 }
248 } 248 }
249 249
250 if (loop >= INIT_LOOP) { 250 if (loop >= INIT_LOOP) {
251 wl12xx_error("timeout waiting for the hardware to " 251 wl1251_error("timeout waiting for the hardware to "
252 "complete initialization"); 252 "complete initialization");
253 return -EIO; 253 return -EIO;
254 } 254 }
255 255
256 /* get hardware config command mail box */ 256 /* get hardware config command mail box */
257 wl->cmd_box_addr = wl12xx_reg_read32(wl, REG_COMMAND_MAILBOX_PTR); 257 wl->cmd_box_addr = wl1251_reg_read32(wl, REG_COMMAND_MAILBOX_PTR);
258 258
259 /* get hardware config event mail box */ 259 /* get hardware config event mail box */
260 wl->event_box_addr = wl12xx_reg_read32(wl, REG_EVENT_MAILBOX_PTR); 260 wl->event_box_addr = wl1251_reg_read32(wl, REG_EVENT_MAILBOX_PTR);
261 261
262 /* set the working partition to its "running" mode offset */ 262 /* set the working partition to its "running" mode offset */
263 wl12xx_set_partition(wl, 263 wl1251_set_partition(wl,
264 wl->chip.p_table[PART_WORK].mem.start, 264 wl->chip.p_table[PART_WORK].mem.start,
265 wl->chip.p_table[PART_WORK].mem.size, 265 wl->chip.p_table[PART_WORK].mem.size,
266 wl->chip.p_table[PART_WORK].reg.start, 266 wl->chip.p_table[PART_WORK].reg.start,
267 wl->chip.p_table[PART_WORK].reg.size); 267 wl->chip.p_table[PART_WORK].reg.size);
268 268
269 wl12xx_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x event_box_addr 0x%x", 269 wl1251_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x event_box_addr 0x%x",
270 wl->cmd_box_addr, wl->event_box_addr); 270 wl->cmd_box_addr, wl->event_box_addr);
271 271
272 wl->chip.op_fw_version(wl); 272 wl->chip.op_fw_version(wl);
@@ -277,20 +277,20 @@ int wl12xx_boot_run_firmware(struct wl12xx *wl)
277 */ 277 */
278 278
279 /* enable gpio interrupts */ 279 /* enable gpio interrupts */
280 wl12xx_boot_enable_interrupts(wl); 280 wl1251_boot_enable_interrupts(wl);
281 281
282 wl->chip.op_target_enable_interrupts(wl); 282 wl->chip.op_target_enable_interrupts(wl);
283 283
284 /* unmask all mbox events */ 284 /* unmask all mbox events */
285 wl->event_mask = 0xffffffff; 285 wl->event_mask = 0xffffffff;
286 286
287 ret = wl12xx_event_unmask(wl); 287 ret = wl1251_event_unmask(wl);
288 if (ret < 0) { 288 if (ret < 0) {
289 wl12xx_error("EVENT mask setting failed"); 289 wl1251_error("EVENT mask setting failed");
290 return ret; 290 return ret;
291 } 291 }
292 292
293 wl12xx_event_mbox_config(wl); 293 wl1251_event_mbox_config(wl);
294 294
295 /* firmware startup completed */ 295 /* firmware startup completed */
296 return 0; 296 return 0;