linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 6/8] ath5k: Fixes for PCI-E cards
@ 2008-02-24  4:28 Nick Kossifidis
  2008-02-24  4:45 ` [ath5k-devel] " Nick Kossifidis
  2008-02-24 20:16 ` Christoph Hellwig
  0 siblings, 2 replies; 25+ messages in thread
From: Nick Kossifidis @ 2008-02-24  4:28 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless; +Cc: linville, bruno, jirislaby, mcgrof

 * Fix nic_wakeup for PCI-E chips (don't set AR5K_RESET_CTL_PCI bit)

 * Fix dma size setting for PCI-E chips (thanx to Bob Copeland).

Changes-licensed-under: ISC
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

---
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h
index c0b6596..d8ec373 100644
--- a/drivers/net/wireless/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath5k/ath5k.h
@@ -971,6 +971,7 @@ struct ath5k_hw {
 	enum ath5k_version	ah_version;
 	enum ath5k_radio	ah_radio;
 	u32			ah_phy;
+	bool			ah_pcie;
 
 	bool			ah_5ghz;
 	bool			ah_2ghz;
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index 3ae5522..cd640ed 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -214,6 +214,14 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 		ah->ah_single_chip = false;
 	}
 
+	/* Identify PCI-E cards */
+	if((srev >= AR5K_SREV_VER_AR2424 && srev <= AR5K_SREV_VER_AR5424) ||
+	srev >= AR5K_SREV_VER_AR5416) {
+		ah->ah_pcie = true;
+	} else {
+		ah->ah_pcie = false;
+	}
+
 	/* Single chip radio */
 	if (ah->ah_radio_2ghz_revision == ah->ah_radio_5ghz_revision)
 		ah->ah_radio_2ghz_revision = 0;
@@ -377,9 +385,12 @@ static int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
 					AR5K_PHY_TURBO);
 	}
 
-	/* ...reset chipset and PCI device */
-	if (ah->ah_single_chip == false && ath5k_hw_nic_reset(ah,
-				AR5K_RESET_CTL_CHIP | AR5K_RESET_CTL_PCI)) {
+	/* ...reset chipset
+	 * Warning: reseting PCI on PCI-E cards results card to hang
+	 * and always return 0xffff...
+	 */
+	if (ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | AR5K_RESET_CTL_BASEBAND |
+				(ah->ah_pcie == false ? AR5K_RESET_CTL_PCI : 0) )) {
 		ATH5K_ERR(ah->ah_sc, "failed to reset the MAC Chip + PCI\n");
 		return -EIO;
 	}
@@ -900,13 +911,25 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
 
 	/*
 	 * Set Rx/Tx DMA Configuration
-	 *(passing dma size not available on 5210)
+	 * 
+	 * Set maximum DMA size (512) except for PCI-E cards since
+	 * it causes rx overruns and tx errors (tested on 5424 but since
+	 * rx overruns also occur on 5416/5418 with madwifi we set 128
+	 * for all PCI-E cards to be safe).
+	 *
+	 * In dumps this is 128 for allchips.
+	 *
+	 * XXX: need to check 5210 for this
+	 * TODO: Check out tx triger level, it's always 64 on dumps but i 
+	 * guess we can tweak it and see how it goes ;-)
 	 */
 	if (ah->ah_version != AR5K_AR5210) {
 		AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG, AR5K_TXCFG_SDMAMR,
-				AR5K_DMASIZE_512B | AR5K_TXCFG_DMASIZE);
+				(ah->ah_pcie == true ?
+				AR5K_DMASIZE_128B : AR5K_DMASIZE_512B));
 		AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG, AR5K_RXCFG_SDMAMW,
