* [PATCH 7/8] ath5k: Minor code review to match regdumps
@ 2008-02-24 4:31 Nick Kossifidis
2008-02-27 4:00 ` Luis R. Rodriguez
2008-02-28 22:50 ` Luis R. Rodriguez
0 siblings, 2 replies; 7+ messages in thread
From: Nick Kossifidis @ 2008-02-24 4:31 UTC (permalink / raw)
To: ath5k-devel, linux-wireless; +Cc: linville, bruno, jirislaby, mcgrof
* Make some changes to follow register dumps.
Changes-licensed-under: ISC
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
---
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index cd640ed..adcce6f 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -727,15 +727,23 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
/*
* Write some more initial register settings
*/
- if (ah->ah_version > AR5K_AR5211){ /* found on 5213+ */
+ if (ah->ah_version == AR5K_AR5212){
ath5k_hw_reg_write(ah, 0x0002a002, AR5K_PHY(11));
if (channel->hw_value == CHANNEL_G)
- ath5k_hw_reg_write(ah, 0x00f80d80, AR5K_PHY(83)); /* 0x00fc0ec0 */
+ if (ah->ah_mac_srev < AR5K_SREV_VER_AR2413) {
+ ath5k_hw_reg_write(ah, 0x00f80d80, AR5K_PHY(83));
+ } else if (ah->ah_mac_srev < AR5K_SREV_VER_AR2424) {
+ ath5k_hw_reg_write(ah, 0x00380140, AR5K_PHY(83));
+ } else if (ah->ah_mac_srev < AR5K_SREV_VER_AR2425) {
+ ath5k_hw_reg_write(ah, 0x00fc0ec0, AR5K_PHY(83));
+ } else {
+ /* 2425 */
+ ath5k_hw_reg_write(ah, 0x00fc0fc0, AR5K_PHY(83));
+ }
else
ath5k_hw_reg_write(ah, 0x00000000, AR5K_PHY(83));
- ath5k_hw_reg_write(ah, 0x000001b5, 0xa228); /* 0x000009b5 */
ath5k_hw_reg_write(ah, 0x000009b5, 0xa228);
ath5k_hw_reg_write(ah, 0x0000000f, 0x8060);
ath5k_hw_reg_write(ah, 0x00000000, 0xa254);
@@ -1019,6 +1027,8 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
/*
* Set the 32MHz reference clock on 5212 phy clock sleep register
+ *
+ * TODO: Find out how to switch to external 32Khz clock to save power
*/
if (ah->ah_version == AR5K_AR5212) {
ath5k_hw_reg_write(ah, AR5K_PHY_SCR_32MHZ, AR5K_PHY_SCR);
@@ -1029,6 +1039,14 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
ath5k_hw_reg_write(ah, ah->ah_phy_spending, AR5K_PHY_SPENDING);
}
+ if (ah->ah_version == AR5K_AR5212) {
+ ath5k_hw_reg_write(ah, 0x000100aa, 0x8118);
+ ath5k_hw_reg_write(ah, 0x00003210, 0x811c);
+ ath5k_hw_reg_write(ah, 0x00000052, 0x8108);
+ if (ah->ah_mac_srev >= AR5K_SREV_VER_AR2413)
+ ath5k_hw_reg_write(ah, 0x00000004, 0x8120);
+ }
+
/*
* Disable beacons and reset the register
*/
@@ -2273,8 +2291,8 @@ void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id)
* Set simple BSSID mask on 5212
*/
if (ah->ah_version == AR5K_AR5212) {
- ath5k_hw_reg_write(ah, 0xfffffff, AR5K_BSS_IDM0);
- ath5k_hw_reg_write(ah, 0xfffffff, AR5K_BSS_IDM1);
+ ath5k_hw_reg_write(ah, 0xffffffff, AR5K_BSS_IDM0);
+ ath5k_hw_reg_write(ah, 0xffffffff, AR5K_BSS_IDM1);
}
/*
@@ -2419,6 +2437,8 @@ void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah)
{
ATH5K_TRACE(ah->ah_sc);
AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX);
+
+ /* TODO: ANI Support */
}
/*
@@ -2428,6 +2448,8 @@ void ath5k_hw_stop_pcu_recv(struct ath5k_hw *ah)
{
ATH5K_TRACE(ah->ah_sc);
AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX);
+
+ /* TODO: ANI Support */
}
/*
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 7/8] ath5k: Minor code review to match regdumps
2008-02-24 4:31 [PATCH 7/8] ath5k: Minor code review to match regdumps Nick Kossifidis
@ 2008-02-27 4:00 ` Luis R. Rodriguez
2008-02-28 22:50 ` Luis R. Rodriguez
1 sibling, 0 replies; 7+ messages in thread
From: Luis R. Rodriguez @ 2008-02-27 4:00 UTC (permalink / raw)
To: ath5k-devel, linux-wireless, linville, bruno, jirislaby, mcgrof
On Sat, Feb 23, 2008 at 11:31 PM, Nick Kossifidis <mick@madwifi.org> wrote:
>
> * Make some changes to follow register dumps.
>
> Changes-licensed-under: ISC
> Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Please run through checkpatch.
Luis
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 7/8] ath5k: Minor code review to match regdumps
2008-02-24 4:31 [PATCH 7/8] ath5k: Minor code review to match regdumps Nick Kossifidis
2008-02-27 4:00 ` Luis R. Rodriguez
@ 2008-02-28 22:50 ` Luis R. Rodriguez
1 sibling, 0 replies; 7+ messages in thread
From: Luis R. Rodriguez @ 2008-02-28 22:50 UTC (permalink / raw)
To: ath5k-devel, linux-wireless, linville, bruno, jirislaby, mcgrof
On Sat, Feb 23, 2008 at 11:31 PM, Nick Kossifidis <mick@madwifi.org> wrote:
>
> * Make some changes to follow register dumps.
>
> Changes-licensed-under: ISC
> Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
>
> ---
> diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
> index cd640ed..adcce6f 100644
> --- a/drivers/net/wireless/ath5k/hw.c
> +++ b/drivers/net/wireless/ath5k/hw.c
> @@ -727,15 +727,23 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
> /*
> * Write some more initial register settings
> */
> - if (ah->ah_version > AR5K_AR5211){ /* found on 5213+ */
> + if (ah->ah_version == AR5K_AR5212){
We should probably just move this to a helper. Will send a patch based on this.
Luis
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/8] ath5k: Add RF2413 srev values
@ 2008-02-28 22:56 Luis R. Rodriguez
2008-02-28 23:00 ` [PATCH 7/8] ath5k: Minor code review to match regdumps Luis R. Rodriguez
0 siblings, 1 reply; 7+ messages in thread
From: Luis R. Rodriguez @ 2008-02-28 22:56 UTC (permalink / raw)
To: linville; +Cc: ath5k-devel, linux-wireless, jirislaby, mickflemm, bruno, me
* Add RF2413 srev values and a new entry on ath5k_radio enum for it
since it differs from RF5413 (it's not like 5112-2112).
Changes-licensed-under: ISC
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
---
drivers/net/wireless/ath5k/ath5k.h | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h
index 18223d9..25c8e98 100644
--- a/drivers/net/wireless/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath5k/ath5k.h
@@ -140,7 +140,8 @@ enum ath5k_radio {
AR5K_RF5110 = 0,
AR5K_RF5111 = 1,
AR5K_RF5112 = 2,
- AR5K_RF5413 = 3,
+ AR5K_RF2413 = 3,
+ AR5K_RF5413 = 4,
};
/*
@@ -168,12 +169,15 @@ struct ath5k_srev_name {
#define AR5K_SREV_VER_AR5212 0x50
#define AR5K_SREV_VER_AR5213 0x55
#define AR5K_SREV_VER_AR5213A 0x59
+#define AR5K_SREV_VER_AR2413 0x78
+#define AR5K_SREV_VER_AR2414 0x79
#define AR5K_SREV_VER_AR2424 0xa0
#define AR5K_SREV_VER_AR5424 0xa3
#define AR5K_SREV_VER_AR5413 0xa4
#define AR5K_SREV_VER_AR5414 0xa5
#define AR5K_SREV_VER_AR5416 0xc0 /* ? */
#define AR5K_SREV_VER_AR5418 0xca
+#define AR5K_SREV_VER_AR2425 0xe2
#define AR5K_SREV_RAD_5110 0x00
#define AR5K_SREV_RAD_5111 0x10
@@ -183,8 +187,9 @@ struct ath5k_srev_name {
#define AR5K_SREV_RAD_5112A 0x35
#define AR5K_SREV_RAD_2112 0x40
#define AR5K_SREV_RAD_2112A 0x45
+#define AR5K_SREV_RAD_SC0 0x56 /* Found on 2413/2414 */
#define AR5K_SREV_RAD_SC1 0x63 /* Found on 5413/5414 */
-#define AR5K_SREV_RAD_SC2 0xa2 /* Found on 2424/5424 */
+#define AR5K_SREV_RAD_SC2 0xa2 /* Found on 2424-5/5424 */
#define AR5K_SREV_RAD_5133 0xc0 /* MIMO found on 5418 */
/* IEEE defs */
--
1.5.3.7
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 7/8] ath5k: Minor code review to match regdumps
2008-02-28 22:56 [PATCH 1/8] ath5k: Add RF2413 srev values Luis R. Rodriguez
@ 2008-02-28 23:00 ` Luis R. Rodriguez
2008-02-28 23:40 ` Christoph Hellwig
0 siblings, 1 reply; 7+ messages in thread
From: Luis R. Rodriguez @ 2008-02-28 23:00 UTC (permalink / raw)
To: linville; +Cc: ath5k-devel, linux-wireless, jirislaby, mickflemm, bruno, me
Make some changes which mimic what we see in register dumps. Also,
lets move ar5212 initial settings out into a helper during reset
to make code more readible.
Changes-licensed-under: ISC
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
---
drivers/net/wireless/ath5k/hw.c | 66 +++++++++++++++++++++++++++++---------
1 files changed, 50 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index 6f69e46..b8e412c 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -589,6 +589,38 @@ static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah,
}
/*
+ * ath5k_hw_reset_ar5212 - reset helper for ar5212
+ *
+ * @ah: the &struct ath5k_hw
+ * @channel: the &ieee80211_channel
+ *
+ * This is a helper to ath5k_hw_reset() for AR5212.
+ */
+static inline void ath5k_hw_reset_init_ar5212(struct ath5k_hw *ah,
+ struct ieee80211_channel *channel)
+{
+ ath5k_hw_reg_write(ah, 0x0002a002, AR5K_PHY(11));
+
+ if ((channel->hw_value & CHANNEL_MODES) == CHANNEL_G) {
+ if (ah->ah_mac_srev < AR5K_SREV_VER_AR2413)
+ ath5k_hw_reg_write(ah, 0x00f80d80, AR5K_PHY(83));
+ else if (ah->ah_mac_srev < AR5K_SREV_VER_AR2424)
+ ath5k_hw_reg_write(ah, 0x00380140, AR5K_PHY(83));
+ else if (ah->ah_mac_srev < AR5K_SREV_VER_AR2425)
+ ath5k_hw_reg_write(ah, 0x00fc0ec0, AR5K_PHY(83));
+ else
+ /* 2425 */
+ ath5k_hw_reg_write(ah, 0x00fc0fc0, AR5K_PHY(83));
+ } else
+ ath5k_hw_reg_write(ah, 0x00000000, AR5K_PHY(83));
+
+ ath5k_hw_reg_write(ah, 0x000009b5, 0xa228);
+ ath5k_hw_reg_write(ah, 0x0000000f, 0x8060);
+ ath5k_hw_reg_write(ah, 0x00000000, 0xa254);
+ ath5k_hw_reg_write(ah, 0x0000000e, AR5K_PHY_SCAL);
+}
+
+/*
* Main reset function
*/
int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
@@ -724,20 +756,8 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
/*
* Write some more initial register settings
*/
- if (ah->ah_version > AR5K_AR5211){ /* found on 5213+ */
- ath5k_hw_reg_write(ah, 0x0002a002, AR5K_PHY(11));
-
- if (channel->hw_value == CHANNEL_G)
- ath5k_hw_reg_write(ah, 0x00f80d80, AR5K_PHY(83)); /* 0x00fc0ec0 */
- else
- ath5k_hw_reg_write(ah, 0x00000000, AR5K_PHY(83));
-
- ath5k_hw_reg_write(ah, 0x000001b5, 0xa228); /* 0x000009b5 */
- ath5k_hw_reg_write(ah, 0x000009b5, 0xa228);
- ath5k_hw_reg_write(ah, 0x0000000f, 0x8060);
- ath5k_hw_reg_write(ah, 0x00000000, 0xa254);
- ath5k_hw_reg_write(ah, 0x0000000e, AR5K_PHY_SCAL);
- }
+ if (ah->ah_version == AR5K_AR5212)
+ ath5k_hw_reset_init_ar5212(ah, channel);
/* Fix for first revision of the RF5112 RF chipset */
if (ah->ah_radio >= AR5K_RF5112 &&
@@ -1015,6 +1035,8 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
/*
* Set the 32MHz reference clock on 5212 phy clock sleep register
+ *
+ * TODO: Find out how to switch to external 32Khz clock to save power
*/
if (ah->ah_version == AR5K_AR5212) {
ath5k_hw_reg_write(ah, AR5K_PHY_SCR_32MHZ, AR5K_PHY_SCR);
@@ -1025,6 +1047,14 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
ath5k_hw_reg_write(ah, ah->ah_phy_spending, AR5K_PHY_SPENDING);
}
+ if (ah->ah_version == AR5K_AR5212) {
+ ath5k_hw_reg_write(ah, 0x000100aa, 0x8118);
+ ath5k_hw_reg_write(ah, 0x00003210, 0x811c);
+ ath5k_hw_reg_write(ah, 0x00000052, 0x8108);
+ if (ah->ah_mac_srev >= AR5K_SREV_VER_AR2413)
+ ath5k_hw_reg_write(ah, 0x00000004, 0x8120);
+ }
+
/*
* Disable beacons and reset the register
*/
@@ -2269,8 +2299,8 @@ void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id)
* Set simple BSSID mask on 5212
*/
if (ah->ah_version == AR5K_AR5212) {
- ath5k_hw_reg_write(ah, 0xfffffff, AR5K_BSS_IDM0);
- ath5k_hw_reg_write(ah, 0xfffffff, AR5K_BSS_IDM1);
+ ath5k_hw_reg_write(ah, 0xffffffff, AR5K_BSS_IDM0);
+ ath5k_hw_reg_write(ah, 0xffffffff, AR5K_BSS_IDM1);
}
/*
@@ -2415,6 +2445,8 @@ void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah)
{
ATH5K_TRACE(ah->ah_sc);
AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX);
+
+ /* TODO: ANI Support */
}
/*
@@ -2424,6 +2456,8 @@ void ath5k_hw_stop_pcu_recv(struct ath5k_hw *ah)
{
ATH5K_TRACE(ah->ah_sc);
AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX);
+
+ /* TODO: ANI Support */
}
/*
--
1.5.3.7
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 7/8] ath5k: Minor code review to match regdumps
2008-02-28 23:00 ` [PATCH 7/8] ath5k: Minor code review to match regdumps Luis R. Rodriguez
@ 2008-02-28 23:40 ` Christoph Hellwig
[not found] ` <43e72e890802281558h2566fbcdxac56ec77918308c3@mail.gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2008-02-28 23:40 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: linville, ath5k-devel, linux-wireless, jirislaby, mickflemm,
bruno, me
On Thu, Feb 28, 2008 at 06:00:24PM -0500, Luis R. Rodriguez wrote:
> /*
> + * ath5k_hw_reset_ar5212 - reset helper for ar5212
> + *
> + * @ah: the &struct ath5k_hw
> + * @channel: the &ieee80211_channel
> + *
> + * This is a helper to ath5k_hw_reset() for AR5212.
> + */
> +static inline void ath5k_hw_reset_init_ar5212(struct ath5k_hw *ah,
> + struct ieee80211_channel *channel)
s/inline // please
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-03-07 17:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-24 4:31 [PATCH 7/8] ath5k: Minor code review to match regdumps Nick Kossifidis
2008-02-27 4:00 ` Luis R. Rodriguez
2008-02-28 22:50 ` Luis R. Rodriguez
-- strict thread matches above, loose matches on Subject: below --
2008-02-28 22:56 [PATCH 1/8] ath5k: Add RF2413 srev values Luis R. Rodriguez
2008-02-28 23:00 ` [PATCH 7/8] ath5k: Minor code review to match regdumps Luis R. Rodriguez
2008-02-28 23:40 ` Christoph Hellwig
[not found] ` <43e72e890802281558h2566fbcdxac56ec77918308c3@mail.gmail.com>
2008-02-29 0:02 ` Luis R. Rodriguez
2008-03-07 17:21 ` Luis R. Rodriguez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox