Skip to contentSkip to conversation

staging: brcm80211: first reaction to mainline patch #2

PATCH In review Roland Vossen 2 participants 15 messages Aug 26, 2011 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: brcm80211: first reaction to mainline patch #2

Comments were given by various people. This patch covers part of those comments. Apart from that, there is also a bugfix.

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

Message-ID: <927eab8b5c950c13991911cd4c16457a5d618bc7.1314252671.git.joe@perches.com>

Arend van Spriel (6):
staging: brcm80211: remove unused definition flag from top Makefile
staging: brcm80211: remove macro definitions from brcmsmac Makefile
staging: brcm80211: remove usage of macro WL11N_20MHZONLY
staging: brcm80211: remove macro definitions from brcmfmac Makefile
staging: brcm80211: rename key endian conversion functions
staging: brcm80211: remove brcmf_find_msb() function

Roland Vossen (7):
staging: brcm80211: removed unused code in dma.c
staging: brcm80211: assigned physical addresses in dma.c correct type
staging: brcm80211: bugfix for 32 bit power pc platform
staging: brcm80211: removed NORADIO_ENAB() macro from softmac phy
code
staging: brcm80211: removed unused phy logging
staging: brcm80211: removed unused #ifdef sections
staging: brcm80211: got rid of static function declarations in
softmac phy

 drivers/staging/brcm80211/Makefile                |    1 -
 drivers/staging/brcm80211/brcmfmac/Makefile       |    5 -
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |    4 -
 drivers/staging/brcm80211/brcmfmac/dhd_bus.h      |    7 +-
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c    |   16 -
 drivers/staging/brcm80211/brcmfmac/dhd_proto.h    |    5 -
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c     |   37 +-
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c  |   65 +-
 drivers/staging/brcm80211/brcmsmac/Makefile       |    7 -
 drivers/staging/brcm80211/brcmsmac/aiutils.c      |    1 +
 drivers/staging/brcm80211/brcmsmac/aiutils.h      |   17 -
 drivers/staging/brcm80211/brcmsmac/channel.c      |   12 -
 drivers/staging/brcm80211/brcmsmac/d11.h          |    4 -
 drivers/staging/brcm80211/brcmsmac/dma.c          |  173 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c  |   13 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h  |    3 -
 drivers/staging/brcm80211/brcmsmac/main.c         |   35 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c  |  444 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h  |   22 -
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c  | 5375 +++---
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c    |23214 ++++++++++-----------
 drivers/staging/brcm80211/brcmsmac/pub.h          |   16 +-
 drivers/staging/brcm80211/brcmsmac/srom.c         |   12 +-
 drivers/staging/brcm80211/brcmsmac/types.h        |    8 -
 drivers/staging/brcm80211/include/brcmu_utils.h   |    6 -
 drivers/staging/brcm80211/include/brcmu_wifi.h    |   14 -
 drivers/staging/brcm80211/include/defs.h          |    6 -
 drivers/staging/brcm80211/include/soc.h           |    4 -
 28 files changed, 14416 insertions(+), 15110 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/13 staging: brcm80211: remove unused definition flag from top Makefile

From: Arend van Spriel <[email protected]>

The use of the definition BCMDMA32 was already removed from the source code, but it was still defined in the top-level Makefile. This patch removes it.

---
 drivers/staging/brcm80211/Makefile |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/brcm80211/Makefile +0 -1
index 8b01f5e..f41c047 100644
@@ -16,7 +16,6 @@
 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 # common flags
-subdir-ccflags-y					:= -DBCMDMA32
 subdir-ccflags-$(CONFIG_BRCMDBG)	+= -DBCMDBG
 
 obj-$(CONFIG_BRCMUTIL)	+= brcmutil/
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/13 staging: brcm80211: remove macro definitions from brcmsmac Makefile

In reply to Roland Vossen

From: Arend van Spriel <[email protected]>

The Makefile for the brcmsmac driver contains macro definitions that are always set and even some are not used in the source code anymore. This patch removes those definitions from the Makefile and source code.

---
 drivers/staging/brcm80211/brcmsmac/Makefile      |    7 -------
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |    5 +----
 drivers/staging/brcm80211/brcmsmac/srom.c        |   12 ++----------
 3 files changed, 3 insertions(+), 21 deletions(-)
drivers/staging/brcm80211/brcmsmac/Makefile +0 -7
index 3147c48..eee2fe3 100644
@@ -16,13 +16,6 @@
 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 ccflags-y :=				\
-	-DWLC_HIGH				\
-	-DWLC_LOW				\
-	-DSTA					\
-	-DWME					\
-	-DWL11N					\
-	-DDBAND					\
-	-DBCMNVRAMR				\
 	-Idrivers/staging/brcm80211/brcmsmac \
 	-Idrivers/staging/brcm80211/brcmsmac/phy \
 	-Idrivers/staging/brcm80211/include
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +1 -4
index 5307bd8..cbb0bde 100644
@@ -1666,13 +1666,10 @@ void wlc_phy_txpower_recalc_target(struct brcms_phy *pi)
 			}
 		}
 	}
-#if WL11N
+
 	max_num_rate = ((ISNPHY(pi)) ? (TXP_NUM_RATES) :
 			((ISLCNPHY(pi)) ?
 			 (TXP_LAST_SISO_MCS_20 + 1) : (TXP_LAST_OFDM + 1)));
-#else
-	max_num_rate = ((ISNPHY(pi)) ? (TXP_NUM_RATES) : (TXP_LAST_OFDM + 1));
-#endif
 
 	wlc_phy_upd_env_txpwr_rate_limits(pi, band);
 
drivers/staging/brcm80211/brcmsmac/srom.c +2 -10
index 90e2ac8..a8f7c00 100644
@@ -798,9 +798,7 @@ static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
 			     uint *count);
 static int sprom_read_pci(struct si_pub *sih, u16 *sprom,
 			  uint wordoff, u16 *buf, uint nwords, bool check_crc);
-#if defined(BCMNVRAMR)
 static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz);
-#endif
 
 static int initvars_table(char *start, char *end,
 			  char **vars, uint *count);
@@ -940,7 +938,6 @@ sprom_read_pci(struct si_pub *sih, u16 *sprom, uint wordoff,
 	return err;
 }
 
-#if defined(BCMNVRAMR)
 static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz)
 {
 	u8 *otp;
@@ -976,7 +973,7 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz)
 
 	return err;
 }
-#endif				/* defined(BCMNVRAMR) */
+
 /*
 * Create variable table from memory.
 * Return 0 on success, nonzero on error.
@@ -1208,18 +1205,13 @@ static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
 				sromrev = 1;
 		}
 	}
-#if defined(BCMNVRAMR)
-	/* Use OTP if SPROM not available */
 	else {
+		/* Use OTP if SPROM not available */
 		err = otp_read_pci(sih, srom, SROM_MAX);
 		if (err == 0)
 			/* OTP only contain SROM rev8/rev9 for now */
 			sromrev = srom[SROM4_CRCREV] & 0xff;
 	}
