Linux wireless drivers development
 help / color / mirror / Atom feed
From: Nick Kossifidis <mick@madwifi.org>
To: ath5k-devel@lists.ath5k.org, linux-wireless@vger.kernel.org
Cc: linville@tuxdriver.com, bruno@thinktube.com, jirislaby@gmail.com,
	mcgrof@gmail.com
Subject: [PATCH 6/8] ath5k: Fixes for PCI-E cards
Date: Sun, 24 Feb 2008 06:28:51 +0200	[thread overview]
Message-ID: <20080224042851.GE4426@makis.domain.invalid> (raw)

 * 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));
 	}
 
 	/*



             reply	other threads:[~2008-02-24  4:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-24  4:28 Nick Kossifidis [this message]
2008-02-24  4:45 ` [ath5k-devel] [PATCH 6/8] ath5k: Fixes for PCI-E cards 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-28 22:56 [PATCH 1/8] ath5k: Add RF2413 srev values Luis R. Rodriguez
2008-02-28 22:59 ` [PATCH 6/8] ath5k: Fixes for PCI-E cards Luis R. Rodriguez
2008-02-29  2:03   ` Bob Copeland

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=20080224042851.GE4426@makis.domain.invalid \
    --to=mick@madwifi.org \
    --cc=ath5k-devel@lists.ath5k.org \
    --cc=bruno@thinktube.com \
    --cc=jirislaby@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mcgrof@gmail.com \
    /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