Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 May 2011 03:42:04 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r221480 - head/sys/dev/ath/ath_hal/ar5416
Message-ID:  <201105050342.p453g4E7080188@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Thu May  5 03:42:04 2011
New Revision: 221480
URL: http://svn.freebsd.org/changeset/base/221480

Log:
  Fix up the chipset checks for the AR5416 and later silicon.
  
  The checks should function as follows:
  
  * AR_SREV_<silicon> : check macVersion matches that version id
  * AR_SREV_<silicon>_<revision> : check macVersion and macRevision match
      the version / revision respectively
  
  * AR_SREV_<silicon>_<revision>_OR_LATER: check that
    + if the chip silicon version == macVersion, enforce revision >= macRevision
    + if the chip silicon version > macVersion, allow it.
  
  For example, AR_SREV_MERLIN() only matches AR9280 (any revision),
  AR_SREV_MERLIN_10() would only match AR9280 version 1.0, but
  AR_SREV_MERLIN_20_OR_LATER() matches AR9280 version >= 2.0 _AND_
  any subsequent MAC (So AR9285, AR9287, etc.)
  
  The specific fixes which may impact users:
  
  * if there is Merlin hardware > revision 2.0, it'll now be correctly
    matched by AR_SREV_MERLIN_20_OR_LATER() - the older code simply
    would match on either Merlin 2.0 or a subsequent MAC (AR9285, AR9287, etc.)
  
  * Kite version 1.1/1.2 should now correctly match. As these macros
    are used in the AR9285 reset/attach path, and it's assumed that the
    hardware is kite anyway, the behaviour shouldn't change. It'll only
    change if these macros are used in other codepaths shared with
    older silicon.
  
  Obtained from:	Linux ath9k, Atheros

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h	Thu May  5 02:59:31 2011	(r221479)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h	Thu May  5 03:42:04 2011	(r221480)
@@ -625,56 +625,83 @@
 #define	AR_XSREV_REVISION_KITE_11	1	/* Kite 1.1 */
 #define	AR_XSREV_REVISION_KITE_12	2	/* Kite 1.2 */
 
+/* Owl (AR5416) */
 #define	AR_SREV_OWL(_ah) \
 	((AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_OWL_PCI) || \
 	 (AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_OWL_PCIE))
 
 #define	AR_SREV_OWL_20_OR_LATER(_ah) \
-	((AR_SREV_OWL(_ah) && AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_OWL_20) || \
-	AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_HOWL)
+	((AR_SREV_OWL(_ah) &&						\
+	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_OWL_20) ||	\
+	 AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_HOWL)
+
 #define	AR_SREV_OWL_22_OR_LATER(_ah) \
-	((AR_SREV_OWL(_ah) && AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_OWL_22) || \
-	AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_HOWL)
+	((AR_SREV_OWL(_ah) &&						\
+	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_OWL_22) ||	\
+	 AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_HOWL)
+
+/* Howl (AR9130) */
 
 #define AR_SREV_HOWL(_ah) \
 	(AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_HOWL)
+
 #define	AR_SREV_9100(_ah)	AR_SREV_HOWL(_ah)
 
+/* Sowl (AR9160) */
+
 #define	AR_SREV_SOWL(_ah) \
 	(AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_SOWL)
+
 #define	AR_SREV_SOWL_10_OR_LATER(_ah) \
 	(AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_SOWL)
+
 #define	AR_SREV_SOWL_11(_ah) \
 	(AR_SREV_SOWL(_ah) && \
 	 AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_SOWL_11)
 
+/* Merlin (AR9280) */
+
 #define	AR_SREV_MERLIN(_ah) \
 	(AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_MERLIN)
+
 #define	AR_SREV_MERLIN_10_OR_LATER(_ah)	\
 	(AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_MERLIN)
+
 #define	AR_SREV_MERLIN_20(_ah) \
 	(AR_SREV_MERLIN(_ah) && \
 	 AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_MERLIN_20)
+
 #define	AR_SREV_MERLIN_20_OR_LATER(_ah) \
-	(AR_SREV_MERLIN_20(_ah) || \
-	 AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_MERLIN)
+	((AH_PRIVATE((_ah))->ah_macVersion > AR_XSREV_VERSION_MERLIN) ||	\
+	 (AR_SREV_MERLIN((_ah)) &&						\
+	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_MERLIN_20))
+
+/* Kite (AR9285) */
 
 #define	AR_SREV_KITE(_ah) \
 	(AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_KITE)
+
 #define	AR_SREV_KITE_10_OR_LATER(_ah) \
 	(AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_KITE)
+
 #define	AR_SREV_KITE_11(_ah) \
 	(AR_SREV_KITE(ah) && \
 	 AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_KITE_11)
+
 #define	AR_SREV_KITE_11_OR_LATER(_ah) \
-	(AR_SREV_KITE_11(_ah) || \
-	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KITE_11)
+	((AH_PRIVATE((_ah))->ah_macVersion > AR_XSREV_VERSION_KITE) ||	\
+	 (AR_SREV_KITE((_ah)) &&					\
+	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KITE_11))
+
 #define	AR_SREV_KITE_12(_ah) \
 	(AR_SREV_KITE(ah) && \
 	 AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_KITE_12)
+
 #define	AR_SREV_KITE_12_OR_LATER(_ah) \
-	(AR_SREV_KITE_12(_ah) || \
-	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KITE_12)
+	((AH_PRIVATE((_ah))->ah_macVersion > AR_XSREV_VERSION_KITE) ||	\
+	 (AR_SREV_KITE((_ah)) &&					\
+	 AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KITE_12))
+
 #define	AR_SREV_9285E_20(_ah) \
 	(AR_SREV_KITE_12_OR_LATER(_ah) && \
 	((OS_REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105050342.p453g4E7080188>