Skip to contentSkip to conversation

ath5k: Update reset code

PATCH In review Nick Kossifidis 6 participants 32 messages Jan 31, 2009 – Feb 8, 2009 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 5/5 ath5k: Update reset code

* Update reset and sync with HALs
* Clean up eeprom settings and tweaking of initvals and put them on separate functions
* Set/Restore 32KHz ref clk operation
* Add some more documentation
TODO: Spur mitigation, tpc, half/quarter rate, compression etc

---
 drivers/net/wireless/ath5k/ath5k.h  |   12 +-
 drivers/net/wireless/ath5k/attach.c |   16 +-
 drivers/net/wireless/ath5k/eeprom.c |   12 +
 drivers/net/wireless/ath5k/eeprom.h |    1 +
 drivers/net/wireless/ath5k/reg.h    |   41 +-
 drivers/net/wireless/ath5k/reset.c  |  901 ++++++++++++++++++++++++++---------
 6 files changed, 711 insertions(+), 272 deletions(-)
drivers/net/wireless/ath5k/ath5k.h +8 -4
index 5b2e0da..a3313be 100644
@@ -222,6 +222,8 @@
 #endif
 
 /* Initial values */
+#define	AR5K_INIT_RSSI_THR			0x00000781
+#define	AR5K_INIT_CYCRSSI_THR1			2
 #define AR5K_INIT_TX_LATENCY			502
 #define AR5K_INIT_USEC				39
 #define AR5K_INIT_USEC_TURBO			79
@@ -313,7 +315,7 @@ struct ath5k_srev_name {
 #define AR5K_SREV_AR5424	0x90 /* Condor */
 #define AR5K_SREV_AR5413	0xa4 /* Eagle lite */
 #define AR5K_SREV_AR5414	0xa0 /* Eagle */
-#define AR5K_SREV_AR2415	0xb0 /* Cobra */
+#define AR5K_SREV_AR2415	0xb0 /* Talon */
 #define AR5K_SREV_AR5416	0xc0 /* PCI-E */
 #define AR5K_SREV_AR5418	0xca /* PCI-E */
 #define AR5K_SREV_AR2425	0xe0 /* Swan */
@@ -331,7 +333,7 @@ struct ath5k_srev_name {
 #define	AR5K_SREV_RAD_2112B	0x46
 #define AR5K_SREV_RAD_2413	0x50
 #define AR5K_SREV_RAD_5413	0x60
-#define AR5K_SREV_RAD_2316	0x70
+#define AR5K_SREV_RAD_2316	0x70 /* Cobra SoC */
 #define AR5K_SREV_RAD_2317	0x80
 #define AR5K_SREV_RAD_5424	0xa0 /* Mostly same as 5413 */
 #define AR5K_SREV_RAD_2425	0xa2
@@ -340,7 +342,7 @@ struct ath5k_srev_name {
 #define AR5K_SREV_PHY_5211	0x30
 #define AR5K_SREV_PHY_5212	0x41
 #define	AR5K_SREV_PHY_5212A	0x42
-#define AR5K_SREV_PHY_2112B	0x43
+#define AR5K_SREV_PHY_5212B	0x43
 #define AR5K_SREV_PHY_2413	0x45
 #define AR5K_SREV_PHY_5413	0x61
 #define AR5K_SREV_PHY_2425	0x70
@@ -1030,7 +1032,6 @@ struct ath5k_hw {
 	u16			ah_phy_revision;
 	u16			ah_radio_5ghz_revision;
 	u16			ah_radio_2ghz_revision;
-	u32			ah_phy_spending;
 
 	enum ath5k_version	ah_version;
 	enum ath5k_radio	ah_radio;
@@ -1156,6 +1157,7 @@ extern void ath5k_hw_update_mib_counters(struct ath5k_hw *ah, struct ieee80211_l
 /* EEPROM access functions */
 extern int ath5k_eeprom_init(struct ath5k_hw *ah);
 extern int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac);
+extern bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah);
 
 /* Protocol Control Unit Functions */
 extern int ath5k_hw_set_opmode(struct ath5k_hw *ah);
@@ -1258,6 +1260,7 @@ extern int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, unsigned int power);
 
 /*
  * Translate usec to hw clock units
+ * TODO: Half/quarter rate
  */
 static inline unsigned int ath5k_hw_htoclock(unsigned int usec, bool turbo)
 {
@@ -1266,6 +1269,7 @@ static inline unsigned int ath5k_hw_htoclock(unsigned int usec, bool turbo)
 
 /*
  * Translate hw clock units to usec
+ * TODO: Half/quarter rate
  */
 static inline unsigned int ath5k_hw_clocktoh(unsigned int clock, bool turbo)
 {
drivers/net/wireless/ath5k/attach.c +2 -14
index a3f07a4..05bc5cb 100644
@@ -169,7 +169,6 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 		ah->ah_single_chip = false;
 		ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
 							CHANNEL_2GHZ);
-		ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5111;
 		break;
 	case AR5K_SREV_RAD_5112:
 	case AR5K_SREV_RAD_2112:
@@ -177,38 +176,31 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 		ah->ah_single_chip = false;
 		ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
 							CHANNEL_2GHZ);
-		ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112;
 		break;
 	case AR5K_SREV_RAD_2413:
 		ah->ah_radio = AR5K_RF2413;
 		ah->ah_single_chip = true;
-		ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2413;
 		break;
 	case AR5K_SREV_RAD_5413:
 		ah->ah_radio = AR5K_RF5413;
 		ah->ah_single_chip = true;
-		ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
 		break;
 	case AR5K_SREV_RAD_2316:
 		ah->ah_radio = AR5K_RF2316;
 		ah->ah_single_chip = true;
-		ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2316;
 		break;
 	case AR5K_SREV_RAD_2317:
 		ah->ah_radio = AR5K_RF2317;
 		ah->ah_single_chip = true;
-		ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2317;
 		break;
 	case AR5K_SREV_RAD_5424:
 		if (ah->ah_mac_version == AR5K_SREV_AR2425 ||
 		ah->ah_mac_version == AR5K_SREV_AR2417){
 			ah->ah_radio = AR5K_RF2425;
 			ah->ah_single_chip = true;
-			ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2425;
 		} else {
 			ah->ah_radio = AR5K_RF5413;
 			ah->ah_single_chip = true;
-			ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
 		}
 		break;
 	default:
@@ -227,29 +219,25 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 			ah->ah_radio = AR5K_RF2425;
 			ah->ah_single_chip = true;
 			ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2425;
-			ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2425;
 		} else if (srev == AR5K_SREV_AR5213A &&
-		ah->ah_phy_revision == AR5K_SREV_PHY_2112B) {
+		ah->ah_phy_revision == AR5K_SREV_PHY_5212B) {
 			ah->ah_radio = AR5K_RF5112;
 			ah->ah_single_chip = false;
-			ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2112B;
+			ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_5112B;
 		} else if (ah->ah_mac_version == (AR5K_SREV_AR2415 >> 4)) {
 			ah->ah_radio = AR5K_RF2316;
 			ah->ah_single_chip = true;
 			ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2316;
-			ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2316;
 		} else if (ah->ah_mac_version == (AR5K_SREV_AR5414 >> 4) ||
 		ah->ah_phy_revision == AR5K_SREV_PHY_5413) {
 			ah->ah_radio = AR5K_RF5413;
 			ah->ah_single_chip = true;
 			ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_5413;
-			ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
 		} else if (ah->ah_mac_version == (AR5K_SREV_AR2414 >> 4) ||
 		ah->ah_phy_revision == AR5K_SREV_PHY_2413) {
 			ah->ah_radio = AR5K_RF2413;
 			ah->ah_single_chip = true;
 			ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2413;
-			ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2413;
 		} else {
 			ATH5K_ERR(sc, "Couldn't identify radio revision.\n");
 			ret = -ENODEV;
drivers/net/wireless/ath5k/eeprom.c +12 -0
index b4ec539..5f16fea 100644
@@ -1412,6 +1412,7 @@ ath5k_eeprom_init(struct ath5k_hw *ah)
 
 	return 0;
 }
+
 /*
  * Read the MAC address from eeprom
  */
@@ -1448,3 +1449,14 @@ int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
 	return 0;
 }
 
+bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah)
+{
+	u16 data;
+
+	ath5k_hw_eeprom_read(ah, AR5K_EEPROM_IS_HB63, &data);
+
+	if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4) && data))
+		return true;
+	else
+		return false;
+}
drivers/net/wireless/ath5k/eeprom.h +1 -0
index 09eb7d0..1deebc0 100644
@@ -25,6 +25,7 @@
 #define AR5K_EEPROM_MAGIC_5211		0x0000145b /* 5211 */
 #define AR5K_EEPROM_MAGIC_5210		0x0000145a /* 5210 */
 
+#define	AR5K_EEPROM_IS_HB63		0x000b	/* Talon detect */
 #define AR5K_EEPROM_REG_DOMAIN		0x00bf	/* EEPROM regdom */
 #define AR5K_EEPROM_CHECKSUM		0x00c0	/* EEPROM checksum */
 #define AR5K_EEPROM_INFO_BASE		0x00c0	/* EEPROM header */
