Message ID | 1302614273-2063-1-git-send-email-vasanth@atheros.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On 2011-04-12 3:17 PM, Vasanthakumar Thiagarajan wrote: > pll configuration will differ for 25mhz clock. > > Signed-off-by: Vasanthakumar Thiagarajan<vasanth@atheros.com> > --- > drivers/net/wireless/ath/ath9k/hw.c | 11 +++++++++++ > drivers/net/wireless/ath/ath9k/hw.h | 2 ++ > 2 files changed, 13 insertions(+), 0 deletions(-) > > diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c > index d98b4c6..8b90b9c 100644 > --- a/drivers/net/wireless/ath/ath9k/hw.c > +++ b/drivers/net/wireless/ath/ath9k/hw.c > @@ -481,6 +481,9 @@ static void ath9k_hw_attach_ops(struct ath_hw *ah) > /* Called for all hardware families */ > static int __ath9k_hw_init(struct ath_hw *ah) > { > +#define AR9340_SOC_SEL_25M_40M 0xB80600B0 > +#define AR9340_REF_CLK_40 (1<< 4) /* 0 - 25MHz 1 - 40 MHz */ > + > struct ath_common *common = ath9k_hw_common(ah); > int r = 0; > > @@ -508,6 +511,14 @@ static int __ath9k_hw_init(struct ath_hw *ah) > > ath9k_hw_attach_ops(ah); > > + if (AR_SREV_9340(ah)) { > + if (*((volatile u32 *) AR9340_SOC_SEL_25M_40M)& > + AR9340_REF_CLK_40) > + ah->is_clk_25mhz = false; > + else > + ah->is_clk_25mhz = true; > + } > + > if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) { > ath_err(common, "Couldn't wakeup chip\n"); > return -EIO; I think this flag should be passed down from the arch code through platform data instead. Also, dereferencing volatile u32 pointers for reading registers is somewhat hackish, readl or ioread32 would be better. - Felix -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 12, 2011 at 07:20:32PM +0530, Felix Fietkau wrote: > On 2011-04-12 3:17 PM, Vasanthakumar Thiagarajan wrote: > > pll configuration will differ for 25mhz clock. > > > > Signed-off-by: Vasanthakumar Thiagarajan<vasanth@atheros.com> > > --- > > drivers/net/wireless/ath/ath9k/hw.c | 11 +++++++++++ > > drivers/net/wireless/ath/ath9k/hw.h | 2 ++ > > 2 files changed, 13 insertions(+), 0 deletions(-) > > > > diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c > > index d98b4c6..8b90b9c 100644 > > --- a/drivers/net/wireless/ath/ath9k/hw.c > > +++ b/drivers/net/wireless/ath/ath9k/hw.c > > @@ -481,6 +481,9 @@ static void ath9k_hw_attach_ops(struct ath_hw *ah) > > /* Called for all hardware families */ > > static int __ath9k_hw_init(struct ath_hw *ah) > > { > > +#define AR9340_SOC_SEL_25M_40M 0xB80600B0 > > +#define AR9340_REF_CLK_40 (1<< 4) /* 0 - 25MHz 1 - 40 MHz */ > > + > > struct ath_common *common = ath9k_hw_common(ah); > > int r = 0; > > > > @@ -508,6 +511,14 @@ static int __ath9k_hw_init(struct ath_hw *ah) > > > > ath9k_hw_attach_ops(ah); > > > > + if (AR_SREV_9340(ah)) { > > + if (*((volatile u32 *) AR9340_SOC_SEL_25M_40M)& > > + AR9340_REF_CLK_40) > > + ah->is_clk_25mhz = false; > > + else > > + ah->is_clk_25mhz = true; > > + } > > + > > if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) { > > ath_err(common, "Couldn't wakeup chip\n"); > > return -EIO; > I think this flag should be passed down from the arch code through > platform data instead. Also, dereferencing volatile u32 pointers for > reading registers is somewhat hackish, readl or ioread32 would be better. Yeah, I was also not comfortable with this part of code. I'll fix that. thanks for the comments. Vasanth -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 12, 2011 at 07:30:36PM +0530, Vasanth Thiagarajan wrote: > > > { > > > +#define AR9340_SOC_SEL_25M_40M 0xB80600B0 > > > +#define AR9340_REF_CLK_40 (1<< 4) /* 0 - 25MHz 1 - 40 MHz */ > > > + > > > struct ath_common *common = ath9k_hw_common(ah); > > > int r = 0; > > > > > > @@ -508,6 +511,14 @@ static int __ath9k_hw_init(struct ath_hw *ah) > > > > > > ath9k_hw_attach_ops(ah); > > > > > > + if (AR_SREV_9340(ah)) { > > > + if (*((volatile u32 *) AR9340_SOC_SEL_25M_40M)& > > > + AR9340_REF_CLK_40) > > > + ah->is_clk_25mhz = false; > > > + else > > > + ah->is_clk_25mhz = true; > > > + } > > > + > > > if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) { > > > ath_err(common, "Couldn't wakeup chip\n"); > > > return -EIO; > > I think this flag should be passed down from the arch code through > > platform data instead. Also, dereferencing volatile u32 pointers for > > reading registers is somewhat hackish, readl or ioread32 would be better. > > Yeah, I was also not comfortable with this part of code. I'll fix > that. thanks for the comments. Linville, ralf, The code change needs to be done in arch code also to fix this cleanly. I'm not quite sure about the right way of submitting changes in BSP and ath9k driver without possibly breaking the driver due to the fact that the change in BSP may not be available along with driver change soon in wireless-testing. Vasanth -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 12, 2011 at 08:03:06PM +0530, Vasanthakumar Thiagarajan wrote: > On Tue, Apr 12, 2011 at 07:30:36PM +0530, Vasanth Thiagarajan wrote: > > > > { > > > > +#define AR9340_SOC_SEL_25M_40M 0xB80600B0 > > > > +#define AR9340_REF_CLK_40 (1<< 4) /* 0 - 25MHz 1 - 40 MHz */ > > > > + > > > > struct ath_common *common = ath9k_hw_common(ah); > > > > int r = 0; > > > > > > > > @@ -508,6 +511,14 @@ static int __ath9k_hw_init(struct ath_hw *ah) > > > > > > > > ath9k_hw_attach_ops(ah); > > > > > > > > + if (AR_SREV_9340(ah)) { > > > > + if (*((volatile u32 *) AR9340_SOC_SEL_25M_40M)& > > > > + AR9340_REF_CLK_40) > > > > + ah->is_clk_25mhz = false; > > > > + else > > > > + ah->is_clk_25mhz = true; > > > > + } > > > > + > > > > if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) { > > > > ath_err(common, "Couldn't wakeup chip\n"); > > > > return -EIO; > > > I think this flag should be passed down from the arch code through > > > platform data instead. Also, dereferencing volatile u32 pointers for > > > reading registers is somewhat hackish, readl or ioread32 would be better. > > > > Yeah, I was also not comfortable with this part of code. I'll fix > > that. thanks for the comments. > > Linville, ralf, > > The code change needs to be done in arch code also to fix this > cleanly. I'm not quite sure about the right way of submitting changes > in BSP and ath9k driver without possibly breaking the driver due to > the fact that the change in BSP may not be available along with > driver change soon in wireless-testing. Generally we can negotiate to take the related changes through one tree or the other. How does the arch change look? John
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index d98b4c6..8b90b9c 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -481,6 +481,9 @@ static void ath9k_hw_attach_ops(struct ath_hw *ah) /* Called for all hardware families */ static int __ath9k_hw_init(struct ath_hw *ah) { +#define AR9340_SOC_SEL_25M_40M 0xB80600B0 +#define AR9340_REF_CLK_40 (1 << 4) /* 0 - 25MHz 1 - 40 MHz */ + struct ath_common *common = ath9k_hw_common(ah); int r = 0; @@ -508,6 +511,14 @@ static int __ath9k_hw_init(struct ath_hw *ah) ath9k_hw_attach_ops(ah); + if (AR_SREV_9340(ah)) { + if (*((volatile u32 *) AR9340_SOC_SEL_25M_40M) & + AR9340_REF_CLK_40) + ah->is_clk_25mhz = false; + else + ah->is_clk_25mhz = true; + } + if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) { ath_err(common, "Couldn't wakeup chip\n"); return -EIO; diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index afdb006..721eb27 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h @@ -845,6 +845,8 @@ struct ath_hw { /* Enterprise mode cap */ u32 ent_mode; + + bool is_clk_25mhz; }; static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah)
pll configuration will differ for 25mhz clock. Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com> --- drivers/net/wireless/ath/ath9k/hw.c | 11 +++++++++++ drivers/net/wireless/ath/ath9k/hw.h | 2 ++ 2 files changed, 13 insertions(+), 0 deletions(-)