-#else
-	else
-		err = -ENODEV;
-#endif
 
 	if (!err) {
 		/* Bitmask for the sromrev */
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 3/13 staging: brcm80211: remove usage of macro WL11N_20MHZONLY

In reply to Roland Vossen

From: Arend van Spriel <[email protected]>

The macro WL11N_20MHZONLY is never defined so code #ifdef'ed by it has been removed.

---
 drivers/staging/brcm80211/include/brcmu_wifi.h |   14 --------------
 1 files changed, 0 insertions(+), 14 deletions(-)
drivers/staging/brcm80211/include/brcmu_wifi.h +0 -14
index 717d885..0ab432d 100644
@@ -96,18 +96,6 @@
 #define CHSPEC_CHANNEL(chspec)	((u8)((chspec) & WL_CHANSPEC_CHAN_MASK))
 #define CHSPEC_BAND(chspec)	((chspec) & WL_CHANSPEC_BAND_MASK)
 
-#ifdef WL11N_20MHZONLY
-
-#define CHSPEC_CTL_SB(chspec)	WL_CHANSPEC_CTL_SB_NONE
-#define CHSPEC_BW(chspec)	WL_CHANSPEC_BW_20
-#define CHSPEC_IS10(chspec)	0
-#define CHSPEC_IS20(chspec)	1
-#ifndef CHSPEC_IS40
-#define CHSPEC_IS40(chspec)	0
-#endif
-
-#else				/* !WL11N_20MHZONLY */
-
 #define CHSPEC_CTL_SB(chspec)	((chspec) & WL_CHANSPEC_CTL_SB_MASK)
 #define CHSPEC_BW(chspec)	((chspec) & WL_CHANSPEC_BW_MASK)
 
@@ -122,8 +110,6 @@
 	(((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40)
 #endif
 
-#endif				/* !WL11N_20MHZONLY */
-
 #define CHSPEC_IS5G(chspec) \
 	(((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_5G)
 
Signature · 1 line
1.7.4.1
#4 lore raw

PATCH 4/13 staging: brcm80211: remove macro definitions from brcmfmac Makefile

In reply to Roland Vossen

From: Arend van Spriel <[email protected]>

The Makefile for the brcmfmac driver contains macro definitions that are always set. This patch removes those definitions from the Makefile and source code.

---
 drivers/staging/brcm80211/brcmfmac/Makefile   |    5 -----
 drivers/staging/brcm80211/brcmfmac/dhd_bus.h  |    7 +------
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |   15 ++-------------
 3 files changed, 3 insertions(+), 24 deletions(-)
drivers/staging/brcm80211/brcmfmac/Makefile +0 -5
index da3c805..826a2ba 100644
@@ -15,11 +15,6 @@
 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-ccflags-y :=			\
-	-DBRCMF_FIRSTREAD=64	\
-	-DBRCMF_SDALIGN=64	\
-	-DMAX_HDR_READ=64
-
 ccflags-$(CONFIG_BRCMDBG)	+= -DSHOW_EVENTS
 
 ccflags-y += \
drivers/staging/brcm80211/brcmfmac/dhd_bus.h +1 -6
index 653cf0d..24f578a 100644
@@ -18,12 +18,7 @@
 #define _BRCMF_BUS_H_
 
 /* Packet alignment for most efficient SDIO (can change based on platform) */
-#ifndef BRCMF_SDALIGN
-#define BRCMF_SDALIGN	32
-#endif
-#if !ISPOWEROF2(BRCMF_SDALIGN)
-#error BRCMF_SDALIGN is not a power of 2!
-#endif
+#define BRCMF_SDALIGN	(1 << 6)
 
 /*
  * Exported from brcmf bus module (brcmf_usb, brcmf_sdio)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +2 -13
index 8e59086..9b41891 100644
@@ -130,13 +130,8 @@ struct rte_console {
 #define MAX_DATA_BUF	(32 * 1024)	/* Must be large enough to hold
 				 biggest possible glom */
 
-#ifndef BRCMF_FIRSTREAD
-#define BRCMF_FIRSTREAD	32
-#endif
+#define BRCMF_FIRSTREAD	(1 << 6)
 
-#if !ISPOWEROF2(BRCMF_FIRSTREAD)
-#error BRCMF_FIRSTREAD is not a power of 2!
-#endif
 
 /* SBSDIO_DEVICE_CTL */
 
@@ -362,13 +357,7 @@ struct rte_console {
 
 
 /* Space for header read, limit for data packets */
-#ifndef MAX_HDR_READ
-#define MAX_HDR_READ	32
-#endif
-#if !ISPOWEROF2(MAX_HDR_READ)
-#error MAX_HDR_READ is not a power of 2!
-#endif
-
+#define MAX_HDR_READ	(1 << 6)
 #define MAX_RX_DATASZ	2048
 
 /* Maximum milliseconds to wait for F2 to come up */
Signature · 1 line
1.7.4.1
#5 lore raw

PATCH 5/13 staging: brcm80211: rename key endian conversion functions

In reply to Roland Vossen

From: Arend van Spriel <[email protected]>

The key endian conversion functions in wl_cfg80211.c have been renamed as the old names were misleasing.

---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +10 -10
index 80bb30a..8b052b0 100644
@@ -215,8 +215,8 @@ static s32 brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev,
 /*
 ** key indianess swap utilities
 */
-static void swap_key_from_BE(struct brcmf_wsec_key *key);
-static void swap_key_to_BE(struct brcmf_wsec_key *key);
+static void convert_key_from_CPU(struct brcmf_wsec_key *key);
+static void convert_key_to_CPU(struct brcmf_wsec_key *key);
 
 /*
 ** brcmf_cfg80211_priv memory init/deinit utilities
@@ -509,7 +509,7 @@ static const u32 __wl_cipher_suites[] = {
 	WLAN_CIPHER_SUITE_AES_CMAC,
 };
 
-static void swap_key_from_BE(struct brcmf_wsec_key *key)
+static void convert_key_from_CPU(struct brcmf_wsec_key *key)
 {
 	key->index = cpu_to_le32(key->index);
 	key->len = cpu_to_le32(key->len);
@@ -520,7 +520,7 @@ static void swap_key_from_BE(struct brcmf_wsec_key *key)
 	key->iv_initialized = cpu_to_le32(key->iv_initialized);
 }
 
-static void swap_key_to_BE(struct brcmf_wsec_key *key)
+static void convert_key_to_CPU(struct brcmf_wsec_key *key)
 {
 	key->index = le32_to_cpu(key->index);
 	key->len = le32_to_cpu(key->len);
@@ -1344,7 +1344,7 @@ brcmf_set_set_sharedkey(struct net_device *dev,
 			WL_CONN("key length (%d) key index (%d) algo (%d)\n",
 			       key.len, key.index, key.algo);
 			WL_CONN("key \"%s\"\n", key.data);
-			swap_key_from_BE(&key);
+			convert_key_from_CPU(&key);
 			err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key,
 					sizeof(key));
 			if (unlikely(err)) {
@@ -1612,7 +1612,7 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev,
 	/* check for key index change */
 	if (key.len == 0) {
 		/* key delete */
-		swap_key_from_BE(&key);
+		convert_key_from_CPU(&key);
 		err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key));
 		if (unlikely(err)) {
 			WL_ERR("key delete error (%d)\n", err);
@@ -1670,7 +1670,7 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev,
 			WL_ERR("Invalid cipher (0x%x)\n", params->cipher);
 			return -EINVAL;
 		}
-		swap_key_from_BE(&key);
+		convert_key_from_CPU(&key);
 
 		brcmf_netdev_wait_pend8021x(dev);
 		err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key));
@@ -1745,7 +1745,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
 	}
 
 	/* Set the new key/index */
-	swap_key_from_BE(&key);
+	convert_key_from_CPU(&key);
 	err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key));
 	if (unlikely(err)) {
 		WL_ERR("WLC_SET_KEY error (%d)\n", err);
@@ -1795,7 +1795,7 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
 
 	WL_CONN("key index (%d)\n", key_idx);
 	/* Set the new key/index */
-	swap_key_from_BE(&key);
+	convert_key_from_CPU(&key);
 	err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key));
 	if (unlikely(err)) {
 		if (err == -EINVAL) {
@@ -1859,7 +1859,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
 
 	memset(&key, 0, sizeof(key));
 	key.index = key_idx;
-	swap_key_to_BE(&key);
+	convert_key_to_CPU(&key);
 	memset(&params, 0, sizeof(params));
 	params.key_len = (u8) min_t(u8, WLAN_MAX_KEY_LEN, key.len);
 	memcpy(params.key, key.data, params.key_len);
Signature · 1 line
1.7.4.1
#6 lore raw

PATCH 6/13 staging: brcm80211: remove brcmf_find_msb() function

In reply to Roland Vossen

From: Arend van Spriel <[email protected]>

This function is similar to ffs() wihch is provided by the linux kernel already. This patch replaces brcmf_find_msb() with ffs().

---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |   39 ++-------------------
 1 files changed, 4 insertions(+), 35 deletions(-)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +4 -35
index 8b052b0..4f7b081 100644
@@ -20,6 +20,7 @@
 #include <linux/kthread.h>
 #include <linux/netdevice.h>
 #include <linux/sched.h>
+#include <linux/bitops.h>
 #include <linux/etherdevice.h>
 #include <linux/ieee80211.h>
 #include <linux/mmc/sdio_func.h>
@@ -294,11 +295,6 @@ static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv);
 static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_priv *cfg_priv);
 
 /*
-* find most significant bit set
-*/
-static __used u32 brcmf_find_msb(u16 bit16);
-
-/*
 * update pmklist to dongle
 */
 static __used s32 brcmf_update_pmklist(struct net_device *dev,
@@ -2008,33 +2004,6 @@ done:
 	return err;
 }
 
-static __used u32 brcmf_find_msb(u16 bit16)
-{
-	u32 ret = 0;
-
-	if (bit16 & 0xff00) {
-		ret += 8;
-		bit16 >>= 8;
-	}
-
-	if (bit16 & 0xf0) {
-		ret += 4;
-		bit16 >>= 4;
-	}
-
-	if (bit16 & 0xc) {
-		ret += 2;
-		bit16 >>= 2;
-	}
-
-	if (bit16 & 2)
-		ret += bit16 & 2;
-	else if (bit16)
-		ret += bit16;
-
-	return ret;
-}
-
 static s32
 brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
 			     const u8 *addr,
@@ -2062,10 +2031,10 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
 
 	rateset.count = le32_to_cpu(rateset.count);
 
-	legacy = brcmf_find_msb(mask->control[IEEE80211_BAND_2GHZ].legacy);
+	legacy = ffs(mask->control[IEEE80211_BAND_2GHZ].legacy & 0xFFFF);
 	if (!legacy)
-		legacy = brcmf_find_msb(
-				mask->control[IEEE80211_BAND_5GHZ].legacy);
+		legacy = ffs(mask->control[IEEE80211_BAND_5GHZ].legacy &
+			     0xFFFF);
 
 	val = wl_g_rates[legacy - 1].bitrate * 100000;
 
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH 7/13 staging: brcm80211: removed unused code in dma.c

In reply to Roland Vossen

Code cleanup. Preprocessor symbol BCMDMASGLISTOSL was never defined.

---
 drivers/staging/brcm80211/brcmsmac/dma.c |  138 +++++-------------------------
 1 files changed, 22 insertions(+), 116 deletions(-)
drivers/staging/brcm80211/brcmsmac/dma.c +22 -116
index 05dad9f..e53088e 100644
@@ -207,18 +207,6 @@ static uint dma_msg_level;
 
 #define	DI_INFO(dmah)	((dma_info_t *)dmah)
 
-/* One physical DMA segment */
-struct dma_seg {
-	unsigned long addr;
-	u32 length;
-};
-
-struct dma_seg_map {
-	uint origsize;	/* Size of the virtual packet */
-	uint nsegs;
-	struct dma_seg segs[MAX_DMA_SEGS];
-};
-
 /*
  * DMA Descriptor
  * Descriptors are only read by the hardware, never written back.
@@ -261,7 +249,6 @@ struct dma_info {
 	u16 txout;		/* index of next descriptor to post */
 	/* pointer to parallel array of pointers to packets */
 	struct sk_buff **txp;
-	struct dma_seg_map *txp_dmah;	/* DMA MAP meta-data handle */
 	/* Aligned physical address of descriptor ring */
 	unsigned long txdpa;
 	/* Original physical address of descriptor ring */
@@ -278,7 +265,6 @@ struct dma_info {
 	u16 rxout;	/* index of next descriptor to post */
 	/* pointer to parallel array of pointers to packets */
 	struct sk_buff **rxp;
-	struct dma_seg_map *rxp_dmah;	/* DMA MAP meta-data handle */
 	/* Aligned physical address of descriptor ring */
 	unsigned long rxdpa;
 	/* Original physical address of descriptor ring */
@@ -312,16 +298,6 @@ struct dma_info {
 	bool aligndesc_4k;
 };
 
-/*
- * DMA Scatter-gather list is supported. Note this is limited to TX
- * direction only
- */
-#ifdef BCMDMASGLISTOSL
-#define DMASGLIST_ENAB true
-#else
-#define DMASGLIST_ENAB false
-#endif				/* BCMDMASGLISTOSL */
-
 /* descriptor bumping macros */
 /* faster than %, but n must be power of 2 */
 #define	XXD(x, n)	((x) & ((n) - 1))
@@ -524,23 +500,6 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
 		   di->ddoffsethigh, di->dataoffsetlow, di->dataoffsethigh,
 		   di->addrext));
 
