diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h index 9308916..1e121a1 100644 --- a/drivers/net/wireless/ath5k/ath5k.h +++ b/drivers/net/wireless/ath5k/ath5k.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2004-2007 Reyk Floeter * Copyright (c) 2006-2007 Nick Kossifidis + * Copyright (c) 2007 Luis R. Rodriguez * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -1072,7 +1073,7 @@ extern unsigned int ath5k_hw_get_def_antenna(struct ath_hw *hal); extern int ath5k_hw_txpower(struct ath_hw *hal, struct ieee80211_channel *channel, unsigned int txpower); extern int ath5k_hw_set_txpower_limit(struct ath_hw *hal, unsigned int power); - +#ifdef __LITTLE_ENDIAN static inline u32 ath5k_hw_reg_read(struct ath_hw *hal, u16 reg) { return ioread32(hal->ah_sh + reg); @@ -1083,4 +1084,35 @@ static inline void ath5k_hw_reg_write(struct ath_hw *hal, u32 val, u16 reg) iowrite32(val, hal->ah_sh + reg); } +#else /* We're big endian */ + +/* + * Using as documenation: + * + * http://madwifi.org/browser/trunk/ath_hal/ah_os.h + * + * Atheros device registers are natively little endian. We handle + * big-endian hosts by byte-swapping reads and writes in the + * reset range registers. 0x4000 is the AR5K_RESET_CTL. Note + * then 0x4004 is AR5K_SLEEP_CTL, 0x4008 the AR5K_INTPEND which + * is the Interrupt pending register. Although ah_os.h went up to + * 0x5000 lets only go up 0x4009 for now.. + */ +static inline u32 ath5k_hw_reg_read(struct ath_hw *hal, u16 reg) +{ + if (0x4000 <= reg && reg < 0x4009) + return ioread32(hal->ah_sh + reg); + else + return ioread32be(hal->ah_sh + reg); +} + +static inline void ath5k_hw_reg_write(struct ath_hw *hal, u32 val, u16 reg) +{ + if (0x4000 <= reg && reg < 0x4009) + iowrite32(val, hal->ah_sh + reg); + else + iowrite32be(val, hal->ah_sh + (reg)); +} +#endif /* __LITTLE_ENDIAN */ + #endif diff --git a/drivers/net/wireless/ath5k/initvals.c b/drivers/net/wireless/ath5k/initvals.c index 11aeacc..1f96a86 100644 --- a/drivers/net/wireless/ath5k/initvals.c +++ b/drivers/net/wireless/ath5k/initvals.c @@ -710,6 +710,12 @@ static const struct ath5k_ini ar5212_ini[] = { { AR5K_PHY(657), 0x00007bb6 }, { AR5K_PHY(658), 0x0fff3ffc }, { AR5K_PHY_CCKTXCTL, 0x00000000 }, + { AR5K_BB_GAIN(0), 0x00000000 }, /* 0x9b00 */ + { AR5K_BB_GAIN(10), 0x0000000c }, /* 0x9b28 */ + { AR5K_BB_GAIN(14), 0x00000012 }, /* 0x9b38 */ + { AR5K_BB_GAIN(25), 0x00000021 }, /* 0x9b64 */ + { AR5K_BB_GAIN(35), 0x0000002d }, /* 0x9b8c */ + { AR5K_BB_GAIN(39), 0x00000033 }, /* 0x9b9c */ }; /* Initial mode-specific settings for AR5212 */ @@ -747,6 +753,34 @@ static const struct ath5k_ini_mode ar5212_ini_mode[] = { { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000b0e0, 0x00014068 } }, { AR5K_TIME_OUT, { 0x03e803e8, 0x06e006e0, 0x04200420, 0x08400840, 0x06e006e0 } }, + { 0x9804, + { 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000003 } }, + { 0x9820, + { 0x02020200, 0x02020200, 0x02010200, 0x02020200, 0x02020200 } }, + { 0x9834, + { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } }, + { 0x9838, + { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } }, + { 0x9844, + { 0x1372161c, 0x13721c25, 0x13721728, 0x137216a2, 0x13721c25 } }, + { 0x9850, + { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } }, + { 0x9858, + { 0x7e800d2e, 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e, 0x7e800d2e } }, + { 0x9860, + { 0x00009d10, 0x00009d10, 0x00009d18, 0x00009d10, 0x00009d10 } }, + { 0x9864, + { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } }, + { 0x9868, + { 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190 } }, + { 0x9918, + { 0x000001b8, 0x000001b8, 0x00000084, 0x00000108, 0x000001b8 } }, + { 0x9924, + { 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05 } }, + { 0xa180, + { 0x10ff14ff, 0x10ff14ff, 0x10ff10ff, 0x10ff19ff, 0x10ff19ff } }, + { 0xa230, + { 0x00000000, 0x00000000, 0x00000000, 0x00000108, 0x00000000 } }, }; /* Initial mode-specific settings for AR5212 + RF5111 */ diff --git a/drivers/net/wireless/ath5k/phy.c b/drivers/net/wireless/ath5k/phy.c