All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org,
	"Luis R. Rodriguez" <lrodriguez@atheros.com>
Subject: [PATCH v2 17/20] ath9k_hw: provide a helper for managing the MIB control register
Date: Wed, 17 Mar 2010 18:28:10 -0400	[thread overview]
Message-ID: <1268864893-11428-18-git-send-email-lrodriguez@atheros.com> (raw)
In-Reply-To: <1268864893-11428-1-git-send-email-lrodriguez@atheros.com>

This will help with the hardware family abstraction.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/ani.c |   49 +++++++++++++++++++++++++++++++---
 1 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index efe0bb9..024f8f6 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -833,6 +833,48 @@ static void ath9k_hw_clear_mib_counters(struct ath_hw *ah,
 		REG_WRITE(ah, AR_SLP_MIB_CTRL, AR_SLP_MIB_CLEAR);
 }
 
+/**
+ * ath9k_hw_mibc_cmd - commands for the MIB control register (MIBC)
+ *
+ * @ATH9K_HW_MIBC_INIT: initializes the register
+ * @ATH9K_HW_MIBC_WARN_TEST: Warning test indicator
+ * @ATH9K_HW_MIBC_FREEZE: freeze all counters, useful prior to collecting
+ *	the MIB counters.
+ * @ATH9K_HW_MIBC_CLEAR: clear all counters, can be used after collecting
+ *	the MIB counters.
+ * @ATH9K_HW_MIBC_STROBE: MIB counter strobe, can increment every
+ *	counter by 1.
+ */
+enum ath9k_hw_mibc_cmd {
+	ATH9K_HW_MIBC_INIT = 0,
+	ATH9K_HW_MIBC_WARN_TEST,
+	ATH9K_HW_MIBC_FREEZE,
+	ATH9K_HW_MIBC_CLEAR,
+	ATH9K_HW_MIBC_STROBE,
+};
+
+static void ath9k_hw_send_mibc_cmd(struct ath_hw *ah,
+				   enum ath9k_hw_mibc_cmd cmd)
+{
+	switch (cmd) {
+	case ATH9K_HW_MIBC_INIT:
+		REG_WRITE(ah, AR_MIBC, 0);
+		break;
+	case ATH9K_HW_MIBC_WARN_TEST: /* unused */
+		REG_WRITE(ah, AR_MIBC, AR_MIBC_COW);
+		break;
+	case ATH9K_HW_MIBC_FREEZE:
+		REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC);
+		break;
+	case ATH9K_HW_MIBC_CLEAR:
+		REG_WRITE(ah, AR_MIBC, AR_MIBC_CMC);
+		break;
+	case ATH9K_HW_MIBC_STROBE: /* unused */
+		REG_WRITE(ah, AR_MIBC, AR_MIBC_MCS);
+		break;
+	}
+}
+
 void ath9k_enable_mib_counters(struct ath_hw *ah)
 {
 	struct ath_common *common = ath9k_hw_common(ah);
@@ -841,8 +883,7 @@ void ath9k_enable_mib_counters(struct ath_hw *ah)
 
 	ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
 	ath9k_hw_clear_mib_counters(ah, false);
-
-	REG_WRITE(ah, AR_MIBC, 0);
+	ath9k_hw_send_mibc_cmd(ah, ATH9K_HW_MIBC_INIT);
 	ath9k_hw_update_phy_err_masks(ah);
 }
 
@@ -853,9 +894,9 @@ void ath9k_hw_disable_mib_counters(struct ath_hw *ah)
 
 	ath_print(common, ATH_DBG_ANI, "Disable MIB counters\n");
 
-	REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC);
+	ath9k_hw_send_mibc_cmd(ah, ATH9K_HW_MIBC_FREEZE);
 	ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
-	REG_WRITE(ah, AR_MIBC, AR_MIBC_CMC);
+	ath9k_hw_send_mibc_cmd(ah, ATH9K_HW_MIBC_CLEAR);
 
 	ath9k_hw_clear_mib_counters(ah, false);
 }
-- 
1.6.3.3


WARNING: multiple messages have this Message-ID (diff)
From: Luis R. Rodriguez <lrodriguez@atheros.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH v2 17/20] ath9k_hw: provide a helper for managing the MIB control register
Date: Wed, 17 Mar 2010 18:28:10 -0400	[thread overview]
Message-ID: <1268864893-11428-18-git-send-email-lrodriguez@atheros.com> (raw)
In-Reply-To: <1268864893-11428-1-git-send-email-lrodriguez@atheros.com>

This will help with the hardware family abstraction.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/ani.c |   49 +++++++++++++++++++++++++++++++---
 1 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index efe0bb9..024f8f6 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -833,6 +833,48 @@ static void ath9k_hw_clear_mib_counters(struct ath_hw *ah,
 		REG_WRITE(ah, AR_SLP_MIB_CTRL, AR_SLP_MIB_CLEAR);
 }
 