drivers/net/wireless/ath5k/reg.h +21 -20

107 lines not on this page · raw message

drivers/net/wireless/ath5k/reset.c +667 -234

1,123 lines not on this page · raw message

#1 lore raw
Quoted 5 lines · Nick Kossifidis

* Update reset and sync with HALs
* Clean up eeprom settings and tweaking of initvals and put them on separate functions
* Set/Restore 32KHz ref clk operation
* Add some more documentation
TODO: Spur mitigation, tpc, half/quarter rate, compression etc

Awesome work! I just double checked it, I have some minor comments, on the whole looks very good.

Quoted 1 line

Should be "Signed-off-by:" (lowercase O) according to checkpatch.

drivers/net/wireless/ath5k/eeprom.c int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) · line 1458

Quoted 8 lines

[...]

drivers/net/wireless/ath5k/eeprom.c +7 -0
+bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah)
+{
+	u16 data;
+
+	ath5k_hw_eeprom_read(ah, AR5K_EEPROM_IS_HB63, &data);
+
+	if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4) && data))

Don't think it makes a difference, but judging from the double parens, I think you meant:

Review

Quoted 1 line
(quoted diff) +1 -0
+	if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4)) && data)

Do we need to check for eeprom version 5.4 or better? HAL does.

drivers/net/wireless/ath5k/reg.h line 2161

Quoted 8 lines

[...]

drivers/net/wireless/ath5k/reg.h +2 -1
@@ -2156,7 +2157,8 @@
 #define	AR5K_PHY_ANT_CTL_TXRX_EN	0x00000001	/* Enable TX/RX (?) */
 #define	AR5K_PHY_ANT_CTL_SECTORED_ANT	0x00000004	/* Sectored Antenna */
 #define	AR5K_PHY_ANT_CTL_HITUNE5	0x00000008	/* Hitune5 (?) */
-#define	AR5K_PHY_ANT_CTL_SWTABLE_IDLE	0x00000010	/* Switch table idle (?) */
+#define	AR5K_PHY_ANT_CTL_SWTABLE_IDLE	0x000003f9	/* Switch table idle (?) */
+#define	AR5K_PHY_ANT_CTL_SWTABLE_IDLE_S	4

That doesn't look right.. should be 3f0? (still probably works, I guess).

drivers/net/wireless/ath5k/reg.h line 2201

Quoted 2 lines
drivers/net/wireless/ath5k/reg.h +1 -1
-#define	AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_S	0
+#define	AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_S	1

Heh, we should write a little tool to check the shifts and masks :)

drivers/net/wireless/ath5k/reset.c line 41

Quoted 5 lines
drivers/net/wireless/ath5k/reset.c +2 -3
- * Write the OFDM timings for the AR5212 upon reset. This is a helper for
- * ath5k_hw_reset(). This seems to tune the PLL a specified frequency
- * depending on the bandwidth of the channel.
+ * Write the delta slope coefficient (used on pilot tracking ?) for OFDM
+ * operration on the AR5212 upon reset. This is a helper for ath5k_hw_reset().

operation

Quoted 2 lines

*
+ * Since delta slope is floating point we split it on it's exponent and

its

Quoted 3 lines

+ * mantissa and provide these values on hw.
+ *
+ * For more infos i think this pattent is related

patent

Quoted 7 lines
drivers/net/wireless/ath5k/reset.c +0 -3
@@ -53,13 +57,20 @@ static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah,
 		!(channel->hw_value & CHANNEL_OFDM))
 		BUG();
 
-	/* Seems there are two PLLs, one for baseband sampling and one
-	 * for tuning. Tuning basebands are 40 MHz or 80MHz when in
-	 * turbo. */

drivers/net/wireless/ath5k/reset.c static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, · line 68

Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +9 -1
-	clock = channel->hw_value & CHANNEL_TURBO ? 80 : 40;
+	/* Get coefficient
+	 * ALGO: coef = (5 * clock * carrier_freq) / 2)
+	 * we scale coef by shifting clock value by 24 for
+	 * better precision since we use integers */
+	/* TODO: Half/quarter rate */
+	clock = channel->hw_value & CHANNEL_TURBO ?
+				ath5k_hw_htoclock(1, true) :
+				ath5k_hw_htoclock(1, false);
+

Could be:

    clock = ath5k_hw_htoclock(1, channel->hw_value & CHANNEL_TURBO);

drivers/net/wireless/ath5k/reset.c static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, · line 76

Quoted 8 lines
drivers/net/wireless/ath5k/reset.c +2 -0
 	coef_scaled = ((5 * (clock << 24)) / 2) /
 	channel->center_freq;
 
+	/* Get exponent
+	 * ALGO: coe_exp = 14 - highest set bit position */
 	for (coef_exp = 31; coef_exp > 0; coef_exp--)
 		if ((coef_scaled >> coef_exp) & 0x1)
 			break;

I know this is existing code, but we could use something like get_bitmask_order() here or fls() instead of the open-coded loop. For some other patch.

Quoted 4 lines

/*
+ * If there is an external 32KHz crystal available, use it
+ * as ref. clock instead of 32/40MHz clock and baseband clocks
+ * to save power durring sleep or restore normal 32/40MHz

during

Quoted 6 lines

+ * operation.
+ *
+ * XXX: When operating on 32KHz certain PHY registers (27 - 31,
+ * 123 - 127) require delay on access.
+ */
+void ath5k_hw_set_sleep_clock(struct ath5k_hw *ah, bool enable)

ACK

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 544

Quoted 3 lines
drivers/net/wireless/ath5k/reset.c +3 -0
+static bool ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah,
+				struct ieee80211_channel *channel)
+{

ACK

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 612

Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +10 -0
+	/* Set DAC/ADC delays */
+	if (ah->ah_version == AR5K_AR5212) {
+		if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))
+			data = AR5K_PHY_SCAL_32MHZ_2417;
+		else if (ath5k_eeprom_is_hb63(ah))
+			data = AR5K_PHY_SCAL_32MHZ_HB63;
+		else
+			data = AR5K_PHY_SCAL_32MHZ;
+		ath5k_hw_reg_write(ah, data, AR5K_PHY_SCAL);
+		data = 0;

why data = 0; ?

Quoted 5 lines
drivers/net/wireless/ath5k/reset.c +5 -0
+	}
+
+	/* Set fast ADC */
+	if ((ah->ah_radio == AR5K_RF5413) ||
+	(ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) {

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 627

Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +10 -0
+		data = 1;
+
+		if (channel->center_freq == 2462 ||
+		channel->center_freq == 2467)
+			data = 0;
+
+		if (ath5k_hw_reg_read(ah, AR5K_PHY_FAST_ADC) != data)
+				ath5k_hw_reg_write(ah, data,
+						AR5K_PHY_FAST_ADC);
+		data = 0;

ditto

Quoted 4 lines
drivers/net/wireless/ath5k/reset.c +4 -0
+	}
+
+	/* Fix for first revision of the RF5112 RF chipset */
+	if (ah->ah_radio >= AR5K_RF5112 &&

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 641

Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +10 -0
+			ah->ah_radio_5ghz_revision <
+			AR5K_SREV_RAD_5112A) {
+		ath5k_hw_reg_write(ah, AR5K_PHY_CCKTXCTL_WORLD,
+				AR5K_PHY_CCKTXCTL);
+		if (channel->hw_value & CHANNEL_5GHZ)
+			data = 0xffb81020;
+		else
+			data = 0xffb80d20;
+		ath5k_hw_reg_write(ah, data, AR5K_PHY_FRAME_CTL);
+		data = 0;

ditto

Quoted 12 lines
drivers/net/wireless/ath5k/reset.c +12 -0
+	}
+
+	if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
+		/* 5311 has different tx/rx latency masks
+		 * from 5211, since we deal 5311 the same
+		 * as 5211 when setting initvals, shift
+		 * values here to their proper locations */
+		data = ath5k_hw_reg_read(ah, AR5K_USEC_5211);
+		ath5k_hw_reg_write(ah, data & (AR5K_USEC_1 |
+				AR5K_USEC_32 |
+				AR5K_USEC_TX_LATENCY_5211 |
+				AR5K_REG_SM(29,

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 663

Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +10 -0
+				AR5K_USEC_RX_LATENCY_5210)),
+				AR5K_USEC_5211);
+		/* Clear QCU/DCU clock gating register */
+		ath5k_hw_reg_write(ah, 0, AR5K_QCUDCU_CLKGT);
+		/* Set DAC/ADC delays */
+		ath5k_hw_reg_write(ah, 0x08, AR5K_PHY_SCAL);
+		/* Enable PCU FIFO corruption ECO */
+		AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW_5211,
+					AR5K_DIAG_SW_ECO_ENABLE);
+		data = 0;

ditto

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 539

Quoted 3 lines
drivers/net/wireless/ath5k/reset.c +3 -0
+	}
+
+	return;

No need for return.

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 673