-	/* allocate DMA mapping vectors */
-	if (DMASGLIST_ENAB) {
-		if (ntxd) {
-			size = ntxd * sizeof(struct dma_seg_map);
-			di->txp_dmah = kzalloc(size, GFP_ATOMIC);
-			if (di->txp_dmah == NULL)
-				goto fail;
-		}
-
-		if (nrxd) {
-			size = nrxd * sizeof(struct dma_seg_map);
-			di->rxp_dmah = kzalloc(size, GFP_ATOMIC);
-			if (di->rxp_dmah == NULL)
-				goto fail;
-		}
-	}
-
 	return (struct dma_pub *) di;
 
  fail:
@@ -635,12 +594,6 @@ void dma_detach(struct dma_pub *pub)
 	kfree(di->txp);
 	kfree(di->rxp);
 
-	/* free tx packet DMA handles */
-	kfree(di->txp_dmah);
-
-	/* free rx packet DMA handles */
-	kfree(di->rxp_dmah);
-
 	/* free our private info structure */
 	kfree(di);
 
@@ -910,10 +863,6 @@ bool dma_rxfill(struct dma_pub *pub)
 		 */
 		*(u32 *) (p->data) = 0;
 
-		if (DMASGLIST_ENAB)
-			memset(&di->rxp_dmah[rxout], 0,
-				sizeof(struct dma_seg_map));
-
 		pa = pci_map_single(di->pbus, p->data,
 			di->rxbufsize, PCI_DMA_FROMDEVICE);
 
@@ -1265,9 +1214,6 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit)
 	 * allocating and initializing transmit descriptor entries.
 	 */
 	for (p = p0; p; p = next) {
-		uint nsegs, j;
-		struct dma_seg_map *map;
-
 		data = p->data;
 		len = p->len;
 		next = p->next;
@@ -1280,53 +1226,25 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit)
 			continue;
 
 		/* get physical address of buffer start */
-		if (DMASGLIST_ENAB)
-			memset(&di->txp_dmah[txout], 0,
-				sizeof(struct dma_seg_map));
-
 		pa = pci_map_single(di->pbus, data, len, PCI_DMA_TODEVICE);
 
-		if (DMASGLIST_ENAB) {
-			map = &di->txp_dmah[txout];
-
-			/* See if all the segments can be accounted for */
-			if (map->nsegs >
-			    (uint) (di->ntxd - NTXDACTIVE(di->txin, di->txout) -
-				    1))
-				goto outoftxd;
-
-			nsegs = map->nsegs;
-		} else
-			nsegs = 1;
-
-		for (j = 1; j <= nsegs; j++) {
-			flags = 0;
-			if (p == p0 && j == 1)
-				flags |= D64_CTRL1_SOF;
+		flags = 0;
+		if (p == p0)
+			flags |= D64_CTRL1_SOF;
 
-			/* With a DMA segment list, Descriptor table is filled
-			 * using the segment list instead of looping over
-			 * buffers in multi-chain DMA. Therefore, EOF for SGLIST
-			 * is when end of segment list is reached.
-			 */
-			if ((!DMASGLIST_ENAB && next == NULL) ||
-			    (DMASGLIST_ENAB && j == nsegs))
-				flags |= (D64_CTRL1_IOC | D64_CTRL1_EOF);
-			if (txout == (di->ntxd - 1))
-				flags |= D64_CTRL1_EOT;
-
-			if (DMASGLIST_ENAB) {
-				len = map->segs[j - 1].length;
-				pa = map->segs[j - 1].addr;
-			}
-			dma64_dd_upd(di, di->txd64, pa, txout, &flags, len);
+		/* With a DMA segment list, Descriptor table is filled
+		 * using the segment list instead of looping over
+		 * buffers in multi-chain DMA. Therefore, EOF for SGLIST
+		 * is when end of segment list is reached.
+		 */
+		if (next == NULL)
+			flags |= (D64_CTRL1_IOC | D64_CTRL1_EOF);
+		if (txout == (di->ntxd - 1))
+			flags |= D64_CTRL1_EOT;
 
-			txout = NEXTTXD(txout);
-		}
+		dma64_dd_upd(di, di->txd64, pa, txout, &flags, len);
 
-		/* See above. No need to loop over individual buffers */
-		if (DMASGLIST_ENAB)
-			break;
+		txout = NEXTTXD(txout);
 	}
 
 	/* if last txd eof not set, fix it */
@@ -1414,31 +1332,19 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
 
 	for (i = start; i != end && !txp; i = NEXTTXD(i)) {
 		unsigned long pa;
-		struct dma_seg_map *map = NULL;
-		uint size, j, nsegs;
+		uint size;
 
 		pa = cpu_to_le32(di->txd64[i].addrlow) - di->dataoffsetlow;
 
-		if (DMASGLIST_ENAB) {
-			map = &di->txp_dmah[i];
-			size = map->origsize;
-			nsegs = map->nsegs;
-		} else {
-			size =
-			    (cpu_to_le32(di->txd64[i].ctrl2) &
-			     D64_CTRL2_BC_MASK);
-			nsegs = 1;
-		}
+		size =
+		    (cpu_to_le32(di->txd64[i].ctrl2) &
+		     D64_CTRL2_BC_MASK);
 
-		for (j = nsegs; j > 0; j--) {
-			di->txd64[i].addrlow = 0xdeadbeef;
-			di->txd64[i].addrhigh = 0xdeadbeef;
+		di->txd64[i].addrlow = 0xdeadbeef;
+		di->txd64[i].addrhigh = 0xdeadbeef;
 
-			txp = di->txp[i];
-			di->txp[i] = NULL;
-			if (j > 1)
-				i = NEXTTXD(i);
-		}
+		txp = di->txp[i];
+		di->txp[i] = NULL;
 
 		pci_unmap_single(di->pbus, pa, size, PCI_DMA_TODEVICE);
 	}
Signature · 1 line
1.7.4.1
#8 lore raw

PATCH 8/13 staging: brcm80211: assigned physical addresses in dma.c correct type

In reply to Roland Vossen

Code cleanup. Physical addresses in dma.c are all allocated by calls to pci_alloc_consistent(). Since that call returns physical addresses as type 'dma_addr_t', all physical addresses in dma.c were changed from 'unsigned long' to 'dma_addr_t'.

---
 drivers/staging/brcm80211/brcmsmac/dma.c |   35 ++++++++++++-----------------
 1 files changed, 15 insertions(+), 20 deletions(-)
drivers/staging/brcm80211/brcmsmac/dma.c +15 -20
index e53088e..42446cd 100644
@@ -250,9 +250,9 @@ struct dma_info {
 	/* pointer to parallel array of pointers to packets */
 	struct sk_buff **txp;
 	/* Aligned physical address of descriptor ring */
-	unsigned long txdpa;
+	dma_addr_t txdpa;
 	/* Original physical address of descriptor ring */
-	unsigned long txdpaorig;
+	dma_addr_t txdpaorig;
 	u16 txdalign;	/* #bytes added to alloc'd mem to align txd */
 	u32 txdalloc;	/* #bytes allocated for the ring */
 	u32 xmtptrbase;	/* When using unaligned descriptors, the ptr register
@@ -266,9 +266,9 @@ struct dma_info {
 	/* pointer to parallel array of pointers to packets */
 	struct sk_buff **rxp;
 	/* Aligned physical address of descriptor ring */
-	unsigned long rxdpa;
+	dma_addr_t rxdpa;
 	/* Original physical address of descriptor ring */
-	unsigned long rxdpaorig;
+	dma_addr_t rxdpaorig;
 	u16 rxdalign;	/* #bytes added to alloc'd mem to align rxd */
 	u32 rxdalloc;	/* #bytes allocated for the ring */
 	u32 rcvptrbase;	/* Base for ptr reg when using unaligned descriptors */
@@ -327,14 +327,14 @@ static bool _dma_isaddrext(struct dma_info *di);
 static bool _dma_descriptor_align(struct dma_info *di);
 static bool _dma_alloc(struct dma_info *di, uint direction);
 static void _dma_ddtable_init(struct dma_info *di, uint direction,
-			      unsigned long pa);
+			      dma_addr_t pa);
 static void _dma_rxenable(struct dma_info *di);
 static struct sk_buff *_dma_getnextrxp(struct dma_info *di, bool forceall);
 static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags);
 static u8 dma_align_sizetobits(uint size);
 static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size,
 			   u16 *alignbits, uint *alloced,
-			   unsigned long *descpa);
+			   dma_addr_t *descpa);
 
 /* Prototypes for 64-bit routines */
 static bool dma64_alloc(struct dma_info *di, uint direction);
@@ -521,7 +521,7 @@ static inline u32 parity32(u32 data)
 
 static inline void
 dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring,
-	     unsigned long pa, uint outidx, u32 *flags, u32 bufcount)
+	     dma_addr_t pa, uint outidx, u32 *flags, u32 bufcount)
 {
 	u32 ctrl2 = bufcount & D64_CTRL2_BC_MASK;
 
@@ -557,20 +557,15 @@ 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)
+			       uint *alloced, dma_addr_t *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;
 	}
-	rc = pci_alloc_consistent(pdev, size, &dma_addr);
-	*pap = dma_addr;
-	return rc;
+	return pci_alloc_consistent(pdev, size, pap);
 }
 
 /* !! may be called with core in reset */
@@ -644,7 +639,7 @@ static bool _dma_isaddrext(struct dma_info *di)
 
 /* initialize descriptor table base address */
 static void
-_dma_ddtable_init(struct dma_info *di, uint direction, unsigned long pa)
+_dma_ddtable_init(struct dma_info *di, uint direction, dma_addr_t pa)
 {
 	if (!di->aligndesc_4k) {
 		if (direction == DMA_TX)
@@ -814,7 +809,7 @@ bool dma_rxfill(struct dma_pub *pub)
 	u32 flags = 0;
 	uint n;
 	uint i;
-	unsigned long pa;
+	dma_addr_t pa;
 	uint extra_offset = 0;
 	bool ring_empty;
 
@@ -977,7 +972,7 @@ u8 dma_align_sizetobits(uint size)
  */
 static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size,
 			   u16 *alignbits, uint *alloced,
-			   unsigned long *descpa)
+			   dma_addr_t *descpa)
 {
 	void *va;
 	u32 desc_strtaddr;
@@ -1203,7 +1198,7 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit)
 	uint len;
 	u16 txout;
 	u32 flags = 0;
