diff options
author | Luciano Coelho <coelho@ti.com> | 2012-04-11 03:15:46 -0400 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2012-04-12 01:43:57 -0400 |
commit | f16ff75872b04fa6c779367ae24146c8a1729f2e (patch) | |
tree | 05e21d99615ee1312ce91edecc7c47b575398959 | |
parent | 30d9b4a58bc168620eed0fc6d90b2f05cd02a462 (diff) |
wlcore/wl12xx: add command trigger and event ack operations
Different chips may use different bits in the interrupt trigger
register. Add operations to handle these differences.
Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/main.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/reg.h | 16 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/cmd.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/event.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/wlcore.h | 18 |
5 files changed, 40 insertions, 19 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c index cef2884b37c8..8d82203d3da8 100644 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ b/drivers/net/wireless/ti/wl12xx/main.c | |||
@@ -571,6 +571,16 @@ out: | |||
571 | return ret; | 571 | return ret; |
572 | } | 572 | } |
573 | 573 | ||
574 | static void wl12xx_trigger_cmd(struct wl1271 *wl) | ||
575 | { | ||
576 | wlcore_write_reg(wl, REG_INTERRUPT_TRIG, WL12XX_INTR_TRIG_CMD); | ||
577 | } | ||
578 | |||
579 | static void wl12xx_ack_event(struct wl1271 *wl) | ||
580 | { | ||
581 | wlcore_write_reg(wl, REG_INTERRUPT_TRIG, WL12XX_INTR_TRIG_EVENT_ACK); | ||
582 | } | ||
583 | |||
574 | static bool wl12xx_mac_in_fuse(struct wl1271 *wl) | 584 | static bool wl12xx_mac_in_fuse(struct wl1271 *wl) |
575 | { | 585 | { |
576 | bool supported = false; | 586 | bool supported = false; |
@@ -637,6 +647,8 @@ static void wl12xx_get_mac(struct wl1271 *wl) | |||
637 | static struct wlcore_ops wl12xx_ops = { | 647 | static struct wlcore_ops wl12xx_ops = { |
638 | .identify_chip = wl12xx_identify_chip, | 648 | .identify_chip = wl12xx_identify_chip, |
639 | .boot = wl12xx_boot, | 649 | .boot = wl12xx_boot, |
650 | .trigger_cmd = wl12xx_trigger_cmd, | ||
651 | .ack_event = wl12xx_ack_event, | ||
640 | .get_pg_ver = wl12xx_get_pg_ver, | 652 | .get_pg_ver = wl12xx_get_pg_ver, |
641 | .get_mac = wl12xx_get_mac, | 653 | .get_mac = wl12xx_get_mac, |
642 | }; | 654 | }; |
diff --git a/drivers/net/wireless/ti/wl12xx/reg.h b/drivers/net/wireless/ti/wl12xx/reg.h index 003041bdb5f7..79ede02e2587 100644 --- a/drivers/net/wireless/ti/wl12xx/reg.h +++ b/drivers/net/wireless/ti/wl12xx/reg.h | |||
@@ -490,6 +490,22 @@ enum { | |||
490 | 490 | ||
491 | /* end PLL configuration algorithm for wl128x */ | 491 | /* end PLL configuration algorithm for wl128x */ |
492 | 492 | ||
493 | /* | ||
494 | * Host Command Interrupt. Setting this bit masks | ||
495 | * the interrupt that the host issues to inform | ||
496 | * the FW that it has sent a command | ||
497 | * to the Wlan hardware Command Mailbox. | ||
498 | */ | ||
499 | #define WL12XX_INTR_TRIG_CMD BIT(0) | ||
500 | |||
501 | /* | ||
502 | * Host Event Acknowlegde Interrupt. The host | ||
503 | * sets this bit to acknowledge that it received | ||
504 | * the unsolicited information from the event | ||
505 | * mailbox. | ||
506 | */ | ||
507 | #define WL12XX_INTR_TRIG_EVENT_ACK BIT(1) | ||
508 | |||
493 | /*=============================================== | 509 | /*=============================================== |
494 | HI_CFG Interface Configuration Register Values | 510 | HI_CFG Interface Configuration Register Values |
495 | ------------------------------------------ | 511 | ------------------------------------------ |
diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c index 3ec86e96f5c7..e80f674e77cc 100644 --- a/drivers/net/wireless/ti/wlcore/cmd.c +++ b/drivers/net/wireless/ti/wlcore/cmd.c | |||
@@ -66,7 +66,11 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, | |||
66 | 66 | ||
67 | wl1271_write(wl, wl->cmd_box_addr, buf, len, false); | 67 | wl1271_write(wl, wl->cmd_box_addr, buf, len, false); |
68 | 68 | ||
69 | wlcore_write_reg(wl, REG_INTERRUPT_TRIG, INTR_TRIG_CMD); | 69 | /* |
70 | * TODO: we just need this because one bit is in a different | ||
71 | * place. Is there any better way? | ||
72 | */ | ||
73 | wl->ops->trigger_cmd(wl); | ||
70 | 74 | ||
71 | timeout = jiffies + msecs_to_jiffies(WL1271_COMMAND_TIMEOUT); | 75 | timeout = jiffies + msecs_to_jiffies(WL1271_COMMAND_TIMEOUT); |
72 | 76 | ||
diff --git a/drivers/net/wireless/ti/wlcore/event.c b/drivers/net/wireless/ti/wlcore/event.c index 078cb012fcca..e3f572cbdf9a 100644 --- a/drivers/net/wireless/ti/wlcore/event.c +++ b/drivers/net/wireless/ti/wlcore/event.c | |||
@@ -305,8 +305,11 @@ int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num) | |||
305 | if (ret < 0) | 305 | if (ret < 0) |
306 | return ret; | 306 | return ret; |
307 | 307 | ||
308 | /* then we let the firmware know it can go on...*/ | 308 | /* |
309 | wlcore_write_reg(wl, REG_INTERRUPT_TRIG, INTR_TRIG_EVENT_ACK); | 309 | * TODO: we just need this because one bit is in a different |
310 | * place. Is there any better way? | ||
311 | */ | ||
312 | wl->ops->ack_event(wl); | ||
310 | 313 | ||
311 | return 0; | 314 | return 0; |
312 | } | 315 | } |
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index 38d1ed2967c8..76c27dd93c20 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h | |||
@@ -30,6 +30,8 @@ | |||
30 | struct wlcore_ops { | 30 | struct wlcore_ops { |
31 | int (*identify_chip)(struct wl1271 *wl); | 31 | int (*identify_chip)(struct wl1271 *wl); |
32 | int (*boot)(struct wl1271 *wl); | 32 | int (*boot)(struct wl1271 *wl); |
33 | void (*trigger_cmd)(struct wl1271 *wl); | ||
34 | void (*ack_event)(struct wl1271 *wl); | ||
33 | s8 (*get_pg_ver)(struct wl1271 *wl); | 35 | s8 (*get_pg_ver)(struct wl1271 *wl); |
34 | void (*get_mac)(struct wl1271 *wl); | 36 | void (*get_mac)(struct wl1271 *wl); |
35 | }; | 37 | }; |
@@ -345,22 +347,6 @@ int wlcore_free_hw(struct wl1271 *wl); | |||
345 | /* Hardware to Embedded CPU Interrupts - first 32-bit register set */ | 347 | /* Hardware to Embedded CPU Interrupts - first 32-bit register set */ |
346 | 348 | ||
347 | /* | 349 | /* |
348 | * Host Command Interrupt. Setting this bit masks | ||
349 | * the interrupt that the host issues to inform | ||
350 | * the FW that it has sent a command | ||
351 | * to the Wlan hardware Command Mailbox. | ||
352 | */ | ||
353 | #define INTR_TRIG_CMD BIT(0) | ||
354 | |||
355 | /* | ||
356 | * Host Event Acknowlegde Interrupt. The host | ||
357 | * sets this bit to acknowledge that it received | ||
358 | * the unsolicited information from the event | ||
359 | * mailbox. | ||
360 | */ | ||
361 | #define INTR_TRIG_EVENT_ACK BIT(1) | ||
362 | |||
363 | /* | ||
364 | * The host sets this bit to inform the Wlan | 350 | * The host sets this bit to inform the Wlan |
365 | * FW that a TX packet is in the XFER | 351 | * FW that a TX packet is in the XFER |
366 | * Buffer #0. | 352 | * Buffer #0. |