Quoted 7 lines
drivers/net/wireless/ath5k/reset.c +7 -0
+}
+
+static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
+		struct ieee80211_channel *channel, u8 *ant, u8 ee_mode)
+{
+	struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
+	int16_t cck_ofdm_pwr_delta = 0;

I don't think you need to assign it, unless gcc is particularly dumb.

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 684

Quoted 11 lines
drivers/net/wireless/ath5k/reset.c +11 -0
+
+	/* Set CCK to OFDM power delta */
+	if (ah->ah_phy_revision > AR5K_SREV_PHY_5212A) {
+		/* Adjust power delta for channel 14 */
+		if (channel->center_freq == 2484)
+			cck_ofdm_pwr_delta =
+				((ee->ee_cck_ofdm_power_delta -
+				ee->ee_scaled_cck_delta) * 2) / 10;
+		else
+			cck_ofdm_pwr_delta =
+				ee->ee_cck_ofdm_power_delta;

missing * 2 / 10 here?

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 750

Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +9 -0
+
+		if (channel->hw_value == CHANNEL_G)
+			ath5k_hw_reg_write(ah,
+			AR5K_REG_SM((ee->ee_cck_ofdm_power_delta * -1),
[...]
+		AR5K_REG_WRITE_BITS(ah, AR5K_PHY_GAIN,
+				AR5K_PHY_GAIN_TXRX_ATTEN,
+				ee->ee_atn_tx_rx[ee_mode]);
+
+		/* ADC/PGA dezired size */

desired

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 778

Quoted 3 lines

[...]

drivers/net/wireless/ath5k/reset.c +2 -0
+
+	/* Thres64 (ANI) */

Thresh62 ?

Quoted 7 lines
drivers/net/wireless/ath5k/reset.c +6 -0
+	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_NF,
+			AR5K_PHY_NF_THRESH62,
+			ee->ee_thr_62[ee_mode]);
+
 
+	/* I/Q correction
+	 * TODO: Per channel i/q infos ? */

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 808

Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +10 -0
+	AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ,
+		AR5K_PHY_IQ_CORR_ENABLE |
+		(ee->ee_i_cal[ee_mode] << AR5K_PHY_IQ_CORR_Q_I_COFF_S) |
+		ee->ee_q_cal[ee_mode]);
+
+	/* Heavy clipping -disable for now */
+	if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_1)
+		ath5k_hw_reg_write(ah, 0, AR5K_PHY_HEAVY_CLIP_ENABLE);
+
+	return;

No need for return.

Quoted 1 line

+}

My eyes got tired, so I skipped a lot :)

drivers/net/wireless/ath5k/reset.c int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, · line 1148

Quoted 7 lines
drivers/net/wireless/ath5k/reset.c +7 -0
+
+	/* QoS NOACK Policy */
+	if (ah->ah_version == AR5K_AR5212) {
+		ath5k_hw_reg_write(ah,
+			AR5K_REG_SM(2, AR5K_QOS_NOACK_2BIT_VALUES) |
+			AR5K_REG_SM(5, AR5K_QOS_NOACK_BIT_OFFSET)  |
+			AR5K_REG_SM(0, AR5K_QOS_NOACK_BYTE_OFFSET),

AR5K_QOS_NOACK_BYTE_OFFSET_S is also wrong, should be 7.

drivers/net/wireless/ath5k/reset.c int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, · line 1151

Quoted 3 lines
drivers/net/wireless/ath5k/reset.c +3 -0
+			AR5K_QOS_NOACK);
+	}
+

Thanks!

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#2 lore raw

2009/1/31 Bob Copeland <[email protected]>:

Quoted 10 lines · Nick Kossifidis
Quoted 5 lines

* Update reset and sync with HALs
* Clean up eeprom settings and tweaking of initvals and put them on separate functions
* Set/Restore 32KHz ref clk operation
* Add some more documentation
TODO: Spur mitigation, tpc, half/quarter rate, compression etc

Awesome work! I just double checked it, I have some minor comments, on the whole looks very good.

Thanks a lot for the review ! ;-)

Quoted 4 lines
Quoted 1 line

Should be "Signed-off-by:" (lowercase O) according to checkpatch.

ACK, i just c/p it from my previous patches and it seems i got it wrong on all of them :P

Quoted 13 lines

drivers/net/wireless/ath5k/eeprom.c int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) · line 1458

Quoted 8 lines

[...]

drivers/net/wireless/ath5k/eeprom.c +7 -0
+bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah)
+{
+     u16 data;
+
+     ath5k_hw_eeprom_read(ah, AR5K_EEPROM_IS_HB63, &data);
+
+     if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4) && data))

Don't think it makes a difference, but judging from the double parens, I think you meant:

Quoted 1 line

+ if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4)) && data)

You are right, i'll change that...

Quoted 3 lines

Do we need to check for eeprom version 5.4 or better? HAL does.

Well ath5k_eeprom_is_hb63 is a temporary solution, i'll make a ath5k_hw_get_eeprom_info for all eeprom flags (rf kill, antenna gain etc) and use that instead.

Quoted 11 lines

drivers/net/wireless/ath5k/reg.h line 2161

Quoted 8 lines

[...]

drivers/net/wireless/ath5k/reg.h +2 -1
@@ -2156,7 +2157,8 @@
 #define      AR5K_PHY_ANT_CTL_TXRX_EN        0x00000001      /* Enable TX/RX (?) */
 #define      AR5K_PHY_ANT_CTL_SECTORED_ANT   0x00000004      /* Sectored Antenna */
 #define      AR5K_PHY_ANT_CTL_HITUNE5        0x00000008      /* Hitune5 (?) */
-#define      AR5K_PHY_ANT_CTL_SWTABLE_IDLE   0x00000010      /* Switch table idle (?) */
+#define      AR5K_PHY_ANT_CTL_SWTABLE_IDLE   0x000003f9      /* Switch table idle (?) */
+#define      AR5K_PHY_ANT_CTL_SWTABLE_IDLE_S 4

That doesn't look right.. should be 3f0? (still probably works, I guess).

I know, but HAL does this...

	AR_PHY_BIS(ah, 68, 0xFFFFFC06,
		(ee->ee_antennaControl[0][arrayMode] << 4) | 0x1);

~0xFFFFFC06 = 3F9

Quoted 5 lines

drivers/net/wireless/ath5k/reg.h line 2201

Quoted 2 lines
drivers/net/wireless/ath5k/reg.h +1 -1
-#define      AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_S     0
+#define      AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_S     1

Heh, we should write a little tool to check the shifts and masks :)

Yup :P

Quoted 11 lines

drivers/net/wireless/ath5k/reset.c line 41

Quoted 5 lines
drivers/net/wireless/ath5k/reset.c +2 -3
- * Write the OFDM timings for the AR5212 upon reset. This is a helper for
- * ath5k_hw_reset(). This seems to tune the PLL a specified frequency
- * depending on the bandwidth of the channel.
+ * Write the delta slope coefficient (used on pilot tracking ?) for OFDM
+ * operration on the AR5212 upon reset. This is a helper for ath5k_hw_reset().

operation

Quoted 2 lines

*
+ * Since delta slope is floating point we split it on it's exponent and

Quoted 8 lines

its

Quoted 3 lines

+ * mantissa and provide these values on hw.
+ *
+ * For more infos i think this pattent is related

patent

ACK

Quoted 21 lines
Quoted 7 lines
drivers/net/wireless/ath5k/reset.c +0 -3
@@ -53,13 +57,20 @@ static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah,
              !(channel->hw_value & CHANNEL_OFDM))
              BUG();
 
-     /* Seems there are two PLLs, one for baseband sampling and one
-      * for tuning. Tuning basebands are 40 MHz or 80MHz when in
-      * turbo. */

drivers/net/wireless/ath5k/reset.c static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, · line 68

Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +9 -1
-     clock = channel->hw_value & CHANNEL_TURBO ? 80 : 40;
+     /* Get coefficient
+      * ALGO: coef = (5 * clock * carrier_freq) / 2)
+      * we scale coef by shifting clock value by 24 for
+      * better precision since we use integers */
+     /* TODO: Half/quarter rate */
+     clock = channel->hw_value & CHANNEL_TURBO ?
+                             ath5k_hw_htoclock(1, true) :
+                             ath5k_hw_htoclock(1, false);
+

Could be:

Quoted 2 lines
   clock = ath5k_hw_htoclock(1, channel->hw_value & CHANNEL_TURBO);

My intention is to reimplement hw_htoclock to account for half/quarter rate so it'll soon be
clock = ath5k_hw_htoclock(1, channel->hw_value);

Quoted 9 lines

drivers/net/wireless/ath5k/reset.c static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, · line 76

Quoted 8 lines
drivers/net/wireless/ath5k/reset.c +2 -0
      coef_scaled = ((5 * (clock << 24)) / 2) /
      channel->center_freq;
 
+     /* Get exponent
+      * ALGO: coe_exp = 14 - highest set bit position */
      for (coef_exp = 31; coef_exp > 0; coef_exp--)
              if ((coef_scaled >> coef_exp) & 0x1)
                      break;
