linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, Felix Fietkau <nbd@openwrt.org>,
	"Luis R. Rodriguez" <lrodriguez@atheros.com>
Subject: [PATCH v3 28/97] ath9k_hw: Set the channel on AR9003
Date: Thu, 15 Apr 2010 17:38:33 -0400	[thread overview]
Message-ID: <1271367582-992-29-git-send-email-lrodriguez@atheros.com> (raw)
In-Reply-To: <1271367582-992-1-git-send-email-lrodriguez@atheros.com>

From: Felix Fietkau <nbd@openwrt.org>

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/ar9003_phy.c |   47 ++++++++++++++++++++++++++-
 1 files changed, 46 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 084b0f9..f1632ab 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -44,7 +44,52 @@
  */
 static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
 {
-	/* TODO */
+	u16 bMode, fracMode = 0, aModeRefSel = 0;
+	u32 freq, channelSel = 0, reg32 = 0;
+	struct chan_centers centers;
+	int loadSynthChannel;
+
+	ath9k_hw_get_channel_centers(ah, chan, &centers);
+	freq = centers.synth_center;
+
+	if (freq < 4800) {     /* 2 GHz, fractional mode */
+		channelSel = CHANSEL_2G(freq);
+		/* Set to 2G mode */
+		bMode = 1;
+	} else {
+		channelSel = CHANSEL_5G(freq);
+		/* Doubler is ON, so, divide channelSel by 2. */
+		channelSel >>= 1;
+		/* Set to 5G mode */
+		bMode = 0;
+	}
+
+	/* Enable fractional mode for all channels */
+	fracMode = 1;
+	aModeRefSel = 0;
+	loadSynthChannel = 0;
+
+	reg32 = (bMode << 29);
+	REG_WRITE(ah, AR_PHY_SYNTH_CONTROL, reg32);
+
+	/* Enable Long shift Select for Synthesizer */
+	REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_SYNTH4,
+		      AR_PHY_SYNTH4_LONG_SHIFT_SELECT, 1);
+
+	/* Program Synth. setting */
+	reg32 = (channelSel << 2) | (fracMode << 30) |
+		(aModeRefSel << 28) | (loadSynthChannel << 31);
+	REG_WRITE(ah, AR_PHY_65NM_CH0_SYNTH7, reg32);
+
+	/* Toggle Load Synth channel bit */
+	loadSynthChannel = 1;
+	reg32 = (channelSel << 2) | (fracMode << 30) |
+		(aModeRefSel << 28) | (loadSynthChannel << 31);
+	REG_WRITE(ah, AR_PHY_65NM_CH0_SYNTH7, reg32);
+
+	ah->curchan = chan;
+	ah->curchan_rad_index = -1;
+
 	return 0;
 }
 
-- 
1.6.3.3


  parent reply	other threads:[~2010-04-15 21:39 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15 21:38 [PATCH v3 00/97] ath9k: add AR9003 support Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 01/97] ath9k_hw: start building an abstraction layer for hardware routines Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 02/97] ath9k_hw: add silicon revision macros for AR9300 Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 03/97] ath9k_hw: add a macro for abstracting generic timer access Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 04/97] ath9k_hw: fix a missing hex prefix for a register mask Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 05/97] ath9k_hw: add simple register abstraction for some AR9300 registers Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 06/97] ath9k_hw: add support for GPIO differences on AR9003 Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 07/97] ath9k_hw: AR9003 does not have AR_RC_AHB skip its setting Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 08/97] ath9k_hw: remove wrapper ath9k_hw_write_regs() Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 09/97] ath9k_hw: Move some RF ops to the private callbacks Luis R. Rodriguez
