linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] brcmsmac fixes and driver cleanup
@ 2011-08-23 12:13 Arend van Spriel
  2011-08-23 12:13 ` [PATCH 1/8] staging: brcm80211: only enable brcmsmac if bcma is not set Arend van Spriel
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Arend van Spriel @ 2011-08-23 12:13 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel

With 3.1 kernel the crc8 and cordic library modules are available in the
staging tree. The brcmsmac driver now uses them. Some small fixes have
been made and the driver is made to work on the Sparc platform.

This series applies to staging-next and depends on the following patch set:

Message-ID: <1313415267-5264-1-git-send-email-arend@broadcom.com>

Arend van Spriel (4):
  staging: brcm80211: make use of crc8 library function
  staging: brcm80211: make use of cordic library function
  staging: brcm80211: fix rtnl_lock issue when bringing down brcmfmac
  staging: brcm80211: fill in proper rx rate in mac80211 rx status

Franky Lin (1):
  staging: brcm80211: fix checkpatch warning in fullmac

Henry Ptasinski (1):
  staging: brcm80211: only enable brcmsmac if bcma is not set

Roland Vossen (2):
  staging: brcm80211: bugfix for exception on Sparc platforms
  staging: brcm80211: bugfix for fifo problem on 64 bits platforms.

 drivers/staging/brcm80211/Kconfig                |    3 +
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |    7 ++
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h |    2 +-
 drivers/staging/brcm80211/brcmsmac/dma.c         |    7 ++-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |    9 ++-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h |    6 ++
 drivers/staging/brcm80211/brcmsmac/main.c        |   15 ++++-
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |   62 -------------------
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h |    1 -
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c |    7 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c   |   14 +++--
 drivers/staging/brcm80211/brcmsmac/srom.c        |   20 +++++-
 drivers/staging/brcm80211/brcmutil/utils.c       |   69 ----------------------
 drivers/staging/brcm80211/include/brcmu_utils.h  |    5 --
 14 files changed, 71 insertions(+), 156 deletions(-)

-- 
1.7.4.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/8] staging: brcm80211: only enable brcmsmac if bcma is not set
  2011-08-23 12:13 [PATCH 0/8] brcmsmac fixes and driver cleanup Arend van Spriel
@ 2011-08-23 12:13 ` Arend van Spriel
  2011-08-23 12:13 ` [PATCH 2/8] staging: brcm80211: make use of crc8 library function Arend van Spriel
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Arend van Spriel @ 2011-08-23 12:13 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Henry Ptasinski, Arend van Spriel

From: Henry Ptasinski <henryp@broadcom.com>

brcmsmac doesn't yet use bcma, but both drivers attempt to claim the same
device.  For now, turn of brcmsmac if bcma is enabled.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/brcm80211/Kconfig b/drivers/staging/brcm80211/Kconfig
index 621570a..ef77b44 100644
--- a/drivers/staging/brcm80211/Kconfig
+++ b/drivers/staging/brcm80211/Kconfig
@@ -7,6 +7,7 @@ config BRCMSMAC
 	default n
 	depends on PCI
 	depends on WLAN && MAC80211
+	depends on BCMA=n
 	select BRCMUTIL
 	select FW_LOADER
 	select CRC_CCITT
-- 
1.7.4.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/8] staging: brcm80211: make use of crc8 library function
  2011-08-23 12:13 [PATCH 0/8] brcmsmac fixes and driver cleanup Arend van Spriel
  2011-08-23 12:13 ` [PATCH 1/8] staging: brcm80211: only enable brcmsmac if bcma is not set Arend van Spriel
@ 2011-08-23 12:13 ` Arend van Spriel
  2011-08-23 12:13 ` [PATCH 3/8] staging: brcm80211: make use of cordic " Arend van Spriel
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Arend van Spriel @ 2011-08-23 12:13 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel

The crc8 function is now available as a library function provided
by kernel module crc8.ko. The function has been removed from brcmutil
module and srom.c now uses crc8 library function.

Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/Kconfig               |    1 +
 drivers/staging/brcm80211/brcmsmac/srom.c       |   20 +++++-
 drivers/staging/brcm80211/brcmutil/utils.c      |   69 -----------------------
 drivers/staging/brcm80211/include/brcmu_utils.h |    5 --
 4 files changed, 17 insertions(+), 78 deletions(-)

diff --git a/drivers/staging/brcm80211/Kconfig b/drivers/staging/brcm80211/Kconfig
index ef77b44..816a7af 100644
--- a/drivers/staging/brcm80211/Kconfig
+++ b/drivers/staging/brcm80211/Kconfig
@@ -11,6 +11,7 @@ config BRCMSMAC
 	select BRCMUTIL
 	select FW_LOADER
 	select CRC_CCITT
+	select CRC8
 	---help---
 	  This module adds support for PCIe wireless adapters based on Broadcom
 	  IEEE802.11n SoftMAC chipsets.  If you choose to build a module, it'll
diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
index 7a17f59..90e2ac8 100644
--- a/drivers/staging/brcm80211/brcmsmac/srom.c
+++ b/drivers/staging/brcm80211/brcmsmac/srom.c
@@ -18,6 +18,7 @@
 #include <linux/string.h>
 #include <linux/io.h>
 #include <linux/etherdevice.h>
+#include <linux/crc8.h>
 #include <stdarg.h>
 
 #include <chipcommon.h>
@@ -39,6 +40,13 @@
 #define WRITE_WORD_DELAY	20
 #endif
 
+/*
+ * SROM CRC8 polynomial value:
+ *
+ * x^8 + x^7 +x^6 + x^4 + x^2 + 1
+ */
+#define SROM_CRC8_POLY		0xAB
+
 /* Maximum srom: 6 Kilobits == 768 bytes */
 #define	SROM_MAX		768
 
@@ -782,6 +790,8 @@ static const struct brcms_sromvar perpath_pci_sromvars[] = {
 	{NULL, 0, 0, 0, 0}
 };
 
+static u8 srom_crc8_table[CRC8_TABLE_SIZE];
+
 static void _initvars_srom_pci(u8 sromrev, u16 *srom, uint off,
 			       struct brcms_varbuf *b);
 static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
@@ -919,8 +929,8 @@ sprom_read_pci(struct si_pub *sih, u16 *sprom, uint wordoff,
 
 		/* fixup the endianness so crc8 will pass */
 		htol16_buf(buf, nwords * 2);
-		if (brcmu_crc8((u8 *) buf, nwords * 2, CRC8_INIT_VALUE) !=
-		    CRC8_GOOD_VALUE)
+		if (crc8(srom_crc8_table, (u8 *) buf, nwords * 2,
+			 CRC8_INIT_VALUE) != CRC8_GOOD_VALUE(srom_crc8_table))
 			/* DBG only pci always read srom4 first, then srom8/9 */
 			err = -EIO;
 
@@ -957,8 +967,8 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz)
 
 	/* fixup the endianness so crc8 will pass */
 	htol16_buf(buf, bufsz);
-	if (brcmu_crc8((u8 *) buf, SROM4_WORDS * 2, CRC8_INIT_VALUE) !=
-	    CRC8_GOOD_VALUE)
+	if (crc8(srom_crc8_table, (u8 *) buf, SROM4_WORDS * 2,
+		 CRC8_INIT_VALUE) != CRC8_GOOD_VALUE(srom_crc8_table))
 		err = -EIO;
 
 	/* now correct the endianness of the byte array */
@@ -1174,6 +1184,8 @@ static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
 		return -ENOMEM;
 
 	sromwindow = (u16 *) SROM_OFFSET(sih);
