ath9k: Implement integer mode for AR9485
PATCH 1/2 ath9k: Implement integer mode for AR9485
This fixes random disconnect.
--- drivers/net/wireless/ath/ath9k/ar9003_phy.c | 15 +++++++-- drivers/net/wireless/ath/ath9k/hw.c | 45 +++++++++++++++++--------- drivers/net/wireless/ath/ath9k/phy.h | 1 - drivers/net/wireless/ath/ath9k/reg.h | 31 +++++++++++++++--- 4 files changed, 67 insertions(+), 25 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_phy.c +12 -3
@@ -75,9 +75,18 @@ static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan) freq = centers.synth_center;if (freq <4800 ) {/* 2 GHz, fractional mode */ -if (AR_SREV_9485 (ah)) - channelSel =CHANSEL_2G_9485 (freq); -else +if (AR_SREV_9485 (ah)) { +u32 chan_frac; + +/* +* freq_ref = 40 / (refdiva >> amoderefsel); where refdiva=1 and amoderefsel=0 +* ndiv = ((chan_mhz * 4) / 3) / freq_ref; +* chansel = int(ndiv), chanfrac = (ndiv - chansel) * 0x20000 +*/ + channelSel = (freq *4 ) /120 ; + chan_frac = (((freq *4 ) %120 ) *0x20000 ) /120 ; + channelSel = (channelSel <<17 ) | chan_frac; + }else channelSel =CHANSEL_2G (freq);/* Set to 2G mode */ bMode =1 ;
drivers/net/wireless/ath/ath9k/hw.c +29 -16
71 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/phy.h +0 -1
@@ -19,7 +19,6 @@#define CHANSEL_DIV 15#define CHANSEL_2G (_freq) (((_freq) * 0x10000) / CHANSEL_DIV) -#define CHANSEL_2G_9485 (_freq) ((((_freq) * 0x10000) - 215) / CHANSEL_DIV)#define CHANSEL_5G (_freq) (((_freq) * 0x8000) / CHANSEL_DIV)#define AR_PHY_BASE 0x9800
drivers/net/wireless/ath/ath9k/reg.h +26 -5
@@ -1088,14 +1088,35 @@ enum {#define AR_ENT_OTP 0x40d8#define AR_ENT_OTP_CHAIN2_DISABLE 0x00020000#define AR_ENT_OTP_MPSD 0x00800000 -#define AR_CH0_BB_DPLL2 0x16184 + +#define AR_CH0_BB_DPLL1 0x16180 +#define AR_CH0_BB_DPLL1_REFDIV 0xF8000000 +#define AR_CH0_BB_DPLL1_REFDIV_S 27 +#define AR_CH0_BB_DPLL1_NINI 0x07FC0000 +#define AR_CH0_BB_DPLL1_NINI_S 18 +#define AR_CH0_BB_DPLL1_NFRAC 0x0003FFFF +#define AR_CH0_BB_DPLL1_NFRAC_S 0 + +#define AR_CH0_BB_DPLL2 0x16184 +#define AR_CH0_BB_DPLL2_LOCAL_PLL 0x40000000 +#define AR_CH0_BB_DPLL2_LOCAL_PLL_S 30 +#define AR_CH0_DPLL2_KI 0x3C000000 +#define AR_CH0_DPLL2_KI_S 26 +#define AR_CH0_DPLL2_KD 0x03F80000 +#define AR_CH0_DPLL2_KD_S 19 +#define AR_CH0_BB_DPLL2_EN_NEGTRIG 0x00040000 +#define AR_CH0_BB_DPLL2_EN_NEGTRIG_S 18 +#define AR_CH0_BB_DPLL2_PLL_PWD 0x00010000 +#define AR_CH0_BB_DPLL2_PLL_PWD_S 16 +#define AR_CH0_BB_DPLL2_OUTDIV 0x0000E000 +#define AR_CH0_BB_DPLL2_OUTDIV_S 13 +#define AR_CH0_BB_DPLL3 0x16188 +#define AR_CH0_BB_DPLL3_PHASE_SHIFT 0x3F800000 +#define AR_CH0_BB_DPLL3_PHASE_SHIFT_S 23 +#define AR_CH0_DDR_DPLL2 0x16244#define AR_CH0_DDR_DPLL3 0x16248 -#define AR_CH0_DPLL2_KD 0x03F80000 -#define AR_CH0_DPLL2_KD_S 19 -#define AR_CH0_DPLL2_KI 0x3C000000 -#define AR_CH0_DPLL2_KI_S 26#define AR_CH0_DPLL3_PHASE_SHIFT 0x3F800000#define AR_CH0_DPLL3_PHASE_SHIFT_S 23#define AR_PHY_CCA_NOM_VAL_2GHZ -118
Signature · 1 line
1.7.0.4
PATCH 2/2 ath9k: Register id table for platform device
Take devid from driver_data of platform_device_id instead of using a hardcoded value.
--- drivers/net/wireless/ath/ath9k/ahb.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath9k/ahb.c +10 -1
@@ -21,6 +21,13 @@#include <linux/ath9k_platform.h> #include "ath9k.h" +const struct platform_device_id ath9k_platform_id_table[] = { + { + .name ="ar913x_wmac" , + .driver_data =AR5416_AR9100_DEVID , + }, +}; +/* return bus cachesize in 4B word units */ static void ath_ahb_read_cachesize (struct ath_common *common,int *csz) {
@@ -57,6 +64,7 @@ static int ath_ahb_probe(struct platform_device *pdev)struct ath_softc *sc;struct ieee80211_hw *hw;struct resource *res; +const struct platform_device_id *id =platform_get_device_id (pdev);int irq;int ret =0 ;struct ath_hw *ah;
@@ -116,7 +124,7 @@ static int ath_ahb_probe(struct platform_device *pdev) goto err_free_hw; } - ret =ath9k_init_device (AR5416_AR9100_DEVID , sc,0x0 , &ath_ahb_bus_ops); + ret =ath9k_init_device (id->driver_data, sc,0x0 , &ath_ahb_bus_ops);if (ret) {dev_err (&pdev->dev,"failed to initialize device\n" ); goto err_irq;
@@ -165,6 +173,7 @@ static struct platform_driver ath_ahb_driver = { .name = "ath9k", .owner = THIS_MODULE, }, + .id_table = ath9k_platform_id_table, };int ath_ahb_init (void )
Signature · 1 line
1.7.0.4
RE: [PATCH 2/2] ath9k: Register id table for platform device
________________________________________
From: [email protected] [[email protected]] On Behalf Of Vasanthakumar Thiagarajan [[email protected]]
Sent: Monday, April 11, 2011 4:09 AM
To: [email protected]
Cc: [email protected]; Gabor Juhos
Subject: [PATCH 2/2] ath9k: Register id table for platform device
Take devid from driver_data of platform_device_id instead of using a hardcoded value.
--- drivers/net/wireless/ath/ath9k/ahb.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
Please drop this patch, this would break the existing board support. I'll send an updated one
Vasanth