Quoted 4 lines

I know this is existing code, but we could use something like get_bitmask_order() here or fls() instead of the open-coded loop. For some other patch.

Sure thing, i was also looking for some fast bit operation but i didn't put it in

Quoted 19 lines
Quoted 4 lines

/*
+ * If there is an external 32KHz crystal available, use it
+ * as ref. clock instead of 32/40MHz clock and baseband clocks
+ * to save power durring sleep or restore normal 32/40MHz

during

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 612

Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +10 -0
+     /* Set DAC/ADC delays */
+     if (ah->ah_version == AR5K_AR5212) {
+             if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))
+                     data = AR5K_PHY_SCAL_32MHZ_2417;
+             else if (ath5k_eeprom_is_hb63(ah))
+                     data = AR5K_PHY_SCAL_32MHZ_HB63;
+             else
+                     data = AR5K_PHY_SCAL_32MHZ;
+             ath5k_hw_reg_write(ah, data, AR5K_PHY_SCAL);
+             data = 0;
Quoted 2 lines

why data = 0; ?

Instead of having multiple temporary variables, i use only "data". To be sure that "data" is ok for use i always zero it each time i use it so that we don't write any weird stuff by mistake.

Quoted 7 lines

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 539

Quoted 4 lines
drivers/net/wireless/ath5k/reset.c +3 -0
+     }
+
+     return;

No need for return.

It's for my eyes mostly

Quoted 10 lines

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 673

Quoted 7 lines
drivers/net/wireless/ath5k/reset.c +7 -0
+}
+
+static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
+             struct ieee80211_channel *channel, u8 *ant, u8 ee_mode)
+{
+     struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
+     int16_t cck_ofdm_pwr_delta = 0;

I don't think you need to assign it, unless gcc is particularly dumb.

I agree but it's a good practice to initialize vars and it's free

Quoted 12 lines

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 684

Quoted 11 lines
drivers/net/wireless/ath5k/reset.c +11 -0
+
+     /* Set CCK to OFDM power delta */
+     if (ah->ah_phy_revision > AR5K_SREV_PHY_5212A) {
+             /* Adjust power delta for channel 14 */
+             if (channel->center_freq == 2484)
+                     cck_ofdm_pwr_delta =
+                             ((ee->ee_cck_ofdm_power_delta -
+                             ee->ee_scaled_cck_delta) * 2) / 10;
+             else
+                     cck_ofdm_pwr_delta =
+                             ee->ee_cck_ofdm_power_delta;
Quoted 2 lines

missing * 2 / 10 here?

Ouch ! Nice catch ;-)

Quoted 13 lines

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 750

Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +9 -0
+
+             if (channel->hw_value == CHANNEL_G)
+                     ath5k_hw_reg_write(ah,
+                     AR5K_REG_SM((ee->ee_cck_ofdm_power_delta * -1),
[...]
+             AR5K_REG_WRITE_BITS(ah, AR5K_PHY_GAIN,
+                             AR5K_PHY_GAIN_TXRX_ATTEN,
+                             ee->ee_atn_tx_rx[ee_mode]);
+
+             /* ADC/PGA dezired size */

desired

Quoted 6 lines

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 778

Quoted 3 lines

[...]

drivers/net/wireless/ath5k/reset.c +2 -0
+
+     /* Thres64 (ANI) */

Thresh62 ?

Yup, I mispelled it

Quoted 10 lines

drivers/net/wireless/ath5k/reset.c int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, · line 1148

Quoted 7 lines
drivers/net/wireless/ath5k/reset.c +7 -0
+
+     /* QoS NOACK Policy */
+     if (ah->ah_version == AR5K_AR5212) {
+             ath5k_hw_reg_write(ah,
+                     AR5K_REG_SM(2, AR5K_QOS_NOACK_2BIT_VALUES) |
+                     AR5K_REG_SM(5, AR5K_QOS_NOACK_BIT_OFFSET)  |
+                     AR5K_REG_SM(0, AR5K_QOS_NOACK_BYTE_OFFSET),

AR5K_QOS_NOACK_BYTE_OFFSET_S is also wrong, should be 7.

ACK

Thanks a lot for your comments, i'll address them asap and come up with a new version of this patch ;-)

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#3 lore raw
Quoted 12 lines · Nick Kossifidis
Quoted 11 lines

drivers/net/wireless/ath5k/reg.h line 2161

Quoted 8 lines

[...]

drivers/net/wireless/ath5k/reg.h +2 -1
@@ -2156,7 +2157,8 @@
 #define      AR5K_PHY_ANT_CTL_TXRX_EN        0x00000001      /* Enable TX/RX (?) */
 #define      AR5K_PHY_ANT_CTL_SECTORED_ANT   0x00000004      /* Sectored Antenna */
 #define      AR5K_PHY_ANT_CTL_HITUNE5        0x00000008      /* Hitune5 (?) */
-#define      AR5K_PHY_ANT_CTL_SWTABLE_IDLE   0x00000010      /* Switch table idle (?) */
+#define      AR5K_PHY_ANT_CTL_SWTABLE_IDLE   0x000003f9      /* Switch table idle (?) */
+#define      AR5K_PHY_ANT_CTL_SWTABLE_IDLE_S 4

That doesn't look right.. should be 3f0? (still probably works, I guess).

Quoted 5 lines

I know, but HAL does this...

	AR_PHY_BIS(ah, 68, 0xFFFFFC06,
		(ee->ee_antennaControl[0][arrayMode] << 4) | 0x1);

~0xFFFFFC06 = 3F9

How about splitting it up and making the 0x1 a separate flag?

Quoted 3 lines

My intention is to reimplement hw_htoclock to account for half/quarter rate so it'll soon be
clock = ath5k_hw_htoclock(1, channel->hw_value);

AFAIK Sam's HAL might have a bug there. If I remember correctly, the MAC runs at the same clock speed with Half/Quarter rate.
It's done that way in the legacy HAL. Though there is a possibility of it being hardware dependent, I'm pretty sure that it is that way at least on 5413.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +10 -0
+     /* Set DAC/ADC delays */
+     if (ah->ah_version == AR5K_AR5212) {
+             if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))
+                     data = AR5K_PHY_SCAL_32MHZ_2417;
+             else if (ath5k_eeprom_is_hb63(ah))
+                     data = AR5K_PHY_SCAL_32MHZ_HB63;
+             else
+                     data = AR5K_PHY_SCAL_32MHZ;
+             ath5k_hw_reg_write(ah, data, AR5K_PHY_SCAL);
+             data = 0;
Quoted 5 lines
Quoted 2 lines

why data = 0; ?

Instead of having multiple temporary variables, i use only "data". To be sure that "data" is ok for use i always zero it each time i use it so that we don't write any weird stuff by mistake.

Wouldn't multiple temporary values be preferable, since the compiler optimizes that stuff anyway?

- Felix

#4 lore raw

2009/1/31 Felix Fietkau <[email protected]>:

Quoted 13 lines
Quoted 12 lines · Nick Kossifidis
Quoted 11 lines

drivers/net/wireless/ath5k/reg.h line 2161

Quoted 8 lines

[...]

drivers/net/wireless/ath5k/reg.h +2 -1
@@ -2156,7 +2157,8 @@
 #define      AR5K_PHY_ANT_CTL_TXRX_EN        0x00000001      /* Enable TX/RX (?) */
 #define      AR5K_PHY_ANT_CTL_SECTORED_ANT   0x00000004      /* Sectored Antenna */
 #define      AR5K_PHY_ANT_CTL_HITUNE5        0x00000008      /* Hitune5 (?) */
-#define      AR5K_PHY_ANT_CTL_SWTABLE_IDLE   0x00000010      /* Switch table idle (?) */
+#define      AR5K_PHY_ANT_CTL_SWTABLE_IDLE   0x000003f9      /* Switch table idle (?) */
+#define      AR5K_PHY_ANT_CTL_SWTABLE_IDLE_S 4

That doesn't look right.. should be 3f0? (still probably works, I guess).

Quoted 7 lines
Quoted 5 lines

I know, but HAL does this...

      AR_PHY_BIS(ah, 68, 0xFFFFFC06,
              (ee->ee_antennaControl[0][arrayMode] << 4) | 0x1);

~0xFFFFFC06 = 3F9

How about splitting it up and making the 0x1 a separate flag?

Agree, i'll change eeprom.c too...

	/* Get antenna modes */
	ah->ah_antenna[mode][0] =
	    (ee->ee_ant_control[mode][0] << 4) | 0x1;
Quoted 9 lines
Quoted 3 lines

My intention is to reimplement hw_htoclock to account for half/quarter rate so it'll soon be
clock = ath5k_hw_htoclock(1, channel->hw_value);

AFAIK Sam's HAL might have a bug there. If I remember correctly, the MAC runs at the same clock speed with Half/Quarter rate.
It's done that way in the legacy HAL. Though there is a possibility of it being hardware dependent, I'm pretty sure that it is that way at least on 5413.

Both HALs tweak clock this way on ar5212SetDeltaSlope on all chips. If clock depends on channel bandwidth for turbo it makes sense to also change on half/quarter rate operation.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +10 -0
+     /* Set DAC/ADC delays */
+     if (ah->ah_version == AR5K_AR5212) {
+             if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))
+                     data = AR5K_PHY_SCAL_32MHZ_2417;
+             else if (ath5k_eeprom_is_hb63(ah))
+                     data = AR5K_PHY_SCAL_32MHZ_HB63;
+             else
+                     data = AR5K_PHY_SCAL_32MHZ;
+             ath5k_hw_reg_write(ah, data, AR5K_PHY_SCAL);
+             data = 0;
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

why data = 0; ?

Instead of having multiple temporary variables, i use only "data". To be sure that "data" is ok for use i always zero it each time i use it so that we don't write any weird stuff by mistake.

Wouldn't multiple temporary values be preferable, since the compiler optimizes that stuff anyway?

Hmm, you are right, i just opened ath5k.o with IDA and it seems hw_reset has too many ints so what i'm doing is probably confusing for gcc.

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#5 lore raw
Quoted 10 lines · Nick Kossifidis
Quoted 9 lines
Quoted 3 lines

My intention is to reimplement hw_htoclock to account for half/quarter rate so it'll soon be
clock = ath5k_hw_htoclock(1, channel->hw_value);

AFAIK Sam's HAL might have a bug there. If I remember correctly, the MAC runs at the same clock speed with Half/Quarter rate.
It's done that way in the legacy HAL. Though there is a possibility of it being hardware dependent, I'm pretty sure that it is that way at least on 5413.

Quoted 3 lines

Both HALs tweak clock this way on ar5212SetDeltaSlope on all chips. If clock depends on channel bandwidth for turbo it makes sense to also change on half/quarter rate operation.

Yeah, for the delta slope it may be the same, but not for the MAC, IMHO. Check out ath_hal_mac_clks in the legacy HAL and Sam's HAL. I believe the legacy HAL variant is correct in this case.

- Felix

#6 lore raw
In reply to Nick Kossifidis
Quoted 4 lines · Nick Kossifidis
Quoted 2 lines

Heh, we should write a little tool to check the shifts and masks :)

Yup :P

I just wrote one, I can post it later :) It also found:

AR5K_PHY_SIGMA_DELTA_ADC_CLIP 0x01ff3000 13

Should be 12 or a different mask...

Quoted 2 lines

Thanks a lot for your comments, i'll address them asap and come up with a new version of this patch ;-)

My computer also hangs with the whole series... reverting the reset part makes it work. I'll try and narrow that down later when I get some time.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#7 lore raw

2009/2/1 Bob Copeland <[email protected]>:

Quoted 12 lines · Nick Kossifidis
Quoted 4 lines
Quoted 2 lines

Heh, we should write a little tool to check the shifts and masks :)