+
+	crc8_populate_lsb(srom_crc8_table, SROM_CRC8_POLY);
 	if (ai_is_sprom_available(sih)) {
 		err = sprom_read_pci(sih, sromwindow, 0, srom, SROM_WORDS,
 				     true);
diff --git a/drivers/staging/brcm80211/brcmutil/utils.c b/drivers/staging/brcm80211/brcmutil/utils.c
index 7b4d658..6280ec1 100644
--- a/drivers/staging/brcm80211/brcmutil/utils.c
+++ b/drivers/staging/brcm80211/brcmutil/utils.c
@@ -431,75 +431,6 @@ int brcmu_iovar_lencheck(const struct brcmu_iovar *vi, void *arg, int len,
 }
 EXPORT_SYMBOL(brcmu_iovar_lencheck);
 
-/*******************************************************************************
- * crc8
- *
- * Computes a crc8 over the input data using the polynomial:
- *
- *       x^8 + x^7 +x^6 + x^4 + x^2 + 1
- *
- * The caller provides the initial value (either CRC8_INIT_VALUE
- * or the previous returned value) to allow for processing of
- * discontiguous blocks of data.  When generating the CRC the
- * caller is responsible for complementing the final return value
- * and inserting it into the byte stream.  When checking, a final
- * return value of CRC8_GOOD_VALUE indicates a valid CRC.
- *
- * Reference: Dallas Semiconductor Application Note 27
- *   Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms",
- *     ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd.,
- *     ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
- *
- * ****************************************************************************
- */
-
-static const u8 crc8_table[256] = {
-	0x00, 0xF7, 0xB9, 0x4E, 0x25, 0xD2, 0x9C, 0x6B,
-	0x4A, 0xBD, 0xF3, 0x04, 0x6F, 0x98, 0xD6, 0x21,
-	0x94, 0x63, 0x2D, 0xDA, 0xB1, 0x46, 0x08, 0xFF,
-	0xDE, 0x29, 0x67, 0x90, 0xFB, 0x0C, 0x42, 0xB5,
-	0x7F, 0x88, 0xC6, 0x31, 0x5A, 0xAD, 0xE3, 0x14,
-	0x35, 0xC2, 0x8C, 0x7B, 0x10, 0xE7, 0xA9, 0x5E,
-	0xEB, 0x1C, 0x52, 0xA5, 0xCE, 0x39, 0x77, 0x80,
-	0xA1, 0x56, 0x18, 0xEF, 0x84, 0x73, 0x3D, 0xCA,
-	0xFE, 0x09, 0x47, 0xB0, 0xDB, 0x2C, 0x62, 0x95,
-	0xB4, 0x43, 0x0D, 0xFA, 0x91, 0x66, 0x28, 0xDF,
-	0x6A, 0x9D, 0xD3, 0x24, 0x4F, 0xB8, 0xF6, 0x01,
-	0x20, 0xD7, 0x99, 0x6E, 0x05, 0xF2, 0xBC, 0x4B,
-	0x81, 0x76, 0x38, 0xCF, 0xA4, 0x53, 0x1D, 0xEA,
-	0xCB, 0x3C, 0x72, 0x85, 0xEE, 0x19, 0x57, 0xA0,
-	0x15, 0xE2, 0xAC, 0x5B, 0x30, 0xC7, 0x89, 0x7E,
-	0x5F, 0xA8, 0xE6, 0x11, 0x7A, 0x8D, 0xC3, 0x34,
-	0xAB, 0x5C, 0x12, 0xE5, 0x8E, 0x79, 0x37, 0xC0,
-	0xE1, 0x16, 0x58, 0xAF, 0xC4, 0x33, 0x7D, 0x8A,
-	0x3F, 0xC8, 0x86, 0x71, 0x1A, 0xED, 0xA3, 0x54,
-	0x75, 0x82, 0xCC, 0x3B, 0x50, 0xA7, 0xE9, 0x1E,
-	0xD4, 0x23, 0x6D, 0x9A, 0xF1, 0x06, 0x48, 0xBF,
-	0x9E, 0x69, 0x27, 0xD0, 0xBB, 0x4C, 0x02, 0xF5,
-	0x40, 0xB7, 0xF9, 0x0E, 0x65, 0x92, 0xDC, 0x2B,
-	0x0A, 0xFD, 0xB3, 0x44, 0x2F, 0xD8, 0x96, 0x61,
-	0x55, 0xA2, 0xEC, 0x1B, 0x70, 0x87, 0xC9, 0x3E,
-	0x1F, 0xE8, 0xA6, 0x51, 0x3A, 0xCD, 0x83, 0x74,
-	0xC1, 0x36, 0x78, 0x8F, 0xE4, 0x13, 0x5D, 0xAA,
-	0x8B, 0x7C, 0x32, 0xC5, 0xAE, 0x59, 0x17, 0xE0,
-	0x2A, 0xDD, 0x93, 0x64, 0x0F, 0xF8, 0xB6, 0x41,
-	0x60, 0x97, 0xD9, 0x2E, 0x45, 0xB2, 0xFC, 0x0B,
-	0xBE, 0x49, 0x07, 0xF0, 0x9B, 0x6C, 0x22, 0xD5,
-	0xF4, 0x03, 0x4D, 0xBA, 0xD1, 0x26, 0x68, 0x9F
-};
-
-u8 brcmu_crc8(u8 *pdata,	/* pointer to array of data to process */
-	      uint nbytes,	/* number of input data bytes to process */
-	      u8 crc	/* either CRC8_INIT_VALUE or previous return value */
-	) {
-	/* loop over the buffer data */
-	while (nbytes-- > 0)
-		crc = crc8_table[(crc ^ *pdata++) & 0xff];
-
-	return crc;
-}
-EXPORT_SYMBOL(brcmu_crc8);
-
 /*
  * Traverse a string of 1-byte tag/1-byte length/variable-length value
  * triples, returning a pointer to the substring whose first element
diff --git a/drivers/staging/brcm80211/include/brcmu_utils.h b/drivers/staging/brcm80211/include/brcmu_utils.h
index da13e24..ff8f363 100644
--- a/drivers/staging/brcm80211/include/brcmu_utils.h
+++ b/drivers/staging/brcm80211/include/brcmu_utils.h
@@ -246,8 +246,6 @@ extern int brcmu_iovar_lencheck(const struct brcmu_iovar *table, void *arg,
 #define MODSUB_POW2(x, y, bound) (((x) - (y)) & ((bound) - 1))
 
 /* crc defines */
-#define CRC8_INIT_VALUE  0xff	/* Initial CRC8 checksum value */
-#define CRC8_GOOD_VALUE  0x9f	/* Good final CRC8 checksum value */
 #define CRC16_INIT_VALUE 0xffff	/* Initial CRC16 checksum value */
 #define CRC16_GOOD_VALUE 0xf0b8	/* Good final CRC16 checksum value */
 
@@ -268,9 +266,6 @@ struct brcmu_tlv {
 #define ETHER_ADDR_STR_LEN	18
 
 /* externs */
-/* crc */
-extern u8 brcmu_crc8(u8 *p, uint nbytes, u8 crc);
-
 /* format/print */
 #if defined(BCMDBG)
 extern int brcmu_format_flags(const struct brcmu_bit_desc *bd, u32 flags,
-- 
1.7.4.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/8] staging: brcm80211: make use of cordic library function
  2011-08-23 12:13 [PATCH 0/8] brcmsmac fixes and driver cleanup Arend van Spriel
  2011-08-23 12:13 ` [PATCH 1/8] staging: brcm80211: only enable brcmsmac if bcma is not set Arend van Spriel
  2011-08-23 12:13 ` [PATCH 2/8] staging: brcm80211: make use of crc8 library function Arend van Spriel
@ 2011-08-23 12:13 ` Arend van Spriel
  2011-08-23 12:13 ` [PATCH 4/8] staging: brcm80211: fix checkpatch warning in fullmac Arend van Spriel
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Arend van Spriel @ 2011-08-23 12:13 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel

The cordic function which calculates cosine and sine values for given
angle is now provided in library module. The phy code now uses this
module function.

Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/Kconfig                |    1 +
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |   62 ----------------------
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h |    1 -
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c |    7 ++-
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c   |   14 +++--
 5 files changed, 13 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/brcm80211/Kconfig b/drivers/staging/brcm80211/Kconfig
index 816a7af..59e9c85 100644
--- a/drivers/staging/brcm80211/Kconfig
+++ b/drivers/staging/brcm80211/Kconfig
@@ -12,6 +12,7 @@ config BRCMSMAC
 	select FW_LOADER
 	select CRC_CCITT
 	select CRC8
+	select CORDIC
 	---help---
 	  This module adds support for PCIe wireless adapters based on Broadcom
 	  IEEE802.11n SoftMAC chipsets.  If you choose to build a module, it'll
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
index 448afae..5307bd8 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -2779,68 +2779,6 @@ wlc_phy_papd_decode_epsilon(u32 epsilon, s32 *eps_real, s32 *eps_imag)
 		*eps_real -= 0x2000;
 }
 
-static const s32 AtanTbl[] = {
-	2949120,
-	1740967,
-	919879,
-	466945,
-	234379,
-	117304,
-	58666,
-	29335,
-	14668,
-	7334,
-	3667,
-	1833,
-	917,
-	458,
-	229,
-	115,
-	57,
-	29
-};
-
-void wlc_phy_cordic(s32 theta, struct cs32 *val)
-{
-	s32 angle, valtmp;
-	unsigned iter;
-	int signx = 1;
-	int signtheta;
-
-	val[0].i = CORDIC_AG;
-	val[0].q = 0;
-	angle = 0;
-
-	signtheta = (theta < 0) ? -1 : 1;
-	theta =	((theta + FIXED(180) * signtheta) % FIXED(360)) -
-		FIXED(180) * signtheta;
-
-	if (FLOAT(theta) > 90) {
-		theta -= FIXED(180);
-		signx = -1;
-	} else if (FLOAT(theta) < -90) {
-		theta += FIXED(180);
-		signx = -1;
-	}
-
-	for (iter = 0; iter < CORDIC_NI; iter++) {
-		if (theta > angle) {
-			valtmp = val[0].i - (val[0].q >> iter);
-			val[0].q = (val[0].i >> iter) + val[0].q;
-			val[0].i = valtmp;
-			angle += AtanTbl[iter];
-		} else {
-			valtmp = val[0].i + (val[0].q >> iter);
-			val[0].q = -(val[0].i >> iter) + val[0].q;
-			val[0].i = valtmp;
-			angle -= AtanTbl[iter];
-		}
-	}
-
-	val[0].i = val[0].i * signx;
-	val[0].q = val[0].q * signx;
-}
-
 void wlc_phy_cal_perical_mphase_reset(struct brcms_phy *pi)
 {
 	wlapi_del_timer(pi->sh->physhim, pi->phycal_timer);
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
index b98d76b..0594a08 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
@@ -1039,7 +1039,6 @@ extern void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val);
 extern void write_phy_channel_reg(struct brcms_phy *pi, uint val);
 extern void wlc_phy_txpower_update_shm(struct brcms_phy *pi);
 
-extern void wlc_phy_cordic(s32 theta, struct cs32 *val);
 extern u8 wlc_phy_nbits(s32 value);
 extern void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_dB, u8 core);
 
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
index dcf626e5..269346e 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -15,6 +15,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/cordic.h>
 
 #include <pmu.h>
 #include <d11.h>
