Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Nov 2012 05:32:24 +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: r243424 - in head/sys/dev/ath/ath_hal: . ar5212 ar5416
Message-ID:  <201211230532.qAN5WOJY045763@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Fri Nov 23 05:32:24 2012
New Revision: 243424
URL: http://svnweb.freebsd.org/changeset/base/243424

Log:
  Implement a HAL method to set a 64 bit TSF value.
  
  TODO: implement it (and test) for the AR5210/AR5211.

Modified:
  head/sys/dev/ath/ath_hal/ah.h
  head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c

Modified: head/sys/dev/ath/ath_hal/ah.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.h	Fri Nov 23 04:30:54 2012	(r243423)
+++ head/sys/dev/ath/ath_hal/ah.h	Fri Nov 23 05:32:24 2012	(r243424)
@@ -1388,6 +1388,7 @@ struct ath_hal {
 	void	  __ahdecl(*ah_gpioSetIntr)(struct ath_hal*, u_int, uint32_t);
 	uint32_t __ahdecl(*ah_getTsf32)(struct ath_hal*);
 	uint64_t __ahdecl(*ah_getTsf64)(struct ath_hal*);
+	void     __ahdecl(*ah_setTsf64)(struct ath_hal *, uint64_t);
 	void	  __ahdecl(*ah_resetTsf)(struct ath_hal*);
 	HAL_BOOL  __ahdecl(*ah_detectCardPresent)(struct ath_hal*);
 	void	  __ahdecl(*ah_updateMibCounters)(struct ath_hal*,

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c	Fri Nov 23 04:30:54 2012	(r243423)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c	Fri Nov 23 05:32:24 2012	(r243424)
@@ -111,6 +111,7 @@ static const struct ath_hal_private ar52
 	.ah_gpioSetIntr			= ar5212GpioSetIntr,
 	.ah_getTsf32			= ar5212GetTsf32,
 	.ah_getTsf64			= ar5212GetTsf64,
+	.ah_setTsf64			= ar5212SetTsf64,
 	.ah_resetTsf			= ar5212ResetTsf,
 	.ah_detectCardPresent		= ar5212DetectCardPresent,
 	.ah_updateMibCounters		= ar5212UpdateMibCounters,

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Fri Nov 23 04:30:54 2012	(r243423)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Fri Nov 23 05:32:24 2012	(r243424)
@@ -142,6 +142,7 @@ ar5416InitState(struct ath_hal_5416 *ahp
 	ah->ah_gpioSet			= ar5416GpioSet;
 	ah->ah_gpioSetIntr		= ar5416GpioSetIntr;
 	ah->ah_getTsf64			= ar5416GetTsf64;
+	ah->ah_setTsf64			= ar5416SetTsf64;
 	ah->ah_resetTsf			= ar5416ResetTsf;
 	ah->ah_getRfGain		= ar5416GetRfgain;
 	ah->ah_setAntennaSwitch		= ar5416SetAntennaSwitch;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c	Fri Nov 23 04:30:54 2012	(r243423)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c	Fri Nov 23 05:32:24 2012	(r243424)
@@ -131,6 +131,21 @@ ar5416GetTsf64(struct ath_hal *ah)
 void
 ar5416SetTsf64(struct ath_hal *ah, uint64_t tsf64)
 {
+	/* XXX check if this is correct! */
+#if 0
+	int i;
+	uint32_t v;
+
+	for (i = 0; i < 10; i++) {
+		v = OS_REG_READ(ah, AR_SLP32_MODE);
+		if ((v & AR_SLP32_TSF_WRITE_STATUS) == 0)
+			break;
+		OS_DELAY(10);
+	}
+	if (i == 10)
+		ath_hal_printf(ah, "%s: couldn't slew things right!\n", __func__);
+#endif
+
 	OS_REG_WRITE(ah, AR_TSF_L32, tsf64 & 0xffffffff);
 	OS_REG_WRITE(ah, AR_TSF_U32, (tsf64 >> 32) & 0xffffffff);
 }



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