-	unsigned long pa;
+	dma_addr_t pa;
 
 	DMA_TRACE(("%s: dma_txfast\n", di->name));
 
@@ -1331,7 +1326,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
 		goto bogus;
 
 	for (i = start; i != end && !txp; i = NEXTTXD(i)) {
-		unsigned long pa;
+		dma_addr_t pa;
 		uint size;
 
 		pa = cpu_to_le32(di->txd64[i].addrlow) - di->dataoffsetlow;
@@ -1366,7 +1361,7 @@ static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall)
 {
 	uint i, curr;
 	struct sk_buff *rxp;
-	unsigned long pa;
+	dma_addr_t pa;
 
 	i = di->rxin;
 
Signature · 1 line
1.7.4.1
#9 lore raw

PATCH 9/13 staging: brcm80211: bugfix for 32 bit power pc platform

In reply to Roland Vossen

On some platforms resource_size_t == 64 but but unsigned long is only 32-bits. In this particular problem, reported and fixed by Tony Breeds, a physical address was truncated as a result.

---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +2 -7
index 2370171..9b787e6 100644
@@ -752,12 +752,11 @@ static int brcms_set_hint(struct brcms_info *wl, char *abbrev)
  * is called in brcms_pci_probe() context, therefore no locking required.
  */
 static struct brcms_info *brcms_attach(u16 vendor, u16 device,
-				       unsigned long regs,
+				       resource_size_t regs,
 				       struct pci_dev *btparam, uint irq)
 {
 	struct brcms_info *wl = NULL;
 	int unit, err;
-	unsigned long base_addr;
 	struct ieee80211_hw *hw;
 	u8 perm[ETH_ALEN];
 
@@ -780,11 +779,7 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device,
 	/* setup the bottom half handler */
 	tasklet_init(&wl->tasklet, brcms_dpc, (unsigned long) wl);
 
-
-
-	base_addr = regs;
-
-	wl->regsva = ioremap_nocache(base_addr, PCI_BAR0_WINSZ);
+	wl->regsva = ioremap_nocache(regs, PCI_BAR0_WINSZ);
 	if (wl->regsva == NULL) {
 		wiphy_err(wl->wiphy, "wl%d: ioremap() failed\n", unit);
 		goto fail;
Signature · 1 line
1.7.4.1
#10 lore raw

PATCH 10/13 staging: brcm80211: removed NORADIO_ENAB() macro from softmac phy code

In reply to Roland Vossen

Code cleanup. Preprocessor constant EXT_CBALL was never defined so removed related code.

---
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |   35 ------
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h |    6 -
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c |   57 +--------
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c   |  140 ++++++++-------------
 4 files changed, 57 insertions(+), 181 deletions(-)
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +0 -35
index cbb0bde..3d54a39 100644
@@ -220,9 +220,6 @@ u16 read_radio_reg(struct brcms_phy *pi, u16 addr)
 	if ((addr == RADIO_IDCODE))
 		return 0xffff;
 
-	if (NORADIO_ENAB(pi->pubpi))
-		return NORADIO_IDCODE & 0xffff;
-
 	switch (pi->pubpi.phy_type) {
 	case PHY_TYPE_N:
 		CASECHECK(PHYTYPE, PHY_TYPE_N);
@@ -265,9 +262,6 @@ u16 read_radio_reg(struct brcms_phy *pi, u16 addr)
 
 void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
 {
-	if (NORADIO_ENAB(pi->pubpi))
-		return;
-
 	if ((D11REV_GE(pi->sh->corerev, 24)) ||
 	    (D11REV_IS(pi->sh->corerev, 22)
 	     && (pi->pubpi.phy_type != PHY_TYPE_SSN))) {
@@ -289,9 +283,6 @@ static u32 read_radio_id(struct brcms_phy *pi)
 {
 	u32 id;
 
-	if (NORADIO_ENAB(pi->pubpi))
-		return NORADIO_IDCODE;
-
 	if (D11REV_GE(pi->sh->corerev, 24)) {
 		u32 b0, b1, b2;
 
@@ -317,9 +308,6 @@ void and_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
 {
 	u16 rval;
 
-	if (NORADIO_ENAB(pi->pubpi))
-		return;
-
 	rval = read_radio_reg(pi, addr);
 	write_radio_reg(pi, addr, (rval & val));
 }
@@ -328,9 +316,6 @@ void or_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
 {
 	u16 rval;
 
-	if (NORADIO_ENAB(pi->pubpi))
-		return;
-
 	rval = read_radio_reg(pi, addr);
 	write_radio_reg(pi, addr, (rval | val));
 }
@@ -339,9 +324,6 @@ void xor_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask)
 {
 	u16 rval;
 
-	if (NORADIO_ENAB(pi->pubpi))
-		return;
-
 	rval = read_radio_reg(pi, addr);
 	write_radio_reg(pi, addr, (rval ^ mask));
 }
@@ -350,9 +332,6 @@ void mod_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val)
 {
 	u16 rval;
 
-	if (NORADIO_ENAB(pi->pubpi))
-		return;
-
 	rval = read_radio_reg(pi, addr);
 	write_radio_reg(pi, addr, (rval & ~mask) | (val & mask));
 }
@@ -1225,9 +1204,6 @@ void wlc_phy_switch_radio(struct brcms_phy_pub *pih, bool on)
 {
 	struct brcms_phy *pi = (struct brcms_phy *) pih;
 
-	if (NORADIO_ENAB(pi->pubpi))
-		return;
-
 	{
 		uint mc;
 
@@ -2308,9 +2284,6 @@ wlc_phy_noise_sample_request(struct brcms_phy_pub *pih, u8 reason, u8 ch)
 	bool sampling_in_progress = (pi->phynoise_state != 0);
 	bool wait_for_intr = true;
 
-	if (NORADIO_ENAB(pi->pubpi))
-		return;
-
 	switch (reason) {
 	case PHY_NOISE_SAMPLE_MON:
 		pi->phynoise_chan_watchdog = ch;
@@ -2618,11 +2591,6 @@ void wlc_phy_rssi_compute(struct brcms_phy_pub *pih,
 	uint radioid = pih->radioid;
 	struct brcms_phy *pi = (struct brcms_phy *) pih;
 
-	if (NORADIO_ENAB(pi->pubpi)) {
-		rssi = BRCMS_RSSI_INVALID;
-		goto end;
-	}
-
 	if ((pi->sh->corerev >= 11)
 	    && !(le16_to_cpu(rxh->RxStatus2) & RXS_PHYRXST_VALID)) {
 		rssi = BRCMS_RSSI_INVALID;
@@ -2704,9 +2672,6 @@ void wlc_phy_watchdog(struct brcms_phy_pub *pih)
 			pi->phycal_txpower = pi->sh->now;
 	}
 
-	if (NORADIO_ENAB(pi->pubpi))
-		return;
-
 	if ((SCAN_RM_IN_PROGRESS(pi) || PLT_INPROG_PHY(pi)
 	     || ASSOC_INPROG_PHY(pi)))
 		return;
drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +0 -6
index 0594a08..7ec2ad2 100644
@@ -297,12 +297,6 @@ enum phy_cal_mode {
 #define PUB_NOT_ASSOC(pi) \
 	(mboolisset(pi->measure_hold, PHY_HOLD_FOR_NOT_ASSOC))
 
-#if defined(EXT_CBALL)
-#define NORADIO_ENAB(pub) ((pub).radioid == NORADIO_ID)
-#else
-#define NORADIO_ENAB(pub) 0
-#endif
-
 #define PHY_LTRN_LIST_LEN	64
 extern u16 ltrn_list[PHY_LTRN_LIST_LEN];
 
drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +4 -53

159 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +53 -87

213 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#11 lore raw

PATCH 11/13 staging: brcm80211: removed unused phy logging

In reply to Roland Vossen

Macro's were not used so they were removed.

---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |    4 ----
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |    2 --
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h |   16 ----------------
 3 files changed, 0 insertions(+), 22 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +0 -4
index 9b787e6..01829db 100644
@@ -105,8 +105,6 @@ MODULE_DEVICE_TABLE(pci, brcms_pci_id_table);
 #ifdef BCMDBG
 static int msglevel = 0xdeadbeef;
 module_param(msglevel, int, 0);
-static int phymsglevel = 0xdeadbeef;
-module_param(phymsglevel, int, 0);
 #endif				/* BCMDBG */
 
 #define HW_TO_WL(hw)	 (hw->priv)
@@ -1282,8 +1280,6 @@ static int __init brcms_module_init(void)
 #ifdef BCMDBG
 	if (msglevel != 0xdeadbeef)
 		brcm_msg_level = msglevel;
-	if (phymsglevel != 0xdeadbeef)
-		phyhal_msg_level = phymsglevel;
 #endif				/* BCMDBG */
 
 	error = pci_register_driver(&brcms_pci_driver);
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +0 -2
index 3d54a39..bd602de 100644
@@ -27,8 +27,6 @@
 #include "phy_lcn.h"
 #include "phyreg_n.h"
 
-u32 phyhal_msg_level = PHYHAL_ERROR;
-
 struct chan_info_basic {
 	u16 chan;
 	u16 freq;
drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +0 -16
index 7ec2ad2..a06e719 100644
@@ -23,22 +23,6 @@
 
 #define	PHY_VERSION			{ 1, 82, 8, 0 }
 
-#define PHYHAL_ERROR	0x0001
-#define PHYHAL_TRACE	0x0002
-#define PHYHAL_INFORM	0x0004
-
-extern u32 phyhal_msg_level;
-
-#define PHY_INFORM_ON()		(phyhal_msg_level & PHYHAL_INFORM)
-#define PHY_THERMAL_ON()	(phyhal_msg_level & PHYHAL_THERMAL)
-#define PHY_CAL_ON()		(phyhal_msg_level & PHYHAL_CAL)
-
-#ifdef BOARD_TYPE
-#define BOARDTYPE(_type) BOARD_TYPE
-#else
-#define BOARDTYPE(_type) _type
-#endif
-
 #define LCNXN_BASEREV		16
 
 struct phy_shim_info;
Signature · 1 line
1.7.4.1
#12 lore raw

PATCH 12/13 staging: brcm80211: removed unused #ifdef sections

In reply to Roland Vossen
---
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |    4 --
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c    |   16 ---------
 drivers/staging/brcm80211/brcmfmac/dhd_proto.h    |    5 ---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c     |   22 -------------
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c  |    6 ---
 drivers/staging/brcm80211/brcmsmac/aiutils.c      |    1 +
 drivers/staging/brcm80211/brcmsmac/aiutils.h      |   17 ----------
 drivers/staging/brcm80211/brcmsmac/channel.c      |   12 -------
 drivers/staging/brcm80211/brcmsmac/d11.h          |    4 --
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h  |    3 --
 drivers/staging/brcm80211/brcmsmac/main.c         |   35 ++-------------------
 drivers/staging/brcm80211/brcmsmac/pub.h          |   16 +---------
 drivers/staging/brcm80211/brcmsmac/types.h        |    8 -----
 drivers/staging/brcm80211/include/brcmu_utils.h   |    6 ---
 drivers/staging/brcm80211/include/defs.h          |    6 ---
 drivers/staging/brcm80211/include/soc.h           |    4 --
 16 files changed, 5 insertions(+), 160 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +0 -4
index 0b92cef..a15765b 100644
@@ -34,15 +34,11 @@
 #include "dhd_dbg.h"
 #include "wl_cfg80211.h"
 
-#if !defined(SDIO_VENDOR_ID_BROADCOM)
 #define SDIO_VENDOR_ID_BROADCOM		0x02d0
-#endif				/* !defined(SDIO_VENDOR_ID_BROADCOM) */
 
 #define DMA_ALIGN_MASK	0x03
 
-#if !defined(SDIO_DEVICE_ID_BROADCOM_4329)
 #define SDIO_DEVICE_ID_BROADCOM_4329	0x4329
-#endif		/* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */
 
 static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr);
 static int brcmf_ops_sdio_probe(struct sdio_func *func,
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +0 -16
index 2c633fa..46f75b7 100644
@@ -120,18 +120,6 @@ uint brcmf_radio_up = 1;
 char iface_name[IFNAMSIZ] = "wlan";
 module_param_string(iface_name, iface_name, IFNAMSIZ, 0);
 
-/* The following are specific to the SDIO dongle */
-
-#ifdef SDTEST
-/* Echo packet generator (pkts/s) */
-uint brcmf_pktgen;
-module_param(brcmf_pktgen, uint, 0);
-
-/* Echo packet len (0 => sawtooth, max 2040) */
-uint brcmf_pktgen_len;
-module_param(brcmf_pktgen_len, uint, 0);
-#endif
-
 static int brcmf_toe_get(struct brcmf_info *drvr_priv, int idx, u32 *toe_ol);
 static int brcmf_toe_set(struct brcmf_info *drvr_priv, int idx, u32 toe_ol);
 static int brcmf_host_event(struct brcmf_info *drvr_priv, int *ifidx,
@@ -1065,7 +1053,6 @@ done:
 
 static int brcmf_netdev_stop(struct net_device *net)
 {
-#if !defined(IGNORE_ETH0_DOWN)
 	struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
 
 	brcmf_dbg(TRACE, "Enter\n");
@@ -1076,9 +1063,6 @@ static int brcmf_netdev_stop(struct net_device *net)
 	/* Set state and stop OS transmissions */
 	drvr_priv->pub.up = 0;
 	netif_stop_queue(net);
-#else
-	brcmf_dbg(ERROR, "BYPASSed due to BRCM compilation: under investigation\n");
-#endif				/* !defined(IGNORE_ETH0_DOWN) */
 
 	return 0;
 }
drivers/staging/brcm80211/brcmfmac/dhd_proto.h +0 -5
index ff788b3..2ce5fea 100644
@@ -17,13 +17,8 @@
 #ifndef _BRCMF_PROTO_H_
 #define _BRCMF_PROTO_H_
 
-#ifndef IOCTL_RESP_TIMEOUT
 #define IOCTL_RESP_TIMEOUT  2000	/* In milli second */
-#endif
-
-#ifndef IOCTL_CHIP_ACTIVE_TIMEOUT
 #define IOCTL_CHIP_ACTIVE_TIMEOUT  10	/* In milli second */
-#endif
 
 /*
  * Exported from the brcmf protocol module (brcmf_cdc)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +0 -22
index 9b41891..c1647eb 100644
@@ -368,10 +368,8 @@ struct rte_console {
  * for HT availability, it could take a couple hundred ms more, so
  * max out at a 1 second (1000000us).
  */
-#if (PMU_MAX_TRANSITION_DLY <= 1000000)
 #undef PMU_MAX_TRANSITION_DLY
 #define PMU_MAX_TRANSITION_DLY 1000000
-#endif
 
 /* Value for ChipClockCSR during initial setup */
 #define BRCMF_INIT_CLKCTL1	(SBSDIO_FORCE_HW_CLKREQ_OFF |	\
@@ -3145,19 +3143,6 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
 	brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
 			       SBSDIO_FUNC1_CHIPCLKCSR, saveclk, &err);
 
-#if defined(OOB_INTR_ONLY)
-	/* Host registration for OOB interrupt */
-	if (brcmf_sdio_register_oob_intr(bus->dhd)) {
-		brcmf_sdbrcm_wd_timer(bus, 0);
-		brcmf_dbg(ERROR, "Host failed to resgister for OOB\n");
-		ret = -ENODEV;
-		goto exit;
-	}
-
-	/* Enable oob at firmware */
-	brcmf_sdbrcm_enable_oob_intr(bus, true);
-#endif		/* defined(OOB_INTR_ONLY) */
-
 	/* If we didn't come up, turn off backplane clock */
 	if (drvr->busstate != BRCMF_BUS_DATA)
 		brcmf_sdbrcm_clkctl(bus, CLK_NONE, false);
@@ -4533,15 +4518,8 @@ void brcmf_sdbrcm_isr(void *arg)
 	if (!bus->intr)
 		brcmf_dbg(ERROR, "isr w/o interrupt configured!\n");
 
-#if defined(SDIO_ISR_THREAD)
-	brcmf_dbg(TRACE, "Calling brcmf_sdbrcm_dpc()\n");
-	while (brcmf_sdbrcm_dpc(bus))
-		;
-#else
 	bus->dpc_sched = true;
 	brcmf_sdbrcm_sched_dpc(bus);
-#endif
-
 }
 
 extern bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +0 -6
index 4f7b081..9010ce7 100644
@@ -2337,14 +2337,10 @@ static struct wireless_dev *brcmf_alloc_wdev(s32 sizeof_iface,
 	wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
 	wdev->wiphy->cipher_suites = __wl_cipher_suites;
 	wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
-#ifndef WL_POWERSAVE_DISABLED
 	wdev->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;	/* enable power
 								 * save mode
 								 * by default
 								 */
-#else
-	wdev->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
-#endif				/* !WL_POWERSAVE_DISABLED */
 	err = wiphy_register(wdev->wiphy);
 	if (unlikely(err < 0)) {
 		WL_ERR("Couldn not register wiphy device (%d)\n", err);
@@ -3409,9 +3405,7 @@ static s32 wl_init_priv(struct brcmf_cfg80211_priv *cfg_priv)
 	s32 err = 0;
 
 	cfg_priv->scan_request = NULL;
-#ifndef WL_POWERSAVE_DISABLED
 	cfg_priv->pwr_save = true;
-#endif /* WL_POWERSAVE_DISABLED */
 	cfg_priv->iscan_on = true;	/* iscan on & off switch.
 				 we enable iscan per default */
 	cfg_priv->roam_on = true;	/* roam on & off switch.
drivers/staging/brcm80211/brcmsmac/aiutils.c +1 -0
index c9c41a5..62186b7 100644
@@ -23,6 +23,7 @@
 #include <chipcommon.h>
 #include <brcmu_utils.h>
 #include <brcm_hw_ids.h>
+#include <soc.h>
 #include "types.h"
 #include "pub.h"
 #include "pmu.h"
drivers/staging/brcm80211/brcmsmac/aiutils.h +0 -17
index 375c06f..5dee80f 100644
@@ -33,12 +33,6 @@
 /* Region 2 for sdram (512 MB) */
 #define SI_SDRAM_R2		0x80000000
 
-#ifdef SI_ENUM_BASE_VARIABLE
-#define SI_ENUM_BASE		(sii->pub.si_enum_base)
-#else
-#define SI_ENUM_BASE		0x18000000	/* Enumeration space base */
-#endif				/* SI_ENUM_BASE_VARIABLE */
-
 /* Wrapper space base */
 #define SI_WRAP_BASE		0x18100000
 /* each core gets 4Kbytes for registers */
@@ -337,10 +331,8 @@
 #define DEFAULT_GPIO_ONTIME	10	/* Default: 10% on */
 #define DEFAULT_GPIO_OFFTIME	90	/* Default: 10% on */
 
-#ifndef DEFAULT_GPIOTIMERVAL
 #define DEFAULT_GPIOTIMERVAL \
 	((DEFAULT_GPIO_ONTIME << GPIO_ONTIME_SHIFT) | DEFAULT_GPIO_OFFTIME)
-#endif
 
 /*
  * Data structure to export all chip specific common variables
@@ -412,20 +404,11 @@ struct si_pub {
 #define SI_PCIUP	3
 
 /* PMU clock/power control */
-#if defined(BCMPMUCTL)
-#define PMUCTL_ENAB(sih)	(BCMPMUCTL)
-#else
 #define PMUCTL_ENAB(sih)	((sih)->cccaps & CC_CAP_PMU)
-#endif
 
 /* chipcommon clock/power control (exclusive with PMU's) */
-#if defined(BCMPMUCTL) && BCMPMUCTL
-#define CCCTL_ENAB(sih)		(0)
-#define CCPLL_ENAB(sih)		(0)
-#else
 #define CCCTL_ENAB(sih)		((sih)->cccaps & CC_CAP_PWR_CTL)
 #define CCPLL_ENAB(sih)		((sih)->cccaps & CC_CAP_PLL_MASK)
-#endif
 
 /* External PA enable mask */
 #define GPIO_CTRL_EPA_EN_MASK 0x40
drivers/staging/brcm80211/brcmsmac/channel.c +0 -12
index 1aad680..89d8fa7 100644
@@ -107,9 +107,6 @@ static const struct locale_mimo_info *brcms_c_get_mimo_2g(u8 locale_idx);
 static const struct locale_mimo_info *brcms_c_get_mimo_5g(u8 locale_idx);
 
 /* QDB() macro takes a dB value and converts to a quarter dB value */
-#ifdef QDB
-#undef QDB
-#endif
 #define QDB(n) ((n) * BRCMS_TXPWR_DB_FACTOR)
 
 /* Regulatory Matrix Spreadsheet (CLM) MIMO v3.7.9 */
@@ -489,19 +486,10 @@ static const struct locale_mimo_info *g_mimo_5g_table[] = {
 	&locale_11n
 };
 
-#ifdef LC
-#undef LC
-#endif
 #define LC(id)	LOCALE_MIMO_IDX_ ## id
 
-#ifdef LC_2G
-#undef LC_2G
-#endif
 #define LC_2G(id)	LOCALE_2G_IDX_ ## id
 
-#ifdef LC_5G
-#undef LC_5G
-#endif
 #define LC_5G(id)	LOCALE_5G_IDX_ ## id
 
 #define LOCALES(band2, band5, mimo2, mimo5) \
drivers/staging/brcm80211/brcmsmac/d11.h +0 -4
index 96f487a..f0c3f5a 100644
@@ -47,11 +47,7 @@
 #define	TX_DATA_FIFO		TX_AC_BE_FIFO
 #define	TX_CTL_FIFO		TX_AC_VO_FIFO
 
-#ifndef WL_RSSI_ANT_MAX
 #define WL_RSSI_ANT_MAX		4	/* max possible rx antennas */
-#elif WL_RSSI_ANT_MAX != 4
-#error "WL_RSSI_ANT_MAX does not match"
-#endif
 
 struct intctrlregs {
 	u32 intstatus;
drivers/staging/brcm80211/brcmsmac/mac80211_if.h +0 -3
index 7f290d7..1d52803 100644
@@ -75,9 +75,6 @@ struct brcms_info {
 
 	struct tasklet_struct tasklet;	/* dpc tasklet */
 	bool resched;		/* dpc needs to be and is rescheduled */
-#ifdef LINUXSTA_PS
-	u32 pci_psstate[16];	/* pci ps-state save/restore */
-#endif
 	struct brcms_firmware fw;
 	struct wiphy *wiphy;
 };
drivers/staging/brcm80211/brcmsmac/main.c +3 -32
index 339ab28..3aa0309 100644
@@ -3540,11 +3540,6 @@ void brcms_c_set_bssid(struct brcms_bss_cfg *cfg)
 	/* if primary config, we need to update BSSID in RXE match registers */
 	if (cfg == wlc->cfg)
 		brcms_c_set_addrmatch(wlc, RCM_BSSID_OFFSET, cfg->BSSID);
-#ifdef SUPPORT_HWKEYS
-	else if (BSSCFG_STA(cfg) && cfg->BSS)
-		brcms_c_rcmta_add_bssid(wlc, cfg);
-
-#endif
 }
 
 void brcms_b_set_shortslot(struct brcms_hardware *wlc_hw, bool shortslot)
@@ -3774,7 +3769,7 @@ u32 brcms_c_lowest_basic_rspec(struct brcms_c_info *wlc,
 			break;
 		}
 	}
-#if NCONF
+
 	/*
 	 * pick siso/cdd as default for OFDM (note no basic
 	 * rate MCSs are supported yet)
@@ -3782,8 +3777,6 @@ u32 brcms_c_lowest_basic_rspec(struct brcms_c_info *wlc,
 	if (IS_OFDM(lowest_basic_rspec))
 		lowest_basic_rspec |= (wlc->stf->ss_opmode << RSPEC_STF_SHIFT);
 
-#endif
-
 	return lowest_basic_rspec;
 }
 
@@ -4236,12 +4229,6 @@ void brcms_c_info_init(struct brcms_c_info *wlc, int unit)
 
 	/* WME QoS mode is Auto by default */
 	wlc->pub->_wme = AUTO;
-
-#ifdef BCMSDIODEV_ENABLED
-	/* enable priority flow control for sdio dongle */
-	wlc->pub->_priofc = true;
-#endif
-
 	wlc->pub->_ampdu = AMPDU_AGG_HOST;
 	wlc->pub->bcmerror = 0;
 	wlc->pub->_coex = ON;
@@ -7457,16 +7444,8 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
 			else
 				rspec[k] |= (mimo_ctlchbw << RSPEC_BW_SHIFT);
 
-			/* Set Short GI */
-#ifdef NOSGIYET
-			if (IS_MCS(rspec[k])
-			    && (txrate[k]->flags & IEEE80211_TX_RC_SHORT_GI))
-				rspec[k] |= RSPEC_SHORT_GI;
-			else if (!(txrate[k]->flags & IEEE80211_TX_RC_SHORT_GI))
-				rspec[k] &= ~RSPEC_SHORT_GI;
-#else
+			/* Disable short GI, not supported yet */
 			rspec[k] &= ~RSPEC_SHORT_GI;
-#endif
 
 			mimo_preamble_type = BRCMS_MM_PREAMBLE;
 			if (txrate[k]->flags & IEEE80211_TX_RC_GREEN_FIELD)
@@ -9582,15 +9561,7 @@ static void
 brcms_c_txflowcontrol_signal(struct brcms_c_info *wlc,
 			     struct brcms_txq_info *qi, bool on, int prio)
 {
-#ifdef NON_FUNCTIONAL
-	/* wlcif_list is never filled so this function is not functional */
-	struct brcms_c_if *wlcif;
-
-	for (wlcif = wlc->wlcif_list; wlcif != NULL; wlcif = wlcif->next) {
-		if (wlcif->qi == qi && wlcif->flags & BRCMS_IF_LINKED)
-			brcms_txflowcontrol(wlc->wl, wlcif->wlif, on, prio);
-	}
-#endif
+	/* wlcif_list is never filled so this function is not functional yet */
 }
 
 static struct brcms_txq_info *brcms_c_txq_alloc(struct brcms_c_info *wlc)
drivers/staging/brcm80211/brcmsmac/pub.h +1 -15
index c2ab1a3..f4e47e8 100644
@@ -113,10 +113,8 @@
 #define ANTSWITCH_TYPE_3	3
 
 #define RXBUFSZ		PKTBUFSZ
-#ifndef AIDMAPSZ
 /* aid bitmap size in bytes */
 #define AIDMAPSZ	(roundup(MAXSCB, NBBY)/NBBY)
-#endif				/* AIDMAPSZ */
 
 #define MAX_STREAMS_SUPPORTED	4	/* max number of streams supported */
 
@@ -353,22 +351,10 @@ enum wlc_par_id {
 #define SUPPORT_11N	(ENAB_1x1|ENAB_2x2)
 #define SUPPORT_HT	(ENAB_1x1|ENAB_2x2|ENAB_3x3)
 /* WL11N Support */
-#if ((defined(NCONF) && (NCONF != 0)) || \
-	(defined(LCNCONF) && (LCNCONF != 0)) || \
-	(defined(HTCONF) && (HTCONF != 0)) || \
-	(defined(SSLPNCONF) && (SSLPNCONF != 0)))
 #define N_ENAB(pub) ((pub)->_n_enab & SUPPORT_11N)
 #define N_REQD(pub) ((pub)->_n_reqd)
-#else
-#define N_ENAB(pub)	0
-#define N_REQD(pub)	0
-#endif
-
-#if (defined(HTCONF) && (HTCONF != 0))
-#define HT_ENAB(pub) (((pub)->_n_enab & SUPPORT_HT) == SUPPORT_HT)
-#else
+
 #define HT_ENAB(pub) 0
-#endif
 
 #define AMPDU_AGG_HOST	1
 #define AMPDU_ENAB(pub) ((pub)->_ampdu)
drivers/staging/brcm80211/brcmsmac/types.h +0 -8
index d44db56..6d17d7f 100644
@@ -20,14 +20,6 @@
 #include <linux/types.h>
 #include <linux/io.h>
 
-#if 0
-/* Bus types */
-#define SDIO_BUS		3	/* SDIO target */
-#define USB_BUS			5	/* USB (does not support R/W REG) */
-#define SPI_BUS			6	/* gSPI target */
-#define RPC_BUS			7	/* RPC target */
-#endif
-
 #define WL_CHAN_FREQ_RANGE_2G      0
 #define WL_CHAN_FREQ_RANGE_5GL     1
 #define WL_CHAN_FREQ_RANGE_5GM     2
drivers/staging/brcm80211/include/brcmu_utils.h +0 -6
index ff8f363..de627c2 100644
@@ -45,12 +45,8 @@ struct brcmu_strbuf {
 }
 
 /* osl multi-precedence packet queue */
-#ifndef PKTQ_LEN_DEFAULT
 #define PKTQ_LEN_DEFAULT        128	/* Max 128 packets */
-#endif
-#ifndef PKTQ_MAX_PREC
 #define PKTQ_MAX_PREC           16	/* Maximum precedence levels */
-#endif
 
 struct pktq_prec {
 	struct sk_buff *head;	/* first packet to dequeue */
@@ -192,9 +188,7 @@ extern int brcmu_iovar_lencheck(const struct brcmu_iovar *table, void *arg,
 
 #define BCME_STRLEN		64	/* Max string length for BCM errors */
 
-#ifndef ABS
 #define	ABS(a)			(((a) < 0) ? -(a) : (a))
-#endif				/* ABS */
 
 #define CEIL(x, y)		(((x) + ((y)-1)) / (y))
 #define	ISPOWEROF2(x)		((((x)-1)&(x)) == 0)
drivers/staging/brcm80211/include/defs.h +0 -6
index 8e0c559..c745b7e 100644
@@ -27,14 +27,8 @@
 #define USB_BUS			5
 #define SPI_BUS			6
 
-#ifndef OFF
 #define	OFF	0
-#endif
-
-#ifndef ON
 #define	ON	1		/* ON = 1 */
-#endif
-
 #define	AUTO	(-1)		/* Auto = -1 */
 
 /*
drivers/staging/brcm80211/include/soc.h +0 -4
index f23edc5..4fcb956 100644
@@ -17,11 +17,7 @@
 #ifndef	_BRCM_SOC_H
 #define	_BRCM_SOC_H
 
-#ifdef SI_ENUM_BASE_VARIABLE
-#define SI_ENUM_BASE		(sii->pub.si_enum_base)
-#else
 #define SI_ENUM_BASE		0x18000000	/* Enumeration space base */
-#endif				/* SI_ENUM_BASE_VARIABLE */
 
 /* core codes */
 #define	NODEV_CORE_ID		0x700	/* Invalid coreid */
Signature · 1 line
1.7.4.1
#13 lore raw

PATCH 13/13 staging: brcm80211: got rid of static function declarations in softmac phy

In reply to Roland Vossen

Code cleanup. Reshuffled functions so that the declarations were not necessary anymore.

---
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |  402 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 5650 +++---
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c   |22588 +++++++++++-----------
 3 files changed, 14218 insertions(+), 14422 deletions(-)
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +188 -214
index bd602de..3955d6e 100644
@@ -119,32 +119,6 @@ const u8 ofdm_rate_lookup[] = {
 
 #define PHY_WREG_LIMIT  24
 
-static void wlc_set_phy_uninitted(struct brcms_phy *pi);
-static u32 wlc_phy_get_radio_ver(struct brcms_phy *pi);
-static void wlc_phy_timercb_phycal(struct brcms_phy *pi);
-
-static bool wlc_phy_noise_calc_phy(struct brcms_phy *pi, u32 *cmplx_pwr,
-				   s8 *pwr_ant);
-
-static void wlc_phy_cal_perical_mphase_schedule(struct brcms_phy *pi,
-						uint delay);
-
-static void wlc_phy_noise_cb(struct brcms_phy *pi, u8 channel, s8 noise_dbm);
-static void wlc_phy_noise_sample_request(struct brcms_phy_pub *pih, u8 reason,
-					 u8 ch);
-
-static void wlc_phy_txpower_reg_limit_calc(struct brcms_phy *pi,
-					   struct txpwr_limits *tp,
-					   u16 chanspec);
-
-static bool wlc_phy_cal_txpower_recalc_sw(struct brcms_phy *pi);
-
-static s8 wlc_user_txpwr_antport_to_rfport(struct brcms_phy *pi, uint chan,
-					   u32 band, u8 rate);
-static void wlc_phy_upd_env_txpwr_rate_limits(struct brcms_phy *pi, u32 band);
-static s8 wlc_phy_env_measure_vbat(struct brcms_phy *pi);
-static s8 wlc_phy_env_measure_temperature(struct brcms_phy *pi);
-
 char *phy_getvar(struct brcms_phy *pi, const char *name)
 {
 	char *vars = pi->vars;
@@ -480,6 +454,37 @@ struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp)
 	return sh;
 }
 
+static void wlc_phy_timercb_phycal(struct brcms_phy *pi)
+{
+	uint delay = 5;
+
+	if (PHY_PERICAL_MPHASE_PENDING(pi)) {
+		if (!pi->sh->up) {
+			wlc_phy_cal_perical_mphase_reset(pi);
+			return;
+		}
+
+		if (SCAN_RM_IN_PROGRESS(pi) || PLT_INPROG_PHY(pi)) {
+
+			delay = 1000;
+			wlc_phy_cal_perical_mphase_restart(pi);
+		} else
+			wlc_phy_cal_perical_nphy_run(pi, PHY_PERICAL_AUTO);
+		wlapi_add_timer(pi->sh->physhim, pi->phycal_timer, delay, 0);
+		return;
+	}
+
+}
+
+static u32 wlc_phy_get_radio_ver(struct brcms_phy *pi)
+{
+	u32 ver;
+
+	ver = read_radio_id(pi);
+
+	return ver;
+}
+
 struct brcms_phy_pub *
 wlc_phy_attach(struct shared_phy *sh, struct d11regs *regs, int bandtype,
 	       char *vars, struct wiphy *wiphy)
@@ -692,28 +697,6 @@ u32 wlc_phy_get_coreflags(struct brcms_phy_pub *pih)
 	return pi->pubpi.coreflags;
 }
 
-static void wlc_phy_timercb_phycal(struct brcms_phy *pi)
-{
-	uint delay = 5;
-
-	if (PHY_PERICAL_MPHASE_PENDING(pi)) {
-		if (!pi->sh->up) {
-			wlc_phy_cal_perical_mphase_reset(pi);
-			return;
-		}
-
-		if (SCAN_RM_IN_PROGRESS(pi) || PLT_INPROG_PHY(pi)) {
-
-			delay = 1000;
-			wlc_phy_cal_perical_mphase_restart(pi);
-		} else
-			wlc_phy_cal_perical_nphy_run(pi, PHY_PERICAL_AUTO);
-		wlapi_add_timer(pi->sh->physhim, pi->phycal_timer, delay, 0);
-		return;
-	}
-
-}
-
 void wlc_phy_anacore(struct brcms_phy_pub *pih, bool on)
 {
 	struct brcms_phy *pi = (struct brcms_phy *) pih;
@@ -909,15 +892,6 @@ int wlc_phy_down(struct brcms_phy_pub *pih)
 	return callbacks;
 }
 
-static u32 wlc_phy_get_radio_ver(struct brcms_phy *pi)
-{
-	u32 ver;
-
-	ver = read_radio_id(pi);
-
-	return ver;
-}
-
 void
 wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, uint tbl_offset,
 		   u16 tblAddr, u16 tblDataHi, u16 tblDataLo)
@@ -1594,6 +1568,46 @@ u8 wlc_phy_txpower_get_target_max(struct brcms_phy_pub *ppi)
 	return pi->tx_power_max;
 }
 
+static s8 wlc_phy_env_measure_vbat(struct brcms_phy *pi)
+{
+	if (ISLCNPHY(pi))
+		return wlc_lcnphy_vbatsense(pi, 0);
+	else
+		return 0;
+}
+
+static s8 wlc_phy_env_measure_temperature(struct brcms_phy *pi)
+{
+	if (ISLCNPHY(pi))
+		return wlc_lcnphy_tempsense_degree(pi, 0);
+	else
+		return 0;
+}
+
+static void wlc_phy_upd_env_txpwr_rate_limits(struct brcms_phy *pi, u32 band)
+{
+	u8 i;
+	s8 temp, vbat;
+
+	for (i = 0; i < TXP_NUM_RATES; i++)
+		pi->txpwr_env_limit[i] = BRCMS_TXPWR_MAX;
+
+	vbat = wlc_phy_env_measure_vbat(pi);
+	temp = wlc_phy_env_measure_temperature(pi);
+
+}
+
+static s8
+wlc_user_txpwr_antport_to_rfport(struct brcms_phy *pi, uint chan, u32 band,
+				 u8 rate)
+{
+	s8 offset = 0;
+
+	if (!pi->user_txpwr_at_rfport)
+		return offset;
+	return offset;
+}
+
 void wlc_phy_txpower_recalc_target(struct brcms_phy *pi)
 {
 	u8 maxtxpwr, mintxpwr, rate, pactrl;
@@ -2274,6 +2288,123 @@ wlc_phy_noise_calc_phy(struct brcms_phy *pi, u32 *cmplx_pwr, s8 *pwr_ant)
 	return true;
 }
 
+static void wlc_phy_noise_cb(struct brcms_phy *pi, u8 channel, s8 noise_dbm)
+{
+	if (!pi->phynoise_state)
+		return;
+
+	if (pi->phynoise_state & PHY_NOISE_STATE_MON) {
+		if (pi->phynoise_chan_watchdog == channel) {
+			pi->sh->phy_noise_window[pi->sh->phy_noise_index] =
+				noise_dbm;
+			pi->sh->phy_noise_index =
+				MODINC(pi->sh->phy_noise_index, MA_WINDOW_SZ);
+		}
+		pi->phynoise_state &= ~PHY_NOISE_STATE_MON;
+	}
+
+	if (pi->phynoise_state & PHY_NOISE_STATE_EXTERNAL)
+		pi->phynoise_state &= ~PHY_NOISE_STATE_EXTERNAL;
+
+}
+
+static s8 wlc_phy_noise_read_shmem(struct brcms_phy *pi)
+{
+	u32 cmplx_pwr[PHY_CORE_MAX];
+	s8 noise_dbm_ant[PHY_CORE_MAX];
+	u16 lo, hi;
+	u32 cmplx_pwr_tot = 0;
+	s8 noise_dbm = PHY_NOISE_FIXED_VAL_NPHY;
+	u8 idx, core;
+
+	memset((u8 *) cmplx_pwr, 0, sizeof(cmplx_pwr));
+	memset((u8 *) noise_dbm_ant, 0, sizeof(noise_dbm_ant));
+
+	for (idx = 0, core = 0; core < pi->pubpi.phy_corenum; idx += 2,
+	     core++) {
+		lo = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP(idx));
+		hi = wlapi_bmac_read_shm(pi->sh->physhim,
+					 M_PWRIND_MAP(idx + 1));
+		cmplx_pwr[core] = (hi << 16) + lo;
+		cmplx_pwr_tot += cmplx_pwr[core];
+		if (cmplx_pwr[core] == 0)
+			noise_dbm_ant[core] = PHY_NOISE_FIXED_VAL_NPHY;
+		else
+			cmplx_pwr[core] >>= PHY_NOISE_SAMPLE_LOG_NUM_UCODE;
+	}
+
+	if (cmplx_pwr_tot != 0)
+		wlc_phy_noise_calc_phy(pi, cmplx_pwr, noise_dbm_ant);
+
+	for (core = 0; core < pi->pubpi.phy_corenum; core++) {
+		pi->nphy_noise_win[core][pi->nphy_noise_index] =
+			noise_dbm_ant[core];
+
+		if (noise_dbm_ant[core] > noise_dbm)
+			noise_dbm = noise_dbm_ant[core];
+	}
+	pi->nphy_noise_index =
+		MODINC_POW2(pi->nphy_noise_index, PHY_NOISE_WINDOW_SZ);
+
+	return noise_dbm;
+
+}
+
+void wlc_phy_noise_sample_intr(struct brcms_phy_pub *pih)
+{
+	struct brcms_phy *pi = (struct brcms_phy *) pih;
+	u16 jssi_aux;
+	u8 channel = 0;
+	s8 noise_dbm = PHY_NOISE_FIXED_VAL_NPHY;
+
+	if (ISLCNPHY(pi)) {
+		u32 cmplx_pwr, cmplx_pwr0, cmplx_pwr1;
+		u16 lo, hi;
+		s32 pwr_offset_dB, gain_dB;
+		u16 status_0, status_1;
+
+		jssi_aux = wlapi_bmac_read_shm(pi->sh->physhim, M_JSSI_AUX);
+		channel = jssi_aux & D11_CURCHANNEL_MAX;
+
+		lo = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP0);
+		hi = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP1);
+		cmplx_pwr0 = (hi << 16) + lo;
+
+		lo = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP2);
+		hi = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP3);
+		cmplx_pwr1 = (hi << 16) + lo;
+		cmplx_pwr = (cmplx_pwr0 + cmplx_pwr1) >> 6;
+
+		status_0 = 0x44;
+		status_1 = wlapi_bmac_read_shm(pi->sh->physhim, M_JSSI_0);
+		if ((cmplx_pwr > 0 && cmplx_pwr < 500)
+		    && ((status_1 & 0xc000) == 0x4000)) {
+
+			wlc_phy_compute_dB(&cmplx_pwr, &noise_dbm,
+					   pi->pubpi.phy_corenum);
+			pwr_offset_dB = (read_phy_reg(pi, 0x434) & 0xFF);
+			if (pwr_offset_dB > 127)
+				pwr_offset_dB -= 256;
+
+			noise_dbm += (s8) (pwr_offset_dB - 30);
+
+			gain_dB = (status_0 & 0x1ff);
+			noise_dbm -= (s8) (gain_dB);
+		} else {
+			noise_dbm = PHY_NOISE_FIXED_VAL_LCNPHY;
+		}
+	} else if (ISNPHY(pi)) {
+
+		jssi_aux = wlapi_bmac_read_shm(pi->sh->physhim, M_JSSI_AUX);
+		channel = jssi_aux & D11_CURCHANNEL_MAX;
+
+		noise_dbm = wlc_phy_noise_read_shmem(pi);
+	}
+
+	wlc_phy_noise_cb(pi, channel, noise_dbm);
+
+}
+
 static void
 wlc_phy_noise_sample_request(struct brcms_phy_pub *pih, u8 reason, u8 ch)
 {
@@ -2408,123 +2539,6 @@ void wlc_phy_noise_sample_request_external(struct brcms_phy_pub *pih)
 	wlc_phy_noise_sample_request(pih, PHY_NOISE_SAMPLE_EXTERNAL, channel);
 }
 
-static void wlc_phy_noise_cb(struct brcms_phy *pi, u8 channel, s8 noise_dbm)
-{
-	if (!pi->phynoise_state)
-		return;
-
-	if (pi->phynoise_state & PHY_NOISE_STATE_MON) {
-		if (pi->phynoise_chan_watchdog == channel) {
-			pi->sh->phy_noise_window[pi->sh->phy_noise_index] =
-				noise_dbm;
-			pi->sh->phy_noise_index =
-				MODINC(pi->sh->phy_noise_index, MA_WINDOW_SZ);
-		}
-		pi->phynoise_state &= ~PHY_NOISE_STATE_MON;
-	}
-
-	if (pi->phynoise_state & PHY_NOISE_STATE_EXTERNAL)
-		pi->phynoise_state &= ~PHY_NOISE_STATE_EXTERNAL;
-
-}
-
-static s8 wlc_phy_noise_read_shmem(struct brcms_phy *pi)
-{
-	u32 cmplx_pwr[PHY_CORE_MAX];
-	s8 noise_dbm_ant[PHY_CORE_MAX];
-	u16 lo, hi;
-	u32 cmplx_pwr_tot = 0;
-	s8 noise_dbm = PHY_NOISE_FIXED_VAL_NPHY;
-	u8 idx, core;
-
-	memset((u8 *) cmplx_pwr, 0, sizeof(cmplx_pwr));
-	memset((u8 *) noise_dbm_ant, 0, sizeof(noise_dbm_ant));
-
-	for (idx = 0, core = 0; core < pi->pubpi.phy_corenum; idx += 2,
-	     core++) {
-		lo = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP(idx));
-		hi = wlapi_bmac_read_shm(pi->sh->physhim,
-					 M_PWRIND_MAP(idx + 1));
-		cmplx_pwr[core] = (hi << 16) + lo;
-		cmplx_pwr_tot += cmplx_pwr[core];
-		if (cmplx_pwr[core] == 0)
-			noise_dbm_ant[core] = PHY_NOISE_FIXED_VAL_NPHY;
-		else
-			cmplx_pwr[core] >>= PHY_NOISE_SAMPLE_LOG_NUM_UCODE;
-	}
-
-	if (cmplx_pwr_tot != 0)
-		wlc_phy_noise_calc_phy(pi, cmplx_pwr, noise_dbm_ant);
-
-	for (core = 0; core < pi->pubpi.phy_corenum; core++) {
-		pi->nphy_noise_win[core][pi->nphy_noise_index] =
-			noise_dbm_ant[core];
-
-		if (noise_dbm_ant[core] > noise_dbm)
-			noise_dbm = noise_dbm_ant[core];
-	}
-	pi->nphy_noise_index =
-		MODINC_POW2(pi->nphy_noise_index, PHY_NOISE_WINDOW_SZ);
-
-	return noise_dbm;
-
-}
-
-void wlc_phy_noise_sample_intr(struct brcms_phy_pub *pih)
-{
-	struct brcms_phy *pi = (struct brcms_phy *) pih;
-	u16 jssi_aux;
-	u8 channel = 0;
-	s8 noise_dbm = PHY_NOISE_FIXED_VAL_NPHY;
-
-	if (ISLCNPHY(pi)) {
-		u32 cmplx_pwr, cmplx_pwr0, cmplx_pwr1;
-		u16 lo, hi;
-		s32 pwr_offset_dB, gain_dB;
-		u16 status_0, status_1;
-
-		jssi_aux = wlapi_bmac_read_shm(pi->sh->physhim, M_JSSI_AUX);
-		channel = jssi_aux & D11_CURCHANNEL_MAX;
-
-		lo = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP0);
-		hi = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP1);
-		cmplx_pwr0 = (hi << 16) + lo;
-
-		lo = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP2);
-		hi = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP3);
-		cmplx_pwr1 = (hi << 16) + lo;
-		cmplx_pwr = (cmplx_pwr0 + cmplx_pwr1) >> 6;
-
-		status_0 = 0x44;
-		status_1 = wlapi_bmac_read_shm(pi->sh->physhim, M_JSSI_0);
-		if ((cmplx_pwr > 0 && cmplx_pwr < 500)
-		    && ((status_1 & 0xc000) == 0x4000)) {
-
-			wlc_phy_compute_dB(&cmplx_pwr, &noise_dbm,
-					   pi->pubpi.phy_corenum);
-			pwr_offset_dB = (read_phy_reg(pi, 0x434) & 0xFF);
-			if (pwr_offset_dB > 127)
-				pwr_offset_dB -= 256;
-
-			noise_dbm += (s8) (pwr_offset_dB - 30);
-
-			gain_dB = (status_0 & 0x1ff);
-			noise_dbm -= (s8) (gain_dB);
-		} else {
-			noise_dbm = PHY_NOISE_FIXED_VAL_LCNPHY;
-		}
-	} else if (ISNPHY(pi)) {
-
-		jssi_aux = wlapi_bmac_read_shm(pi->sh->physhim, M_JSSI_AUX);
-		channel = jssi_aux & D11_CURCHANNEL_MAX;
-
-		noise_dbm = wlc_phy_noise_read_shmem(pi);
-	}
-
-	wlc_phy_noise_cb(pi, channel, noise_dbm);
-
-}
-
 s8 lcnphy_gain_index_offset_for_pkt_rssi[] = {
 	8,
 	8,
@@ -2985,46 +2999,6 @@ void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode)
 	}
 }
 