@@ -2723,7 +2724,7 @@ wlc_lcnphy_start_tx_tone(struct brcms_phy *pi, s32 f_kHz, u16 max_val,
 	u16 num_samps, t, k;
 	u32 bw;
 	s32 theta = 0, rot = 0;
-	struct cs32 tone_samp;
+	struct cordic_iq tone_samp;
 	u32 data_buf[64];
 	u16 i_samp, q_samp;
 	struct phytbl_info tab;
@@ -2751,12 +2752,12 @@ wlc_lcnphy_start_tx_tone(struct brcms_phy *pi, s32 f_kHz, u16 max_val,
 	} else
 		num_samps = 2;
 
-	rot = FIXED((f_kHz * 36) / phy_bw) / 100;
+	rot = ((f_kHz * 36) / phy_bw) / 100;
 	theta = 0;
 
 	for (t = 0; t < num_samps; t++) {
 
-		wlc_phy_cordic(theta, &tone_samp);
+		tone_samp = cordic_calc_iq(theta);
 
 		theta += rot;
 
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
index 2e8aa64..2d90f09 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
@@ -15,6 +15,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/cordic.h>
 
 #include <brcm_hw_ids.h>
 #include <aiutils.h>
@@ -14214,7 +14215,8 @@ static u16 wlc_phy_gen_load_samples_nphy(struct brcms_phy *pi, u32 f_kHz,
 					 u16 max_val,
 					 u8 dac_test_mode);
 static void wlc_phy_loadsampletable_nphy(struct brcms_phy *pi,
-					 struct cs32 *tone_buf, u16 num_samps);
+					 struct cordic_iq *tone_buf,
+					 u16 num_samps);
 static void wlc_phy_runsamples_nphy(struct brcms_phy *pi, u16 n, u16 lps,
 				    u16 wait, u8 iq, u8 dac_test_mode,
 				    bool modify_bbmult);
@@ -22179,7 +22181,7 @@ wlc_phy_gen_load_samples_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val,
 	u16 num_samps, t, spur;
 	s32 theta = 0, rot = 0;
 	u32 tbl_len;
-	struct cs32 *tone_buf = NULL;
+	struct cordic_iq *tone_buf = NULL;
 
 	is_phybw40 = CHSPEC_IS40(pi->radio_chanspec);
 	phy_bw = (is_phybw40 == 1) ? 40 : 20;
@@ -22194,17 +22196,17 @@ wlc_phy_gen_load_samples_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val,
 		tbl_len = (phy_bw << 1);
 	}
 