Yup :P

I just wrote one, I can post it later :) It also found:

AR5K_PHY_SIGMA_DELTA_ADC_CLIP 0x01ff3000 13

Should be 12 or a different mask...

ACK

Quoted 7 lines
Quoted 2 lines

Thanks a lot for your comments, i'll address them asap and come up with a new version of this patch ;-)

My computer also hangs with the whole series... reverting the reset part makes it work. I'll try and narrow that down later when I get some time.

O.K. i'll work on the other issues and when you find the problem let me know so i can resend reset patch.

Are you all ok on the rest 4 patches ?

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#8 lore raw
Quoted 1 line · Nick Kossifidis

Are you all ok on the rest 4 patches ?

I skimmed the rest of the patches, all look good to me.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#9 lore raw
In reply to Bob Copeland

2009/2/1 Bob Copeland <[email protected]>:

Quoted 12 lines · Nick Kossifidis
Quoted 4 lines
Quoted 2 lines

Heh, we should write a little tool to check the shifts and masks :)

Yup :P

I just wrote one, I can post it later :) It also found:

AR5K_PHY_SIGMA_DELTA_ADC_CLIP 0x01ff3000 13

Should be 12 or a different mask...

13 is correct

0x01ff3000 -> 1111111111110000000000000

12 only counts the 3 zeros (3 * 4)

I've fixed all things mentioned so far, as soon as you find out why it hangs on your pc we can move on ;-)

Again thanks a lot for the review ;-)

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#10 lore raw
Quoted 9 lines · Nick Kossifidis

2009/2/1 Bob Copeland <[email protected]>:

Quoted 8 lines · Nick Kossifidis
Quoted 4 lines
Quoted 2 lines

Heh, we should write a little tool to check the shifts and masks :)

Yup :P

I just wrote one, I can post it later :) It also found:

Quoted 8 lines
Quoted 4 lines

AR5K_PHY_SIGMA_DELTA_ADC_CLIP 0x01ff3000 13

Should be 12 or a different mask...

13 is correct

0x01ff3000 -> 1111111111110000000000000

I think it's 1111111110011000000000000? :)

This mask makes 12 seem more likely.

- Felix

#11 lore raw

2009/2/1 Felix Fietkau <[email protected]>:

Quoted 15 lines
Quoted 14 lines · Nick Kossifidis

2009/2/1 Bob Copeland <[email protected]>:

Quoted 12 lines · Nick Kossifidis
Quoted 4 lines
Quoted 2 lines

Heh, we should write a little tool to check the shifts and masks :)

Yup :P

I just wrote one, I can post it later :) It also found:

AR5K_PHY_SIGMA_DELTA_ADC_CLIP 0x01ff3000 13

Should be 12 or a different mask...

Quoted 9 lines
Quoted 3 lines

13 is correct

0x01ff3000 -> 1111111111110000000000000

I think it's 1111111110011000000000000? :)

This mask makes 12 seem more likely.

- Felix

Maybe it's in big endian format (we don't know anything about this reg anyway :P), both HALs have 13 plus it doesn't make sense to have a field split.

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#12 lore raw
Quoted 21 lines · Nick Kossifidis

2009/2/1 Felix Fietkau <[email protected]>:

Quoted 20 lines
Quoted 9 lines · Nick Kossifidis

2009/2/1 Bob Copeland <[email protected]>:

Quoted 8 lines · Nick Kossifidis
Quoted 4 lines
Quoted 2 lines

Heh, we should write a little tool to check the shifts and masks :)

Yup :P

I just wrote one, I can post it later :) It also found:

Quoted 8 lines
Quoted 4 lines

AR5K_PHY_SIGMA_DELTA_ADC_CLIP 0x01ff3000 13

Should be 12 or a different mask...

13 is correct

0x01ff3000 -> 1111111111110000000000000

I think it's 1111111110011000000000000? :)

Quoted 8 lines
Quoted 4 lines

This mask makes 12 seem more likely.

- Felix

Maybe it's in big endian format (we don't know anything about this reg anyway :P), both HALs have 13 plus it doesn't make sense to have a field split.

Ah, figured it out. It's a typo :)
Here are the settings from Sam's HAL:

#define   AR_PHY_SIGMA_DELTA_ADC_CLIP     0x01FFE000
#define   AR_PHY_SIGMA_DELTA_ADC_CLIP_S   13

Which does make a lot more sense than 0x01FF3000 :)

- Felix

#13 lore raw

2009/2/1 Felix Fietkau <[email protected]>:

Quoted 33 lines
Quoted 21 lines · Nick Kossifidis

2009/2/1 Felix Fietkau <[email protected]>:

Quoted 20 lines
Quoted 9 lines · Nick Kossifidis

2009/2/1 Bob Copeland <[email protected]>:

Quoted 8 lines · Nick Kossifidis
Quoted 4 lines
Quoted 2 lines

Heh, we should write a little tool to check the shifts and masks :)

Yup :P

I just wrote one, I can post it later :) It also found:

Quoted 8 lines
Quoted 4 lines

AR5K_PHY_SIGMA_DELTA_ADC_CLIP 0x01ff3000 13

Should be 12 or a different mask...

13 is correct

0x01ff3000 -> 1111111111110000000000000

I think it's 1111111110011000000000000? :)

Quoted 8 lines
Quoted 4 lines

This mask makes 12 seem more likely.

- Felix

Maybe it's in big endian format (we don't know anything about this reg anyway :P), both HALs have 13 plus it doesn't make sense to have a field split.

Ah, figured it out. It's a typo :)
Here are the settings from Sam's HAL:

Quoted 7 lines
#define   AR_PHY_SIGMA_DELTA_ADC_CLIP     0x01FFE000
#define   AR_PHY_SIGMA_DELTA_ADC_CLIP_S   13

Which does make a lot more sense than 0x01FF3000 :)

- Felix

/me has to get a new pair of glasses :P

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#14 lore raw
In reply to Nick Kossifidis

On Sat, 31 Jan 2009 04:31:47 +0200, Nick Kossifidis wrote

Quoted 2 lines

int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
struct ieee80211_channel *channel, bool change_channel)

Here's another thing I just noticed:

drivers/net/wireless/ath5k/reset.c int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) · line 817

Quoted 2 lines