+/**
+ * ath9k_hw_mibc_cmd - commands for the MIB control register (MIBC)
+ *
+ * @ATH9K_HW_MIBC_INIT: initializes the register
+ * @ATH9K_HW_MIBC_WARN_TEST: Warning test indicator
+ * @ATH9K_HW_MIBC_FREEZE: freeze all counters, useful prior to collecting
+ *	the MIB counters.
+ * @ATH9K_HW_MIBC_CLEAR: clear all counters, can be used after collecting
+ *	the MIB counters.
+ * @ATH9K_HW_MIBC_STROBE: MIB counter strobe, can increment every
+ *	counter by 1.
+ */
+enum ath9k_hw_mibc_cmd {
+	ATH9K_HW_MIBC_INIT = 0,
+	ATH9K_HW_MIBC_WARN_TEST,
+	ATH9K_HW_MIBC_FREEZE,
+	ATH9K_HW_MIBC_CLEAR,
+	ATH9K_HW_MIBC_STROBE,
+};
+
+static void ath9k_hw_send_mibc_cmd(struct ath_hw *ah,
+				   enum ath9k_hw_mibc_cmd cmd)
+{
+	switch (cmd) {
+	case ATH9K_HW_MIBC_INIT:
+		REG_WRITE(ah, AR_MIBC, 0);
+		break;
+	case ATH9K_HW_MIBC_WARN_TEST: /* unused */
+		REG_WRITE(ah, AR_MIBC, AR_MIBC_COW);
+		break;
+	case ATH9K_HW_MIBC_FREEZE:
+		REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC);
+		break;
+	case ATH9K_HW_MIBC_CLEAR:
+		REG_WRITE(ah, AR_MIBC, AR_MIBC_CMC);
+		break;
+	case ATH9K_HW_MIBC_STROBE: /* unused */
+		REG_WRITE(ah, AR_MIBC, AR_MIBC_MCS);
+		break;
+	}
+}
+
 void ath9k_enable_mib_counters(struct ath_hw *ah)
 {
 	struct ath_common *common = ath9k_hw_common(ah);
@@ -841,8 +883,7 @@ void ath9k_enable_mib_counters(struct ath_hw *ah)
 
 	ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
 	ath9k_hw_clear_mib_counters(ah, false);
-
-	REG_WRITE(ah, AR_MIBC, 0);
+	ath9k_hw_send_mibc_cmd(ah, ATH9K_HW_MIBC_INIT);
 	ath9k_hw_update_phy_err_masks(ah);
 }
 
@@ -853,9 +894,9 @@ void ath9k_hw_disable_mib_counters(struct ath_hw *ah)
 
 	ath_print(common, ATH_DBG_ANI, "Disable MIB counters\n");
 
-	REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC);
+	ath9k_hw_send_mibc_cmd(ah, ATH9K_HW_MIBC_FREEZE);
 	ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
-	REG_WRITE(ah, AR_MIBC, AR_MIBC_CMC);
+	ath9k_hw_send_mibc_cmd(ah, ATH9K_HW_MIBC_CLEAR);
 
 	ath9k_hw_clear_mib_counters(ah, false);
 }
-- 
1.6.3.3

  parent reply	other threads:[~2010-03-17 22:28 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-17 22:27 [PATCH v2 00/20] ath9k_hw: ar93xx initial abstraction work Luis R. Rodriguez
2010-03-17 22:27 ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:27 ` [PATCH v2 01/20] ath9k: start building an abstraction layer for hardware routines Luis R. Rodriguez
2010-03-17 22:27   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:27 ` [PATCH v2 02/20] ath9k: initial move of ar9002 specific code to its own file Luis R. Rodriguez
2010-03-17 22:27   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:27 ` [PATCH v2 03/20] ath9k: rename initvals.h to ar9002_initvals.h Luis R. Rodriguez
2010-03-17 22:27   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:27 ` [PATCH v2 04/20] ath9k_hw: rename getNoiseFloorThresh() to ath9k_hw_getnf_thres() Luis R. Rodriguez
2010-03-17 22:27   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:27 ` [PATCH v2 05/20] ath9k_hw: move < AR9002 specific calibration stuff to its own file Luis R. Rodriguez
2010-03-17 22:27   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:27 ` [PATCH v2 06/20] ath9k_hw: move calibration settings to ar9002_calib_settings.c Luis R. Rodriguez
2010-03-17 22:27   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 07/20] ath9k_hw: consolidate the pci express checks on __ath9k_hw_init() Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 08/20] ath9k_hw: move ar9002 bluetooth coexistence code to its own file Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 09/20] ath9k_hw: Use a helper for setting phy error masks Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 10/20] ath9k_hw: add helpers for writing phy errors counts Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 11/20] ath9k_hw: add a helper for phy error counter reads Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 12/20] ath9k_hw: add documentation for the TPC register Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 13/20] ath9k_hw: remove unused and buggy ath9k_hw_GetMibCycleCountsPct() Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 14/20] ath9k_hw: add a helper for retrieving the MIB cycle counters Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 15/20] ath9k_hw: provide a helper for clearing the MIB counters Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 16/20] ath9k_hw: simplify reseting of the MIB control register Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` Luis R. Rodriguez [this message]
2010-03-17 22:28   ` [ath9k-devel] [PATCH v2 17/20] ath9k_hw: provide a helper for managing " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 18/20] ath9k_hw: move common defines for ANI into ath/reg.h Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 19/20] ath9k_hw: move ar9002 ANI code to its own file Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:28 ` [PATCH v2 20/20] ath9k_hw: remove wrapper ath9k_hw_write_regs() Luis R. Rodriguez
2010-03-17 22:28   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:32 ` [PATCH v2 00/20] ath9k_hw: ar93xx initial abstraction work Luis R. Rodriguez
2010-03-17 22:32   ` [ath9k-devel] " Luis R. Rodriguez
2010-03-17 22:50   ` Luis R. Rodriguez
2010-03-17 22:50     ` [ath9k-devel] " Luis R. Rodriguez
2010-03-18  1:53     ` Luis R. Rodriguez
2010-03-18  1:53       ` [ath9k-devel] " Luis R. Rodriguez
2010-03-23 20:44       ` John W. Linville
2010-03-23 20:44         ` [ath9k-devel] " John W. Linville
2010-03-23 20:53         ` Luis R. Rodriguez
2010-03-23 20:53           ` [ath9k-devel] " 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=1268864893-11428-18-git-send-email-lrodriguez@atheros.com \
    --to=lrodriguez@atheros.com \
    --cc=ath9k-devel@lists.ath9k.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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 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.