-	tone_buf = kmalloc(sizeof(struct cs32) * tbl_len, GFP_ATOMIC);
+	tone_buf = kmalloc(sizeof(struct cordic_iq) * tbl_len, GFP_ATOMIC);
 	if (tone_buf == NULL)
 		return 0;
 
 	num_samps = (u16) tbl_len;
-	rot = FIXED((f_kHz * 36) / phy_bw) / 100;
+	rot = ((f_kHz * 36) / phy_bw) / 100;
 	theta = 0;
 
 	for (t = 0; t < num_samps; t++) {
 
-		wlc_phy_cordic(theta, &tone_buf[t]);
+		tone_buf[t] = cordic_calc_iq(theta);
 
 		theta += rot;
 
@@ -22239,7 +22241,7 @@ wlc_phy_tx_tone_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val,
 }
 
 static void
-wlc_phy_loadsampletable_nphy(struct brcms_phy *pi, struct cs32 *tone_buf,
+wlc_phy_loadsampletable_nphy(struct brcms_phy *pi, struct cordic_iq *tone_buf,
 			     u16 num_samps)
 {
 	u16 t;
-- 
1.7.4.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/8] staging: brcm80211: fix checkpatch warning in fullmac
  2011-08-23 12:13 [PATCH 0/8] brcmsmac fixes and driver cleanup Arend van Spriel
                   ` (2 preceding siblings ...)
  2011-08-23 12:13 ` [PATCH 3/8] staging: brcm80211: make use of cordic " Arend van Spriel
@ 2011-08-23 12:13 ` Arend van Spriel
  2011-08-23 12:13 ` [PATCH 5/8] staging: brcm80211: fix rtnl_lock issue when bringing down brcmfmac Arend van Spriel
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Arend van Spriel @ 2011-08-23 12:13 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Franky Lin, Arend van Spriel

From: Franky Lin <frankyl@broadcom.com>

Fix the __aligned checkpatch warning in wl_cfg80211.h

Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
index 049138b..0542bac 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
@@ -317,7 +317,7 @@ struct brcmf_cfg80211_priv {
 	u8 *ioctl_buf;	/* ioctl buffer */
 	u8 *extra_buf;	/* maily to grab assoc information */
 	struct dentry *debugfsdir;
-	u8 ci[0] __attribute__ ((__aligned__(NETDEV_ALIGN)));
+	u8 ci[0] __aligned(NETDEV_ALIGN);
 };
 
 #define cfg_to_wiphy(w) (w->wdev->wiphy)
-- 
1.7.4.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/8] staging: brcm80211: fix rtnl_lock issue when bringing down brcmfmac
  2011-08-23 12:13 [PATCH 0/8] brcmsmac fixes and driver cleanup Arend van Spriel
                   ` (3 preceding siblings ...)
  2011-08-23 12:13 ` [PATCH 4/8] staging: brcm80211: fix checkpatch warning in fullmac Arend van Spriel