-				AR5K_DMASIZE_512B);
+				(ah->ah_pcie == true ?
+				AR5K_DMASIZE_128B : AR5K_DMASIZE_512B));
 	}
 
 	/*



^ permalink raw reply related	[flat|nested] 25+ messages in thread
* Re: [ath5k-devel] [PATCH 6/8] ath5k: Fixes for PCI-E cards
@ 2008-02-25 15:43 Bob Copeland
  2008-02-26  2:13 ` bruno randolf
  0 siblings, 1 reply; 25+ messages in thread
From: Bob Copeland @ 2008-02-25 15:43 UTC (permalink / raw)
  To: Nick Kossifidis, ath5k-devel, linux-wireless, linville, bruno,
	jirislaby, mcgrof

> > Hey, that's a good clue... I just switched over to b-only and it seems to
> >  be much more stable.

...or not.  I still got some calibration errors last night in b-mode.  Just
so we're on the same page, I see things in the dmesg like:

ath0: failed to restore operational channel after scan
ath5k phy0: calibration timeout (2412 MHz)
ath5k phy0: ath5k_chan_set: unable to reset channel (2412 Mhz)
ath0: failed to set freq to 2412 MHz for scan
ath5k phy0: calibration timeout (2417 MHz)

> If i'm correct you should get 4-7Mbit/sec @ 11Mbit. Plz let me know if
> you have some results, meanwhile i'll try to figure out the i/q
> calibration algo (we are ok for noise floor calibration i believe).

One thing I noticed from my traces is that the binary driver sets
bits AR5K_PHY_AGCCTL_NF | AR5K_PHY_AGCCTL_CAL in AR5K_PHY_AGCCTL.
Then it makes a whole lot of misc register writes, then re-reads
AR5K_PHY_AGCCTL; in that time only the noise floor bit got cleared
but _CAL is still high.  Dunno if that means anything to you or not.

e.g:

R: 0x9860 = 0x00009d18 - AR5K_PHY_AGCCTL
W: 0x9860 = 0x00009d1b - AR5K_PHY_AGCCTL  <-- set (_CAL | _NF)
W: 0x1000 = 0x00000001 - AR5K_DCU_QCUMASK_BASE
W: 0x1004 = 0x00000002 - unknown
W: 0x1008 = 0x00000004 - unknown
[... lots more writes to DCU & IMR regs ...]
W: 0x00a0 = 0x00080965 - AR5K_PIMR
R: 0x00ac = 0x00000000 - AR5K_SIMR2
W: 0x00ac = 0x00070000 - AR5K_SIMR2
R: 0x9860 = 0x00009d1b - AR5K_PHY_AGCCTL
R: 0x9860 = 0x00009d1b - AR5K_PHY_AGCCTL
R: 0x9860 = 0x00009d1b - AR5K_PHY_AGCCTL
R: 0x9860 = 0x00009d1b - AR5K_PHY_AGCCTL
R: 0x9860 = 0x00009d1b - AR5K_PHY_AGCCTL
R: 0x9860 = 0x00009d1a - AR5K_PHY_AGCCTL  <-- _NF cleared

Maybe a red herring as obviously the current method of doing things
works for me sometimes...

-- 
Bob Copeland %% www.bobcopeland.com



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2008-02-28 22:20 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-24  4:28 [PATCH 6/8] ath5k: Fixes for PCI-E cards Nick Kossifidis
2008-02-24  4:45 ` [ath5k-devel] " Nick Kossifidis
2008-02-24  4:47   ` Nick Kossifidis
2008-02-24 16:09   ` Bob Copeland
2008-02-24 17:59   ` Bob Copeland
2008-02-24 18:58     ` Nick Kossifidis
2008-02-24 20:21       ` Bob Copeland
2008-02-24 23:23         ` Nick Kossifidis
2008-02-27  3:23       ` Luis R. Rodriguez
2008-02-27  5:54         ` Nick Kossifidis
2008-02-27 13:30           ` Luis R. Rodriguez
2008-02-27 15:52             ` John W. Linville
2008-02-27 18:44               ` Nick Kossifidis
2008-02-28 22:20                 ` Luis R. Rodriguez
2008-02-24 23:48     ` Nick Kossifidis
2008-02-25  2:23       ` Bob Copeland
2008-02-25 14:20         ` Nick Kossifidis
2008-02-24 20:17   ` Christoph Hellwig
2008-02-24 23:27     ` Nick Kossifidis
2008-02-24 20:16 ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2008-02-25 15:43 [ath5k-devel] " Bob Copeland
2008-02-26  2:13 ` bruno randolf
2008-02-26  3:51   ` Bob Copeland
2008-02-26  3:57   ` Nick Kossifidis
2008-02-26  4:39     ` Bob Copeland

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).