All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20110715161857.GA2122@redhat.com>

diff --git a/a/1.txt b/N1/1.txt
index 6707772..6e37604 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -7,3 +7,136 @@ problem please give it a try. Except testing, I'm also interested
 on comments :-)
 
 ---
+>From 6f6f488156d60b44adeb68bbd0cb474b92111681 Mon Sep 17 00:00:00 2001
+From: Stanislaw Gruszka <sgruszka@redhat.com>
+Date: Fri, 15 Jul 2011 17:50:48 +0200
+Subject: [PATCH] ath9k: skip ->config_pci_powersave quirks if PCIe port has ASPM disabled
+
+We receive many bug reports about system hang during suspend/resume
+when ath9k driver is in use. Adrian Chadd remarked that this problem
+happens on systems that have ASPM disabled.
+
+To do not hit the bug, try to skip doing ->config_pci_powersave magic
+if PCIe downstream port device, which ath9k device is connected to, has
+ASPM disabled.
+
+This is test only patch, for now I'm interesting if it works. If so
+proper patch will need to cope with runtime ASPM setting change, and
+probably setup some ath9k registers correctly in both case ASPM is
+disabled.
+
+Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
+---
+ drivers/net/wireless/ath/ath9k/ar9002_hw.c |    6 +-----
+ drivers/net/wireless/ath/ath9k/ar9003_hw.c |    6 +-----
+ drivers/net/wireless/ath/ath9k/hw.c        |    1 -
+ drivers/net/wireless/ath/ath9k/hw.h        |    2 +-
+ drivers/net/wireless/ath/ath9k/pci.c       |   20 ++++++++++++++++++++
+ 5 files changed, 23 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+index 9ff7c30..44d9d8d 100644
+--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
++++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+@@ -309,11 +309,7 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah,
+ 	u8 i;
+ 	u32 val;
+ 
+-	if (ah->is_pciexpress != true)
+-		return;
+-
+-	/* Do not touch SerDes registers */
+-	if (ah->config.pcie_powersave_enable == 2)
++	if (ah->is_pciexpress != true || ah->aspm_enabled != true)
+ 		return;
+ 
+ 	/* Nothing to do on restore for 11N */
+diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+index 8efdec2..ad2bb2b 100644
+--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+@@ -519,11 +519,7 @@ static void ar9003_hw_configpcipowersave(struct ath_hw *ah,
+ 					 int restore,
+ 					 int power_off)
+ {
+-	if (ah->is_pciexpress != true)
+-		return;
+-
+-	/* Do not touch SerDes registers */
+-	if (ah->config.pcie_powersave_enable == 2)
++	if (ah->is_pciexpress != true || ah->aspm_enabled != true)
+ 		return;
+ 
+ 	/* Nothing to do on restore for 11N */
+diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
+index 2a5f908..8a80e7d 100644
+--- a/drivers/net/wireless/ath/ath9k/hw.c
++++ b/drivers/net/wireless/ath/ath9k/hw.c
+@@ -378,7 +378,6 @@ static void ath9k_hw_init_config(struct ath_hw *ah)
+ 	ah->config.additional_swba_backoff = 0;
+ 	ah->config.ack_6mb = 0x0;
+ 	ah->config.cwm_ignore_extcca = 0;
+-	ah->config.pcie_powersave_enable = 0;
+ 	ah->config.pcie_clock_req = 0;
+ 	ah->config.pcie_waen = 0;
+ 	ah->config.analog_shiftreg = 1;
+diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
+index 6acd0f9..7dd78e7 100644
+--- a/drivers/net/wireless/ath/ath9k/hw.h
++++ b/drivers/net/wireless/ath/ath9k/hw.h
+@@ -219,7 +219,6 @@ struct ath9k_ops_config {
+ 	int additional_swba_backoff;
+ 	int ack_6mb;
+ 	u32 cwm_ignore_extcca;
+-	u8 pcie_powersave_enable;
+ 	bool pcieSerDesWrite;
+ 	u8 pcie_clock_req;
+ 	u32 pcie_waen;
+@@ -673,6 +672,7 @@ struct ath_hw {
+ 
+ 	bool sw_mgmt_crypto;
+ 	bool is_pciexpress;
++	bool aspm_enabled;
+ 	bool is_monitoring;
+ 	bool need_an_top2_fixup;
+ 	u16 tx_trig_level;
+diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
+index 3bad0b2..2f34503 100644
+--- a/drivers/net/wireless/ath/ath9k/pci.c
++++ b/drivers/net/wireless/ath/ath9k/pci.c
+@@ -123,6 +123,24 @@ static const struct ath_bus_ops ath_pci_bus_ops = {
+ 	.extn_synch_en = ath_pci_extn_synch_enable,
+ };
+ 
++static void ath_pci_check_aspm(struct ath_softc *sc)
++{
++	struct ath_hw *ah = sc->sc_ah;
++	struct pci_dev *pdev = to_pci_dev(sc->dev);
++	struct pci_dev *parent;
++	u8 aspm;
++
++	ah->aspm_enabled = false;
++
++	if (!pci_is_pcie(pdev))
++		return;
++
++	parent = pdev->bus->self;
++	pci_read_config_byte(parent, ATH_PCIE_CAP_LINK_CTRL, &aspm);
++	if (aspm & (ATH_PCIE_CAP_LINK_L0S | ATH_PCIE_CAP_LINK_L1))
++		ah->aspm_enabled = true;
++}
++
+ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+ {
+ 	void __iomem *mem;
+@@ -230,6 +248,8 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+ 		goto err_init;
+ 	}
+ 
++	ath_pci_check_aspm(sc);
++
+ 	ath9k_hw_name(sc->sc_ah, hw_name, sizeof(hw_name));
+ 	wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n",
+ 		   hw_name, (unsigned long)mem, pdev->irq);
+-- 
+1.7.1
diff --git a/a/content_digest b/N1/content_digest
index 2eb7c93..7fa04f2 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -2,9 +2,15 @@
  "ref\020110613132009.GA7133@redhat.com\0"
  "ref\0BANLkTi=epV40yWe0piXoaDes_F5jOV_DJQ@mail.gmail.com\0"
  "From\0Stanislaw Gruszka <sgruszka@redhat.com>\0"
- "Subject\0[ath9k-devel] APSM, AR9285 and bus hangs\0"
+ "Subject\0Re: APSM, AR9285 and bus hangs\0"
  "Date\0Fri, 15 Jul 2011 18:18:58 +0200\0"
- "To\0ath9k-devel@lists.ath9k.org\0"
+ "To\0Adrian Chadd <adrian@freebsd.org>\0"
+ "Cc\0Jonathan Nieder <jrnieder@gmail.com>"
+  ath9k-devel@venema.h4ckr.net
+  Tony Houghton <h@realh.co.uk>
+  linux-wireless <linux-wireless@vger.kernel.org>
+  camilo@mesias.co.uk
+ " Rajkumar Manoharan <rmanoharan@atheros.com>\0"
  "\00:1\0"
  "b\0"
  "On Tue, Jun 14, 2011 at 08:02:54AM +0800, Adrian Chadd wrote:\n"
@@ -15,6 +21,139 @@
  "problem please give it a try. Except testing, I'm also interested\n"
  "on comments :-)\n"
  "\n"
- ---
+ "---\n"
+ ">From 6f6f488156d60b44adeb68bbd0cb474b92111681 Mon Sep 17 00:00:00 2001\n"
+ "From: Stanislaw Gruszka <sgruszka@redhat.com>\n"
+ "Date: Fri, 15 Jul 2011 17:50:48 +0200\n"
+ "Subject: [PATCH] ath9k: skip ->config_pci_powersave quirks if PCIe port has ASPM disabled\n"
+ "\n"
+ "We receive many bug reports about system hang during suspend/resume\n"
+ "when ath9k driver is in use. Adrian Chadd remarked that this problem\n"
+ "happens on systems that have ASPM disabled.\n"
+ "\n"
+ "To do not hit the bug, try to skip doing ->config_pci_powersave magic\n"
+ "if PCIe downstream port device, which ath9k device is connected to, has\n"
+ "ASPM disabled.\n"
+ "\n"
+ "This is test only patch, for now I'm interesting if it works. If so\n"
+ "proper patch will need to cope with runtime ASPM setting change, and\n"
+ "probably setup some ath9k registers correctly in both case ASPM is\n"
+ "disabled.\n"
+ "\n"
+ "Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>\n"
+ "---\n"
+ " drivers/net/wireless/ath/ath9k/ar9002_hw.c |    6 +-----\n"
+ " drivers/net/wireless/ath/ath9k/ar9003_hw.c |    6 +-----\n"
+ " drivers/net/wireless/ath/ath9k/hw.c        |    1 -\n"
+ " drivers/net/wireless/ath/ath9k/hw.h        |    2 +-\n"
+ " drivers/net/wireless/ath/ath9k/pci.c       |   20 ++++++++++++++++++++\n"
+ " 5 files changed, 23 insertions(+), 12 deletions(-)\n"
+ "\n"
+ "diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c\n"
+ "index 9ff7c30..44d9d8d 100644\n"
+ "--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c\n"
+ "+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c\n"
+ "@@ -309,11 +309,7 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah,\n"
+ " \tu8 i;\n"
+ " \tu32 val;\n"
+ " \n"
+ "-\tif (ah->is_pciexpress != true)\n"
+ "-\t\treturn;\n"
+ "-\n"
+ "-\t/* Do not touch SerDes registers */\n"
+ "-\tif (ah->config.pcie_powersave_enable == 2)\n"
+ "+\tif (ah->is_pciexpress != true || ah->aspm_enabled != true)\n"
+ " \t\treturn;\n"
+ " \n"
+ " \t/* Nothing to do on restore for 11N */\n"
+ "diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c\n"
+ "index 8efdec2..ad2bb2b 100644\n"
+ "--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c\n"
+ "+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c\n"
+ "@@ -519,11 +519,7 @@ static void ar9003_hw_configpcipowersave(struct ath_hw *ah,\n"
+ " \t\t\t\t\t int restore,\n"
+ " \t\t\t\t\t int power_off)\n"
+ " {\n"
+ "-\tif (ah->is_pciexpress != true)\n"
+ "-\t\treturn;\n"
+ "-\n"
+ "-\t/* Do not touch SerDes registers */\n"
+ "-\tif (ah->config.pcie_powersave_enable == 2)\n"
+ "+\tif (ah->is_pciexpress != true || ah->aspm_enabled != true)\n"
+ " \t\treturn;\n"
+ " \n"
+ " \t/* Nothing to do on restore for 11N */\n"
+ "diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c\n"
+ "index 2a5f908..8a80e7d 100644\n"
+ "--- a/drivers/net/wireless/ath/ath9k/hw.c\n"
+ "+++ b/drivers/net/wireless/ath/ath9k/hw.c\n"
+ "@@ -378,7 +378,6 @@ static void ath9k_hw_init_config(struct ath_hw *ah)\n"
+ " \tah->config.additional_swba_backoff = 0;\n"
+ " \tah->config.ack_6mb = 0x0;\n"
+ " \tah->config.cwm_ignore_extcca = 0;\n"
+ "-\tah->config.pcie_powersave_enable = 0;\n"
+ " \tah->config.pcie_clock_req = 0;\n"
+ " \tah->config.pcie_waen = 0;\n"
+ " \tah->config.analog_shiftreg = 1;\n"
+ "diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h\n"
+ "index 6acd0f9..7dd78e7 100644\n"
+ "--- a/drivers/net/wireless/ath/ath9k/hw.h\n"
+ "+++ b/drivers/net/wireless/ath/ath9k/hw.h\n"
+ "@@ -219,7 +219,6 @@ struct ath9k_ops_config {\n"
+ " \tint additional_swba_backoff;\n"
+ " \tint ack_6mb;\n"
+ " \tu32 cwm_ignore_extcca;\n"
+ "-\tu8 pcie_powersave_enable;\n"
+ " \tbool pcieSerDesWrite;\n"
+ " \tu8 pcie_clock_req;\n"
+ " \tu32 pcie_waen;\n"
+ "@@ -673,6 +672,7 @@ struct ath_hw {\n"
+ " \n"
+ " \tbool sw_mgmt_crypto;\n"
+ " \tbool is_pciexpress;\n"
+ "+\tbool aspm_enabled;\n"
+ " \tbool is_monitoring;\n"
+ " \tbool need_an_top2_fixup;\n"
+ " \tu16 tx_trig_level;\n"
+ "diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c\n"
+ "index 3bad0b2..2f34503 100644\n"
+ "--- a/drivers/net/wireless/ath/ath9k/pci.c\n"
+ "+++ b/drivers/net/wireless/ath/ath9k/pci.c\n"
+ "@@ -123,6 +123,24 @@ static const struct ath_bus_ops ath_pci_bus_ops = {\n"
+ " \t.extn_synch_en = ath_pci_extn_synch_enable,\n"
+ " };\n"
+ " \n"
+ "+static void ath_pci_check_aspm(struct ath_softc *sc)\n"
+ "+{\n"
+ "+\tstruct ath_hw *ah = sc->sc_ah;\n"
+ "+\tstruct pci_dev *pdev = to_pci_dev(sc->dev);\n"
+ "+\tstruct pci_dev *parent;\n"
+ "+\tu8 aspm;\n"
+ "+\n"
+ "+\tah->aspm_enabled = false;\n"
+ "+\n"
+ "+\tif (!pci_is_pcie(pdev))\n"
+ "+\t\treturn;\n"
+ "+\n"
+ "+\tparent = pdev->bus->self;\n"
+ "+\tpci_read_config_byte(parent, ATH_PCIE_CAP_LINK_CTRL, &aspm);\n"
+ "+\tif (aspm & (ATH_PCIE_CAP_LINK_L0S | ATH_PCIE_CAP_LINK_L1))\n"
+ "+\t\tah->aspm_enabled = true;\n"
+ "+}\n"
+ "+\n"
+ " static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)\n"
+ " {\n"
+ " \tvoid __iomem *mem;\n"
+ "@@ -230,6 +248,8 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)\n"
+ " \t\tgoto err_init;\n"
+ " \t}\n"
+ " \n"
+ "+\tath_pci_check_aspm(sc);\n"
+ "+\n"
+ " \tath9k_hw_name(sc->sc_ah, hw_name, sizeof(hw_name));\n"
+ " \twiphy_info(hw->wiphy, \"%s mem=0x%lx, irq=%d\\n\",\n"
+ " \t\t   hw_name, (unsigned long)mem, pdev->irq);\n"
+ "-- \n"
+ 1.7.1
 
-fa17d60683ec1dc3106b41621c85a0fa629516df036fac5243bbbdcdfc6938ec
+2c3084443627094a2e6b53c5c36dfa035a395dea025d5b829d4c3c0514df697d

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.