@ 2011-08-23 12:13 ` Arend van Spriel
  2011-08-23 12:13 ` [PATCH 6/8] staging: brcm80211: bugfix for exception on Sparc platforms Arend van Spriel
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Arend van Spriel @ 2011-08-23 12:13 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel

When bringing down the netdevice interface a deadlock occurred
sporadically due to the rtnl_lock being held by a task that was
waiting for another task trying to get the lock. This patch fixes
that issue.

Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 95d6944..f9742b0 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -3189,7 +3189,14 @@ static void brcmf_term_iscan(struct brcmf_cfg80211_priv *cfg_priv)
 	if (cfg_priv->iscan_on && iscan->tsk) {
 		iscan->state = WL_ISCAN_STATE_IDLE;
 		send_sig(SIGTERM, iscan->tsk, 1);
+
+		/*
+		 * The iscan task may want to acquire the rtnl_lock
+		 * so release it here upon stopping the task.
+		 */
+		rtnl_unlock();
 		kthread_stop(iscan->tsk);
+		rtnl_lock();
 		iscan->tsk = NULL;
 
 		/* Abort iscan running in FW */
-- 
1.7.4.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/8] staging: brcm80211: bugfix for exception on Sparc platforms
  2011-08-23 12:13 [PATCH 0/8] brcmsmac fixes and driver cleanup Arend van Spriel
                   ` (4 preceding siblings ...)
  2011-08-23 12:13 ` [PATCH 5/8] staging: brcm80211: fix rtnl_lock issue when bringing down brcmfmac Arend van Spriel
@ 2011-08-23 12:13 ` Arend van Spriel
  2011-08-23 12:13 ` [PATCH 7/8] staging: brcm80211: bugfix for fifo problem on 64 bits platforms Arend van Spriel
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Arend van Spriel @ 2011-08-23 12:13 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Roland Vossen, Arend van Spriel

From: Roland Vossen <rvossen@broadcom.com>

Problem would pop up during driver load on a Sun Fire V120 and manifested
itself as an exception. This was caused by int* pointers provided to memcpy()
that were not aligned on an int boundary. The pointer type provided to
memcpy() is used by the compiler for optimization purposes. Fix was to cast
the int* pointers to void* pointers.

Bernhard R. Link and David S. Miller provided valuable feedback, thanks gents.

Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/main.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index c625c25..7e729d29 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -6111,9 +6111,12 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
 	/* default argument is generic integer */
 	pval = arg ? (int *)arg : NULL;
 
-	/* This will prevent the misaligned access */
+	/*
+	 * This will prevent misaligned access. The (void *) cast prevents a
+	 * memcpy alignment issue on e.g. Sparc64 platforms.
+	 */
 	if (pval && (u32) len >= sizeof(val))
-		memcpy(&val, pval, sizeof(val));
+		memcpy((void *)&val, (void *)pval, sizeof(val));
 	else
 		val = 0;
 
-- 
1.7.4.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 7/8] staging: brcm80211: bugfix for fifo problem on 64 bits platforms.
  2011-08-23 12:13 [PATCH 0/8] brcmsmac fixes and driver cleanup Arend van Spriel
                   ` (5 preceding siblings ...)
  2011-08-23 12:13 ` [PATCH 6/8] staging: brcm80211: bugfix for exception on Sparc platforms Arend van Spriel
