blob: d235da244a2155b0b6b90f99fc53613f19dcc47f [file] [log] [blame]
Luciano Coelhob2ba99f2011-11-20 23:32:10 +02001/*
2 * This file is part of wl1271
3 *
4 * Copyright (C) 2008-2010 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#include <linux/module.h>
23#include <linux/platform_device.h>
24
Luciano Coelhoffeb5012011-11-21 18:55:51 +020025#include <linux/err.h>
26
Luciano Coelhodd5512e2012-04-11 11:03:14 +030027#include <linux/wl12xx.h>
28
Luciano Coelhob2ba99f2011-11-20 23:32:10 +020029#include "../wlcore/wlcore.h"
Luciano Coelhoffeb5012011-11-21 18:55:51 +020030#include "../wlcore/debug.h"
Luciano Coelho4ded91c2012-04-11 10:54:52 +030031#include "../wlcore/io.h"
Luciano Coelhodd5512e2012-04-11 11:03:14 +030032#include "../wlcore/acx.h"
33#include "../wlcore/boot.h"
Luciano Coelhoffeb5012011-11-21 18:55:51 +020034
Luciano Coelho00782132011-11-29 13:38:37 +020035#include "reg.h"
Luciano Coelho25a43d72011-11-21 20:37:14 +020036
Luciano Coelho25a43d72011-11-21 20:37:14 +020037static struct wlcore_partition_set wl12xx_ptable[PART_TABLE_LEN] = {
38 [PART_DOWN] = {
39 .mem = {
40 .start = 0x00000000,
41 .size = 0x000177c0
42 },
43 .reg = {
44 .start = REGISTERS_BASE,
45 .size = 0x00008800
46 },
47 .mem2 = {
48 .start = 0x00000000,
49 .size = 0x00000000
50 },
51 .mem3 = {
52 .start = 0x00000000,
53 .size = 0x00000000
54 },
55 },
56
Luciano Coelho00782132011-11-29 13:38:37 +020057 [PART_BOOT] = { /* in wl12xx we can use a mix of work and down
58 * partition here */
59 .mem = {
60 .start = 0x00040000,
61 .size = 0x00014fc0
62 },
63 .reg = {
64 .start = REGISTERS_BASE,
65 .size = 0x00008800
66 },
67 .mem2 = {
68 .start = 0x00000000,
69 .size = 0x00000000
70 },
71 .mem3 = {
72 .start = 0x00000000,
73 .size = 0x00000000
74 },
75 },
76
Luciano Coelho25a43d72011-11-21 20:37:14 +020077 [PART_WORK] = {
78 .mem = {
79 .start = 0x00040000,
80 .size = 0x00014fc0
81 },
82 .reg = {
83 .start = REGISTERS_BASE,
84 .size = 0x0000a000
85 },
86 .mem2 = {
87 .start = 0x003004f8,
88 .size = 0x00000004
89 },
90 .mem3 = {
91 .start = 0x00040404,
92 .size = 0x00000000
93 },
94 },
95
96 [PART_DRPW] = {
97 .mem = {
98 .start = 0x00040000,
99 .size = 0x00014fc0
100 },
101 .reg = {
102 .start = DRPW_BASE,
103 .size = 0x00006000
104 },
105 .mem2 = {
106 .start = 0x00000000,
107 .size = 0x00000000
108 },
109 .mem3 = {
110 .start = 0x00000000,
111 .size = 0x00000000
112 }
113 }
114};
115
Luciano Coelho00782132011-11-29 13:38:37 +0200116static const int wl12xx_rtable[REG_TABLE_LEN] = {
117 [REG_ECPU_CONTROL] = WL12XX_REG_ECPU_CONTROL,
118 [REG_INTERRUPT_NO_CLEAR] = WL12XX_REG_INTERRUPT_NO_CLEAR,
119 [REG_INTERRUPT_ACK] = WL12XX_REG_INTERRUPT_ACK,
120 [REG_COMMAND_MAILBOX_PTR] = WL12XX_REG_COMMAND_MAILBOX_PTR,
121 [REG_EVENT_MAILBOX_PTR] = WL12XX_REG_EVENT_MAILBOX_PTR,
122 [REG_INTERRUPT_TRIG] = WL12XX_REG_INTERRUPT_TRIG,
123 [REG_INTERRUPT_MASK] = WL12XX_REG_INTERRUPT_MASK,
124 [REG_PC_ON_RECOVERY] = WL12XX_SCR_PAD4,
125 [REG_CHIP_ID_B] = WL12XX_CHIP_ID_B,
126 [REG_CMD_MBOX_ADDRESS] = WL12XX_CMD_MBOX_ADDRESS,
127
128 /* data access memory addresses, used with partition translation */
129 [REG_SLV_MEM_DATA] = WL1271_SLV_MEM_DATA,
130 [REG_SLV_REG_DATA] = WL1271_SLV_REG_DATA,
131
132 /* raw data access memory addresses */
133 [REG_RAW_FW_STATUS_ADDR] = FW_STATUS_ADDR,
134};
135
Luciano Coelho6f7dd162011-11-29 16:27:31 +0200136/* TODO: maybe move to a new header file? */
137#define WL127X_FW_NAME_MULTI "ti-connectivity/wl127x-fw-4-mr.bin"
138#define WL127X_FW_NAME_SINGLE "ti-connectivity/wl127x-fw-4-sr.bin"
139#define WL127X_PLT_FW_NAME "ti-connectivity/wl127x-fw-4-plt.bin"
140
141#define WL128X_FW_NAME_MULTI "ti-connectivity/wl128x-fw-4-mr.bin"
142#define WL128X_FW_NAME_SINGLE "ti-connectivity/wl128x-fw-4-sr.bin"
143#define WL128X_PLT_FW_NAME "ti-connectivity/wl128x-fw-4-plt.bin"
144
145static int wl12xx_identify_chip(struct wl1271 *wl)
146{
147 int ret = 0;
148
149 switch (wl->chip.id) {
150 case CHIP_ID_1271_PG10:
151 wl1271_warning("chip id 0x%x (1271 PG10) support is obsolete",
152 wl->chip.id);
153
154 wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT;
155 wl->plt_fw_name = WL127X_PLT_FW_NAME;
156 wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
157 wl->mr_fw_name = WL127X_FW_NAME_MULTI;
158 break;
159
160 case CHIP_ID_1271_PG20:
161 wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1271 PG20)",
162 wl->chip.id);
163
164 wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT;
165 wl->plt_fw_name = WL127X_PLT_FW_NAME;
166 wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
167 wl->mr_fw_name = WL127X_FW_NAME_MULTI;
168 break;
169
170 case CHIP_ID_1283_PG20:
171 wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1283 PG20)",
172 wl->chip.id);
173 wl->plt_fw_name = WL128X_PLT_FW_NAME;
174 wl->sr_fw_name = WL128X_FW_NAME_SINGLE;
175 wl->mr_fw_name = WL128X_FW_NAME_MULTI;
176 break;
177 case CHIP_ID_1283_PG10:
178 default:
179 wl1271_warning("unsupported chip id: 0x%x", wl->chip.id);
180 ret = -ENODEV;
181 goto out;
182 }
183
184out:
185 return ret;
186}
187
Luciano Coelhodd5512e2012-04-11 11:03:14 +0300188static void wl12xx_top_reg_write(struct wl1271 *wl, int addr, u16 val)
189{
190 /* write address >> 1 + 0x30000 to OCP_POR_CTR */
191 addr = (addr >> 1) + 0x30000;
192 wl1271_write32(wl, WL12XX_OCP_POR_CTR, addr);
193
194 /* write value to OCP_POR_WDATA */
195 wl1271_write32(wl, WL12XX_OCP_DATA_WRITE, val);
196
197 /* write 1 to OCP_CMD */
198 wl1271_write32(wl, WL12XX_OCP_CMD, OCP_CMD_WRITE);
199}
200
201static u16 wl12xx_top_reg_read(struct wl1271 *wl, int addr)
202{
203 u32 val;
204 int timeout = OCP_CMD_LOOP;
205
206 /* write address >> 1 + 0x30000 to OCP_POR_CTR */
207 addr = (addr >> 1) + 0x30000;
208 wl1271_write32(wl, WL12XX_OCP_POR_CTR, addr);
209
210 /* write 2 to OCP_CMD */
211 wl1271_write32(wl, WL12XX_OCP_CMD, OCP_CMD_READ);
212
213 /* poll for data ready */
214 do {
215 val = wl1271_read32(wl, WL12XX_OCP_DATA_READ);
216 } while (!(val & OCP_READY_MASK) && --timeout);
217
218 if (!timeout) {
219 wl1271_warning("Top register access timed out.");
220 return 0xffff;
221 }
222
223 /* check data status and return if OK */
224 if ((val & OCP_STATUS_MASK) == OCP_STATUS_OK)
225 return val & 0xffff;
226 else {
227 wl1271_warning("Top register access returned error.");
228 return 0xffff;
229 }
230}
231
232static int wl128x_switch_tcxo_to_fref(struct wl1271 *wl)
233{
234 u16 spare_reg;
235
236 /* Mask bits [2] & [8:4] in the sys_clk_cfg register */
237 spare_reg = wl12xx_top_reg_read(wl, WL_SPARE_REG);
238 if (spare_reg == 0xFFFF)
239 return -EFAULT;
240 spare_reg |= (BIT(3) | BIT(5) | BIT(6));
241 wl12xx_top_reg_write(wl, WL_SPARE_REG, spare_reg);
242
243 /* Enable FREF_CLK_REQ & mux MCS and coex PLLs to FREF */
244 wl12xx_top_reg_write(wl, SYS_CLK_CFG_REG,
245 WL_CLK_REQ_TYPE_PG2 | MCS_PLL_CLK_SEL_FREF);
246
247 /* Delay execution for 15msec, to let the HW settle */
248 mdelay(15);
249
250 return 0;
251}
252
253static bool wl128x_is_tcxo_valid(struct wl1271 *wl)
254{
255 u16 tcxo_detection;
256
257 tcxo_detection = wl12xx_top_reg_read(wl, TCXO_CLK_DETECT_REG);
258 if (tcxo_detection & TCXO_DET_FAILED)
259 return false;
260
261 return true;
262}
263
264static bool wl128x_is_fref_valid(struct wl1271 *wl)
265{
266 u16 fref_detection;
267
268 fref_detection = wl12xx_top_reg_read(wl, FREF_CLK_DETECT_REG);
269 if (fref_detection & FREF_CLK_DETECT_FAIL)
270 return false;
271
272 return true;
273}
274
275static int wl128x_manually_configure_mcs_pll(struct wl1271 *wl)
276{
277 wl12xx_top_reg_write(wl, MCS_PLL_M_REG, MCS_PLL_M_REG_VAL);
278 wl12xx_top_reg_write(wl, MCS_PLL_N_REG, MCS_PLL_N_REG_VAL);
279 wl12xx_top_reg_write(wl, MCS_PLL_CONFIG_REG, MCS_PLL_CONFIG_REG_VAL);
280
281 return 0;
282}
283
284static int wl128x_configure_mcs_pll(struct wl1271 *wl, int clk)
285{
286 u16 spare_reg;
287 u16 pll_config;
288 u8 input_freq;
289
290 /* Mask bits [3:1] in the sys_clk_cfg register */
291 spare_reg = wl12xx_top_reg_read(wl, WL_SPARE_REG);
292 if (spare_reg == 0xFFFF)
293 return -EFAULT;
294 spare_reg |= BIT(2);
295 wl12xx_top_reg_write(wl, WL_SPARE_REG, spare_reg);
296
297 /* Handle special cases of the TCXO clock */
298 if (wl->tcxo_clock == WL12XX_TCXOCLOCK_16_8 ||
299 wl->tcxo_clock == WL12XX_TCXOCLOCK_33_6)
300 return wl128x_manually_configure_mcs_pll(wl);
301
302 /* Set the input frequency according to the selected clock source */
303 input_freq = (clk & 1) + 1;
304
305 pll_config = wl12xx_top_reg_read(wl, MCS_PLL_CONFIG_REG);
306 if (pll_config == 0xFFFF)
307 return -EFAULT;
308 pll_config |= (input_freq << MCS_SEL_IN_FREQ_SHIFT);
309 pll_config |= MCS_PLL_ENABLE_HP;
310 wl12xx_top_reg_write(wl, MCS_PLL_CONFIG_REG, pll_config);
311
312 return 0;
313}
314
315/*
316 * WL128x has two clocks input - TCXO and FREF.
317 * TCXO is the main clock of the device, while FREF is used to sync
318 * between the GPS and the cellular modem.
319 * In cases where TCXO is 32.736MHz or 16.368MHz, the FREF will be used
320 * as the WLAN/BT main clock.
321 */
322static int wl128x_boot_clk(struct wl1271 *wl, int *selected_clock)
323{
324 u16 sys_clk_cfg;
325
326 /* For XTAL-only modes, FREF will be used after switching from TCXO */
327 if (wl->ref_clock == WL12XX_REFCLOCK_26_XTAL ||
328 wl->ref_clock == WL12XX_REFCLOCK_38_XTAL) {
329 if (!wl128x_switch_tcxo_to_fref(wl))
330 return -EINVAL;
331 goto fref_clk;
332 }
333
334 /* Query the HW, to determine which clock source we should use */
335 sys_clk_cfg = wl12xx_top_reg_read(wl, SYS_CLK_CFG_REG);
336 if (sys_clk_cfg == 0xFFFF)
337 return -EINVAL;
338 if (sys_clk_cfg & PRCM_CM_EN_MUX_WLAN_FREF)
339 goto fref_clk;
340
341 /* If TCXO is either 32.736MHz or 16.368MHz, switch to FREF */
342 if (wl->tcxo_clock == WL12XX_TCXOCLOCK_16_368 ||
343 wl->tcxo_clock == WL12XX_TCXOCLOCK_32_736) {
344 if (!wl128x_switch_tcxo_to_fref(wl))
345 return -EINVAL;
346 goto fref_clk;
347 }
348
349 /* TCXO clock is selected */
350 if (!wl128x_is_tcxo_valid(wl))
351 return -EINVAL;
352 *selected_clock = wl->tcxo_clock;
353 goto config_mcs_pll;
354
355fref_clk:
356 /* FREF clock is selected */
357 if (!wl128x_is_fref_valid(wl))
358 return -EINVAL;
359 *selected_clock = wl->ref_clock;
360
361config_mcs_pll:
362 return wl128x_configure_mcs_pll(wl, *selected_clock);
363}
364
365static int wl127x_boot_clk(struct wl1271 *wl)
366{
367 u32 pause;
368 u32 clk;
369
370 if (WL127X_PG_GET_MAJOR(wl->hw_pg_ver) < 3)
371 wl->quirks |= WLCORE_QUIRK_END_OF_TRANSACTION;
372
373 if (wl->ref_clock == CONF_REF_CLK_19_2_E ||
374 wl->ref_clock == CONF_REF_CLK_38_4_E ||
375 wl->ref_clock == CONF_REF_CLK_38_4_M_XTAL)
376 /* ref clk: 19.2/38.4/38.4-XTAL */
377 clk = 0x3;
378 else if (wl->ref_clock == CONF_REF_CLK_26_E ||
379 wl->ref_clock == CONF_REF_CLK_52_E)
380 /* ref clk: 26/52 */
381 clk = 0x5;
382 else
383 return -EINVAL;
384
385 if (wl->ref_clock != CONF_REF_CLK_19_2_E) {
386 u16 val;
387 /* Set clock type (open drain) */
388 val = wl12xx_top_reg_read(wl, OCP_REG_CLK_TYPE);
389 val &= FREF_CLK_TYPE_BITS;
390 wl12xx_top_reg_write(wl, OCP_REG_CLK_TYPE, val);
391
392 /* Set clock pull mode (no pull) */
393 val = wl12xx_top_reg_read(wl, OCP_REG_CLK_PULL);
394 val |= NO_PULL;
395 wl12xx_top_reg_write(wl, OCP_REG_CLK_PULL, val);
396 } else {
397 u16 val;
398 /* Set clock polarity */
399 val = wl12xx_top_reg_read(wl, OCP_REG_CLK_POLARITY);
400 val &= FREF_CLK_POLARITY_BITS;
401 val |= CLK_REQ_OUTN_SEL;
402 wl12xx_top_reg_write(wl, OCP_REG_CLK_POLARITY, val);
403 }
404
405 wl1271_write32(wl, WL12XX_PLL_PARAMETERS, clk);
406
407 pause = wl1271_read32(wl, WL12XX_PLL_PARAMETERS);
408
409 wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause);
410
411 pause &= ~(WU_COUNTER_PAUSE_VAL);
412 pause |= WU_COUNTER_PAUSE_VAL;
413 wl1271_write32(wl, WL12XX_WU_COUNTER_PAUSE, pause);
414
415 return 0;
416}
417
418static int wl1271_boot_soft_reset(struct wl1271 *wl)
419{
420 unsigned long timeout;
421 u32 boot_data;
422
423 /* perform soft reset */
424 wl1271_write32(wl, WL12XX_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT);
425
426 /* SOFT_RESET is self clearing */
427 timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME);
428 while (1) {
429 boot_data = wl1271_read32(wl, WL12XX_SLV_SOFT_RESET);
430 wl1271_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data);
431 if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0)
432 break;
433
434 if (time_after(jiffies, timeout)) {
435 /* 1.2 check pWhalBus->uSelfClearTime if the
436 * timeout was reached */
437 wl1271_error("soft reset timeout");
438 return -1;
439 }
440
441 udelay(SOFT_RESET_STALL_TIME);
442 }
443
444 /* disable Rx/Tx */
445 wl1271_write32(wl, WL12XX_ENABLE, 0x0);
446
447 /* disable auto calibration on start*/
448 wl1271_write32(wl, WL12XX_SPARE_A2, 0xffff);
449
450 return 0;
451}
452
453static int wl12xx_pre_boot(struct wl1271 *wl)
454{
455 int ret = 0;
456 u32 clk;
457 int selected_clock = -1;
458
459 if (wl->chip.id == CHIP_ID_1283_PG20) {
460 ret = wl128x_boot_clk(wl, &selected_clock);
461 if (ret < 0)
462 goto out;
463 } else {
464 ret = wl127x_boot_clk(wl);
465 if (ret < 0)
466 goto out;
467 }
468
469 /* Continue the ELP wake up sequence */
470 wl1271_write32(wl, WL12XX_WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL);
471 udelay(500);
472
473 wlcore_set_partition(wl, &wl->ptable[PART_DRPW]);
474
475 /* Read-modify-write DRPW_SCRATCH_START register (see next state)
476 to be used by DRPw FW. The RTRIM value will be added by the FW
477 before taking DRPw out of reset */
478
479 clk = wl1271_read32(wl, WL12XX_DRPW_SCRATCH_START);
480
481 wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk);
482
483 if (wl->chip.id == CHIP_ID_1283_PG20)
484 clk |= ((selected_clock & 0x3) << 1) << 4;
485 else
486 clk |= (wl->ref_clock << 1) << 4;
487
488 wl1271_write32(wl, WL12XX_DRPW_SCRATCH_START, clk);
489
490 wlcore_set_partition(wl, &wl->ptable[PART_WORK]);
491
492 /* Disable interrupts */
493 wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL);
494
495 ret = wl1271_boot_soft_reset(wl);
496 if (ret < 0)
497 goto out;
498
499out:
500 return ret;
501}
502
503static void wl12xx_pre_upload(struct wl1271 *wl)
504{
505 u32 tmp;
506
507 /* write firmware's last address (ie. it's length) to
508 * ACX_EEPROMLESS_IND_REG */
509 wl1271_debug(DEBUG_BOOT, "ACX_EEPROMLESS_IND_REG");
510
511 wl1271_write32(wl, WL12XX_EEPROMLESS_IND, WL12XX_EEPROMLESS_IND);
512
513 tmp = wlcore_read_reg(wl, REG_CHIP_ID_B);
514
515 wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp);
516
517 /* 6. read the EEPROM parameters */
518 tmp = wl1271_read32(wl, WL12XX_SCR_PAD2);
519
520 /* WL1271: The reference driver skips steps 7 to 10 (jumps directly
521 * to upload_fw) */
522
523 if (wl->chip.id == CHIP_ID_1283_PG20)
524 wl12xx_top_reg_write(wl, SDIO_IO_DS, HCI_IO_DS_6MA);
525}
526
527static void wl12xx_enable_interrupts(struct wl1271 *wl)
528{
529 u32 polarity;
530
531 polarity = wl12xx_top_reg_read(wl, OCP_REG_POLARITY);
532
533 /* We use HIGH polarity, so unset the LOW bit */
534 polarity &= ~POLARITY_LOW;
535 wl12xx_top_reg_write(wl, OCP_REG_POLARITY, polarity);
536
537 wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_ALL_EVENTS_VECTOR);
538
539 wlcore_enable_interrupts(wl);
540 wlcore_write_reg(wl, REG_INTERRUPT_MASK,
541 WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK));
542
543 wl1271_write32(wl, WL12XX_HI_CFG, HI_CFG_DEF_VAL);
544}
545
546static int wl12xx_boot(struct wl1271 *wl)
547{
548 int ret;
549
550 ret = wl12xx_pre_boot(wl);
551 if (ret < 0)
552 goto out;
553
554 ret = wlcore_boot_upload_nvs(wl);
555 if (ret < 0)
556 goto out;
557
558 wl12xx_pre_upload(wl);
559
560 ret = wlcore_boot_upload_firmware(wl);
561 if (ret < 0)
562 goto out;
563
564 ret = wlcore_boot_run_firmware(wl);
565 if (ret < 0)
566 goto out;
567
568 wl12xx_enable_interrupts(wl);
569
570out:
571 return ret;
572}
573
Luciano Coelho4ded91c2012-04-11 10:54:52 +0300574static s8 wl12xx_get_pg_ver(struct wl1271 *wl)
575{
576 u32 die_info;
577
578 if (wl->chip.id == CHIP_ID_1283_PG20)
Luciano Coelhodd5512e2012-04-11 11:03:14 +0300579 die_info = wl12xx_top_reg_read(wl, WL128X_REG_FUSE_DATA_2_1);
Luciano Coelho4ded91c2012-04-11 10:54:52 +0300580 else
Luciano Coelhodd5512e2012-04-11 11:03:14 +0300581 die_info = wl12xx_top_reg_read(wl, WL127X_REG_FUSE_DATA_2_1);
Luciano Coelho4ded91c2012-04-11 10:54:52 +0300582
583 return (s8) (die_info & PG_VER_MASK) >> PG_VER_OFFSET;
584}
585
Luciano Coelho6f7dd162011-11-29 16:27:31 +0200586static struct wlcore_ops wl12xx_ops = {
Luciano Coelhodd5512e2012-04-11 11:03:14 +0300587 .identify_chip = wl12xx_identify_chip,
588 .boot = wl12xx_boot,
589 .get_pg_ver = wl12xx_get_pg_ver,
Luciano Coelho6f7dd162011-11-29 16:27:31 +0200590};
591
Luciano Coelhoffeb5012011-11-21 18:55:51 +0200592static int __devinit wl12xx_probe(struct platform_device *pdev)
593{
594 struct wl1271 *wl;
595 struct ieee80211_hw *hw;
596
597 hw = wlcore_alloc_hw();
598 if (IS_ERR(hw)) {
599 wl1271_error("can't allocate hw");
600 return PTR_ERR(hw);
601 }
602
603 wl = hw->priv;
Luciano Coelhoc31be252011-11-21 19:25:24 +0200604 wl->ops = &wl12xx_ops;
Luciano Coelho25a43d72011-11-21 20:37:14 +0200605 wl->ptable = wl12xx_ptable;
Luciano Coelho00782132011-11-29 13:38:37 +0200606 wl->rtable = wl12xx_rtable;
Luciano Coelhoffeb5012011-11-21 18:55:51 +0200607
608 return wlcore_probe(wl, pdev);
609}
Luciano Coelhob2ba99f2011-11-20 23:32:10 +0200610
611static const struct platform_device_id wl12xx_id_table[] __devinitconst = {
612 { "wl12xx", 0 },
613 { } /* Terminating Entry */
614};
615MODULE_DEVICE_TABLE(platform, wl12xx_id_table);
616
617static struct platform_driver wl12xx_driver = {
Luciano Coelhoffeb5012011-11-21 18:55:51 +0200618 .probe = wl12xx_probe,
Luciano Coelhob2ba99f2011-11-20 23:32:10 +0200619 .remove = __devexit_p(wlcore_remove),
620 .id_table = wl12xx_id_table,
621 .driver = {
622 .name = "wl12xx_driver",
623 .owner = THIS_MODULE,
624 }
625};
626
627static int __init wl12xx_init(void)
628{
629 return platform_driver_register(&wl12xx_driver);
630}
631module_init(wl12xx_init);
632
633static void __exit wl12xx_exit(void)
634{
635 platform_driver_unregister(&wl12xx_driver);
636}
637module_exit(wl12xx_exit);
638
639MODULE_LICENSE("GPL v2");
640MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
Luciano Coelho6f7dd162011-11-29 16:27:31 +0200641MODULE_FIRMWARE(WL127X_FW_NAME_SINGLE);
642MODULE_FIRMWARE(WL127X_FW_NAME_MULTI);
643MODULE_FIRMWARE(WL127X_PLT_FW_NAME);
644MODULE_FIRMWARE(WL128X_FW_NAME_SINGLE);
645MODULE_FIRMWARE(WL128X_FW_NAME_MULTI);
646MODULE_FIRMWARE(WL128X_PLT_FW_NAME);