-static s8
-wlc_user_txpwr_antport_to_rfport(struct brcms_phy *pi, uint chan, u32 band,
-				 u8 rate)
-{
-	s8 offset = 0;
-
-	if (!pi->user_txpwr_at_rfport)
-		return offset;
-	return offset;
-}
-
-static s8 wlc_phy_env_measure_vbat(struct brcms_phy *pi)
-{
-	if (ISLCNPHY(pi))
-		return wlc_lcnphy_vbatsense(pi, 0);
-	else
-		return 0;
-}
-
-static s8 wlc_phy_env_measure_temperature(struct brcms_phy *pi)
-{
-	if (ISLCNPHY(pi))
-		return wlc_lcnphy_tempsense_degree(pi, 0);
-	else
-		return 0;
-}
-
-static void wlc_phy_upd_env_txpwr_rate_limits(struct brcms_phy *pi, u32 band)
-{
-	u8 i;
-	s8 temp, vbat;
-
-	for (i = 0; i < TXP_NUM_RATES; i++)
-		pi->txpwr_env_limit[i] = BRCMS_TXPWR_MAX;
-
-	vbat = wlc_phy_env_measure_vbat(pi);
-	temp = wlc_phy_env_measure_temperature(pi);
-
-}
-
 void wlc_phy_ldpc_override_set(struct brcms_phy_pub *ppi, bool ldpc)
 {
 	return;
drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +2793 -2857

2,550 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +11237 -11351

22,588 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.4.1

Part of the diff is not shown here. View the raw message.

#14 lore raw
In reply to Roland Vossen
Quoted 6 lines · Roland Vossen

Comments were given by various people. This patch covers part of those comments. Apart from that, there is also a bugfix.

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

Message-ID: <927eab8b5c950c13991911cd4c16457a5d618bc7.1314252671.git.joe@perches.com>

All applied.