{

drivers/net/wireless/ath5k/reset.c +1 -0
+	u32 s_seq[10], s_ant, s_led[3], staid1_flags, tsf_up, tsf_lo;

s_seq is now an array (we used to initialize s_seq to 0)

[...]

Quoted 6 lines
drivers/net/wireless/ath5k/reset.c +6 -0
+		if (change_channel) {
+			/*
+			 * Save frame sequence count
+			 * For revs. after Oahu, only save
+			 * seq num for DCU 0 (Global seq num)
+			 */

drivers/net/wireless/ath5k/reset.c int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, · line 900

Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +10 -0
+			if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
+
+				for (i = 0; i < 10; i++)
+					s_seq[i] = ath5k_hw_reg_read(ah,
+						AR5K_QUEUE_DCU_SEQNUM(i));
+
+			} else {
+				s_seq[0] = ath5k_hw_reg_read(ah,
+						AR5K_QUEUE_DCU_SEQNUM(0));
+			}

We only save the DCU sequence values if changing a channel

[...]

drivers/net/wireless/ath5k/reset.c int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, · line 1092

Quoted 11 lines
drivers/net/wireless/ath5k/reset.c +9 -1
 	if (ah->ah_version != AR5K_AR5210) {
-		ath5k_hw_reg_write(ah, s_seq, AR5K_QUEUE_DFS_SEQNUM(0));
+
+		if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
+			for (i = 0; i < 10; i++)
+				ath5k_hw_reg_write(ah, s_seq[i],
+					AR5K_QUEUE_DCU_SEQNUM(i));
+		} else {
+			ath5k_hw_reg_write(ah, s_seq[0],
+				AR5K_QUEUE_DCU_SEQNUM(0));
+		}

But always write it. The old code did this too, the only difference was we explicitly initialized the s_seq[0] to 0. Since it's an array, gcc won't warn about it but s_seq[] probably has random crap in it.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#15 lore raw

2009/2/3 Bob Copeland <[email protected]>:

Quoted 45 lines

On Sat, 31 Jan 2009 04:31:47 +0200, Nick Kossifidis wrote

Quoted 2 lines

int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
struct ieee80211_channel *channel, bool change_channel)

Here's another thing I just noticed:

Quoted 2 lines

{
+ u32 s_seq[10], s_ant, s_led[3], staid1_flags, tsf_up, tsf_lo;

s_seq is now an array (we used to initialize s_seq to 0)

[...]

Quoted 6 lines
drivers/net/wireless/ath5k/reset.c +6 -0
+             if (change_channel) {
+                     /*
+                      * Save frame sequence count
+                      * For revs. after Oahu, only save
+                      * seq num for DCU 0 (Global seq num)
+                      */

drivers/net/wireless/ath5k/reset.c int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, · line 900

Quoted 10 lines
drivers/net/wireless/ath5k/reset.c +10 -0
+                     if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
+
+                             for (i = 0; i < 10; i++)
+                                     s_seq[i] = ath5k_hw_reg_read(ah,
+                                             AR5K_QUEUE_DCU_SEQNUM(i));
+
+                     } else {
+                             s_seq[0] = ath5k_hw_reg_read(ah,
+                                             AR5K_QUEUE_DCU_SEQNUM(0));
+                     }

We only save the DCU sequence values if changing a channel

[...]

drivers/net/wireless/ath5k/reset.c int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, · line 1092

Quoted 11 lines
      if (ah->ah_version != AR5K_AR5210) {
drivers/net/wireless/ath5k/reset.c +9 -1
-             ath5k_hw_reg_write(ah, s_seq, AR5K_QUEUE_DFS_SEQNUM(0));
+
+             if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
+                     for (i = 0; i < 10; i++)
+                             ath5k_hw_reg_write(ah, s_seq[i],
+                                     AR5K_QUEUE_DCU_SEQNUM(i));
+             } else {
+                     ath5k_hw_reg_write(ah, s_seq[0],
+                             AR5K_QUEUE_DCU_SEQNUM(0));
+             }
Quoted 4 lines

But always write it. The old code did this too, the only difference was we explicitly initialized the s_seq[0] to 0. Since it's an array, gcc won't warn about it but s_seq[] probably has random crap in it.

Nice catch ;-)

Another difference i remembered is that we now don't set the TPC register to 3f (until we fix the whole tx power stuff). I'll try to reproduce this with my ar2425 as it turns it also has problems.

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#16 lore raw
Quoted 5 lines · Nick Kossifidis

Nice catch ;-)

Another difference i remembered is that we now don't set the TPC register to 3f (until we fix the whole tx power stuff). I'll try to reproduce this with my ar2425 as it turns it also has problems.

And the winning hunk is:

        if (ah->ah_version != AR5K_AR5210) {
                ath5k_hw_reg_write(ah, 0xffffffff, AR5K_PISR);
-               /* If we later allow tuning for this, store into sc structure */
-               data = AR5K_TUNE_RSSI_THRES |
-                       AR5K_TUNE_BMISS_THRES << AR5K_RSSI_THR_BMISS_S;
-               ath5k_hw_reg_write(ah, data, AR5K_RSSI_THR);
        }

(hmm, bmiss threshold, should've seen that before...)

With that reverted from the rest of the patchset, I no longer get the interrupt storm. I do seem to get an occasional lockup at association time, but I haven't caught an oops for that yet. It could be unrelated.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#17 lore raw

2009/2/4 Bob Copeland <[email protected]>:

Quoted 17 lines · Nick Kossifidis
Quoted 5 lines

Nice catch ;-)

Another difference i remembered is that we now don't set the TPC register to 3f (until we fix the whole tx power stuff). I'll try to reproduce this with my ar2425 as it turns it also has problems.

And the winning hunk is:

       if (ah->ah_version != AR5K_AR5210) {
               ath5k_hw_reg_write(ah, 0xffffffff, AR5K_PISR);
drivers/net/wireless/ath5k/reset.c +0 -4
-               /* If we later allow tuning for this, store into sc structure */
-               data = AR5K_TUNE_RSSI_THRES |
-                       AR5K_TUNE_BMISS_THRES << AR5K_RSSI_THR_BMISS_S;
-               ath5k_hw_reg_write(ah, data, AR5K_RSSI_THR);
       }
Quoted 6 lines

(hmm, bmiss threshold, should've seen that before...)

With that reverted from the rest of the patchset, I no longer get the interrupt storm. I do seem to get an occasional lockup at association time, but I haven't caught an oops for that yet. It could be unrelated.

O.K. i got that from legacy HAL. It first reads the register and if it's zeroed it sets to the default value of 0x781 (which is the same really, it's AR5K_TUNE_RSSI_THRES | AR5K_TUNE_BMISS_THRES << AR5K_RSSI_THR_BMISS_S), if not it saves it and restores it after reset is done.

So can you see why this

	/* Save RSSI thresholds (they 'll get zeroed from initvals) */
	rssi_thr = ath5k_hw_reg_read(ah, AR5K_RSSI_THR);
	/* If they are not set, set the default value */
	if (!rssi_thr)
		rssi_thr = AR5K_INIT_RSSI_THR;

doesn't work ? What is the value of rssi_trh if not zero ?

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#18 lore raw

2009/2/4 Nick Kossifidis <[email protected]>:

Quoted 33 lines

2009/2/4 Bob Copeland <[email protected]>:

Quoted 17 lines · Nick Kossifidis
Quoted 5 lines

Nice catch ;-)

Another difference i remembered is that we now don't set the TPC register to 3f (until we fix the whole tx power stuff). I'll try to reproduce this with my ar2425 as it turns it also has problems.

And the winning hunk is:

       if (ah->ah_version != AR5K_AR5210) {
               ath5k_hw_reg_write(ah, 0xffffffff, AR5K_PISR);
drivers/net/wireless/ath5k/reset.c +0 -4
-               /* If we later allow tuning for this, store into sc structure */
-               data = AR5K_TUNE_RSSI_THRES |
-                       AR5K_TUNE_BMISS_THRES << AR5K_RSSI_THR_BMISS_S;
-               ath5k_hw_reg_write(ah, data, AR5K_RSSI_THR);
       }
Quoted 6 lines

(hmm, bmiss threshold, should've seen that before...)

With that reverted from the rest of the patchset, I no longer get the interrupt storm. I do seem to get an occasional lockup at association time, but I haven't caught an oops for that yet. It could be unrelated.

O.K. i got that from legacy HAL. It first reads the register and if it's zeroed it sets to the default value of 0x781 (which is the same really, it's AR5K_TUNE_RSSI_THRES | AR5K_TUNE_BMISS_THRES << AR5K_RSSI_THR_BMISS_S), if not it saves it and restores it after reset is done.

So can you see why this

Quoted 8 lines
       /* Save RSSI thresholds (they 'll get zeroed from initvals) */
       rssi_thr = ath5k_hw_reg_read(ah, AR5K_RSSI_THR);
       /* If they are not set, set the default value */
       if (!rssi_thr)
               rssi_thr = AR5K_INIT_RSSI_THR;

doesn't work ? What is the value of rssi_trh if not zero ?

