aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/if_cs.c
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2008-06-05 07:07:04 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-14 12:18:03 -0400
commit5314325692239a977a58fc796b4f4fb783643012 (patch)
treef0c97d148170ce9caad9f5b1635a6d5a49921a0d /drivers/net/wireless/libertas/if_cs.c
parent3073556171f1cf2044ff38c1fc3b9f6c805f0873 (diff)
libertas: document register meanings
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/if_cs.c')
-rw-r--r--drivers/net/wireless/libertas/if_cs.c89
1 files changed, 80 insertions, 9 deletions
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index b5d0cd4c411a..6870276259e9 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -159,7 +159,9 @@ static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 r
159 159
160 160
161 161
162/* First the bitmasks for the host/card interrupt/status registers: */ 162/*
163 * First the bitmasks for the host/card interrupt/status registers:
164 */
163#define IF_CS_BIT_TX 0x0001 165#define IF_CS_BIT_TX 0x0001
164#define IF_CS_BIT_RX 0x0002 166#define IF_CS_BIT_RX 0x0002
165#define IF_CS_BIT_COMMAND 0x0004 167#define IF_CS_BIT_COMMAND 0x0004
@@ -167,35 +169,104 @@ static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 r
167#define IF_CS_BIT_EVENT 0x0010 169#define IF_CS_BIT_EVENT 0x0010
168#define IF_CS_BIT_MASK 0x001f 170#define IF_CS_BIT_MASK 0x001f
169 171
170/* And now the individual registers and assorted masks */ 172
173
174/*
175 * It's not really clear to me what the host status register is for. It
176 * needs to be set almost in union with "host int cause". The following
177 * bits from above are used:
178 *
179 * IF_CS_BIT_TX driver downloaded a data packet
180 * IF_CS_BIT_RX driver got a data packet
181 * IF_CS_BIT_COMMAND driver downloaded a command
182 * IF_CS_BIT_RESP not used (has some meaning with powerdown)
183 * IF_CS_BIT_EVENT driver read a host event
184 */
171#define IF_CS_HOST_STATUS 0x00000000 185#define IF_CS_HOST_STATUS 0x00000000
172 186
187/*
188 * With the host int cause register can the host (that is, Linux) cause
189 * an interrupt in the firmware, to tell the firmware about those events:
190 *
191 * IF_CS_BIT_TX a data packet has been downloaded
192 * IF_CS_BIT_RX a received data packet has retrieved
193 * IF_CS_BIT_COMMAND a firmware block or a command has been downloaded
194 * IF_CS_BIT_RESP not used (has some meaning with powerdown)
195 * IF_CS_BIT_EVENT a host event (link lost etc) has been retrieved
196 */
173#define IF_CS_HOST_INT_CAUSE 0x00000002 197#define IF_CS_HOST_INT_CAUSE 0x00000002
174 198
199/*
200 * The host int mask register is used to enable/disable interrupt. However,
201 * I have the suspicion that disabled interrupts are lost.
202 */
175#define IF_CS_HOST_INT_MASK 0x00000004 203#define IF_CS_HOST_INT_MASK 0x00000004
176 204
205/*
206 * Used to send or receive data packets:
207 */
177#define IF_CS_HOST_WRITE 0x00000016 208#define IF_CS_HOST_WRITE 0x00000016
178#define IF_CS_HOST_WRITE_LEN 0x00000014 209#define IF_CS_HOST_WRITE_LEN 0x00000014
179
180#define IF_CS_HOST_CMD 0x0000001A
181#define IF_CS_HOST_CMD_LEN 0x00000018
182
183#define IF_CS_READ 0x00000010 210#define IF_CS_READ 0x00000010
184#define IF_CS_READ_LEN 0x00000024 211#define IF_CS_READ_LEN 0x00000024
185 212
213/*
214 * Used to send commands (and to send firmware block) and to
215 * receive command responses:
216 */
217#define IF_CS_HOST_CMD 0x0000001A
218#define IF_CS_HOST_CMD_LEN 0x00000018
186#define IF_CS_CARD_CMD 0x00000012 219#define IF_CS_CARD_CMD 0x00000012
187#define IF_CS_CARD_CMD_LEN 0x00000030 220#define IF_CS_CARD_CMD_LEN 0x00000030
188 221
222/*
223 * The card status registers shows what the card/firmware actually
224 * accepts:
225 *
226 * IF_CS_BIT_TX you may send a data packet
227 * IF_CS_BIT_RX you may retrieve a data packet
228 * IF_CS_BIT_COMMAND you may send a command
229 * IF_CS_BIT_RESP you may retrieve a command response
230 * IF_CS_BIT_EVENT the card has a event for use (link lost, snr low etc)
231 *
232 * When reading this register several times, you will get back the same
233 * results --- with one exception: the IF_CS_BIT_EVENT clear itself
234 * automatically.
235 *
236 * Not that we don't rely on BIT_RX,_BIT_RESP or BIT_EVENT because
237 * we handle this via the card int cause register.
238 */
189#define IF_CS_CARD_STATUS 0x00000020 239#define IF_CS_CARD_STATUS 0x00000020
190#define IF_CS_CARD_STATUS_MASK 0x7f00 240#define IF_CS_CARD_STATUS_MASK 0x7f00
191 241
242/*
243 * The card int cause register is used by the card/firmware to notify us
244 * about the following events:
245 *
246 * IF_CS_BIT_TX a data packet has successfully been sentx
247 * IF_CS_BIT_RX a data packet has been received and can be retrieved
248 * IF_CS_BIT_COMMAND not used
249 * IF_CS_BIT_RESP the firmware has a command response for us
250 * IF_CS_BIT_EVENT the card has a event for use (link lost, snr low etc)
251 */
192#define IF_CS_CARD_INT_CAUSE 0x00000022 252#define IF_CS_CARD_INT_CAUSE 0x00000022
193 253
254/*
255 * This is used to for handshaking with the card's bootloader/helper image
256 * to synchronize downloading of firmware blocks.
257 */
194#define IF_CS_CARD_SQ_READ_LOW 0x00000028 258#define IF_CS_CARD_SQ_READ_LOW 0x00000028
195#define IF_CS_CARD_SQ_HELPER_OK 0x10 259#define IF_CS_CARD_SQ_HELPER_OK 0x10
196 260
261/*
262 * The scratch register tells us ...
263 *
264 * IF_CS_SCRATCH_BOOT_OK the bootloader runs
265 * IF_CS_SCRATCH_HELPER_OK the helper firmware already runs
266 */
197#define IF_CS_SCRATCH 0x0000003F 267#define IF_CS_SCRATCH 0x0000003F
198 268#define IF_CS_SCRATCH_BOOT_OK 0x00
269#define IF_CS_SCRATCH_HELPER_OK 0x5a
199 270
200 271
201/********************************************************************/ 272/********************************************************************/
@@ -465,11 +536,11 @@ static int if_cs_prog_helper(struct if_cs_card *card)
465 /* "If the value is 0x5a, the firmware is already 536 /* "If the value is 0x5a, the firmware is already
466 * downloaded successfully" 537 * downloaded successfully"
467 */ 538 */
468 if (scratch == 0x5a) 539 if (scratch == IF_CS_SCRATCH_HELPER_OK)
469 goto done; 540 goto done;
470 541
471 /* "If the value is != 00, it is invalid value of register */ 542 /* "If the value is != 00, it is invalid value of register */
472 if (scratch != 0x00) { 543 if (scratch != IF_CS_SCRATCH_BOOT_OK) {
473 ret = -ENODEV; 544 ret = -ENODEV;
474 goto done; 545 goto done;
475 } 546 }