Skip to content

Commit 9b839a7

Browse files
Michael Bueschlinvjw
authored andcommitted
b43: Add simple firmware watchdog
This adds a simple firmware watchdog for the opensource firmware. This will check every 15 seconds, if the firmware zeroed out the watchdog register. The firmware will do this in its eventloop. Signed-off-by: Michael Buesch <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent 9ae705c commit 9b839a7

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

drivers/net/wireless/b43/b43.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ enum {
441441
#define B43_FWPANIC_DIE 0 /* Firmware died. Don't auto-restart it. */
442442
#define B43_FWPANIC_RESTART 1 /* Firmware died. Schedule a controller reset. */
443443

444+
/* The firmware register that contains the watchdog counter. */
445+
#define B43_WATCHDOG_REG 1
444446

445447
/* Device specific rate values.
446448
* The actual values defined here are (rate_in_mbps * 2).

drivers/net/wireless/b43/main.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,6 +2807,21 @@ static void b43_periodic_every30sec(struct b43_wldev *dev)
28072807
static void b43_periodic_every15sec(struct b43_wldev *dev)
28082808
{
28092809
struct b43_phy *phy = &dev->phy;
2810+
u16 wdr;
2811+
2812+
if (dev->fw.opensource) {
2813+
/* Check if the firmware is still alive.
2814+
* It will reset the watchdog counter to 0 in its idle loop. */
2815+
wdr = b43_shm_read16(dev, B43_SHM_SCRATCH, B43_WATCHDOG_REG);
2816+
if (unlikely(wdr)) {
2817+
b43err(dev->wl, "Firmware watchdog: The firmware died!\n");
2818+
b43_controller_restart(dev, "Firmware watchdog");
2819+
return;
2820+
} else {
2821+
b43_shm_write16(dev, B43_SHM_SCRATCH,
2822+
B43_WATCHDOG_REG, 1);
2823+
}
2824+
}
28102825

28112826
if (phy->type == B43_PHYTYPE_G) {
28122827
//TODO: update_aci_moving_average

0 commit comments

Comments
 (0)