Gotcha ;-)
rssi_thr: 0x40

I checked the docs and it seems this register is not changed by the hw, so somewhere we write 0x40 on this register or something else happens. I'll do some more research on that...

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#19 lore raw
In reply to Nick Kossifidis

* Update reset and sync with HALs
* Clean up eeprom settings and tweaking of initvals and put them on separate functions
* Set/Restore 32KHz ref clk operation
* Add some more documentation
TODO: Spur mitigation, tpc, half/quarter rate, compression etc

v2: Address comments from Bob and Felix and fix RSSI threshold bug introduced on the first version of the patch

---
 drivers/net/wireless/ath5k/ath5k.h  |   11 +-
 drivers/net/wireless/ath5k/attach.c |   16 +-
 drivers/net/wireless/ath5k/eeprom.c |   14 +-
 drivers/net/wireless/ath5k/eeprom.h |    1 +
 drivers/net/wireless/ath5k/reg.h    |   56 +-
 drivers/net/wireless/ath5k/reset.c  |  930 +++++++++++++++++++++++++----------
 6 files changed, 732 insertions(+), 296 deletions(-)
drivers/net/wireless/ath5k/ath5k.h +7 -4
index 5b2e0da..b9af2b8 100644
@@ -222,6 +222,7 @@
 #endif
 
 /* Initial values */
+#define	AR5K_INIT_CYCRSSI_THR1			2
 #define AR5K_INIT_TX_LATENCY			502
 #define AR5K_INIT_USEC				39
 #define AR5K_INIT_USEC_TURBO			79
@@ -313,7 +314,7 @@ struct ath5k_srev_name {
 #define AR5K_SREV_AR5424	0x90 /* Condor */
 #define AR5K_SREV_AR5413	0xa4 /* Eagle lite */
 #define AR5K_SREV_AR5414	0xa0 /* Eagle */
-#define AR5K_SREV_AR2415	0xb0 /* Cobra */
+#define AR5K_SREV_AR2415	0xb0 /* Talon */
 #define AR5K_SREV_AR5416	0xc0 /* PCI-E */
 #define AR5K_SREV_AR5418	0xca /* PCI-E */
 #define AR5K_SREV_AR2425	0xe0 /* Swan */
@@ -331,7 +332,7 @@ struct ath5k_srev_name {
 #define	AR5K_SREV_RAD_2112B	0x46
 #define AR5K_SREV_RAD_2413	0x50
 #define AR5K_SREV_RAD_5413	0x60
-#define AR5K_SREV_RAD_2316	0x70
+#define AR5K_SREV_RAD_2316	0x70 /* Cobra SoC */
 #define AR5K_SREV_RAD_2317	0x80
 #define AR5K_SREV_RAD_5424	0xa0 /* Mostly same as 5413 */
 #define AR5K_SREV_RAD_2425	0xa2
@@ -340,7 +341,7 @@ struct ath5k_srev_name {
 #define AR5K_SREV_PHY_5211	0x30
 #define AR5K_SREV_PHY_5212	0x41
 #define	AR5K_SREV_PHY_5212A	0x42
-#define AR5K_SREV_PHY_2112B	0x43
+#define AR5K_SREV_PHY_5212B	0x43
 #define AR5K_SREV_PHY_2413	0x45
 #define AR5K_SREV_PHY_5413	0x61
 #define AR5K_SREV_PHY_2425	0x70
@@ -1030,7 +1031,6 @@ struct ath5k_hw {
 	u16			ah_phy_revision;
 	u16			ah_radio_5ghz_revision;
 	u16			ah_radio_2ghz_revision;
-	u32			ah_phy_spending;
 
 	enum ath5k_version	ah_version;
 	enum ath5k_radio	ah_radio;
@@ -1156,6 +1156,7 @@ extern void ath5k_hw_update_mib_counters(struct ath5k_hw *ah, struct ieee80211_l
 /* EEPROM access functions */
 extern int ath5k_eeprom_init(struct ath5k_hw *ah);
 extern int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac);
+extern bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah);
 
 /* Protocol Control Unit Functions */
 extern int ath5k_hw_set_opmode(struct ath5k_hw *ah);
@@ -1258,6 +1259,7 @@ extern int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, unsigned int power);
 
 /*
  * Translate usec to hw clock units
+ * TODO: Half/quarter rate
  */
 static inline unsigned int ath5k_hw_htoclock(unsigned int usec, bool turbo)
 {
@@ -1266,6 +1268,7 @@ static inline unsigned int ath5k_hw_htoclock(unsigned int usec, bool turbo)
 
 /*
  * Translate hw clock units to usec
+ * TODO: Half/quarter rate
  */
 static inline unsigned int ath5k_hw_clocktoh(unsigned int clock, bool turbo)
 {
drivers/net/wireless/ath5k/attach.c +2 -14
index a3f07a4..05bc5cb 100644
@@ -169,7 +169,6 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 		ah->ah_single_chip = false;
 		ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
 							CHANNEL_2GHZ);
-		ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5111;
 		break;
 	case AR5K_SREV_RAD_5112:
 	case AR5K_SREV_RAD_2112:
@@ -177,38 +176,31 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 		ah->ah_single_chip = false;
 		ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
 							CHANNEL_2GHZ);
-		ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112;
 		break;
 	case AR5K_SREV_RAD_2413:
 		ah->ah_radio = AR5K_RF2413;
 		ah->ah_single_chip = true;
-		ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2413;
 		break;
 	case AR5K_SREV_RAD_5413:
 		ah->ah_radio = AR5K_RF5413;
 		ah->ah_single_chip = true;
-		ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
 		break;
 	case AR5K_SREV_RAD_2316:
 		ah->ah_radio = AR5K_RF2316;
 		ah->ah_single_chip = true;
-		ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2316;
 		break;
 	case AR5K_SREV_RAD_2317:
 		ah->ah_radio = AR5K_RF2317;
 		ah->ah_single_chip = true;
-		ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2317;
 		break;
 	case AR5K_SREV_RAD_5424:
 		if (ah->ah_mac_version == AR5K_SREV_AR2425 ||
 		ah->ah_mac_version == AR5K_SREV_AR2417){
 			ah->ah_radio = AR5K_RF2425;
 			ah->ah_single_chip = true;
-			ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2425;
 		} else {
 			ah->ah_radio = AR5K_RF5413;
 			ah->ah_single_chip = true;
-			ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
 		}
 		break;
 	default:
@@ -227,29 +219,25 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 			ah->ah_radio = AR5K_RF2425;
 			ah->ah_single_chip = true;
 			ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2425;
-			ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2425;
 		} else if (srev == AR5K_SREV_AR5213A &&
-		ah->ah_phy_revision == AR5K_SREV_PHY_2112B) {
+		ah->ah_phy_revision == AR5K_SREV_PHY_5212B) {
 			ah->ah_radio = AR5K_RF5112;
 			ah->ah_single_chip = false;
-			ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2112B;
+			ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_5112B;
 		} else if (ah->ah_mac_version == (AR5K_SREV_AR2415 >> 4)) {
 			ah->ah_radio = AR5K_RF2316;
 			ah->ah_single_chip = true;
 			ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2316;
-			ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2316;
 		} else if (ah->ah_mac_version == (AR5K_SREV_AR5414 >> 4) ||
 		ah->ah_phy_revision == AR5K_SREV_PHY_5413) {
 			ah->ah_radio = AR5K_RF5413;
 			ah->ah_single_chip = true;
 			ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_5413;
-			ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
 		} else if (ah->ah_mac_version == (AR5K_SREV_AR2414 >> 4) ||
 		ah->ah_phy_revision == AR5K_SREV_PHY_2413) {
 			ah->ah_radio = AR5K_RF2413;
 			ah->ah_single_chip = true;
 			ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2413;
-			ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2413;
 		} else {
 			ATH5K_ERR(sc, "Couldn't identify radio revision.\n");
 			ret = -ENODEV;
drivers/net/wireless/ath5k/eeprom.c +13 -1
index b4ec539..21b9334 100644
@@ -204,7 +204,7 @@ static int ath5k_eeprom_read_ants(struct ath5k_hw *ah, u32 *offset,
 
 	/* Get antenna modes */
 	ah->ah_antenna[mode][0] =
-	    (ee->ee_ant_control[mode][0] << 4) | 0x1;
+	    (ee->ee_ant_control[mode][0] << 4);
 	ah->ah_antenna[mode][AR5K_ANT_FIXED_A] =
 	     ee->ee_ant_control[mode][1] 	|
 	    (ee->ee_ant_control[mode][2] << 6) 	|
@@ -1412,6 +1412,7 @@ ath5k_eeprom_init(struct ath5k_hw *ah)
 
 	return 0;
 }
+
 /*
  * Read the MAC address from eeprom
  */
@@ -1448,3 +1449,14 @@ int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
 	return 0;
 }
 
+bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah)
+{
+	u16 data;
+
+	ath5k_hw_eeprom_read(ah, AR5K_EEPROM_IS_HB63, &data);
+
+	if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4)) && data)
+		return true;
+	else
+		return false;
+}
drivers/net/wireless/ath5k/eeprom.h +1 -0
index 09eb7d0..1deebc0 100644
@@ -25,6 +25,7 @@
 #define AR5K_EEPROM_MAGIC_5211		0x0000145b /* 5211 */
 #define AR5K_EEPROM_MAGIC_5210		0x0000145a /* 5210 */
 