@ 2011-08-23 12:13 ` Arend van Spriel
  2011-08-23 12:14 ` [PATCH 8/8] staging: brcm80211: fill in proper rx rate in mac80211 rx status Arend van Spriel
  2011-08-23 20:12 ` [PATCH 0/8] brcmsmac fixes and driver cleanup Greg KH
  8 siblings, 0 replies; 11+ messages in thread
From: Arend van Spriel @ 2011-08-23 12:13 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Roland Vossen, Arend van Spriel

From: Roland Vossen <rvossen@broadcom.com>

Message 'receive fifo overflow' appeared in the log. Root cause was an
invalid physical address being programmed into the DMA engine. This was
caused by an invalid pointer cast in the dma code. Issue was observed on
a Sparc (Sun Fire V120) machine but could theoretically also pop up
on other architectures.

Driver was tested to scan and ping on aforementioned machine.

Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/dma.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/dma.c b/drivers/staging/brcm80211/brcmsmac/dma.c
index 2ef416a..05dad9f 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.c
+++ b/drivers/staging/brcm80211/brcmsmac/dma.c
@@ -600,13 +600,18 @@ static bool _dma_alloc(struct dma_info *di, uint direction)
 void *dma_alloc_consistent(struct pci_dev *pdev, uint size, u16 align_bits,
 			       uint *alloced, unsigned long *pap)
 {
+	void *rc;
+	dma_addr_t dma_addr;
+
 	if (align_bits) {
 		u16 align = (1 << align_bits);
 		if (!IS_ALIGNED(PAGE_SIZE, align))
 			size += align;
 		*alloced = size;
 	}
-	return pci_alloc_consistent(pdev, size, (dma_addr_t *) pap);
+	rc = pci_alloc_consistent(pdev, size, &dma_addr);
+	*pap = dma_addr;
+	return rc;
 }
 
 /* !! may be called with core in reset */
-- 
1.7.4.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 8/8] staging: brcm80211: fill in proper rx rate in mac80211 rx status
  2011-08-23 12:13 [PATCH 0/8] brcmsmac fixes and driver cleanup Arend van Spriel
                   ` (6 preceding siblings ...)
  2011-08-23 12:13 ` [PATCH 7/8] staging: brcm80211: bugfix for fifo problem on 64 bits platforms Arend van Spriel
@ 2011-08-23 12:14 ` Arend van Spriel
  2011-08-23 20:12 ` [PATCH 0/8] brcmsmac fixes and driver cleanup Greg KH
  8 siblings, 0 replies; 11+ messages in thread
From: Arend van Spriel @ 2011-08-23 12:14 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel

The brcmsmac driver supports different rates on 5GHz but this is not
taken into account when providing the rate index in the receive
status information passed to mac80211.

Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |    9 +++++++--
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h |    6 ++++++
 drivers/staging/brcm80211/brcmsmac/main.c        |    8 ++++++++
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index 7179edd..2370171 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -971,6 +971,10 @@ static struct ieee80211_channel brcms_5ghz_nphy_chantable[] = {
 	.hw_value = (rate100m / 5), \
 }
 
+/*
+ * The rate table is used for both 2.4G and 5G rates. The
+ * latter being a subset as it does not support CCK rates.
+ */
 static struct ieee80211_rate legacy_ratetable[] = {
 	RATE(10, 0),
 	RATE(20, IEEE80211_RATE_SHORT_PREAMBLE),
@@ -1012,8 +1016,9 @@ static struct ieee80211_supported_band brcms_band_5GHz_nphy = {
 	.band = IEEE80211_BAND_5GHZ,
 	.channels = brcms_5ghz_nphy_chantable,
 	.n_channels = ARRAY_SIZE(brcms_5ghz_nphy_chantable),
-	.bitrates = legacy_ratetable + 4,
-	.n_bitrates = ARRAY_SIZE(legacy_ratetable) - 4,
+	.bitrates = legacy_ratetable + BRCMS_LEGACY_5G_RATE_OFFSET,
+	.n_bitrates = ARRAY_SIZE(legacy_ratetable) -
+			BRCMS_LEGACY_5G_RATE_OFFSET,
 	.ht_cap = {
 		   .cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 |
 			  IEEE80211_HT_CAP_SGI_40 |
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.h b/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
index fcd711a..7f290d7 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
@@ -20,6 +20,12 @@
 #include <linux/timer.h>
 #include <linux/interrupt.h>
 
+/*
+ * Starting index for 5G rates in the
+ * legacy rate table.
+ */
+#define BRCMS_LEGACY_5G_RATE_OFFSET	4
+
 /* softmac ioctl definitions */
 #define BRCMS_SET_SHORTSLOT_OVERRIDE		146
 
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 7e729d29..339ab28 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -8252,6 +8252,14 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
 			wiphy_err(wlc->wiphy, "%s: Unknown rate\n", __func__);
 		}
 
+		/*
+		 * For 5GHz, we should decrease the index as it is
+		 * a subset of the 2.4G rates. See bitrates field
+		 * of brcms_band_5GHz_nphy (in mac80211_if.c).
+		 */
+		if (rx_status->band == IEEE80211_BAND_5GHZ)
+			rx_status->rate_idx -= BRCMS_LEGACY_5G_RATE_OFFSET;
+
 		/* Determine short preamble and rate_idx */
 		preamble = 0;
 		if (IS_CCK(rspec)) {
-- 
1.7.4.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/8] brcmsmac fixes and driver cleanup
  2011-08-23 12:13 [PATCH 0/8] brcmsmac fixes and driver cleanup Arend van Spriel
                   ` (7 preceding siblings ...)
  2011-08-23 12:14 ` [PATCH 8/8] staging: brcm80211: fill in proper rx rate in mac80211 rx status Arend van Spriel
@ 2011-08-23 20:12 ` Greg KH
  2011-08-24  6:34   ` Arend van Spriel
  8 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2011-08-23 20:12 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: gregkh, devel, linux-wireless

On Tue, Aug 23, 2011 at 02:13:52PM +0200, Arend van Spriel wrote:
> With 3.1 kernel the crc8 and cordic library modules are available in the
> staging tree. The brcmsmac driver now uses them. Some small fixes have
> been made and the driver is made to work on the Sparc platform.
> 
> This series applies to staging-next and depends on the following patch set:
> 
> Message-ID: <1313415267-5264-1-git-send-email-arend@broadcom.com>

All applied.

That's everything that you have pending, right?  Anything I miss?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/8] brcmsmac fixes and driver cleanup
  2011-08-23 20:12 ` [PATCH 0/8] brcmsmac fixes and driver cleanup Greg KH
