Skip to content

Commit

Permalink
ath9k: add external_reset callback to ath9k_platfom_data for AR9330
Browse files Browse the repository at this point in the history
The patch adds a callback to ath9k_platform_data. If the
callback is provided by the platform code, then it can be
used to hard reset the WMAC device.

The callback is required for doing a hard reset of the AR9330
chips to get them working again after a hang.

Signed-off-by: Gabor Juhos <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
  • Loading branch information
juhosg authored and linvjw committed Jun 22, 2011
1 parent 4187afa commit 7d95847
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
35 changes: 35 additions & 0 deletions drivers/net/wireless/ath/ath9k/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,41 @@ static bool ath9k_hw_set_reset(struct ath_hw *ah, int type)
rst_flags |= AR_RTC_RC_MAC_COLD;
}

if (AR_SREV_9330(ah)) {
int npend = 0;
int i;

/* AR9330 WAR:
* call external reset function to reset WMAC if:
* - doing a cold reset
* - we have pending frames in the TX queues
*/

for (i = 0; i < AR_NUM_QCU; i++) {
npend = ath9k_hw_numtxpending(ah, i);
if (npend)
break;
}

if (ah->external_reset &&
(npend || type == ATH9K_RESET_COLD)) {
int reset_err = 0;

ath_dbg(ath9k_hw_common(ah), ATH_DBG_RESET,
"reset MAC via external reset\n");

reset_err = ah->external_reset();
if (reset_err) {
ath_err(ath9k_hw_common(ah),
"External reset failed, err=%d\n",
reset_err);
return false;
}

REG_WRITE(ah, AR_RTC_RESET, 1);
}
}

REG_WRITE(ah, AR_RTC_RC, rst_flags);

REGWRITE_BUFFER_FLUSH(ah);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ath9k/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ struct ath_hw {

bool is_clk_25mhz;
int (*get_mac_revision)(void);
int (*external_reset)(void);
};

struct ath_bus_ops {
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ath9k/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
sc->sc_ah->led_pin = pdata->led_pin;
ah->is_clk_25mhz = pdata->is_clk_25mhz;
ah->get_mac_revision = pdata->get_mac_revision;
ah->external_reset = pdata->external_reset;
}

common = ath9k_hw_common(ah);
Expand Down
1 change: 1 addition & 0 deletions include/linux/ath9k_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct ath9k_platform_data {

bool is_clk_25mhz;
int (*get_mac_revision)(void);
int (*external_reset)(void);
};

#endif /* _LINUX_ATH9K_PLATFORM_H */

0 comments on commit 7d95847

Please sign in to comment.