2010-04-16 19:43   ` John W. Linville
2010-04-16 19:56     ` Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 10/97] ath9k_hw: skip PLL initialization on AR9003 on Power-On-Reset Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 11/97] ath9k_hw: add some comments for ath9k_set_power_network_sleep() Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 12/97] ath9k_hw: add a private callback for PLL control computation Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 13/97] ath9k_hw: Add the PCI IDs for AR9300 and fill up the pci_id_tables Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 14/97] ath9k_hw: Add AR9003 PHY support Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 15/97] ath9k_hw: move init config and default after chip is up Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 16/97] ath9k_hw: add the AR9003 ar9003_hw_macversion_supported() Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 17/97] ath9k_hw: disable ANI for AR9003 Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 18/97] ath9k: disable the MIB interrupt if ANI is disabled Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 19/97] ath9k_hw: Add hw cap flag for EDMA for the AR9003 family Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 20/97] ath9k_hw: Fill few hw cap for edma Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 21/97] ath9k_hw: Add abstraction for rx enable Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 22/97] ath9k_hw: Fill rx_enable() for the AR9003 hardware family Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 23/97] ath9k_hw: Add few routines for rx edma support Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 24/97] ath9k_hw: update the chip tests for AR9003 Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 25/97] ath9k_hw: prevent reset control register zeroing on AR9003 reset Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 26/97] ath9k_hw: Add AR9003 PHY register definitions Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 27/97] ath9k_hw: add common channel select helpers for ar900[23] Luis R. Rodriguez
2010-04-15 21:38 ` Luis R. Rodriguez [this message]
2010-04-15 21:38 ` [PATCH v3 29/97] ath9k_hw: Implement PLL control on AR9003 Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 30/97] ath9k_hw: Implement spur mitigation " Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 31/97] ath9k_hw: split initvals.h by hardware family Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 32/97] ath9k_hw: add initvals for the AR9003 " Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 33/97] ath9k_hw: add helpers for processing the AR9003 INI Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 34/97] ath9k_hw: Split off ANI control to the PHY ops Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 35/97] ath9k_hw: add all the AR9003 PHY callbacks Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 36/97] ath9k_hw: Define tx control struct for AR9003 Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 37/97] ath9k_hw: Move code which populates ds_data to ath9k_hw Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 38/97] ath9k_hw: Add abstraction to set/get link pointer Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 39/97] ath9k: Use abstraction to get " Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 40/97] ath9k: Use memcpy in ath_clone_txbuf() Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 41/97] ath9k: Remove ATH9K_TX_SW_ABORTED and introduce a bool for this purpose Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 42/97] ath9k: Make bf_desc of ath_buf opaque Luis R. Rodriguez
2010-04-16 22:00   ` Pavel Roskin
2010-04-16 22:09     ` Felix Fietkau
2010-04-19 15:53       ` Pavel Roskin
2010-04-15 21:38 ` [PATCH v3 43/97] ath9k: Add Rx EDMA support Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 44/97] ath9k_hw: Split out the function for reading the noise floor Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 45/97] ath9k_hw: the eep_map is used only for AR9280 PCI card ini fixup Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 46/97] ath9k_hw: add a helper for Power Amplifier calibration for AR9002 Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 47/97] ath9k_hw: add a helper for the OLC tem compensation " Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 48/97] ath9k_hw: rename PA calib for AR9287 Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 49/97] ath9k_hw: shift code for AR9280 OLC temp comp Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 50/97] ath9k_hw: move the AR9280 OLC temp comp to its own helper Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 51/97] ath9k_hw: simplify OLC temp compensation for AR9002 Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 52/97] ath9k_hw: rename the PA calib routines to match their families Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 53/97] ath9k_hw: rename getNoiseFloorThresh() to ath9k_hw_loadnf() Luis R. Rodriguez
2010-04-15 21:38 ` [PATCH v3 54/97] ath9k_hw: move the cal AR9100 calibration settings Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 55/97] ath9k_hw: split calib code by hardware families Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 56/97] ath9k_hw: add the AR9003 ar9003_hw_init_cal callback Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 57/97] ath9k_hw: add the config_pci_powersave AR9003 callback Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 58/97] ath9k_hw: split the generic hardware code by hardware family Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 59/97] ath9k_hw: move the cck channel 14 INI to the AR9002 hw code Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 60/97] ath9k_hw: move TX/RX gain INI stuff to its own hardware family code Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 61/97] ath9k_hw: Abstract the routine which returns interrupt status Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 62/97] ath9k_hw: Initialize interrupt mask for AR9003 Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 63/97] ath9k_hw: abstract the AR_PHY_AGC_CONTROL register access Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 64/97] ath9k_hw: abstract loading noisefloor Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 65/97] ath9k_hw: fill in the callbacks for calibration for AR9003 Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 66/97] ath9k_hw: complete AR9003 calibration Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 67/97] ath9k_hw: rename eep_AR9287_ops to eep_ar9287_ops Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 68/97] ath9k_hw: restore mac address reading logic Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 69/97] ath9k_hw: Implement AR9003 eeprom callbacks Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 70/97] ath9k_hw: add OFDM spur mitigation for AR9003 Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 71/97] ath9k_hw: Fill get_isr() " Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 72/97] ath9k_hw: move AR9280 PCI EEPROM fix to eeprom_def.c Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 73/97] ath9k_hw: move the RF claim stuff to AR9002 hardware family Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 74/97] ath9k_hw: Configure Tx interrupt mitigation timer Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 75/97] ath9k_hw: add the AR9300 SREV hw name print Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 76/97] ath9k_hw: add TX/RX gain register initialization for AR9003 Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 77/97] ath9k_hw: Update ath9k_hw_set_dma for AR9300 Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 78/97] ath9k_hw: skip asynch fifo enablement to AR9003 Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 79/97] ath9k_hw: skip WEP aggregation enable code for AR9003 Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 80/97] ath9k: Load SW filtered NF values and start NF cal during full reset " Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 81/97] ath9k_hw: Define abstraction for tx desc access Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 82/97] ath9k_hw: Add function to configure tx status ring buffer Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 83/97] ath9k_hw: move AR9002 mac ops to its own file Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 84/97] ath9k_hw: Fill descriptor abstrations for AR9003 Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 85/97] ath9k: add RXLP and RXHP to debugfs counters Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 86/97] ath9k_hw: enable CRC check of descriptors for AR9003 Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 87/97] ath9k_hw: set cwmin and cwmax to 0 for for AR9003 upon txq reset Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 88/97] ath9k: Setup appropriate tx desc for regular dma and edma Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 89/97] ath9k: Initialize and configure tx status for EDMA Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 90/97] ath9k_hw: Compute pointer checksum over the link descriptor Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 91/97] ath9k: Add Tx EDMA support Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 92/97] mac80211: add LDPC control flag Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 93/97] ath9k_hw: add LDPC support for AR9003 Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 94/97] ath9k: add LDPC support Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 95/97] ath9k: Enable TXOK and TXERR interrupts for TX EDMA Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 96/97] ath9k_hw: Abort rx if hw is not coming out of full sleep in reset Luis R. Rodriguez
2010-04-15 21:39 ` [PATCH v3 97/97] ath9k_hw: add the PCI ID for the first AR9300 device Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1271367582-992-29-git-send-email-lrodriguez@atheros.com \
    --to=lrodriguez@atheros.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=nbd@openwrt.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).