@ 2011-08-24  6:34   ` Arend van Spriel
  0 siblings, 0 replies; 11+ messages in thread
From: Arend van Spriel @ 2011-08-24  6:34 UTC (permalink / raw)
  To: Greg KH
  Cc: gregkh@suse.de, devel@linuxdriverproject.org,
	linux-wireless@vger.kernel.org

On 08/23/2011 10:12 PM, Greg KH wrote:
> On Tue, Aug 23, 2011 at 02:13:52PM +0200, Arend van Spriel wrote:
>> With 3.1 kernel the crc8 and cordic library modules are available in the
>> staging tree. The brcmsmac driver now uses them. Some small fixes have
>> been made and the driver is made to work on the Sparc platform.
>>
>> This series applies to staging-next and depends on the following patch set:
>>
>> Message-ID:<1313415267-5264-1-git-send-email-arend@broadcom.com>
> All applied.
>
> That's everything that you have pending, right?  Anything I miss?
>
> thanks,
>
> greg k-h

Great. It was quite a number of patches. I did a diff between your tree 
and our internal one. Apart from the two community patches we are in 
sync so no misses. Thanks.

Gr. AvS

-- 
Almost nobody dances sober, unless they happen to be insane.
-- H.P. Lovecraft --



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-08-24  6:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-23 12:13 [PATCH 0/8] brcmsmac fixes and driver cleanup Arend van Spriel
2011-08-23 12:13 ` [PATCH 1/8] staging: brcm80211: only enable brcmsmac if bcma is not set Arend van Spriel
2011-08-23 12:13 ` [PATCH 2/8] staging: brcm80211: make use of crc8 library function Arend van Spriel
2011-08-23 12:13 ` [PATCH 3/8] staging: brcm80211: make use of cordic " Arend van Spriel
2011-08-23 12:13 ` [PATCH 4/8] staging: brcm80211: fix checkpatch warning in fullmac Arend van Spriel
2011-08-23 12:13 ` [PATCH 5/8] staging: brcm80211: fix rtnl_lock issue when bringing down brcmfmac Arend van Spriel
2011-08-23 12:13 ` [PATCH 6/8] staging: brcm80211: bugfix for exception on Sparc platforms Arend van Spriel
2011-08-23 12:13 ` [PATCH 7/8] staging: brcm80211: bugfix for fifo problem on 64 bits platforms Arend van Spriel
2011-08-23 12:14 ` [PATCH 8/8] staging: brcm80211: fill in proper rx rate in mac80211 rx status Arend van Spriel
2011-08-23 20:12 ` [PATCH 0/8] brcmsmac fixes and driver cleanup Greg KH
2011-08-24  6:34   ` Arend van Spriel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).