+#define	AR5K_EEPROM_IS_HB63		0x000b	/* Talon detect */
 #define AR5K_EEPROM_REG_DOMAIN		0x00bf	/* EEPROM regdom */
 #define AR5K_EEPROM_CHECKSUM		0x00c0	/* EEPROM checksum */
 #define AR5K_EEPROM_INFO_BASE		0x00c0	/* EEPROM header */
drivers/net/wireless/ath5k/reg.h +28 -28

150 lines not on this page · raw message

drivers/net/wireless/ath5k/reset.c +681 -249

1,160 lines not on this page · raw message

#20 lore raw

On Wed, 4 Feb 2009 23:57:06 +0200, Nick Kossifidis wrote

Quoted 2 lines

* Update reset and sync with HALs
* Clean up eeprom settings and tweaking of initvals and put them on

separate functions

Quoted 8 lines

* Set/Restore 32KHz ref clk operation
* Add some more documentation
TODO: Spur mitigation, tpc, half/quarter rate, compression etc

v2: Address comments from Bob and Felix and fix RSSI threshold bug introduced on the first version of the patch

This works much better, except I still get some hard hangs occasionally. Doesn't appear to be bmiss storm this time. I did it with a VT up and didn't get an oops; I guess I'll try a serial console or some printks.

I could trigger it via a few suspend-resume cycles, so I guess it's the reset from ath5k_init(). Did you still have any problems with the 2425?

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#21 lore raw
Quoted 13 lines · Bob Copeland

On Wed, 4 Feb 2009 23:57:06 +0200, Nick Kossifidis wrote

Quoted 2 lines

* Update reset and sync with HALs
* Clean up eeprom settings and tweaking of initvals and put them on

separate functions

Quoted 8 lines

* Set/Restore 32KHz ref clk operation
* Add some more documentation
TODO: Spur mitigation, tpc, half/quarter rate, compression etc

v2: Address comments from Bob and Felix and fix RSSI threshold bug introduced on the first version of the patch

Quoted 8 lines

This works much better, except I still get some hard hangs occasionally. Doesn't appear to be bmiss storm this time. I did it with a VT up and didn't get an oops; I guess I'll try a serial console or some printks.

I could trigger it via a few suspend-resume cycles, so I guess it's the reset from ath5k_init(). Did you still have any problems with the 2425?

It also work better here, I didn't yet see these hangs, but nether I did many suspend/resume cycles, so I'll take an another look.

But what I did see is that gain/noise timeouts still happen. in exactly same way.

Best regards,
Maxim Levitsky

#22 lore raw
In reply to Bob Copeland

2009/2/5 Bob Copeland <[email protected]>:

Quoted 13 lines

On Wed, 4 Feb 2009 23:57:06 +0200, Nick Kossifidis wrote

Quoted 2 lines

* Update reset and sync with HALs
* Clean up eeprom settings and tweaking of initvals and put them on

separate functions

Quoted 8 lines

* Set/Restore 32KHz ref clk operation
* Add some more documentation
TODO: Spur mitigation, tpc, half/quarter rate, compression etc

v2: Address comments from Bob and Felix and fix RSSI threshold bug introduced on the first version of the patch

Quoted 8 lines

This works much better, except I still get some hard hangs occasionally. Doesn't appear to be bmiss storm this time. I did it with a VT up and didn't get an oops; I guess I'll try a serial console or some printks.

I could trigger it via a few suspend-resume cycles, so I guess it's the reset from ath5k_init(). Did you still have any problems with the 2425?

I think this is because we call reset too many times. Try removing call to reset from config_interface, after some tests i did it seems wrong (we don't need to reset pcu and if we do, we don't need to reset the whole chip and re run phy initialization etc). I don't get any problems with ar2425 but i didn't get any before anyway (i never got a hang, just a few bmiss interrupts, not a storm).

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#23 lore raw
Quoted 2 lines · Nick Kossifidis

I think this is because we call reset too many times. Try removing call to reset from config_interface, after some tests i did it seems

Ok I'll try it, let you know ASAP.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#24 lore raw
In reply to Nick Kossifidis
Quoted 6 lines · Nick Kossifidis

I think this is because we call reset too many times. Try removing call to reset from config_interface, after some tests i did it seems wrong (we don't need to reset pcu and if we do, we don't need to reset the whole chip and re run phy initialization etc). I don't get any problems with ar2425 but i didn't get any before anyway (i never got a hang, just a few bmiss interrupts, not a storm).

Yep, with BMISS interrupts turned off and config_interface no longer calling reset, it's quite stable now. Maybe there was some timing thing at play. If we add a patch to remove those then I'm satisfied :)

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#25 lore raw

2009/2/7 Bob Copeland <[email protected]>:

Quoted 8 lines · Nick Kossifidis
Quoted 6 lines

I think this is because we call reset too many times. Try removing call to reset from config_interface, after some tests i did it seems wrong (we don't need to reset pcu and if we do, we don't need to reset the whole chip and re run phy initialization etc). I don't get any problems with ar2425 but i didn't get any before anyway (i never got a hang, just a few bmiss interrupts, not a storm).

Quoted 4 lines

Yep, with BMISS interrupts turned off and config_interface no longer calling reset, it's quite stable now. Maybe there was some timing thing at play. If we add a patch to remove those then I'm satisfied :)

O.K. do you want me to put these fixes on this patch or post a separate ?

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#26 lore raw
Quoted 1 line · Nick Kossifidis

O.K. do you want me to put these fixes on this patch or post a separate ?

I think a separate patch is fine, it's a valid change by itself.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#27 lore raw

2009/2/7 Bob Copeland <[email protected]>:

Quoted 9 lines · Nick Kossifidis
Quoted 1 line

O.K. do you want me to put these fixes on this patch or post a separate ?

I think a separate patch is fine, it's a valid change by itself.

--
Bob Copeland %% www.bobcopeland.com

O.K. i'm sending a separate patch for this ;-)

John is it ok to push these 5 patches on wireless-testing or should i re-send the whole series along with the next one ?

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#28 lore raw
Quoted 11 lines · Nick Kossifidis

2009/2/7 Bob Copeland <[email protected]>:

Quoted 9 lines · Nick Kossifidis
Quoted 1 line

O.K. do you want me to put these fixes on this patch or post a separate ?

I think a separate patch is fine, it's a valid change by itself.

--
Bob Copeland %% www.bobcopeland.com

Quoted 4 lines

O.K. i'm sending a separate patch for this ;-)

John is it ok to push these 5 patches on wireless-testing or should i re-send the whole series along with the next one ?

There has been a ton of discussion in this thread. It would make things more clear in my inbox if you reposted the whole revised series.

Thanks!

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#29 lore raw

2009/2/8 John W. Linville <[email protected]>:

Quoted 14 lines · Nick Kossifidis
Quoted 13 lines

2009/2/7 Bob Copeland <[email protected]>:

Quoted 9 lines · Nick Kossifidis
Quoted 1 line

O.K. do you want me to put these fixes on this patch or post a separate ?

I think a separate patch is fine, it's a valid change by itself.

--
Bob Copeland %% www.bobcopeland.com

O.K. i'm sending a separate patch for this ;-)

Quoted 8 lines
Quoted 2 lines

John is it ok to push these 5 patches on wireless-testing or should i re-send the whole series along with the next one ?

There has been a ton of discussion in this thread. It would make things more clear in my inbox if you reposted the whole revised series.

Thanks!

ACK ;-)

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#30 lore raw
In reply to Bob Copeland

2009/2/5 Bob Copeland <[email protected]>:

Quoted 11 lines

On Wed, 4 Feb 2009 23:57:06 +0200, Nick Kossifidis wrote

Quoted 2 lines

* Update reset and sync with HALs
* Clean up eeprom settings and tweaking of initvals and put them on

separate functions

Quoted 7 lines

* Set/Restore 32KHz ref clk operation
* Add some more documentation
TODO: Spur mitigation, tpc, half/quarter rate, compression etc

v2: Address comments from Bob and Felix and fix RSSI threshold bug introduced on the first version of the patch

Quoted 7 lines
Quoted 1 line

This works much better, except I still get some hard hangs occasionally. Doesn't appear to be bmiss storm this time. I did it with a VT up and didn't get an oops; I guess I'll try a serial console or some printks.

Did you disable BMISS interrupts on base.c ?

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#31 lore raw
Quoted 6 lines · Nick Kossifidis
Quoted 4 lines

This works much better, except I still get some hard hangs occasionally. Doesn't appear to be bmiss storm this time. I did it with a VT up and didn't get an oops; I guess I'll try a serial console or some printks.

Did you disable BMISS interrupts on base.c ?

Nope this is just vanilla wireless testing + your patchset.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com