blob: ea8480c1fae71f69af416afc84aba0a7279b2081 [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 Coelhob2ba99f2011-11-20 23:32:10 +020027#include "../wlcore/wlcore.h"
Luciano Coelhoffeb5012011-11-21 18:55:51 +020028#include "../wlcore/debug.h"
29
Luciano Coelho00782132011-11-29 13:38:37 +020030#include "reg.h"
Luciano Coelho25a43d72011-11-21 20:37:14 +020031
Luciano Coelhoc31be252011-11-21 19:25:24 +020032static struct wlcore_ops wl12xx_ops = {
33};
34
Luciano Coelho25a43d72011-11-21 20:37:14 +020035static struct wlcore_partition_set wl12xx_ptable[PART_TABLE_LEN] = {
36 [PART_DOWN] = {
37 .mem = {
38 .start = 0x00000000,
39 .size = 0x000177c0
40 },
41 .reg = {
42 .start = REGISTERS_BASE,
43 .size = 0x00008800
44 },
45 .mem2 = {
46 .start = 0x00000000,
47 .size = 0x00000000
48 },
49 .mem3 = {
50 .start = 0x00000000,
51 .size = 0x00000000
52 },
53 },
54
Luciano Coelho00782132011-11-29 13:38:37 +020055 [PART_BOOT] = { /* in wl12xx we can use a mix of work and down
56 * partition here */
57 .mem = {
58 .start = 0x00040000,
59 .size = 0x00014fc0
60 },
61 .reg = {
62 .start = REGISTERS_BASE,
63 .size = 0x00008800
64 },
65 .mem2 = {
66 .start = 0x00000000,
67 .size = 0x00000000
68 },
69 .mem3 = {
70 .start = 0x00000000,
71 .size = 0x00000000
72 },
73 },
74
Luciano Coelho25a43d72011-11-21 20:37:14 +020075 [PART_WORK] = {
76 .mem = {
77 .start = 0x00040000,
78 .size = 0x00014fc0
79 },
80 .reg = {
81 .start = REGISTERS_BASE,
82 .size = 0x0000a000
83 },
84 .mem2 = {
85 .start = 0x003004f8,
86 .size = 0x00000004
87 },
88 .mem3 = {
89 .start = 0x00040404,
90 .size = 0x00000000
91 },
92 },
93
94 [PART_DRPW] = {
95 .mem = {
96 .start = 0x00040000,
97 .size = 0x00014fc0
98 },
99 .reg = {
100 .start = DRPW_BASE,
101 .size = 0x00006000
102 },
103 .mem2 = {
104 .start = 0x00000000,
105 .size = 0x00000000
106 },
107 .mem3 = {
108 .start = 0x00000000,
109 .size = 0x00000000
110 }
111 }
112};
113
Luciano Coelho00782132011-11-29 13:38:37 +0200114static const int wl12xx_rtable[REG_TABLE_LEN] = {
115 [REG_ECPU_CONTROL] = WL12XX_REG_ECPU_CONTROL,
116 [REG_INTERRUPT_NO_CLEAR] = WL12XX_REG_INTERRUPT_NO_CLEAR,
117 [REG_INTERRUPT_ACK] = WL12XX_REG_INTERRUPT_ACK,
118 [REG_COMMAND_MAILBOX_PTR] = WL12XX_REG_COMMAND_MAILBOX_PTR,
119 [REG_EVENT_MAILBOX_PTR] = WL12XX_REG_EVENT_MAILBOX_PTR,
120 [REG_INTERRUPT_TRIG] = WL12XX_REG_INTERRUPT_TRIG,
121 [REG_INTERRUPT_MASK] = WL12XX_REG_INTERRUPT_MASK,
122 [REG_PC_ON_RECOVERY] = WL12XX_SCR_PAD4,
123 [REG_CHIP_ID_B] = WL12XX_CHIP_ID_B,
124 [REG_CMD_MBOX_ADDRESS] = WL12XX_CMD_MBOX_ADDRESS,
125
126 /* data access memory addresses, used with partition translation */
127 [REG_SLV_MEM_DATA] = WL1271_SLV_MEM_DATA,
128 [REG_SLV_REG_DATA] = WL1271_SLV_REG_DATA,
129
130 /* raw data access memory addresses */
131 [REG_RAW_FW_STATUS_ADDR] = FW_STATUS_ADDR,
132};
133
Luciano Coelhoffeb5012011-11-21 18:55:51 +0200134static int __devinit wl12xx_probe(struct platform_device *pdev)
135{
136 struct wl1271 *wl;
137 struct ieee80211_hw *hw;
138
139 hw = wlcore_alloc_hw();
140 if (IS_ERR(hw)) {
141 wl1271_error("can't allocate hw");
142 return PTR_ERR(hw);
143 }
144
145 wl = hw->priv;
Luciano Coelhoc31be252011-11-21 19:25:24 +0200146 wl->ops = &wl12xx_ops;
Luciano Coelho25a43d72011-11-21 20:37:14 +0200147 wl->ptable = wl12xx_ptable;
Luciano Coelho00782132011-11-29 13:38:37 +0200148 wl->rtable = wl12xx_rtable;
Luciano Coelhoffeb5012011-11-21 18:55:51 +0200149
150 return wlcore_probe(wl, pdev);
151}
Luciano Coelhob2ba99f2011-11-20 23:32:10 +0200152
153static const struct platform_device_id wl12xx_id_table[] __devinitconst = {
154 { "wl12xx", 0 },
155 { } /* Terminating Entry */
156};
157MODULE_DEVICE_TABLE(platform, wl12xx_id_table);
158
159static struct platform_driver wl12xx_driver = {
Luciano Coelhoffeb5012011-11-21 18:55:51 +0200160 .probe = wl12xx_probe,
Luciano Coelhob2ba99f2011-11-20 23:32:10 +0200161 .remove = __devexit_p(wlcore_remove),
162 .id_table = wl12xx_id_table,
163 .driver = {
164 .name = "wl12xx_driver",
165 .owner = THIS_MODULE,
166 }
167};
168
169static int __init wl12xx_init(void)
170{
171 return platform_driver_register(&wl12xx_driver);
172}
173module_init(wl12xx_init);
174
175static void __exit wl12xx_exit(void)
176{
177 platform_driver_unregister(&wl12xx_driver);
178}
179module_exit(wl12xx_exit);
180
181MODULE_LICENSE("GPL v2");
182MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");