Skip to contentSkip to conversation

staging: brcm80211: cleanup checkpatch warnings

PATCH In review Arend van Spriel 3 participants 32 messages Jul 22, 2011 – Jul 26, 2011 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: brcm80211: cleanup checkpatch warnings

This series contains several patches getting rid of the last checkpatch warnings on the brcm80211 folder. Also several cleanup patches for brcmfmac driver are in this series.

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

Message-ID:<[email protected]> *excluding* Message-ID:<[email protected]>
Message-ID: <[email protected]>

Arend van Spriel (9):
staging: brcm80211: use PCI_DEVICE() macro in device table
staging: brcm80211: remove unused rx status definitions
staging: brcm80211: reformat long lines in brcmsmac to 80 columns
staging: brcm80211: remove wl_alloc_dma_resources() function
staging: brcm80211: remove dma_addrwidth() function
staging: brcm80211: revisited END_FOREACH_BSS macro
staging: brcm80211: cleanup to get rid of 'over 80 character' line
staging: brcm80211: remove target platform limitations for drivers
staging: brcm80211: updated TODO file

Franky Lin (8):
staging: brcm80211: remove code for unsupported chip
staging: brcm80211: placed suspend flag in gInstance in brcmfmac
staging: brcm80211: remove struct brcmf_sdioh_driver from brcmfmac
staging: brcm80211: remove vendor and device id check from brcmfmac
staging: brcm80211: remove struct brcmf_sdio_card from brcmfmac
staging: brcm80211: remove dead code from brcmfmac
staging: brcm80211: remove dead client interrupt code from brcmfmac
staging: brcm80211: remove function pointer of interrupt isr in
brcmfmac

Pieter-Paul Giesberts (1):
staging: brcm80211: SPARC build error fix

Roland Vossen (11):
staging: brcm80211: fixed checkpatch warnings for fullmac
staging: brcm80211: fixed checkpatch warnings for brcmutil dir
staging: brcm80211: fixed checkpatch warnings for 'include' dir
staging: brcm80211: cleaned up softmac DMA layer
staging: brcm80211: removed void * from softmac phy
staging: brcm80211: simplified register access macro's in softmac
staging: brcm80211: removed unused bus code from softmac
staging: brcm80211: replaced void *btparam into struct pci_dev
*btparam
staging: brcm80211: removed void * from ai_ functions
staging: brcm80211: removed brcms_c_module_unregister() call in
ampdu.c
staging: brcm80211: removed watchdog function from softmac

 drivers/staging/brcm80211/Kconfig                 |    2 -
 drivers/staging/brcm80211/TODO                    |    4 -
 drivers/staging/brcm80211/brcmfmac/bcmsdh.c       |  196 ++----
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |  161 +----
 drivers/staging/brcm80211/brcmfmac/dhd.h          |  115 ++--
 drivers/staging/brcm80211/brcmfmac/dhd_common.c   |   23 +-
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c    |   27 +-
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c     |  687 ++++++++---------
 drivers/staging/brcm80211/brcmfmac/sdio_host.h    |  189 +++---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c  |   23 +-
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h  |    3 +-
 drivers/staging/brcm80211/brcmsmac/aiutils.c      |  701 +++++++----------
 drivers/staging/brcm80211/brcmsmac/aiutils.h      |   40 +-
 drivers/staging/brcm80211/brcmsmac/ampdu.c        |  197 +++--
 drivers/staging/brcm80211/brcmsmac/antsel.c       |   15 +-
 drivers/staging/brcm80211/brcmsmac/channel.c      |  151 +++--
 drivers/staging/brcm80211/brcmsmac/channel.h      |   15 +-
 drivers/staging/brcm80211/brcmsmac/d11.h          |  617 +++++++++------
 drivers/staging/brcm80211/brcmsmac/dma.c          |  726 +++++-------------
 drivers/staging/brcm80211/brcmsmac/dma.h          |  133 +---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c  |   78 +--
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h  |   13 +-
 drivers/staging/brcm80211/brcmsmac/main.c         |  869 +++++++++++++--------
 drivers/staging/brcm80211/brcmsmac/main.h         |  694 ++++++++++-------
 drivers/staging/brcm80211/brcmsmac/nicpci.c       |    4 +-
 drivers/staging/brcm80211/brcmsmac/otp.c          |   33 +-
 drivers/staging/brcm80211/brcmsmac/otp.h          |    3 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c  |   30 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h  |   12 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h  |    8 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c  |    7 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c    |   47 +-
 drivers/staging/brcm80211/brcmsmac/phy_shim.c     |   16 +-
 drivers/staging/brcm80211/brcmsmac/phy_shim.h     |   66 +-
 drivers/staging/brcm80211/brcmsmac/pmu.c          |   14 +-
 drivers/staging/brcm80211/brcmsmac/pub.h          |  228 +++---
 drivers/staging/brcm80211/brcmsmac/rate.c         |  104 ++--
 drivers/staging/brcm80211/brcmsmac/rate.h         |  141 +++-
 drivers/staging/brcm80211/brcmsmac/scb.h          |   35 +-
 drivers/staging/brcm80211/brcmsmac/srom.c         |   75 +-
 drivers/staging/brcm80211/brcmsmac/srom.h         |    4 +-
 drivers/staging/brcm80211/brcmsmac/stf.c          |   54 +-
 drivers/staging/brcm80211/brcmsmac/types.h        |  268 ++++---
 drivers/staging/brcm80211/brcmutil/utils.c        |    9 +-
 drivers/staging/brcm80211/brcmutil/wifi.c         |   23 +-
 drivers/staging/brcm80211/include/brcmu_utils.h   |    3 +-
 drivers/staging/brcm80211/include/brcmu_wifi.h    |  103 ++-
 drivers/staging/brcm80211/include/chipcommon.h    |    9 +-
 drivers/staging/brcm80211/include/defs.h          |   14 +-
 drivers/staging/brcm80211/include/soc.h           |    5 +-
 50 files changed, 3491 insertions(+), 3503 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/29 staging: brcm80211: fixed checkpatch warnings for fullmac

From: Roland Vossen <[email protected]>

Most of them being 'line longer than 80 chars' type of warning.

---
 drivers/staging/brcm80211/brcmfmac/dhd.h         |  115 ++++++++++------
 drivers/staging/brcm80211/brcmfmac/dhd_common.c  |   23 ++--
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c   |   27 ++--
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c    |  156 +++++++++++++---------
 drivers/staging/brcm80211/brcmfmac/sdio_host.h   |   95 +++++++++-----
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |   23 ++--
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h |    3 +-
 7 files changed, 265 insertions(+), 177 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +70 -45
index 3c950cc..cd1b90d 100644
@@ -117,11 +117,16 @@
 #define BRCMF_SCAN_RESULTS_ABORTED	3
 #define BRCMF_SCAN_RESULTS_NO_MEM	4
 
-#define WL_SOFT_KEY	(1 << 0)	/* Indicates this key is using soft encrypt */
-#define BRCMF_PRIMARY_KEY	(1 << 1)	/* primary (ie tx) key */
-#define WL_KF_RES_4	(1 << 4)	/* Reserved for backward compat */
-#define WL_KF_RES_5	(1 << 5)	/* Reserved for backward compat */
-#define WL_IBSS_PEER_GROUP_KEY	(1 << 6)	/* Indicates a group key for a IBSS PEER */
+/* Indicates this key is using soft encrypt */
+#define WL_SOFT_KEY	(1 << 0)
+/* primary (ie tx) key */
+#define BRCMF_PRIMARY_KEY	(1 << 1)
+/* Reserved for backward compat */
+#define WL_KF_RES_4	(1 << 4)
+/* Reserved for backward compat */
+#define WL_KF_RES_5	(1 << 5)
+/* Indicates a group key for a IBSS PEER */
+#define WL_IBSS_PEER_GROUP_KEY	(1 << 6)
 
 /* For supporting multiple interfaces */
 #define BRCMF_MAX_IFS	16
@@ -333,13 +338,18 @@ enum brcmf_bus_state {
  * that indicates which bits within the pattern should be matched.
  */
 struct brcmf_pkt_filter_pattern {
-	u32 offset;		/* Offset within received packet to start pattern matching.
-				 * Offset '0' is the first byte of the ethernet header.
-				 */
-	u32 size_bytes;	/* Size of the pattern.  Bitmask must be the same size. */
-	u8 mask_and_pattern[1];	/* Variable length mask and pattern data.  mask starts
-					 * at offset 0.  Pattern immediately follows mask.
-					 */
+	/*
+	 * Offset within received packet to start pattern matching.
+	 * Offset '0' is the first byte of the ethernet header.
+	 */
+	u32 offset;
+	/* Size of the pattern.  Bitmask must be the same size.*/
+	u32 size_bytes;
+	/*
+	 * Variable length mask and pattern data. mask starts at offset 0.
+	 * Pattern immediately follows mask.
+	 */
+	u8 mask_and_pattern[1];
 };
 
 /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
@@ -373,8 +383,8 @@ struct brcmf_bss_info {
 	u8 SSID_len;
 	u8 SSID[32];
 	struct {
-		uint count;	/* # rates in this set */
-		u8 rates[16];	/* rates in 500kbps units w/hi bit set if basic */
+		uint count;   /* # rates in this set */
+		u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
 	} rateset;		/* supported rates */
 	u16 chanspec;	/* chanspec for bss */
 	u16 atim_window;	/* units are Kusec */
@@ -409,7 +419,7 @@ struct brcmf_scan_params {
 				 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
 				 */
 	u8 scan_type;	/* flags, 0 use default */
-	s32 nprobes;		/* -1 use default, number of probes per channel */
+	s32 nprobes;	  /* -1 use default, number of probes per channel */
 	s32 active_time;	/* -1 use default, dwell time per channel for
 				 * active scanning
 				 */
@@ -460,11 +470,13 @@ struct brcmf_scan_results {
 
 /* used for association with a specific BSSID and chanspec list */
 struct brcmf_assoc_params {
-	u8 bssid[ETH_ALEN];	/* 00:00:00:00:00:00: broadcast scan */
-	s32 chanspec_num;	/* 0: all available channels,
-				 * otherwise count of chanspecs in chanspec_list
-				 */
-	u16 chanspec_list[1];	/* list of chanspecs */
+	/* 00:00:00:00:00:00: broadcast scan */
+	u8 bssid[ETH_ALEN];
+	/* 0: all available channels, otherwise count of chanspecs in
+	 * chanspec_list */
+	s32 chanspec_num;
+	/* list of chanspecs */
+	u16 chanspec_list[1];
 };
 #define BRCMF_ASSOC_PARAMS_FIXED_SIZE \
 	(sizeof(struct brcmf_assoc_params) - sizeof(u16))
@@ -495,8 +507,8 @@ struct brcmf_wsec_key {
 	u32 len;		/* key length */
 	u8 data[WLAN_MAX_KEY_LEN];	/* key data */
 	u32 pad_1[18];
-	u32 algo;		/* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
-	u32 flags;		/* misc flags */
+	u32 algo;	/* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
+	u32 flags;	/* misc flags */
 	u32 pad_2[2];
 	int pad_3;
 	int iv_initialized;	/* has IV been initialized already? */
@@ -558,32 +570,45 @@ struct brcmf_pub {
 	/* Dongle media info */
 	bool iswl;		/* Dongle-resident driver is wl */
 	unsigned long drv_version;	/* Version of dongle-resident driver */
-	u8 mac[ETH_ALEN];			/* MAC address obtained from dongle */
+	u8 mac[ETH_ALEN];		/* MAC address obtained from dongle */
 	struct dngl_stats dstats;	/* Stats for dongle-based data */
 
 	/* Additional stats for the bus level */
-	unsigned long tx_packets;	/* Data packets sent to dongle */
-	unsigned long tx_multicast;	/* Multicast data packets sent to dongle */
-	unsigned long tx_errors;	/* Errors in sending data to dongle */
-	unsigned long tx_ctlpkts;	/* Control packets sent to dongle */
-	unsigned long tx_ctlerrs;	/* Errors sending control frames to dongle */
-	unsigned long rx_packets;	/* Packets sent up the network interface */
-	unsigned long rx_multicast;	/* Multicast packets sent up the network
-					 interface */
-	unsigned long rx_errors;	/* Errors processing rx data packets */
-	unsigned long rx_ctlpkts;	/* Control frames processed from dongle */
-	unsigned long rx_ctlerrs;	/* Errors in processing rx control frames */
-	unsigned long rx_dropped;	/* Packets dropped locally (no memory) */
-	unsigned long rx_flushed;	/* Packets flushed due to
-				unscheduled sendup thread */
-	unsigned long wd_dpc_sched;	/* Number of times dpc scheduled by
-					 watchdog timer */
-
-	unsigned long rx_readahead_cnt;	/* Number of packets where header read-ahead
-					 was used. */
-	unsigned long tx_realloc;	/* Number of tx packets we had to realloc for
-					 headroom */
-	unsigned long fc_packets;	/* Number of flow control pkts recvd */
+
+	/* Data packets sent to dongle */
+	unsigned long tx_packets;
+	/* Multicast data packets sent to dongle */
+	unsigned long tx_multicast;
+	/* Errors in sending data to dongle */
+	unsigned long tx_errors;
+	/* Control packets sent to dongle */
+	unsigned long tx_ctlpkts;
+	/* Errors sending control frames to dongle */
+	unsigned long tx_ctlerrs;
+	/* Packets sent up the network interface */
+	unsigned long rx_packets;
+	/* Multicast packets sent up the network interface */
+	unsigned long rx_multicast;
+	/* Errors processing rx data packets */
+	unsigned long rx_errors;
+	/* Control frames processed from dongle */
+	unsigned long rx_ctlpkts;
+
+	/* Errors in processing rx control frames */
+	unsigned long rx_ctlerrs;
+	/* Packets dropped locally (no memory) */
+	unsigned long rx_dropped;
+	/* Packets flushed due to unscheduled sendup thread */
+	unsigned long rx_flushed;
+	/* Number of times dpc scheduled by watchdog timer */
+	unsigned long wd_dpc_sched;
+
+	/* Number of packets where header read-ahead was used. */
+	unsigned long rx_readahead_cnt;
+	/* Number of tx packets we had to realloc for headroom */
+	unsigned long tx_realloc;
+	/* Number of flow control pkts recvd */
+	unsigned long fc_packets;
 
 	/* Last error return */
 	int bcmerror;
drivers/staging/brcm80211/brcmfmac/dhd_common.c +11 -12
index fdd3629..a6704c4 100644
@@ -660,20 +660,19 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
 				 + be16_to_cpu(hdr.len)) = '\0';
 
 			if (be32_to_cpu(hdr.discarded_bytes)
-			    || be32_to_cpu(hdr.discarded_printf)) {
-				BRCMF_ERROR(
-				    ("\nWLC_E_TRACE: [Discarded traces in dongle -->"
-				     "discarded_bytes %d discarded_printf %d]\n",
-				     be32_to_cpu(hdr.discarded_bytes),
-				     be32_to_cpu(hdr.discarded_printf)));
-			}
+			    || be32_to_cpu(hdr.discarded_printf))
+				BRCMF_ERROR(("\nWLC_E_TRACE: [Discarded traces "
+					     "in dongle -->discarded_bytes %d "
+					     "discarded_printf %d]\n",
+					     be32_to_cpu(hdr.discarded_bytes),
+					     be32_to_cpu(hdr.discarded_printf)))
+					     ;
 
 			nblost = be32_to_cpu(hdr.seqnum) - seqnum_prev - 1;
-			if (nblost > 0) {
-				BRCMF_ERROR(
-				    ("\nWLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n",
-				     be32_to_cpu(hdr.seqnum), nblost));
-			}
+			if (nblost > 0)
+				BRCMF_ERROR(("\nWLC_E_TRACE: [Event lost --> "
+					     "seqnum %d nblost %d\n",
+					     be32_to_cpu(hdr.seqnum), nblost));
 			seqnum_prev = be32_to_cpu(hdr.seqnum);
 
 			/* Display the trace buffer. Advance from \n to \n to
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +15 -12
index 54b09e0..1100097 100644
@@ -133,8 +133,8 @@ module_param(brcmf_pktgen_len, uint, 0);
 
 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, void *pktdata,
-			    struct brcmf_event_msg *event_ptr,
+static int brcmf_host_event(struct brcmf_info *drvr_priv, int *ifidx,
+			    void *pktdata, struct brcmf_event_msg *event_ptr,
 			    void **data_ptr);
 
 static int brcmf_net2idx(struct brcmf_info *drvr_priv, struct net_device *net)
@@ -303,7 +303,8 @@ static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
 	}
 }
 
-static int _brcmf_set_mac_address(struct brcmf_info *drvr_priv, int ifidx, u8 *addr)
+static int
+_brcmf_set_mac_address(struct brcmf_info *drvr_priv, int ifidx, u8 *addr)
 {
 	char buf[32];
 	struct brcmf_ioctl ioc;
@@ -368,7 +369,8 @@ static void brcmf_op_if(struct brcmf_if *ifp)
 		}
 		if (ret == 0) {
 			strcpy(ifp->net->name, ifp->name);
-			memcpy(netdev_priv(ifp->net), &drvr_priv, sizeof(drvr_priv));
+			memcpy(netdev_priv(ifp->net), &drvr_priv,
+			       sizeof(drvr_priv));
 			err = brcmf_net_attach(&drvr_priv->pub, ifp->idx);
 			if (err != 0) {
 				BRCMF_ERROR(("%s: brcmf_net_attach failed, "
@@ -1024,7 +1026,8 @@ static int brcmf_netdev_ioctl_entry(struct net_device *net, struct ifreq *ifr,
 
 	/* check for local brcmf ioctl and handle it */
 	if (driver == BRCMF_IOCTL_MAGIC) {
-		bcmerror = brcmf_c_ioctl((void *)&drvr_priv->pub, &ioc, buf, buflen);
+		bcmerror = brcmf_c_ioctl((void *)&drvr_priv->pub, &ioc,
+					 buf, buflen);
 		if (bcmerror)
 			drvr_priv->pub.bcmerror = bcmerror;
 		goto done;
@@ -1054,9 +1057,8 @@ static int brcmf_netdev_ioctl_entry(struct net_device *net, struct ifreq *ifr,
 	if (is_set_key_cmd)
 		brcmf_netdev_wait_pend8021x(net);
 
-	bcmerror =
-	    brcmf_proto_ioctl(&drvr_priv->pub, ifidx, (struct brcmf_ioctl *)&ioc,
-			      buf, buflen);
+	bcmerror = brcmf_proto_ioctl(&drvr_priv->pub, ifidx,
+				     (struct brcmf_ioctl *)&ioc, buf, buflen);
 
 done:
 	if (!bcmerror && buf && ioc.buf) {
@@ -1253,8 +1255,8 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
 
 	if (brcmf_sysioc) {
 		init_waitqueue_head(&drvr_priv->sysioc_waitq);
-		drvr_priv->sysioc_tsk = kthread_run(_brcmf_sysioc_thread, drvr_priv,
-						"_brcmf_sysioc");
+		drvr_priv->sysioc_tsk = kthread_run(_brcmf_sysioc_thread,
+						    drvr_priv, "_brcmf_sysioc");
 		if (IS_ERR(drvr_priv->sysioc_tsk)) {
 			printk(KERN_WARNING
 				"_brcmf_sysioc thread failed to start\n");
@@ -1513,8 +1515,9 @@ int brcmf_os_proto_unblock(struct brcmf_pub *drvr)
 	return 0;
 }
 
-static int brcmf_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,
-			    struct brcmf_event_msg *event, void **data)
+static int brcmf_host_event(struct brcmf_info *drvr_priv, int *ifidx,
+			    void *pktdata, struct brcmf_event_msg *event,
+			    void **data)
 {
 	int bcmerror = 0;
 
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +91 -65

247 lines not on this page · raw message

drivers/staging/brcm80211/brcmfmac/sdio_host.h +62 -33

132 lines not on this page · raw message

drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +14 -9
index ae0a7eb..b50999c 100644
@@ -795,8 +795,8 @@ __brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
 				sizeof(sr->ssid));
 		if (err) {
 			if (err == -EBUSY)
-				WL_INFO("system busy : scan for \"%s\" canceled\n",
-					sr->ssid.SSID);
+				WL_INFO("system busy : scan for \"%s\" "
+					"canceled\n", sr->ssid.SSID);
 			else
 				WL_ERR("WLC_SCAN error (%d)\n", err);
 
@@ -1098,7 +1098,8 @@ done:
 	return err;
 }
 
-static s32 brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
+static s32
+brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
 {
 	struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
 	s32 err = 0;
@@ -1113,8 +1114,8 @@ static s32 brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev
 	return err;
 }
 
-static s32
-brcmf_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme)
+static s32 brcmf_set_wpa_version(struct net_device *dev,
+				 struct cfg80211_connect_params *sme)
 {
 	struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
 	struct brcmf_cfg80211_security *sec;
@@ -1178,7 +1179,8 @@ brcmf_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)
 }
 
 static s32
-brcmf_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme)
+brcmf_set_set_cipher(struct net_device *dev,
+		     struct cfg80211_connect_params *sme)
 {
 	struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
 	struct brcmf_cfg80211_security *sec;
@@ -1428,7 +1430,8 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
 	memset(&join_params, 0, sizeof(join_params));
 	join_params_size = sizeof(join_params.ssid);
 
-	join_params.ssid.SSID_len = min(sizeof(join_params.ssid.SSID), sme->ssid_len);
+	join_params.ssid.SSID_len =
+		min(sizeof(join_params.ssid.SSID), sme->ssid_len);
 	memcpy(&join_params.ssid.SSID, sme->ssid, join_params.ssid.SSID_len);
 	join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len);
 	brcmf_update_prof(cfg_priv, NULL, &join_params.ssid, WL_PROF_SSID);
@@ -1515,7 +1518,8 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy,
 	/* Make sure radio is off or on as far as software is concerned */
 	disable = WL_RADIO_SW_DISABLE << 16;
 	disable = cpu_to_le32(disable);
-	err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_RADIO, &disable, sizeof(disable));
+	err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_RADIO, &disable,
+			      sizeof(disable));
 	if (unlikely(err))
 		WL_ERR("WLC_SET_RADIO error (%d)\n", err);
 
@@ -2061,7 +2065,8 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
 
 	legacy = brcmf_find_msb(mask->control[IEEE80211_BAND_2GHZ].legacy);
 	if (!legacy)
-		legacy = brcmf_find_msb(mask->control[IEEE80211_BAND_5GHZ].legacy);
+		legacy = brcmf_find_msb(
+				mask->control[IEEE80211_BAND_5GHZ].legacy);
 
 	val = wl_g_rates[legacy - 1].bitrate * 100000;
 
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +2 -1
index e25c755..049138b 100644
@@ -340,7 +340,8 @@ static inline struct brcmf_bss_info *next_bss(struct brcmf_scan_results *list,
 }
 
 #define for_each_bss(list, bss, __i)	\
-	for (__i = 0; __i < list->count && __i < WL_AP_MAX; __i++, bss = next_bss(list, bss))
+	for (__i = 0; __i < list->count && __i < WL_AP_MAX; __i++, \
+	     bss = next_bss(list, bss))
 
 extern s32 brcmf_cfg80211_attach(struct net_device *ndev, void *data);
 extern void brcmf_cfg80211_detach(void);
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/29 staging: brcm80211: fixed checkpatch warnings for brcmutil dir

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

Most of them being 'line longer than 80 chars' type of warning.

---
 drivers/staging/brcm80211/brcmutil/utils.c |    9 ++++++---
 drivers/staging/brcm80211/brcmutil/wifi.c  |   23 +++++++++++++++--------
 2 files changed, 21 insertions(+), 11 deletions(-)
drivers/staging/brcm80211/brcmutil/utils.c +6 -3
index 4b08157..7b4d658 100644
@@ -489,8 +489,8 @@ static const u8 crc8_table[256] = {
 };
 
 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 */
+	      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)
@@ -586,7 +586,10 @@ brcmu_format_flags(const struct brcmu_bit_desc *bd, u32 flags, char *buf,
 }
 EXPORT_SYMBOL(brcmu_format_flags);
 
-/* print bytes formatted as hex to a string. return the resulting string length */
+/*
+ * print bytes formatted as hex to a string. return the resulting
+ * string length
+ */
 int brcmu_format_hex(char *str, const void *bytes, int len)
 {
 	int i;
drivers/staging/brcm80211/brcmutil/wifi.c +15 -8
index 1bce888..636515c 100644
@@ -43,9 +43,9 @@ bool brcmu_chspec_malformed(u16 chanspec)
 EXPORT_SYMBOL(brcmu_chspec_malformed);
 
 /*
- * This function returns the channel number that control traffic is being sent on, for legacy
- * channels this is just the channel number, for 40MHZ channels it is the upper or lowre 20MHZ
- * sideband depending on the chanspec selected
+ * This function returns the channel number that control traffic is being sent
+ * on, for legacy channels this is just the channel number, for 40MHZ channels
+ * it is the upper or lower 20MHZ sideband depending on the chanspec selected.
  */
 u8 brcmu_chspec_ctlchan(u16 chspec)
 {
@@ -55,15 +55,22 @@ u8 brcmu_chspec_ctlchan(u16 chspec)
 	if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) {
 		return CHSPEC_CHANNEL(chspec);
 	} else {
-		/* we only support 40MHZ with sidebands */
-		/* chanspec channel holds the centre frequency, use that and the
-		 * side band information to reconstruct the control channel number
+		/*
+		 * we only support 40MHZ with sidebands. chanspec channel holds
+		 * the centre frequency, use that and the side band information
+		 * to reconstruct the control channel number
 		 */
 		if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER)
-			/* control chan is the upper 20 MHZ SB of the 40MHZ channel */
+			/*
+			 * control chan is the upper 20 MHZ SB of the
+			 * 40MHZ channel
+			 */
 			ctl_chan = UPPER_20_SB(CHSPEC_CHANNEL(chspec));
 		else
-			/* control chan is the lower 20 MHZ SB of the 40MHZ channel */
+			/*
+			 * control chan is the lower 20 MHZ SB of the
+			 * 40MHZ channel
+			 */
 			ctl_chan = LOWER_20_SB(CHSPEC_CHANNEL(chspec));
 	}
 
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 3/29 staging: brcm80211: fixed checkpatch warnings for 'include' dir

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

All of them being 'line longer than 80 chars' type of warning.

---
 drivers/staging/brcm80211/include/brcmu_utils.h |    3 +-
 drivers/staging/brcm80211/include/brcmu_wifi.h  |  103 +++++++++++++++--------
 drivers/staging/brcm80211/include/chipcommon.h  |    9 ++-
 drivers/staging/brcm80211/include/defs.h        |   14 ++-
 drivers/staging/brcm80211/include/soc.h         |    5 +-
 5 files changed, 88 insertions(+), 46 deletions(-)
drivers/staging/brcm80211/include/brcmu_utils.h +2 -1
index 513fa34..da13e24 100644
@@ -264,7 +264,8 @@ struct brcmu_tlv {
 	u8 data[1];
 };
 
-#define ETHER_ADDR_STR_LEN	18	/* 18-bytes of Ethernet address buffer length */
+/* 18-bytes of Ethernet address buffer length */
+#define ETHER_ADDR_STR_LEN	18
 
 /* externs */
 /* crc */
drivers/staging/brcm80211/include/brcmu_wifi.h +68 -35

150 lines not on this page · raw message

drivers/staging/brcm80211/include/chipcommon.h +6 -3
index 8de5913..fefabc3 100644
@@ -231,7 +231,8 @@ struct chipcregs {
 #define	CC_CAP_UARTS_MASK	0x00000003	/* Number of UARTs */
 #define CC_CAP_MIPSEB		0x00000004	/* MIPS is in big-endian mode */
 #define CC_CAP_UCLKSEL		0x00000018	/* UARTs clock select */
-#define CC_CAP_UINTCLK		0x00000008	/* UARTs are driven by internal divided clock */
+/* UARTs are driven by internal divided clock */
+#define CC_CAP_UINTCLK		0x00000008
 #define CC_CAP_UARTGPIO		0x00000020	/* UARTs own GPIOs 15:12 */
 #define CC_CAP_EXTBUS_MASK	0x000000c0	/* External bus mask */
 #define CC_CAP_EXTBUS_NONE	0x00000000	/* No ExtBus present */
@@ -248,10 +249,12 @@ struct chipcregs {
 #define CC_CAP_BKPLN64		0x08000000	/* 64-bit backplane */
 #define	CC_CAP_PMU		0x10000000	/* PMU Present, rev >= 20 */
 #define	CC_CAP_SROM		0x40000000	/* Srom Present, rev >= 32 */
-#define	CC_CAP_NFLASH		0x80000000	/* Nand flash present, rev >= 35 */
+/* Nand flash present, rev >= 35 */
+#define	CC_CAP_NFLASH		0x80000000
 
 #define	CC_CAP2_SECI		0x00000001	/* SECI Present, rev >= 36 */
-#define	CC_CAP2_GSIO		0x00000002	/* GSIO (spi/i2c) present, rev >= 37 */
+/* GSIO (spi/i2c) present, rev >= 37 */
+#define	CC_CAP2_GSIO		0x00000002
 
 /* pmucapabilities */
 #define PCAP_REV_MASK	0x000000ff
drivers/staging/brcm80211/include/defs.h +10 -4
index 838424c..8e0c559 100644
@@ -55,8 +55,10 @@
 #define WL_NUMRATES		16	/* max # of rates in a rateset */
 
 struct brcm_rateset {
-	u32 count;		/* # rates in this set */
-	u8 rates[WL_NUMRATES];	/* rates in 500kbps units w/hi bit set if basic */
+	/* # rates in this set */
+	u32 count;
+	/* rates in 500kbps units w/hi bit set if basic */
+	u8 rates[WL_NUMRATES];
 };
 
 #define BRCM_CNTRY_BUF_SZ	4	/* Country string is 3 bytes + NUL */
@@ -71,10 +73,12 @@ struct brcm_rateset {
 #define BRCM_GET_PHYLIST				180
 
 /* Bit masks for radio disabled status - returned by WL_GET_RADIO */
+
 #define WL_RADIO_SW_DISABLE		(1<<0)
 #define WL_RADIO_HW_DISABLE		(1<<1)
 #define WL_RADIO_MPC_DISABLE		(1<<2)
-#define WL_RADIO_COUNTRY_DISABLE	(1<<3)	/* some countries don't support any channel */
+/* some countries don't support any channel */
+#define WL_RADIO_COUNTRY_DISABLE	(1<<3)
 
 /* Override bit for SET_TXPWR.  if set, ignore other level limits */
 #define WL_TXPWR_OVERRIDE	(1U<<31)
@@ -100,7 +104,9 @@ struct brcm_rateset {
 /*
  * Sonics Configuration Space Registers.
  */
-#define	SBCONFIGOFF		0xf00	/* core sbconfig regs are top 256bytes of regs */
+
+/* core sbconfig regs are top 256bytes of regs */
+#define	SBCONFIGOFF		0xf00
 
 /* cpp contortions to concatenate w/arg prescan */
 #ifndef	PAD
drivers/staging/brcm80211/include/soc.h +2 -3
index 6e5a705..f23edc5 100644
@@ -81,9 +81,8 @@
 #define	DMEMS_CORE_ID		0x835	/* SDR/DDR1 memory controller core */
 #define	DEF_SHIM_COMP		0x837	/* SHIM component in ubus/6362 */
 #define OOB_ROUTER_CORE_ID	0x367	/* OOB router core ID */
-#define	DEF_AI_COMP		0xfff	/* Default component, in ai chips it maps all
-					 * unused address ranges
-					 */
+/* Default component, in ai chips it maps all unused address ranges */
+#define	DEF_AI_COMP		0xfff
 
 /* Common core control flags */
 #define	SICF_BIST_EN		0x8000
Signature · 1 line
1.7.4.1
#4 lore raw

PATCH 4/29 staging: brcm80211: use PCI_DEVICE() macro in device table

In reply to Arend van Spriel

The macro PCI_DEVICE() fills in the entry in abbreviated manner. Using this removes the "lines over 80 characters" checkpatch warning on these entries.

---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +4 -5
index 3987ccf..a9ad95a 100644
@@ -94,11 +94,10 @@ MODULE_LICENSE("Dual BSD/GPL");
 
 /* recognized PCI IDs */
 static DEFINE_PCI_DEVICE_TABLE(brcms_pci_id_table) = {
-	{PCI_VENDOR_ID_BROADCOM, 0x4357, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},	/* 43225 2G */
-	{PCI_VENDOR_ID_BROADCOM, 0x4353, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},	/* 43224 DUAL */
-	{PCI_VENDOR_ID_BROADCOM, 0x4727, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},	/* 4313 DUAL */
-	/* 43224 Ven */
-	{PCI_VENDOR_ID_BROADCOM, 0x0576, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+	{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) }, /* 43225 2G */
+	{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) }, /* 43224 DUAL */
+	{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, /* 4313 DUAL */
+	{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x0576) }, /* 43224 Ven */
 	{0}
 };
 
Signature · 1 line
1.7.4.1
#5 lore raw

PATCH 5/29 staging: brcm80211: remove unused rx status definitions

In reply to Arend van Spriel

The file pub.h contained a number of definitions that are not used in the brcmsmac driver and consequently have been removed.

---
 drivers/staging/brcm80211/brcmsmac/pub.h |   33 ------------------------------
 1 files changed, 0 insertions(+), 33 deletions(-)
drivers/staging/brcm80211/brcmsmac/pub.h +0 -33
index 9b847b3..bfbdc3a 100644
@@ -308,39 +308,6 @@ struct wl_rxsts {
 	struct brcms_if *wlif;	/* wl interface */
 };
 
-/* status per error RX pkt */
-#define WL_RXS_CRC_ERROR		0x00000001	/* CRC Error in packet */
-#define WL_RXS_RUNT_ERROR		0x00000002	/* Runt packet */
-#define WL_RXS_ALIGN_ERROR		0x00000004	/* Misaligned packet */
-#define WL_RXS_OVERSIZE_ERROR		0x00000008	/* packet bigger than RX_LENGTH (usually 1518) */
-#define WL_RXS_WEP_ICV_ERROR		0x00000010	/* Integrity Check Value error */
-#define WL_RXS_WEP_ENCRYPTED		0x00000020	/* Encrypted with WEP */
-#define WL_RXS_PLCP_SHORT		0x00000040	/* Short PLCP error */
-#define WL_RXS_DECRYPT_ERR		0x00000080	/* Decryption error */
-#define WL_RXS_OTHER_ERR		0x80000000	/* Other errors */
-
-/* phy type */
-#define WL_RXS_PHY_A			0x00000000	/* A phy type */
-#define WL_RXS_PHY_B			0x00000001	/* B phy type */
-#define WL_RXS_PHY_G			0x00000002	/* G phy type */
-#define WL_RXS_PHY_N			0x00000004	/* N phy type */
-
-/* encoding */
-#define WL_RXS_ENCODING_CCK		0x00000000	/* CCK encoding */
-#define WL_RXS_ENCODING_OFDM		0x00000001	/* OFDM encoding */
-
-/* preamble */
-#define WL_RXS_UNUSED_STUB		0x0	/* stub to match with wlc_ethereal.h */
-#define WL_RXS_PREAMBLE_SHORT		0x00000001	/* Short preamble */
-#define WL_RXS_PREAMBLE_LONG		0x00000002	/* Long preamble */
-#define WL_RXS_PREAMBLE_MIMO_MM		0x00000003	/* MIMO mixed mode preamble */
-#define WL_RXS_PREAMBLE_MIMO_GF		0x00000004	/* MIMO green field preamble */
-
-#define WL_RXS_NFRM_AMPDU_FIRST		0x00000001	/* first MPDU in A-MPDU */
-#define WL_RXS_NFRM_AMPDU_SUB		0x00000002	/* subsequent MPDU(s) in A-MPDU */
-#define WL_RXS_NFRM_AMSDU_FIRST		0x00000004	/* first MSDU in A-MSDU */
-#define WL_RXS_NFRM_AMSDU_SUB		0x00000008	/* subsequent MSDU(s) in A-MSDU */
-
 enum wlc_par_id {
 	IOV_MPC = 1,
 	IOV_RTSTHRESH,
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH 7/29 staging: brcm80211: remove wl_alloc_dma_resources() function

In reply to Arend van Spriel

The function wl_alloc_dma_resources() does not provide any value for the brcmsmac driver as it only returns true. It has been removed from the driver.

---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |    8 --------
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h |    1 -
 drivers/staging/brcm80211/brcmsmac/main.c        |    6 ------
 3 files changed, 0 insertions(+), 15 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +0 -8
index 6439fd9..a708306 100644
@@ -1443,14 +1443,6 @@ void brcms_intrson(struct brcms_info *wl)
 	INT_UNLOCK(wl, flags);
 }
 
-/*
- * precondition: perimeter lock has been acquired
- */
-bool wl_alloc_dma_resources(struct brcms_info *wl, uint addrwidth)
-{
-	return true;
-}
-
 u32 brcms_intrsoff(struct brcms_info *wl)
 {
 	unsigned long flags;
drivers/staging/brcm80211/brcmsmac/mac80211_if.h +0 -1
index 0d91366..01fce54 100644
@@ -87,7 +87,6 @@ extern int brcms_up(struct brcms_info *wl);
 extern void brcms_down(struct brcms_info *wl);
 extern void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif,
 				bool state, int prio);
-extern bool wl_alloc_dma_resources(struct brcms_info *wl, uint dmaddrwidth);
 extern bool brcms_rfkill_set_hw_state(struct brcms_info *wl);
 
 /* timer functions */
drivers/staging/brcm80211/brcmsmac/main.c +0 -6
index 0e6b9ca..847e1ab 100644
@@ -870,12 +870,6 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)
 		addrwidth =
 		    dma_addrwidth(wlc_hw->sih, DMAREG(wlc_hw, DMA_TX, 0));
 
-		if (!wl_alloc_dma_resources(wlc_hw->wlc->wl, addrwidth)) {
-			wiphy_err(wiphy, "wl%d: wlc_attach: alloc_dma_"
-				  "resources failed\n", unit);
-			return false;
-		}
-
 		/*
 		 * FIFO 0
 		 * TX: TX_AC_BK_FIFO (TX AC Background data packets)
Signature · 1 line
1.7.4.1
#8 lore raw

PATCH 9/29 staging: brcm80211: remove code for unsupported chip

In reply to Arend van Spriel

From: Franky Lin <[email protected]>

Currently fullmac only support bcm4329. Remove dead code for unsupported chip.

---
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +2 -0
index 16ea6e8..2a9efc3 100644
@@ -980,6 +980,8 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
 			return -ENOMEM;
 		sdiodev->func1 = func;
 		dev_set_drvdata(&func->card->dev, sdiodev);
+
+		atomic_set(&brcmf_mmc_suspend, false);
 	}
 
 	gInstance->func[func->num] = func;
Signature · 1 line
1.7.4.1
#10 lore raw

PATCH 10/29 staging: brcm80211: cleaned up softmac DMA layer

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

Code cleanup. Since this driver only needs to support 64 bit DMA hardware, an unnecessary layer of abstraction could be removed. Also DMA functions that were not called have been removed.

---
 drivers/staging/brcm80211/brcmsmac/dma.c |  461 +++---------------------------
 drivers/staging/brcm80211/brcmsmac/dma.h |  114 +-------
 2 files changed, 58 insertions(+), 517 deletions(-)
drivers/staging/brcm80211/brcmsmac/dma.c +42 -419
index 27b07ce..48a053c 100644
@@ -364,30 +364,10 @@ struct dma_info {
 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_detach(struct dma_info *di);
 static void _dma_ddtable_init(struct dma_info *di, uint direction,
 			      unsigned long pa);
-static void _dma_rxinit(struct dma_info *di);
-static void *_dma_rx(struct dma_info *di);
-static bool _dma_rxfill(struct dma_info *di);
-static void _dma_rxreclaim(struct dma_info *di);
 static void _dma_rxenable(struct dma_info *di);
 static void *_dma_getnextrxp(struct dma_info *di, bool forceall);
-static void _dma_rx_param_get(struct dma_info *di, u16 *rxoffset,
-			      u16 *rxbufsize);
-
-static void _dma_txblock(struct dma_info *di);
-static void _dma_txunblock(struct dma_info *di);
-static uint _dma_txactive(struct dma_info *di);
-static uint _dma_rxactive(struct dma_info *di);
-static uint _dma_txpending(struct dma_info *di);
-static uint _dma_txcommitted(struct dma_info *di);
-
-static void *_dma_peeknexttxp(struct dma_info *di);
-static void *_dma_peeknextrxp(struct dma_info *di);
-static unsigned long _dma_getvar(struct dma_info *di, const char *name);
-static void _dma_counterreset(struct dma_info *di);
-static void _dma_fifoloopbackenable(struct dma_info *di);
 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,
@@ -396,78 +376,12 @@ static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size,
 
 /* Prototypes for 64-bit routines */
 static bool dma64_alloc(struct dma_info *di, uint direction);
-static bool dma64_txreset(struct dma_info *di);
-static bool dma64_rxreset(struct dma_info *di);
-static bool dma64_txsuspendedidle(struct dma_info *di);
-static int dma64_txfast(struct dma_info *di, struct sk_buff *p0, bool commit);
-static int dma64_txunframed(struct dma_info *di, void *p0, uint len,
-			    bool commit);
-static void *dma64_getpos(struct dma_info *di, bool direction);
-static void *dma64_getnexttxp(struct dma_info *di, enum txd_range range);
 static void *dma64_getnextrxp(struct dma_info *di, bool forceall);
-static void dma64_txrotate(struct dma_info *di);
-
 static bool dma64_rxidle(struct dma_info *di);
-static void dma64_txinit(struct dma_info *di);
-static bool dma64_txenabled(struct dma_info *di);
-static void dma64_txsuspend(struct dma_info *di);
-static void dma64_txresume(struct dma_info *di);
-static bool dma64_txsuspended(struct dma_info *di);
-static void dma64_txreclaim(struct dma_info *di, enum txd_range range);
-static bool dma64_txstopped(struct dma_info *di);
-static bool dma64_rxstopped(struct dma_info *di);
-static bool dma64_rxenabled(struct dma_info *di);
 static bool _dma64_addrext(struct dma64regs *dma64regs);
 
 static inline u32 parity32(u32 data);
 
-const struct di_fcn_s dma64proc = {
-	(void (*)(struct dma_pub *)) _dma_detach,
-	(void (*)(struct dma_pub *)) dma64_txinit,
-	(bool(*)(struct dma_pub *)) dma64_txreset,
-	(bool(*)(struct dma_pub *)) dma64_txenabled,
-	(void (*)(struct dma_pub *)) dma64_txsuspend,
-	(void (*)(struct dma_pub *)) dma64_txresume,
-	(bool(*)(struct dma_pub *)) dma64_txsuspended,
-	(bool(*)(struct dma_pub *)) dma64_txsuspendedidle,
-	(int (*)(struct dma_pub *, struct sk_buff *, bool)) dma64_txfast,
-	(int (*)(struct dma_pub *, void *, uint, bool)) dma64_txunframed,
-	(void *(*)(struct dma_pub *, bool)) dma64_getpos,
-	(bool(*)(struct dma_pub *)) dma64_txstopped,
-	(void (*)(struct dma_pub *, enum txd_range)) dma64_txreclaim,
-	(void *(*)(struct dma_pub *, enum txd_range)) dma64_getnexttxp,
-	(void *(*)(struct dma_pub *)) _dma_peeknexttxp,
-	(void (*)(struct dma_pub *)) _dma_txblock,
-	(void (*)(struct dma_pub *)) _dma_txunblock,
-	(uint (*)(struct dma_pub *)) _dma_txactive,
-	(void (*)(struct dma_pub *)) dma64_txrotate,
-
-	(void (*)(struct dma_pub *)) _dma_rxinit,
-	(bool(*)(struct dma_pub *)) dma64_rxreset,
-	(bool(*)(struct dma_pub *)) dma64_rxidle,
-	(bool(*)(struct dma_pub *)) dma64_rxstopped,
-	(bool(*)(struct dma_pub *)) _dma_rxenable,
-	(bool(*)(struct dma_pub *)) dma64_rxenabled,
-	(void *(*)(struct dma_pub *)) _dma_rx,
-	(bool(*)(struct dma_pub *)) _dma_rxfill,
-	(void (*)(struct dma_pub *)) _dma_rxreclaim,
-	(void *(*)(struct dma_pub *, bool)) _dma_getnextrxp,
-	(void *(*)(struct dma_pub *)) _dma_peeknextrxp,
-	(void (*)(struct dma_pub *, u16 *, u16 *)) _dma_rx_param_get,
-
-	(void (*)(struct dma_pub *)) _dma_fifoloopbackenable,
-	(unsigned long (*)(struct dma_pub *, const char *)) _dma_getvar,
-	(void (*)(struct dma_pub *)) _dma_counterreset,
-	(uint (*)(struct dma_pub *, uint, uint)) _dma_ctrlflags,
-	NULL,
-	NULL,
-	NULL,
-	(uint (*)(struct dma_pub *)) _dma_rxactive,
-	(uint (*)(struct dma_pub *)) _dma_txpending,
-	(uint (*)(struct dma_pub *)) _dma_txcommitted,
-	39
-};
-
 struct dma_pub *dma_attach(char *name, struct si_pub *sih,
 		     void *dmaregstx, void *dmaregsrx, uint ntxd,
 		     uint nrxd, uint rxbufsize, int rxextheadroom,
@@ -493,15 +407,13 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
 	/* init dma reg pointer */
 	di->d64txregs = (struct dma64regs *) dmaregstx;
 	di->d64rxregs = (struct dma64regs *) dmaregsrx;
-	di->dma.di_fn = (const struct di_fcn_s *)&dma64proc;
 
 	/*
 	 * Default flags (which can be changed by the driver calling
 	 * dma_ctrlflags before enable): For backwards compatibility
 	 * both Rx Overflow Continue and Parity are DISABLED.
 	 */
-	di->dma.di_fn->ctrlflags(&di->dma, DMA_CTRL_ROC | DMA_CTRL_PEN,
-				 0);
+	_dma_ctrlflags(di, DMA_CTRL_ROC | DMA_CTRL_PEN, 0);
 
 	DMA_TRACE(("%s: dma_attach: %s flags 0x%x ntxd %d nrxd %d "
 		   "rxbufsize %d rxextheadroom %d nrxpost %d rxoffset %d "
@@ -654,7 +566,7 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
 	return (struct dma_pub *) di;
 
  fail:
-	_dma_detach(di);
+	dma_detach((struct dma_pub *)di);
 	return NULL;
 }
 
@@ -730,8 +642,9 @@ void *dma_alloc_consistent(struct pci_dev *pdev, uint size, u16 align_bits,
 }
 
 /* !! may be called with core in reset */
-static void _dma_detach(struct dma_info *di)
+void dma_detach(struct dma_pub *pub)
 {
+	struct dma_info *di = (struct dma_info *)pub;
 
 	DMA_TRACE(("%s: dma_detach\n", di->name));
 
@@ -854,15 +767,10 @@ _dma_ddtable_init(struct dma_info *di, uint direction, unsigned long pa)
 	}
 }
 
-static void _dma_fifoloopbackenable(struct dma_info *di)
+void dma_rxinit(struct dma_pub *pub)
 {
-	DMA_TRACE(("%s: dma_fifoloopbackenable\n", di->name));
+	struct dma_info *di = (struct dma_info *)pub;
 
-	OR_REG(&di->d64txregs->control, D64_XC_LE);
-}
-
-static void _dma_rxinit(struct dma_info *di)
-{
 	DMA_TRACE(("%s: dma_rxinit\n", di->name));
 
 	if (di->nrxd == 0)
@@ -907,14 +815,6 @@ static void _dma_rxenable(struct dma_info *di)
 		((di->rxoffset << D64_RC_RO_SHIFT) | control));
 }
 
-static void
-_dma_rx_param_get(struct dma_info *di, u16 *rxoffset, u16 *rxbufsize)
-{
-	/* the normal values fit into 16 bits */
-	*rxoffset = (u16) di->rxoffset;
-	*rxbufsize = (u16) di->rxbufsize;
-}
-
 /*
  * !! rx entry routine
  * returns a pointer to the next frame received, or NULL if there are no more
@@ -925,8 +825,9 @@ _dma_rx_param_get(struct dma_info *di, u16 *rxoffset, u16 *rxbufsize)
  *   buffer data. After it reaches the max size of buffer, the data continues
  *   in next DMA descriptor buffer WITHOUT DMA header
  */
-static void *_dma_rx(struct dma_info *di)
+void *dma_rx(struct dma_pub *pub)
 {
+	struct dma_info *di = (struct dma_info *)pub;
 	struct sk_buff *p, *head, *tail;
 	uint len;
 	uint pkt_len;
@@ -966,7 +867,7 @@ static void *_dma_rx(struct dma_info *di)
 				  D64_RS0_CD_MASK) -
 				 di->rcvptrbase) & D64_RS0_CD_MASK,
 				struct dma64desc);
-			DMA_ERROR(("_dma_rx, rxin %d rxout %d, hw_curr %d\n",
+			DMA_ERROR(("dma_rx, rxin %d rxout %d, hw_curr %d\n",
 				   di->rxin, di->rxout, cur));
 		}
 #endif				/* BCMDBG */
@@ -989,8 +890,9 @@ static void *_dma_rx(struct dma_info *di)
  *  the rx dma and user might want to call rxfill again asap. This unlikely
  *  happens on memory-rich NIC, but often on memory-constrained dongle
  */
-static bool _dma_rxfill(struct dma_info *di)
+bool dma_rxfill(struct dma_pub *pub)
 {
+	struct dma_info *di = (struct dma_info *)pub;
 	struct sk_buff *p;
 	u16 rxin, rxout;
 	u32 flags = 0;
@@ -1074,48 +976,9 @@ static bool _dma_rxfill(struct dma_info *di)
 	return ring_empty;
 }
 
-/* like getnexttxp but no reclaim */
-static void *_dma_peeknexttxp(struct dma_info *di)
-{
-	uint end, i;
-
-	if (di->ntxd == 0)
-		return NULL;
-
-	end =
-	    B2I(((R_REG(&di->d64txregs->status0) &
-		  D64_XS0_CD_MASK) - di->xmtptrbase) & D64_XS0_CD_MASK,
-		  struct dma64desc);
-
-	for (i = di->txin; i != end; i = NEXTTXD(i))
-		if (di->txp[i])
-			return di->txp[i];
-
-	return NULL;
-}
-
-/* like getnextrxp but not take off the ring */
-static void *_dma_peeknextrxp(struct dma_info *di)
-{
-	uint end, i;
-
-	if (di->nrxd == 0)
-		return NULL;
-
-	end =
-	    B2I(((R_REG(&di->d64rxregs->status0) &
-		  D64_RS0_CD_MASK) - di->rcvptrbase) & D64_RS0_CD_MASK,
-		  struct dma64desc);
-
-	for (i = di->rxin; i != end; i = NEXTRXD(i))
-		if (di->rxp[i])
-			return di->rxp[i];
-
-	return NULL;
-}
-
-static void _dma_rxreclaim(struct dma_info *di)
+void dma_rxreclaim(struct dma_pub *pub)
 {
+	struct dma_info *di = (struct dma_info *)pub;
 	void *p;
 
 	DMA_TRACE(("%s: dma_rxreclaim\n", di->name));
@@ -1132,57 +995,12 @@ static void *_dma_getnextrxp(struct dma_info *di, bool forceall)
 	return dma64_getnextrxp(di, forceall);
 }
 
-static void _dma_txblock(struct dma_info *di)
-{
-	di->dma.txavail = 0;
-}
-
-static void _dma_txunblock(struct dma_info *di)
-{
-	di->dma.txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
-}
-
-static uint _dma_txactive(struct dma_info *di)
+void dma_counterreset(struct dma_pub *pub)
 {
-	return NTXDACTIVE(di->txin, di->txout);
-}
-
-static uint _dma_txpending(struct dma_info *di)
-{
-	uint curr;
-
-	curr =
-	    B2I(((R_REG(&di->d64txregs->status0) &
-		  D64_XS0_CD_MASK) - di->xmtptrbase) & D64_XS0_CD_MASK,
-		  struct dma64desc);
-
-	return NTXDACTIVE(curr, di->txout);
-}
-
-static uint _dma_txcommitted(struct dma_info *di)
-{
-	uint ptr;
-	uint txin = di->txin;
-
-	if (txin == di->txout)
-		return 0;
-
-	ptr = B2I(R_REG(&di->d64txregs->ptr), struct dma64desc);
-
-	return NTXDACTIVE(di->txin, ptr);
-}
-
-static uint _dma_rxactive(struct dma_info *di)
-{
-	return NRXDACTIVE(di->rxin, di->rxout);
-}
-
-static void _dma_counterreset(struct dma_info *di)
-{
-	/* reset all software counter */
-	di->dma.rxgiants = 0;
-	di->dma.rxnobuf = 0;
-	di->dma.txnobuf = 0;
+	/* reset all software counters */
+	pub->rxgiants = 0;
+	pub->rxnobuf = 0;
+	pub->txnobuf = 0;
 }
 
 static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags)
@@ -1221,8 +1039,10 @@ static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags)
 }
 
 /* get the address of the var in order to change later */
-static unsigned long _dma_getvar(struct dma_info *di, const char *name)
+unsigned long dma_getvar(struct dma_pub *pub, const char *name)
 {
+	struct dma_info *di = (struct dma_info *)pub;
+
 	if (!strcmp(name, "&txavail"))
 		return (unsigned long)&(di->dma.txavail);
 	return 0;
@@ -1269,8 +1089,9 @@ static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size,
 
 /* 64-bit DMA functions */
 
-static void dma64_txinit(struct dma_info *di)
+void dma_txinit(struct dma_pub *pub)
 {
+	struct dma_info *di = (struct dma_info *)pub;
 	u32 control = D64_XC_XE;
 
 	DMA_TRACE(("%s: dma_txinit\n", di->name));
@@ -1301,17 +1122,10 @@ static void dma64_txinit(struct dma_info *di)
 		_dma_ddtable_init(di, DMA_TX, di->txdpa);
 }
 
-static bool dma64_txenabled(struct dma_info *di)
+void dma_txsuspend(struct dma_pub *pub)
 {
-	u32 xc;
+	struct dma_info *di = (struct dma_info *)pub;
 
-	/* If the chip is dead, it is not enabled :-) */
-	xc = R_REG(&di->d64txregs->control);
-	return (xc != 0xffffffff) && (xc & D64_XC_XE);
-}
-
-static void dma64_txsuspend(struct dma_info *di)
-{
 	DMA_TRACE(("%s: dma_txsuspend\n", di->name));
 
 	if (di->ntxd == 0)
@@ -1320,8 +1134,10 @@ static void dma64_txsuspend(struct dma_info *di)
 	OR_REG(&di->d64txregs->control, D64_XC_SE);
 }
 
-static void dma64_txresume(struct dma_info *di)
+void dma_txresume(struct dma_pub *pub)
 {
+	struct dma_info *di = (struct dma_info *)pub;
+
 	DMA_TRACE(("%s: dma_txresume\n", di->name));
 
 	if (di->ntxd == 0)
@@ -1330,15 +1146,18 @@ static void dma64_txresume(struct dma_info *di)
 	AND_REG(&di->d64txregs->control, ~D64_XC_SE);
 }
 
-static bool dma64_txsuspended(struct dma_info *di)
+bool dma_txsuspended(struct dma_pub *pub)
 {
+	struct dma_info *di = (struct dma_info *)pub;
+
 	return (di->ntxd == 0) ||
 	    ((R_REG(&di->d64txregs->control) & D64_XC_SE) ==
 	     D64_XC_SE);
 }
 
-static void dma64_txreclaim(struct dma_info *di, enum txd_range range)
+void dma_txreclaim(struct dma_pub *pub, enum txd_range range)
 {
+	struct dma_info *di = (struct dma_info *)pub;
 	void *p;
 
 	DMA_TRACE(("%s: dma_txreclaim %s\n", di->name,
@@ -1350,25 +1169,13 @@ static void dma64_txreclaim(struct dma_info *di, enum txd_range range)
 	if (di->txin == di->txout)
 		return;
 
-	while ((p = dma64_getnexttxp(di, range))) {
+	while ((p = dma_getnexttxp(pub, range))) {
 		/* For unframed data, we don't have any packets to free */
 		if (!(di->dma.dmactrlflags & DMA_CTRL_UNFRAMED))
 			brcmu_pkt_buf_free_skb(p);
 	}
 }
 
-static bool dma64_txstopped(struct dma_info *di)
-{
-	return ((R_REG(&di->d64txregs->status0) & D64_XS0_XS_MASK) ==
-		D64_XS0_XS_STOPPED);
-}
-
-static bool dma64_rxstopped(struct dma_info *di)
-{
-	return ((R_REG(&di->d64rxregs->status0) & D64_RS0_RS_MASK) ==
-		D64_RS0_RS_STOPPED);
-}
-
 static bool dma64_alloc(struct dma_info *di, uint direction)
 {
 	u16 size;
@@ -1421,8 +1228,9 @@ static bool dma64_alloc(struct dma_info *di, uint direction)
 	return true;
 }
 
-static bool dma64_txreset(struct dma_info *di)
+bool dma_txreset(struct dma_pub *pub)
 {
+	struct dma_info *di = (struct dma_info *)pub;
 	u32 status;
 
 	if (di->ntxd == 0)
@@ -1457,8 +1265,9 @@ static bool dma64_rxidle(struct dma_info *di)
 		(R_REG(&di->d64rxregs->ptr) & D64_RS0_CD_MASK));
 }
 
-static bool dma64_rxreset(struct dma_info *di)
+bool dma_rxreset(struct dma_pub *pub)
 {
+	struct dma_info *di = (struct dma_info *)pub;
 	u32 status;
 
 	if (di->nrxd == 0)
@@ -1472,128 +1281,15 @@ static bool dma64_rxreset(struct dma_info *di)
 	return status == D64_RS0_RS_DISABLED;
 }
 
-static bool dma64_rxenabled(struct dma_info *di)
-{
-	u32 rc;
-
-	rc = R_REG(&di->d64rxregs->control);
-	return (rc != 0xffffffff) && (rc & D64_RC_RE);
-}
-
-static bool dma64_txsuspendedidle(struct dma_info *di)
-{
-
-	if (di->ntxd == 0)
-		return true;
-
-	if (!(R_REG(&di->d64txregs->control) & D64_XC_SE))
-		return 0;
-
-	if ((R_REG(&di->d64txregs->status0) & D64_XS0_XS_MASK) ==
-	    D64_XS0_XS_IDLE)
-		return 1;
-
-	return 0;
-}
-
-/*
- * Useful when sending unframed data.  This allows us to get a progress report
- * from the DMA. We return a pointer to the beginning of the DATA buffer of the
- * current descriptor. If DMA is idle, we return NULL.
- */
-static void *dma64_getpos(struct dma_info *di, bool direction)
-{
-	void *va;
-	bool idle;
-	u32 cd_offset;
-
-	if (direction == DMA_TX) {
-		cd_offset =
-		    R_REG(&di->d64txregs->status0) & D64_XS0_CD_MASK;
-		idle = !NTXDACTIVE(di->txin, di->txout);
-		va = di->txp[B2I(cd_offset, struct dma64desc)];
-	} else {
-		cd_offset =
-		    R_REG(&di->d64rxregs->status0) & D64_XS0_CD_MASK;
-		idle = !NRXDACTIVE(di->rxin, di->rxout);
-		va = di->rxp[B2I(cd_offset, struct dma64desc)];
-	}
-
-	/* If DMA is IDLE, return NULL */
-	if (idle) {
-		DMA_TRACE(("%s: DMA idle, return NULL\n", __func__));
-		va = NULL;
-	}
-
-	return va;
-}
-
-/* TX of unframed data
- *
- * Adds a DMA ring descriptor for the data pointed to by "buf".
- * This is for DMA of a buffer of data and is unlike other dma TX functions
- * that take a pointer to a "packet"
- * Each call to this is results in a single descriptor being added for "len"
- * bytes of data starting at "buf", it doesn't handle chained buffers.
- */
-static int
-dma64_txunframed(struct dma_info *di, void *buf, uint len, bool commit)
-{
-	u16 txout;
-	u32 flags = 0;
-	unsigned long pa;		/* phys addr */
-
-	txout = di->txout;
-
-	/* return nonzero if out of tx descriptors */
-	if (NEXTTXD(txout) == di->txin)
-		goto outoftxd;
-
-	if (len == 0)
-		return 0;
-
-	pa = pci_map_single(di->pbus, buf, len, PCI_DMA_TODEVICE);
-
-	flags = (D64_CTRL1_SOF | D64_CTRL1_IOC | D64_CTRL1_EOF);
-
-	if (txout == (di->ntxd - 1))
-		flags |= D64_CTRL1_EOT;
-
-	dma64_dd_upd(di, di->txd64, pa, txout, &flags, len);
-
-	/* save the buffer pointer - used by dma_getpos */
-	di->txp[txout] = buf;
-
-	txout = NEXTTXD(txout);
-	/* bump the tx descriptor index */
-	di->txout = txout;
-
-	/* kick the chip */
-	if (commit)
-		W_REG(&di->d64txregs->ptr,
-		      di->xmtptrbase + I2B(txout, struct dma64desc));
-
-	/* tx flow control */
-	di->dma.txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
-
-	return 0;
-
- outoftxd:
-	DMA_ERROR(("%s: %s: out of txds !!!\n", di->name, __func__));
-	di->dma.txavail = 0;
-	di->dma.txnobuf++;
-	return -1;
-}
-
 /*
  * !! tx entry routine
  * WARNING: call must check the return value for error.
  *   the error(toss frames) could be fatal and cause many subsequent hard
  *   to debug problems
  */
-static int dma64_txfast(struct dma_info *di, struct sk_buff *p0,
-				    bool commit)
+int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit)
 {
+	struct dma_info *di = (struct dma_info *)pub;
 	struct sk_buff *p, *next;
 	unsigned char *data;
 	uint len;
@@ -1713,8 +1409,9 @@ static int dma64_txfast(struct dma_info *di, struct sk_buff *p0,
  * If range is DMA_RANGE_ALL, reclaim all txd(s) posted to the ring and
  * return associated packet regardless of the value of hardware pointers.
  */
-static void *dma64_getnexttxp(struct dma_info *di, enum txd_range range)
+void *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
 {
+	struct dma_info *di = (struct dma_info *)pub;
 	u16 start, end, i;
 	u16 active_desc;
 	void *txp;
@@ -1857,80 +1554,6 @@ static bool _dma64_addrext(struct dma64regs *dma64regs)
 }
 
 /*
- * Rotate all active tx dma ring entries "forward" by (ActiveDescriptor - txin).
- */
-static void dma64_txrotate(struct dma_info *di)
-{
-	u16 ad;
-	uint nactive;
-	uint rot;
-	u16 old, new;
-	u32 w;
-	u16 first, last;
-
-	nactive = _dma_txactive(di);
-	ad = (u16) (B2I((((R_REG(&di->d64txregs->status1) &
-			   D64_XS1_AD_MASK) - di->xmtptrbase) &
-			   D64_XS1_AD_MASK), struct dma64desc));
-	rot = TXD(ad - di->txin);
-
-	/* full-ring case is a lot harder - don't worry about this */
-	if (rot >= (di->ntxd - nactive)) {
-		DMA_ERROR(("%s: dma_txrotate: ring full - punt\n", di->name));
-		return;
-	}
-
-	first = di->txin;
-	last = PREVTXD(di->txout);
-
-	/* move entries starting at last and moving backwards to first */
-	for (old = last; old != PREVTXD(first); old = PREVTXD(old)) {
-		new = TXD(old + rot);
-
-		/*
-		 * Move the tx dma descriptor.
-		 * EOT is set only in the last entry in the ring.
-		 */
-		w = BUS_SWAP32(R_SM(&di->txd64[old].ctrl1)) & ~D64_CTRL1_EOT;
-		if (new == (di->ntxd - 1))
-			w |= D64_CTRL1_EOT;
-		W_SM(&di->txd64[new].ctrl1, BUS_SWAP32(w));
-
-		w = BUS_SWAP32(R_SM(&di->txd64[old].ctrl2));
-		W_SM(&di->txd64[new].ctrl2, BUS_SWAP32(w));
-
-		W_SM(&di->txd64[new].addrlow, R_SM(&di->txd64[old].addrlow));
-		W_SM(&di->txd64[new].addrhigh, R_SM(&di->txd64[old].addrhigh));
-
-		/* zap the old tx dma descriptor address field */
-		W_SM(&di->txd64[old].addrlow, BUS_SWAP32(0xdeadbeef));
-		W_SM(&di->txd64[old].addrhigh, BUS_SWAP32(0xdeadbeef));
-
-		/* move the corresponding txp[] entry */
-		di->txp[new] = di->txp[old];
-
-		/* Move the map */
-		if (DMASGLIST_ENAB) {
-			memcpy(&di->txp_dmah[new], &di->txp_dmah[old],
-			       sizeof(struct dma_seg_map));
-			memset(&di->txp_dmah[old], 0,
-			       sizeof(struct dma_seg_map));
-		}
-
-		di->txp[old] = NULL;
-	}
-
-	/* update txin and txout */
-	di->txin = ad;
-	di->txout = TXD(di->txout + rot);
-	di->dma.txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
-
-	/* kick the chip */
-	W_REG(&di->d64txregs->ptr,
-	      di->xmtptrbase + I2B(di->txout, struct dma64desc));
-}
-
-/*
  * Mac80211 initiated actions sometimes require packets in the DMA queue to be
  * modified. The modified portion of the packet is not under control of the DMA
  * engine. This function calls a caller-supplied function for each packet in
drivers/staging/brcm80211/brcmsmac/dma.h +16 -98

131 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#11 lore raw

PATCH 11/29 staging: brcm80211: removed void * from softmac phy

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

Code cleanup. Replacing void * by other pointer types improves code readability and enforces stronger type checking.

---
 drivers/staging/brcm80211/brcmsmac/main.c        |    7 ++-
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |   13 +++---
 drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h |   11 ++++-
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h |    5 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c |    7 +--
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c   |   47 ++++++++-------------
 drivers/staging/brcm80211/brcmsmac/phy_shim.c    |    7 ++-
 drivers/staging/brcm80211/brcmsmac/phy_shim.h    |    6 ++-
 8 files changed, 50 insertions(+), 53 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +4 -3
index a84ecd6..e67bf64 100644
@@ -4528,9 +4528,10 @@ int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, uint unit,
 		    xmtfifo_sz[(wlc_hw->corerev - XMTFIFOTBL_STARTREV)];
 
 		/* Get a phy for this band */
-		wlc_hw->band->pi = wlc_phy_attach(wlc_hw->phy_sh,
-			(void *)regs, brcms_b_bandtype(wlc_hw), vars,
-			wlc->wiphy);
+		wlc_hw->band->pi =
+			wlc_phy_attach(wlc_hw->phy_sh, regs,
+				       brcms_b_bandtype(wlc_hw), vars,
+				       wlc->wiphy);
 		if (wlc_hw->band->pi == NULL) {
 			wiphy_err(wiphy, "wl%d: brcms_b_attach: wlc_phy_"
 				  "attach failed\n", unit);
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +6 -7
index 22f7bfc..831c2fe 100644
@@ -123,7 +123,7 @@ const u8 ofdm_rate_lookup[] = {
 
 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(void *arg);
+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);
@@ -509,7 +509,7 @@ struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp)
 }
 
 struct brcms_phy_pub *
-wlc_phy_attach(struct shared_phy *sh, void *regs, int bandtype,
+wlc_phy_attach(struct shared_phy *sh, struct d11regs *regs, int bandtype,
 	       char *vars, struct wiphy *wiphy)
 {
 	struct brcms_phy *pi;
@@ -539,7 +539,7 @@ wlc_phy_attach(struct shared_phy *sh, void *regs, int bandtype,
 	if (pi == NULL)
 		return NULL;
 	pi->wiphy = wiphy;
-	pi->regs = (struct d11regs *) regs;
+	pi->regs = regs;
 	pi->sh = sh;
 	pi->phy_init_por = true;
 	pi->phy_wreg_limit = PHY_WREG_LIMIT;
@@ -720,9 +720,8 @@ u32 wlc_phy_get_coreflags(struct brcms_phy_pub *pih)
 	return pi->pubpi.coreflags;
 }
 
-static void wlc_phy_timercb_phycal(void *arg)
+static void wlc_phy_timercb_phycal(struct brcms_phy *pi)
 {
-	struct brcms_phy *pi = (struct brcms_phy *) arg;
 	uint delay = 5;
 
 	if (PHY_PERICAL_MPHASE_PENDING(pi)) {
@@ -2619,9 +2618,9 @@ void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_cmplx_pwr_dB, u8 core)
 	}
 }
 
-void wlc_phy_rssi_compute(struct brcms_phy_pub *pih, void *ctx)
+void wlc_phy_rssi_compute(struct brcms_phy_pub *pih,
+			  struct brcms_d11rxhdr *wlc_rxhdr)
 {
-	struct brcms_d11rxhdr *wlc_rxhdr = (struct brcms_d11rxhdr *) ctx;
 	struct d11rxhdr *rxh = &wlc_rxhdr->rxhdr;
 	int rssi = le16_to_cpu(rxh->PhyRxStatus_1) & PRXS1_JSSI_MASK;
 	uint radioid = pih->radioid;
drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h +8 -3
index d2faba2..42e0cf0 100644
@@ -103,6 +103,9 @@
 
 #define	BRCMS_RSSI_INVALID	 0	/* invalid RSSI value */
 
+struct d11regs;
+struct phy_shim_info;
+
 struct txpwr_limits {
 	u8 cck[BRCMS_NUM_RATES_CCK];
 	u8 ofdm[BRCMS_NUM_RATES_OFDM];
@@ -160,7 +163,7 @@ struct brcms_chanvec {
 
 struct shared_phy_params {
 	struct si_pub *sih;
-	void *physhim;
+	struct phy_shim_info *physhim;
 	uint unit;
 	uint corerev;
 	uint bustype;
@@ -181,7 +184,8 @@ struct shared_phy_params {
 
 
 extern struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp);
-extern struct brcms_phy_pub *wlc_phy_attach(struct shared_phy *sh, void *regs,
+extern struct brcms_phy_pub *wlc_phy_attach(struct shared_phy *sh,
+					    struct d11regs *regs,
 					    int bandtype, char *vars,
 					    struct wiphy *wiphy);
 extern void wlc_phy_detach(struct brcms_phy_pub *ppi);
@@ -209,7 +213,8 @@ extern void wlc_phy_chanspec_radio_set(struct brcms_phy_pub *ppi,
 extern u16 wlc_phy_bw_state_get(struct brcms_phy_pub *ppi);
 extern void wlc_phy_bw_state_set(struct brcms_phy_pub *ppi, u16 bw);
 
-extern void wlc_phy_rssi_compute(struct brcms_phy_pub *pih, void *ctx);
+extern void wlc_phy_rssi_compute(struct brcms_phy_pub *pih,
+				 struct brcms_d11rxhdr *wlc_rxhdr);
 extern void wlc_phy_por_inform(struct brcms_phy_pub *ppi);
 extern void wlc_phy_noise_sample_intr(struct brcms_phy_pub *ppi);
 extern bool wlc_phy_bist_check_phy(struct brcms_phy_pub *ppi);
drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +3 -2
index 25ea003..bcc6d83 100644
@@ -41,6 +41,8 @@ extern u32 phyhal_msg_level;
 
 #define LCNXN_BASEREV		16
 
+struct phy_shim_info;
+
 struct brcms_phy_srom_fem {
 	/* TSSI positive slope, 1: positive, 0: negative */
 	u8 tssipos;
@@ -546,7 +548,7 @@ struct shared_phy {
 	struct brcms_phy *phy_head;
 	uint unit;
 	struct si_pub *sih;
-	void *physhim;
+	struct phy_shim_info *physhim;
 	uint corerev;
 	u32 machwcap;
 	bool up;
@@ -611,7 +613,6 @@ struct brcms_phy {
 	struct brcms_phy_pub pubpi_ro;
 	struct shared_phy *sh;
 	struct phy_func_ptr pi_fptr;
-	void *pi_ptr;
 
 	union {
 		struct brcms_phy_lcnphy *pi_lcnphy;
drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +3 -4
index 3d140eb..dcf626e5 100644
@@ -1041,7 +1041,7 @@ void wlc_lcnphy_read_table(struct brcms_phy *pi, struct phytbl_info *pti)
 
 static void
 wlc_lcnphy_common_read_table(struct brcms_phy *pi, u32 tbl_id,
-			     const void *tbl_ptr, u32 tbl_len,
+			     const u16 *tbl_ptr, u32 tbl_len,
 			     u32 tbl_width, u32 tbl_offset)
 {
 	struct phytbl_info tab;
@@ -1055,7 +1055,7 @@ wlc_lcnphy_common_read_table(struct brcms_phy *pi, u32 tbl_id,
 
 static void
 wlc_lcnphy_common_write_table(struct brcms_phy *pi, u32 tbl_id,
-			      const void *tbl_ptr, u32 tbl_len,
+			      const u16 *tbl_ptr, u32 tbl_len,
 			      u32 tbl_width, u32 tbl_offset)
 {
 
@@ -1965,13 +1965,12 @@ wlc_lcnphy_tx_iqlo_cal(struct brcms_phy *pi,
 	write_phy_reg(pi, 0x93d, 0xc0);
 
 	wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL,
-				      (const void *)
 				      lcnphy_iqcal_loft_gainladder,
 				      ARRAY_SIZE(lcnphy_iqcal_loft_gainladder),
 				      16, 0);
 
 	wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL,
-				      (const void *)lcnphy_iqcal_ir_gainladder,
+				      lcnphy_iqcal_ir_gainladder,
 				      ARRAY_SIZE(
 					      lcnphy_iqcal_ir_gainladder), 16,
 				      32);
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +18 -29

88 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/phy_shim.c +4 -3
index a882139..ec88867 100644
@@ -59,11 +59,12 @@ void wlc_phy_shim_detach(struct phy_shim_info *physhim)
 }
 
 struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim,
-				     void (*fn) (void *arg), void *arg,
-				     const char *name)
+				     void (*fn)(struct brcms_phy *pi),
+				     void *arg, const char *name)
 {
 	return (struct wlapi_timer *)
-			brcms_init_timer(physhim->wl, fn, arg, name);
+			brcms_init_timer(physhim->wl, (void (*)(void *))fn,
+					 arg, name);
 }
 
 void wlapi_free_timer(struct phy_shim_info *physhim, struct wlapi_timer *t)
drivers/staging/brcm80211/brcmsmac/phy_shim.h +4 -2
index a35e1ed..14c56f9 100644
@@ -122,14 +122,16 @@
 #define BRCMS_N_TXRX_CHAIN0		0
 #define BRCMS_N_TXRX_CHAIN1		1
 
+struct brcms_phy;
+
 extern struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw,
 						void *wl, void *wlc);
 extern void wlc_phy_shim_detach(struct phy_shim_info *physhim);
 
 /* PHY to WL utility functions */
 extern struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim,
-					    void (*fn) (void *arg), void *arg,
-					    const char *name);
+					    void (*fn) (struct brcms_phy *pi),
+					    void *arg, const char *name);
 extern void wlapi_free_timer(struct phy_shim_info *physhim,
 			     struct wlapi_timer *t);
 extern void wlapi_add_timer(struct phy_shim_info *physhim,
Signature · 1 line
1.7.4.1
#12 lore raw

PATCH 12/29 staging: brcm80211: simplified register access macro's in softmac

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

Code cleanup. Removed MIPS specific 'sync' instruction since this is not required for the chips that this driver supports. MIPS specific macro's were now the same as non-MIPS register access macro's and thus have been deleted. Also added comment that makes clearer what the benefit of these macro's is. Unified big and little end register access macro's.

---
 drivers/staging/brcm80211/brcmsmac/types.h |   81 ++++++++++------------------
 1 files changed, 29 insertions(+), 52 deletions(-)
drivers/staging/brcm80211/brcmsmac/types.h +29 -52
index fcfa2ca..7c07cfd 100644
@@ -319,60 +319,38 @@ do {						\
 
 #define WL_ERROR_ON()		(brcm_msg_level & LOG_ERROR_VAL)
 
-/* register access macros */
+/*
+ * Register access macros.
+ *
+ * These macro's take a pointer to the address to read as one of their
+ * arguments. The macro itself deduces the size of the IO transaction (u8, u16
+ * or u32). Advantage of this approach in combination with using a struct to
+ * define the registers in a register block, is that access size and access
+ * location are defined in only one spot. This reduces the risk of the
+ * programmer trying to use an unsupported transaction size on a register.
+ *
+ * For big endian operation, a byte swap has to be done. Eg, when attempting
+ * to read byte address 0, byte 3 should be read. This is accomplished
+ * using an xor ('^') operator.
+ */
+
 #ifndef __BIG_ENDIAN
-#ifndef __mips__
-#define R_REG(r) \
-	({\
-		sizeof(*(r)) == sizeof(u8) ? \
-		readb((u8 *)(r)) : \
-		sizeof(*(r)) == sizeof(u16) ? readw((u16 *)(r)) : \
-		readl((u32 *)(r)); \
-	})
-#else				/* __mips__ */
-#define R_REG(r) \
-	({ \
-		__typeof(*(r)) __osl_v; \
-		__asm__ __volatile__("sync"); \
-		switch (sizeof(*(r))) { \
-		case sizeof(u8): \
-			__osl_v = readb((u8 *)(r)); \
-			break; \
-		case sizeof(u16): \
-			__osl_v = readw((u16 *)(r)); \
-			break; \
-		case sizeof(u32): \
-			__osl_v = \
-			readl((u32 *)(r)); \
-			break; \
-		} \
-		__asm__ __volatile__("sync"); \
-		__osl_v; \
-	})
-#endif				/* __mips__ */
+#define SWP2(r)	(r)
+#define SWP3(r) (r)
+#else
+#define SWP2(r)	((unsigned long)(r)^2)
+#define SWP3(r)	((unsigned long)(r)^3)
+#endif /* __BIG_ENDIAN */
 
-#define W_REG(r, v) do { \
-		switch (sizeof(*(r))) { \
-		case sizeof(u8): \
-			writeb((u8)(v), (u8 *)(r)); break; \
-		case sizeof(u16): \
-			writew((u16)(v), (u16 *)(r)); break; \
-		case sizeof(u32): \
-			writel((u32)(v), (u32 *)(r)); break; \
-		}; \
-	} while (0)
-#else				/* __BIG_ENDIAN */
 #define R_REG(r) \
 	({ \
 		__typeof(*(r)) __osl_v; \
 		switch (sizeof(*(r))) { \
 		case sizeof(u8): \
-			__osl_v = \
-			readb((u8 *)((unsigned long)(r)^3)); \
+			__osl_v = readb((u8 *)(SWP3(r))); \
 			break; \
 		case sizeof(u16): \
-			__osl_v = \
-			readw((u16 *)((unsigned long)(r)^2)); \
+			__osl_v = readw((u16 *)(SWP2(r))); \
 			break; \
 		case sizeof(u32): \
 			__osl_v = readl((u32 *)(r)); \
@@ -384,17 +362,16 @@ do {						\
 #define W_REG(r, v) do { \
 		switch (sizeof(*(r))) { \
 		case sizeof(u8):	\
-			writeb((u8)(v), \
-			(u8 *)((unsigned long)(r)^3)); break; \
+			writeb((u8)(v), (u8 *)(SWP3(r))); \
+			break; \
 		case sizeof(u16):	\
-			writew((u16)(v), \
-			(u16 *)((unsigned long)(r)^2)); break; \
+			writew((u16)(v), (u16 *)(SWP2(r))); \
+			break; \
 		case sizeof(u32):	\
-			writel((u32)(v), \
-			(u32 *)(r)); break; \
+			writel((u32)(v), (u32 *)(r)); \
+			break; \
 		} \
 	} while (0)
-#endif				/* __BIG_ENDIAN */
 
 #ifdef __mips__
 /*
Signature · 1 line
1.7.4.1
#13 lore raw

PATCH 13/29 staging: brcm80211: revisited END_FOREACH_BSS macro

In reply to Arend van Spriel

The definition of END_FOREACH_BSS macro resulted in an invalid checkpatch.pl warning. By adding braces to the macro this warning goes away. Ideally, the checkpatch.pl script should be adapted but lacking good perl knowledge to do so.

---
 drivers/staging/brcm80211/brcmsmac/main.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +10 -10
index e67bf64..f5f914f 100644
@@ -270,7 +270,7 @@
 		if (!cfg) \
 			continue;
 /* close marker for iterator code block */
-#define END_FOREACH_BSS		}
+#define END_FOREACH_BSS()	}
 
 /* Shared memory location index for various AC params */
 #define wme_shmemacindex(ac)	wme_ac2fifo[ac]
@@ -3345,7 +3345,7 @@ void brcms_c_init(struct brcms_c_info *wlc)
 	FOREACH_BSS(wlc, i, bsscfg)
 		brcms_c_set_mac(bsscfg);
 		brcms_c_set_bssid(bsscfg);
-	END_FOREACH_BSS
+	END_FOREACH_BSS()
 
 	/* Update tsf_cfprep if associated and up */
 	if (wlc->pub->associated) {
@@ -3367,7 +3367,7 @@ void brcms_c_init(struct brcms_c_info *wlc)
 
 				break;
 			}
-		END_FOREACH_BSS
+		END_FOREACH_BSS()
 	}
 
 	brcms_c_bandinit_ordered(wlc, chanspec);
@@ -3577,7 +3577,7 @@ void brcms_c_switch_shortslot(struct brcms_c_info *wlc, bool shortslot)
 		if (wlc->shortslot)
 			cfg->current_bss->capability |=
 					WLAN_CAPABILITY_SHORT_SLOT_TIME;
-	END_FOREACH_BSS /* this comment fixes a checkpatch warning */
+	END_FOREACH_BSS()
 
 	brcms_b_set_shortslot(wlc->hw, shortslot);
 }
@@ -3626,7 +3626,7 @@ void brcms_c_set_home_chanspec(struct brcms_c_info *wlc, u16 chanspec)
 				continue;
 
 			cfg->current_bss->chanspec = chanspec;
-		END_FOREACH_BSS
+		END_FOREACH_BSS()
 
 
 	}
@@ -5384,7 +5384,7 @@ static void brcms_c_watchdog(void *arg)
 			cfg->tk_cm_dt--;
 		if (cfg->tk_cm_bt)
 			cfg->tk_cm_bt--;
-	END_FOREACH_BSS
+	END_FOREACH_BSS()
 
 	/* Call any registered watchdog handlers */
 	for (i = 0; i < BRCMS_MAXMODULES; i++) {
@@ -5557,7 +5557,7 @@ int brcms_c_up(struct brcms_c_info *wlc)
 						  ": rfdisable -> "
 						  "bsscfg_disable()\n",
 						   wlc->pub->unit, idx);
-				END_FOREACH_BSS
+				END_FOREACH_BSS()
 			}
 		}
 	}
@@ -9075,7 +9075,7 @@ void brcms_c_update_beacon(struct brcms_c_info *wlc)
 	FOREACH_BSS(wlc, idx, bsscfg)
 		if (bsscfg->up && (BSSCFG_AP(bsscfg) || !bsscfg->BSS))
 			brcms_c_bss_update_beacon(wlc, bsscfg);
-	END_FOREACH_BSS
+	END_FOREACH_BSS()
 }
 
 /* Write ssid into shared memory */
@@ -9104,7 +9104,7 @@ void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend)
 	FOREACH_BSS(wlc, idx, bsscfg)
 		if (bsscfg->up && (BSSCFG_AP(bsscfg) || !bsscfg->BSS))
 			brcms_c_bss_update_probe_resp(wlc, bsscfg, suspend);
-	END_FOREACH_BSS
+	END_FOREACH_BSS()
 }
 
 void
@@ -9191,7 +9191,7 @@ void brcms_c_reprate_init(struct brcms_c_info *wlc)
 
 	FOREACH_BSS(wlc, i, bsscfg)
 		brcms_c_bsscfg_reprate_init(bsscfg);
-	END_FOREACH_BSS
+	END_FOREACH_BSS()
 }
 
 /* per bsscfg init tx reported rate mechanism */
Signature · 1 line
1.7.4.1
#16 lore raw

PATCH 14/29 staging: brcm80211: placed suspend flag in gInstance in brcmfmac

In reply to Arend van Spriel

From: Franky Lin <[email protected]>

One of the steps to remove global variable. gInstance will be replaced by brcmf_sdio_dev in the upcoming patch.

---
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |   35 ++++++++++-----------
 drivers/staging/brcm80211/brcmfmac/sdio_host.h    |    1 +
 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +17 -18
index 2a9efc3..edcd98e 100644
@@ -66,7 +66,6 @@ static int brcmf_sdio_resume(struct device *dev);
 uint sd_f2_blocksize = 512;	/* Default blocksize */
 
 struct brcmf_sdmmc_instance *gInstance;
-static atomic_t brcmf_mmc_suspend;
 
 /* devices we support, null terminated */
 static const struct sdio_device_id brcmf_sdmmc_ids[] = {
@@ -100,17 +99,17 @@ DECLARE_WAIT_QUEUE_HEAD(sdioh_request_byte_wait);
 DECLARE_WAIT_QUEUE_HEAD(sdioh_request_word_wait);
 DECLARE_WAIT_QUEUE_HEAD(sdioh_request_packet_wait);
 DECLARE_WAIT_QUEUE_HEAD(sdioh_request_buffer_wait);
-#define BRCMF_PM_RESUME_WAIT(a) do { \
+#define BRCMF_PM_RESUME_WAIT(a, b) do { \
 		int retry = 0; \
-		while (atomic_read(&brcmf_mmc_suspend) && retry++ != 30) { \
+		while (atomic_read(&b->suspend) && retry++ != 30) { \
 			wait_event_timeout(a, false, HZ/100); \
 		} \
 	}	while (0)
-#define BRCMF_PM_RESUME_RETURN_ERROR(a)	\
-	do { if (atomic_read(&brcmf_mmc_suspend)) return a; } while (0)
+#define BRCMF_PM_RESUME_RETURN_ERROR(a, b)	\
+	do { if (atomic_read(&b->suspend)) return a; } while (0)
 #else
-#define BRCMF_PM_RESUME_WAIT(a)
-#define BRCMF_PM_RESUME_RETURN_ERROR(a)
+#define BRCMF_PM_RESUME_WAIT(a, b)
+#define BRCMF_PM_RESUME_RETURN_ERROR(a, b)
 #endif		/* CONFIG_PM_SLEEP */
 
 static int
@@ -571,8 +570,8 @@ brcmf_sdioh_request_byte(struct sdioh_info *sd, uint rw, uint func,
 	BRCMF_INFO(("%s: rw=%d, func=%d, addr=0x%05x\n", __func__, rw, func,
 		 regaddr));
 
-	BRCMF_PM_RESUME_WAIT(sdioh_request_byte_wait);
-	BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
+	BRCMF_PM_RESUME_WAIT(sdioh_request_byte_wait, gInstance);
+	BRCMF_PM_RESUME_RETURN_ERROR(-EIO, gInstance);
 	if (rw) {		/* CMD52 Write */
 		if (func == 0) {
 			/* Can only directly write to some F0 registers.
@@ -678,8 +677,8 @@ brcmf_sdioh_request_word(struct sdioh_info *sd, uint cmd_type, uint rw,
 	BRCMF_INFO(("%s: cmd_type=%d, rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
 		 __func__, cmd_type, rw, func, addr, nbytes));
 
-	BRCMF_PM_RESUME_WAIT(sdioh_request_word_wait);
-	BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
+	BRCMF_PM_RESUME_WAIT(sdioh_request_word_wait, gInstance);
+	BRCMF_PM_RESUME_RETURN_ERROR(-EIO, gInstance);
 	/* Claim host controller */
 	sdio_claim_host(gInstance->func[func]);
 
@@ -728,8 +727,8 @@ brcmf_sdioh_request_packet(struct sdioh_info *sd, uint fix_inc, uint write,
 
 	BRCMF_TRACE(("%s: Enter\n", __func__));
 
-	BRCMF_PM_RESUME_WAIT(sdioh_request_packet_wait);
-	BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
+	BRCMF_PM_RESUME_WAIT(sdioh_request_packet_wait, gInstance);
+	BRCMF_PM_RESUME_RETURN_ERROR(-EIO, gInstance);
 
 	/* Claim host controller */
 	sdio_claim_host(gInstance->func[func]);
@@ -806,8 +805,8 @@ brcmf_sdioh_request_buffer(struct sdioh_info *sd, uint pio_dma, uint fix_inc,
 
 	BRCMF_TRACE(("%s: Enter\n", __func__));
 
-	BRCMF_PM_RESUME_WAIT(sdioh_request_buffer_wait);
-	BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
+	BRCMF_PM_RESUME_WAIT(sdioh_request_buffer_wait, gInstance);
+	BRCMF_PM_RESUME_RETURN_ERROR(-EIO, gInstance);
 	/* Case 1: we don't have a packet. */
 	if (pkt == NULL) {
 		BRCMF_DATA(("%s: Creating new %s Packet, len=%d\n",
@@ -981,7 +980,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
 		sdiodev->func1 = func;
 		dev_set_drvdata(&func->card->dev, sdiodev);
 
-		atomic_set(&brcmf_mmc_suspend, false);
+		atomic_set(&gInstance->suspend, false);
 	}
 
 	gInstance->func[func->num] = func;
@@ -1029,7 +1028,7 @@ static int brcmf_sdio_suspend(struct device *dev)
 
 	BRCMF_TRACE(("%s\n", __func__));
 
-	atomic_set(&brcmf_mmc_suspend, true);
+	atomic_set(&gInstance->suspend, true);
 
 	sdio_flags = sdio_get_host_pm_caps(gInstance->func[1]);
 	if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
@@ -1056,7 +1055,7 @@ static int brcmf_sdio_resume(struct device *dev)
 
 	sdiodev = dev_get_drvdata(&func->card->dev);
 	brcmf_sdio_wdtmr_enable(sdiodev, true);
-	atomic_set(&brcmf_mmc_suspend, false);
+	atomic_set(&gInstance->suspend, false);
 	return 0;
 }
 #endif		/* CONFIG_PM_SLEEP */
drivers/staging/brcm80211/brcmfmac/sdio_host.h +1 -0
index aecc8e3..f4e2329 100644
@@ -152,6 +152,7 @@ struct brcmf_sdmmc_instance {
 	struct sdioh_info *sd;
 	struct sdio_func *func[SDIOD_MAX_IOFUNCS];
 	u32 host_claimed;
+	atomic_t suspend;	/* suspend flag */
 };
 
 struct brcmf_sdio_dev {
Signature · 1 line
1.7.4.1
#17 lore raw

PATCH 15/29 staging: brcm80211: remove struct brcmf_sdioh_driver from brcmfmac

In reply to Arend van Spriel

From: Franky Lin <[email protected]>

brcmf_sdioh_driver is a legacy bus driver interface we dont need any more.

---
 drivers/staging/brcm80211/brcmfmac/bcmsdh.c    |   11 +++--------
 drivers/staging/brcm80211/brcmfmac/dhd_bus.h   |    4 ++++
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c  |   17 +++--------------
 drivers/staging/brcm80211/brcmfmac/sdio_host.h |   11 +----------
 4 files changed, 11 insertions(+), 32 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh.c +3 -8
index 0cd449d..82d9d2c 100644
@@ -50,9 +50,6 @@ struct brcmf_sdio_card {
 	u32 sbwad;		/* Save backplane window address */
 };
 
-/* driver info, initialized when brcmf_sdio_register is called */
-static struct brcmf_sdioh_driver drvinfo = { NULL, NULL };
-
 /* Module parameters specific to each host-controller driver */
 
 module_param(sd_f2_blocksize, int, 0);
@@ -443,7 +440,7 @@ int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
 	vendevid = brcmf_sdcard_query_device(sdiodev->card);
 
 	/* try to attach to the target device */
-	sdiodev->bus = drvinfo.attach((vendevid >> 16), (vendevid & 0xFFFF),
+	sdiodev->bus = brcmf_sdbrcm_probe((vendevid >> 16), (vendevid & 0xFFFF),
 				  0, 0, 0, 0, regs, sdiodev->card);
 	if (!sdiodev->bus) {
 		BRCMF_ERROR(("%s: device attach failed\n", __func__));
@@ -462,7 +459,7 @@ EXPORT_SYMBOL(brcmf_sdio_probe);
 int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev)
 {
 	if (sdiodev->bus) {
-		drvinfo.detach(sdiodev->bus);
+		brcmf_sdbrcm_disconnect(sdiodev->bus);
 		sdiodev->bus = NULL;
 	}
 
@@ -477,10 +474,8 @@ int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev)
 }
 EXPORT_SYMBOL(brcmf_sdio_remove);
 
-int brcmf_sdio_register(struct brcmf_sdioh_driver *driver)
+int brcmf_sdio_register(void)
 {
-	drvinfo = *driver;
-
 	return brcmf_sdio_function_init();
 }
 
drivers/staging/brcm80211/brcmfmac/dhd_bus.h +4 -0
index 653cf0d..0fb3250 100644
@@ -75,4 +75,8 @@ extern void brcmf_bus_clearcounts(struct brcmf_pub *drvr);
 
 extern void brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick);
 
+extern void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no,
+				u16 slot, u16 func, uint bustype, u32 regsva,
+				void *card);
+extern void brcmf_sdbrcm_disconnect(void *ptr);
 #endif				/* _BRCMF_BUS_H_ */
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +3 -14
index 6c96f77..1b84767 100644
@@ -962,7 +962,6 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter);
 
 static void brcmf_sdbrcm_release(struct brcmf_bus *bus);
 static void brcmf_sdbrcm_release_malloc(struct brcmf_bus *bus);
-static void brcmf_sdbrcm_disconnect(void *ptr);
 static bool brcmf_sdbrcm_chipmatch(u16 chipid);
 static bool brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card,
 				      u32 regsva, u16 devid);
@@ -5431,7 +5430,7 @@ static bool brcmf_sdbrcm_chipmatch(u16 chipid)
 	return false;
 }
 
-static void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no,
+void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no,
 			   u16 slot, u16 func, uint bustype, u32 regsva,
 			   void *card)
 {
@@ -5889,7 +5888,7 @@ static void brcmf_sdbrcm_release_dongle(struct brcmf_bus *bus)
 	BRCMF_TRACE(("%s: Disconnected\n", __func__));
 }
 
-static void brcmf_sdbrcm_disconnect(void *ptr)
+void brcmf_sdbrcm_disconnect(void *ptr)
 {
 	struct brcmf_bus *bus = (struct brcmf_bus *)ptr;
 
@@ -5901,16 +5900,6 @@ static void brcmf_sdbrcm_disconnect(void *ptr)
 	BRCMF_TRACE(("%s: Disconnected\n", __func__));
 }
 
-/* Register/Unregister functions are called by the main DHD entry
- * point (e.g. module insertion) to link with the bus driver, in
- * order to look for or await the device.
- */
-
-static struct brcmf_sdioh_driver brcmf_sdio = {
-	brcmf_sdbrcm_probe,
-	brcmf_sdbrcm_disconnect
-};
-
 int brcmf_bus_register(void)
 {
 	BRCMF_TRACE(("%s: Enter\n", __func__));
@@ -5930,7 +5919,7 @@ int brcmf_bus_register(void)
 		return -EINVAL;
 	} while (0);
 
-	return brcmf_sdio_register(&brcmf_sdio);
+	return brcmf_sdio_register();
 }
 
 void brcmf_bus_unregister(void)
drivers/staging/brcm80211/brcmfmac/sdio_host.h +1 -10
index f4e2329..3d6c261 100644
@@ -278,20 +278,11 @@ extern int brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name,
 
 /* helper functions */
 
-/* callback functions */
-struct brcmf_sdioh_driver {
-	/* attach to device */
-	void *(*attach) (u16 vend_id, u16 dev_id, u16 bus, u16 slot,
-			 u16 func, uint bustype, u32 regsva, void *param);
-	/* detach from device */
-	void (*detach) (void *ch);
-};
-
 struct sdioh_info;
 
 /* platform specific/high level functions */
 extern int brcmf_sdio_function_init(void);
-extern int brcmf_sdio_register(struct brcmf_sdioh_driver *driver);
+extern int brcmf_sdio_register(void);
 extern void brcmf_sdio_unregister(void);
 extern void brcmf_sdio_function_cleanup(void);
 extern int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev);
Signature · 1 line
1.7.4.1
#18 lore raw

PATCH 16/29 staging: brcm80211: remove vendor and device id check from brcmfmac

In reply to Arend van Spriel

From: Franky Lin <[email protected]>

mmc core is handling the vendor/device id check and matching drivers with devices. No need to do it again in driver.

---
 drivers/staging/brcm80211/brcmfmac/bcmsdh.c    |   14 +------
 drivers/staging/brcm80211/brcmfmac/dhd_bus.h   |    5 +-
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c  |   53 +++---------------------
 drivers/staging/brcm80211/brcmfmac/sdio_host.h |    3 -
 4 files changed, 9 insertions(+), 66 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh.c +1 -13
index 82d9d2c..3208a11 100644
@@ -44,7 +44,6 @@
 struct brcmf_sdio_card {
 	bool init_success;	/* underlying driver successfully attached */
 	void *sdioh;		/* handler for sdioh */
-	u32 vendevid;	/* Target Vendor and Device ID on SD bus */
 	bool regfail;		/* Save status of last
 				 reg_read/reg_write call */
 	u32 sbwad;		/* Save backplane window address */
@@ -399,12 +398,6 @@ int brcmf_sdcard_abort(struct brcmf_sdio_card *card, uint fn)
 	return brcmf_sdioh_abort(card->sdioh, fn);
 }
 
-int brcmf_sdcard_query_device(struct brcmf_sdio_card *card)
-{
-	card->vendevid = (PCI_VENDOR_ID_BROADCOM << 16) | 0;
-	return card->vendevid;
-}
-
 u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card)
 {
 	return card->sbwad;
@@ -413,7 +406,6 @@ u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card)
 int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
 {
 	u32 regs = 0;
-	u32 vendevid;
 	int ret = 0;
 
 	sdiodev->card = kzalloc(sizeof(struct brcmf_sdio_card), GFP_ATOMIC);
@@ -436,12 +428,8 @@ int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
 	/* Report the BAR, to fix if needed */
 	sdiodev->card->sbwad = SI_ENUM_BASE;
 
-	/* Read the vendor/device ID from the CIS */
-	vendevid = brcmf_sdcard_query_device(sdiodev->card);
-
 	/* try to attach to the target device */
-	sdiodev->bus = brcmf_sdbrcm_probe((vendevid >> 16), (vendevid & 0xFFFF),
-				  0, 0, 0, 0, regs, sdiodev->card);
+	sdiodev->bus = brcmf_sdbrcm_probe(0, 0, 0, 0, regs, sdiodev->card);
 	if (!sdiodev->bus) {
 		BRCMF_ERROR(("%s: device attach failed\n", __func__));
 		ret = -ENODEV;
drivers/staging/brcm80211/brcmfmac/dhd_bus.h +2 -3
index 0fb3250..4521fe5 100644
@@ -75,8 +75,7 @@ extern void brcmf_bus_clearcounts(struct brcmf_pub *drvr);
 
 extern void brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick);
 
-extern void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no,
-				u16 slot, u16 func, uint bustype, u32 regsva,
-				void *card);
+extern void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
+				u32 regsva, void *card);
 extern void brcmf_sdbrcm_disconnect(void *ptr);
 #endif				/* _BRCMF_BUS_H_ */
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +6 -47

105 lines not on this page · raw message

drivers/staging/brcm80211/brcmfmac/sdio_host.h +0 -3
index 3d6c261..22441e9 100644
@@ -268,9 +268,6 @@ extern int brcmf_sdcard_rwdata(struct brcmf_sdio_card *card, uint rw, u32 addr,
 /* Issue an abort to the specified function */
 extern int brcmf_sdcard_abort(struct brcmf_sdio_card *card, uint fn);
 
-/* Returns the "Device ID" of target device on the SDIO bus. */
-extern int brcmf_sdcard_query_device(struct brcmf_sdio_card *card);
-
 /* Miscellaneous knob tweaker. */
 extern int brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name,
 				 void *params, int plen, void *arg, int len,
Signature · 1 line
1.7.4.1
#19 lore raw

PATCH 17/29 staging: brcm80211: remove struct brcmf_sdio_card from brcmfmac

In reply to Arend van Spriel

From: Franky Lin <[email protected]>

Use brcmf_sdio_dev as the unified structure to store information of wifi dongle

---
 drivers/staging/brcm80211/brcmfmac/bcmsdh.c    |  145 ++++-----
 drivers/staging/brcm80211/brcmfmac/dhd_bus.h   |    3 -
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c  |  445 ++++++++++++------------
 drivers/staging/brcm80211/brcmfmac/sdio_host.h |   52 ++--
 4 files changed, 317 insertions(+), 328 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh.c +64 -81
index 3208a11..31e6728 100644
@@ -41,48 +41,40 @@
 #define SDIOH_DATA_PIO          0	/* PIO mode */
 #define SDIOH_DATA_DMA          1	/* DMA mode */
 
-struct brcmf_sdio_card {
-	bool init_success;	/* underlying driver successfully attached */
-	void *sdioh;		/* handler for sdioh */
-	bool regfail;		/* Save status of last
-				 reg_read/reg_write call */
-	u32 sbwad;		/* Save backplane window address */
-};
-
 /* Module parameters specific to each host-controller driver */
 
 module_param(sd_f2_blocksize, int, 0);
 
 int
-brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name,
+brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev, const char *name,
 		void *params, int plen, void *arg, int len, bool set)
 {
-	return brcmf_sdioh_iovar_op(card->sdioh, name, params, plen, arg,
+	return brcmf_sdioh_iovar_op(sdiodev->sdioh, name, params, plen, arg,
 				    len, set);
 }
 
-int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card)
+int brcmf_sdcard_intr_enable(struct brcmf_sdio_dev *sdiodev)
 {
-	return brcmf_sdioh_interrupt_set(card->sdioh, true);
+	return brcmf_sdioh_interrupt_set(sdiodev->sdioh, true);
 }
 
-int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card)
+int brcmf_sdcard_intr_disable(struct brcmf_sdio_dev *sdiodev)
 {
-	return brcmf_sdioh_interrupt_set(card->sdioh, false);
+	return brcmf_sdioh_interrupt_set(sdiodev->sdioh, false);
 }
 
-int brcmf_sdcard_intr_reg(struct brcmf_sdio_card *card,
+int brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev,
 			  void (*fn)(void *), void *argh)
 {
-	return brcmf_sdioh_interrupt_register(card->sdioh, fn, argh);
+	return brcmf_sdioh_interrupt_register(sdiodev->sdioh, fn, argh);
 }
 
-int brcmf_sdcard_intr_dereg(struct brcmf_sdio_card *card)
+int brcmf_sdcard_intr_dereg(struct brcmf_sdio_dev *sdiodev)
 {
-	return brcmf_sdioh_interrupt_deregister(card->sdioh);
+	return brcmf_sdioh_interrupt_deregister(sdiodev->sdioh);
 }
 
-u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
+u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
 			 int *err)
 {
 	int status;
@@ -93,7 +85,7 @@ u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
 		if (retry)	/* wait for 1 ms till bus get settled down */
 			udelay(1000);
 		status =
-		    brcmf_sdioh_cfg_read(card->sdioh, fnc_num, addr,
+		    brcmf_sdioh_cfg_read(sdiodev->sdioh, fnc_num, addr,
 				   (u8 *) &data);
 	} while (status != 0
 		 && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
@@ -107,7 +99,7 @@ u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
 }
 
 void
-brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
+brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
 		       u8 data, int *err)
 {
 	int status;
@@ -117,7 +109,7 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
 		if (retry)	/* wait for 1 ms till bus get settled down */
 			udelay(1000);
 		status =
-		    brcmf_sdioh_cfg_write(card->sdioh, fnc_num, addr,
+		    brcmf_sdioh_cfg_write(sdiodev->sdioh, fnc_num, addr,
 				    (u8 *) &data);
 	} while (status != 0
 		 && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
@@ -128,13 +120,13 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
 		     __func__, fnc_num, addr, data));
 }
 
-u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num,
+u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_dev *sdiodev, uint fnc_num,
 			       u32 addr, int *err)
 {
 	int status;
 	u32 data = 0;
 
-	status = brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
+	status = brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL,
 		SDIOH_READ, fnc_num, addr, &data, 4);
 
 	if (err)
@@ -147,13 +139,13 @@ u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num,
 }
 
 void
-brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, uint fnc_num,
+brcmf_sdcard_cfg_write_word(struct brcmf_sdio_dev *sdiodev, uint fnc_num,
 			    u32 addr, u32 data, int *err)
 {
 	int status;
 
 	status =
-	    brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
+	    brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL,
 			       SDIOH_WRITE, fnc_num, addr, &data, 4);
 
 	if (err)
@@ -163,7 +155,7 @@ brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, uint fnc_num,
 		     __func__, fnc_num, addr, data));
 }
 
-int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis,
+int brcmf_sdcard_cis_read(struct brcmf_sdio_dev *sdiodev, uint func, u8 * cis,
 			  uint length)
 {
 	int status;
@@ -173,7 +165,7 @@ int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis,
 	bool ascii = func & ~0xf;
 	func &= 0x7;
 
-	status = brcmf_sdioh_cis_read(card->sdioh, func, cis, length);
+	status = brcmf_sdioh_cis_read(sdiodev->sdioh, func, cis, length);
 
 	if (ascii) {
 		/* Move binary bits to tmp and format them
@@ -197,18 +189,18 @@ int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis,
 }
 
 static int
-brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_card *card, u32 address)
+brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address)
 {
 	int err = 0;
-	brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
+	brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
 			 (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);
 	if (!err)
-		brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
+		brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_1,
 				       SBSDIO_FUNC1_SBADDRMID,
 				       (address >> 16) & SBSDIO_SBADDRMID_MASK,
 				       &err);
 	if (!err)
-		brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
+		brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_1,
 				       SBSDIO_FUNC1_SBADDRHIGH,
 				       (address >> 24) & SBSDIO_SBADDRHIGH_MASK,
 				       &err);
@@ -216,7 +208,7 @@ brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_card *card, u32 address)
 	return err;
 }
 
-u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size)
+u32 brcmf_sdcard_reg_read(struct brcmf_sdio_dev *sdiodev, u32 addr, uint size)
 {
 	int status;
 	u32 word = 0;
@@ -224,21 +216,21 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size)
 
 	BRCMF_INFO(("%s:fun = 1, addr = 0x%x, ", __func__, addr));
 
-	if (bar0 != card->sbwad) {
-		if (brcmf_sdcard_set_sbaddr_window(card, bar0))
+	if (bar0 != sdiodev->sbwad) {
+		if (brcmf_sdcard_set_sbaddr_window(sdiodev, bar0))
 			return 0xFFFFFFFF;
 
-		card->sbwad = bar0;
+		sdiodev->sbwad = bar0;
 	}
 
 	addr &= SBSDIO_SB_OFT_ADDR_MASK;
 	if (size == 4)
 		addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
 
-	status = brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
+	status = brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL,
 				    SDIOH_READ, SDIO_FUNC_1, addr, &word, size);
 
-	card->regfail = (status != 0);
+	sdiodev->regfail = (status != 0);
 
 	BRCMF_INFO(("u32data = 0x%x\n", word));
 
@@ -252,7 +244,7 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size)
 		case sizeof(u32):
 			return word;
 		default:
-			card->regfail = true;
+			sdiodev->regfail = true;
 
 		}
 	}
@@ -263,7 +255,7 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size)
 	return 0xFFFFFFFF;
 }
 
-u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size,
+u32 brcmf_sdcard_reg_write(struct brcmf_sdio_dev *sdiodev, u32 addr, uint size,
 			   u32 data)
 {
 	int status;
@@ -273,21 +265,21 @@ u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size,
 	BRCMF_INFO(("%s:fun = 1, addr = 0x%x, uint%ddata = 0x%x\n",
 		     __func__, addr, size * 8, data));
 
-	if (bar0 != card->sbwad) {
-		err = brcmf_sdcard_set_sbaddr_window(card, bar0);
+	if (bar0 != sdiodev->sbwad) {
+		err = brcmf_sdcard_set_sbaddr_window(sdiodev, bar0);
 		if (err)
 			return err;
 
-		card->sbwad = bar0;
+		sdiodev->sbwad = bar0;
 	}
 
 	addr &= SBSDIO_SB_OFT_ADDR_MASK;
 	if (size == 4)
 		addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
 	status =
-	    brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
+	    brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL,
 			       SDIOH_WRITE, SDIO_FUNC_1, addr, &data, size);
-	card->regfail = (status != 0);
+	sdiodev->regfail = (status != 0);
 
 	if (status == 0)
 		return 0;
@@ -297,13 +289,13 @@ u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size,
 	return 0xFFFFFFFF;
 }
 
-bool brcmf_sdcard_regfail(struct brcmf_sdio_card *card)
+bool brcmf_sdcard_regfail(struct brcmf_sdio_dev *sdiodev)
 {
-	return card->regfail;
+	return sdiodev->regfail;
 }
 
 int
-brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
+brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
 		      uint flags,
 		      u8 *buf, uint nbytes, struct sk_buff *pkt,
 		      void (*complete)(void *handle, int status,
@@ -323,12 +315,12 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
 	if (flags & SDIO_REQ_ASYNC)
 		return -ENOTSUPP;
 
-	if (bar0 != card->sbwad) {
-		err = brcmf_sdcard_set_sbaddr_window(card, bar0);
+	if (bar0 != sdiodev->sbwad) {
+		err = brcmf_sdcard_set_sbaddr_window(sdiodev, bar0);
 		if (err)
 			return err;
 
-		card->sbwad = bar0;
+		sdiodev->sbwad = bar0;
 	}
 
 	addr &= SBSDIO_SB_OFT_ADDR_MASK;
@@ -338,14 +330,14 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
 	if (width == 4)
 		addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
 
-	status = brcmf_sdioh_request_buffer(card->sdioh, SDIOH_DATA_PIO,
+	status = brcmf_sdioh_request_buffer(sdiodev->sdioh, SDIOH_DATA_PIO,
 		incr_fix, SDIOH_READ, fn, addr, width, nbytes, buf, pkt);
 
 	return status;
 }
 
 int
-brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
+brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
 		      uint flags, u8 *buf, uint nbytes, void *pkt,
 		      void (*complete)(void *handle, int status,
 				       bool sync_waiting),
@@ -363,12 +355,12 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
 	if (flags & SDIO_REQ_ASYNC)
 		return -ENOTSUPP;
 
-	if (bar0 != card->sbwad) {
-		err = brcmf_sdcard_set_sbaddr_window(card, bar0);
+	if (bar0 != sdiodev->sbwad) {
+		err = brcmf_sdcard_set_sbaddr_window(sdiodev, bar0);
 		if (err)
 			return err;
 
-		card->sbwad = bar0;
+		sdiodev->sbwad = bar0;
 	}
 
 	addr &= SBSDIO_SB_OFT_ADDR_MASK;
@@ -378,29 +370,29 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn,
 	if (width == 4)
 		addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
 
-	return brcmf_sdioh_request_buffer(card->sdioh, SDIOH_DATA_PIO,
+	return brcmf_sdioh_request_buffer(sdiodev->sdioh, SDIOH_DATA_PIO,
 		incr_fix, SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt);
 }
 
-int brcmf_sdcard_rwdata(struct brcmf_sdio_card *card, uint rw, u32 addr,
+int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw, u32 addr,
 			u8 *buf, uint nbytes)
 {
 	addr &= SBSDIO_SB_OFT_ADDR_MASK;
 	addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
 
-	return brcmf_sdioh_request_buffer(card->sdioh, SDIOH_DATA_PIO,
+	return brcmf_sdioh_request_buffer(sdiodev->sdioh, SDIOH_DATA_PIO,
 		SDIOH_DATA_INC, (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1,
 		addr, 4, nbytes, buf, NULL);
 }
 
-int brcmf_sdcard_abort(struct brcmf_sdio_card *card, uint fn)
+int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn)
 {
-	return brcmf_sdioh_abort(card->sdioh, fn);
+	return brcmf_sdioh_abort(sdiodev->sdioh, fn);
 }
 
-u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card)
+u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev)
 {
-	return card->sbwad;
+	return sdiodev->sbwad;
 }
 
 int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
@@ -408,28 +400,19 @@ int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
 	u32 regs = 0;
 	int ret = 0;
 
-	sdiodev->card = kzalloc(sizeof(struct brcmf_sdio_card), GFP_ATOMIC);
-	if (sdiodev->card == NULL) {
-		BRCMF_ERROR(("sdcard_attach: out of memory"));
-		ret = -ENOMEM;
-		goto out;
-	}
-
-	sdiodev->card->sdioh = brcmf_sdioh_attach((void *)0);
-	if (!sdiodev->card->sdioh) {
+	sdiodev->sdioh = brcmf_sdioh_attach((void *)0);
+	if (!sdiodev->sdioh) {
 		ret = -ENODEV;
 		goto out;
 	}
 
-	sdiodev->card->init_success = true;
-
 	regs = SI_ENUM_BASE;
 
 	/* Report the BAR, to fix if needed */
-	sdiodev->card->sbwad = SI_ENUM_BASE;
+	sdiodev->sbwad = SI_ENUM_BASE;
 
 	/* try to attach to the target device */
-	sdiodev->bus = brcmf_sdbrcm_probe(0, 0, 0, 0, regs, sdiodev->card);
+	sdiodev->bus = brcmf_sdbrcm_probe(0, 0, 0, 0, regs, sdiodev);
 	if (!sdiodev->bus) {
 		BRCMF_ERROR(("%s: device attach failed\n", __func__));
 		ret = -ENODEV;
@@ -451,13 +434,13 @@ int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev)
 		sdiodev->bus = NULL;
 	}
 
-	if (sdiodev->card) {
-		if (sdiodev->card->sdioh)
-			brcmf_sdioh_detach(sdiodev->card->sdioh);
-		kfree(sdiodev->card);
-		sdiodev->card = NULL;
+	if (sdiodev->sdioh) {
+		brcmf_sdioh_detach(sdiodev->sdioh);
+		sdiodev->sdioh = NULL;
 	}
 
+	sdiodev->sbwad = 0;
+
 	return 0;
 }
 EXPORT_SYMBOL(brcmf_sdio_remove);
drivers/staging/brcm80211/brcmfmac/dhd_bus.h +0 -3
index 4521fe5..653cf0d 100644
@@ -75,7 +75,4 @@ extern void brcmf_bus_clearcounts(struct brcmf_pub *drvr);
 
 extern void brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick);
 
-extern void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
-				u32 regsva, void *card);
-extern void brcmf_sdbrcm_disconnect(void *ptr);
 #endif				/* _BRCMF_BUS_H_ */
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +226 -219

1,291 lines not on this page · raw message

drivers/staging/brcm80211/brcmfmac/sdio_host.h +27 -25

134 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#20 lore raw

PATCH 18/29 staging: brcm80211: remove dead code from brcmfmac

In reply to Arend van Spriel

From: Franky Lin <[email protected]>

brcmf_sdcrad_cfg_read_word and brcmf_sdcard_cfg_write_word are not used by anyone.

---
 drivers/staging/brcm80211/brcmfmac/bcmsdh.c    |   35 ------------------------
 drivers/staging/brcm80211/brcmfmac/sdio_host.h |    9 ------
 2 files changed, 0 insertions(+), 44 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh.c +0 -35
index 31e6728..6cabda5 100644
@@ -120,41 +120,6 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
 		     __func__, fnc_num, addr, data));
 }
 
-u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_dev *sdiodev, uint fnc_num,
-			       u32 addr, int *err)
-{
-	int status;
-	u32 data = 0;
-
-	status = brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL,
-		SDIOH_READ, fnc_num, addr, &data, 4);
-
-	if (err)
-		*err = status;
-
-	BRCMF_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n",
-		     __func__, fnc_num, addr, data));
-
-	return data;
-}
-
-void
-brcmf_sdcard_cfg_write_word(struct brcmf_sdio_dev *sdiodev, uint fnc_num,
-			    u32 addr, u32 data, int *err)
-{
-	int status;
-
-	status =
-	    brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL,
-			       SDIOH_WRITE, fnc_num, addr, &data, 4);
-
-	if (err)
-		*err = status;
-
-	BRCMF_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n",
-		     __func__, fnc_num, addr, data));
-}
-
 int brcmf_sdcard_cis_read(struct brcmf_sdio_dev *sdiodev, uint func, u8 * cis,
 			  uint length)
 {
drivers/staging/brcm80211/brcmfmac/sdio_host.h +0 -9
index b82a462..3c97af4 100644
@@ -183,15 +183,6 @@ extern u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint func,
 extern void brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint func,
 				   u32 addr, u8 data, int *err);
 
-/* Read/Write 4bytes from/to cfg space */
-extern u32
-brcmf_sdcard_cfg_read_word(struct brcmf_sdio_dev *sdiodev, uint fnc_num,
-			   u32 addr, int *err);
-
-extern void brcmf_sdcard_cfg_write_word(struct brcmf_sdio_dev *sdiodev,
-					uint fnc_num, u32 addr,
-					u32 data, int *err);
-
 /* Read CIS content for specified function.
  *   fn:     function whose CIS is being requested (0 is common CIS)
  *   cis:    pointer to memory location to place results
Signature · 1 line
1.7.4.1
#21 lore raw

PATCH 19/29 staging: brcm80211: remove dead client interrupt code from brcmfmac

In reply to Arend van Spriel

From: Franky Lin <[email protected]>

In fullmac, brcmf_sdcard_intr_enable/disable is a legacy layer and doesn't really enable/disable any interrupt. This patch removes the corresponding code.

---
 drivers/staging/brcm80211/brcmfmac/bcmsdh.c       |   10 --
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |  109 +--------------------
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c     |   53 +----------
 drivers/staging/brcm80211/brcmfmac/sdio_host.h    |   20 ----
 4 files changed, 3 insertions(+), 189 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh.c +0 -10
index 6cabda5..3a6c015 100644
@@ -53,16 +53,6 @@ brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev, const char *name,
 				    len, set);
 }
 
-int brcmf_sdcard_intr_enable(struct brcmf_sdio_dev *sdiodev)
-{
-	return brcmf_sdioh_interrupt_set(sdiodev->sdioh, true);
-}
-
-int brcmf_sdcard_intr_disable(struct brcmf_sdio_dev *sdiodev)
-{
-	return brcmf_sdioh_interrupt_set(sdiodev->sdioh, false);
-}
-
 int brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev,
 			  void (*fn)(void *), void *argh)
 {
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +2 -107

171 lines not on this page · raw message

drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +1 -52

121 lines not on this page · raw message

drivers/staging/brcm80211/brcmfmac/sdio_host.h +0 -20
index 3c97af4..4fcba2a 100644
@@ -124,18 +124,14 @@ struct brcmf_sdreg {
 
 struct sdioh_info {
 	struct osl_info *osh;		/* osh handler */
-	bool client_intr_enabled;	/* interrupt connnected flag */
 	bool intr_handler_valid; /* client driver interrupt handler valid */
 	void (*intr_handler)(void *);	/* registered interrupt handler */
 	void *intr_handler_arg;	/* argument to call interrupt handler */
-	u16 intmask;		/* Current active interrupts */
-	void *sdos_info;	/* Pointer to per-OS private data */
 
 	uint irq;		/* Client irq */
 	int intrcount;		/* Client interrupts */
 	bool sd_blockmode;	/* sd_blockmode == false => 64 Byte Cmd 53s. */
 	/*  Must be on for sd_multiblock to be effective */
-	bool use_client_ints;	/* If this is false, make sure to restore */
 	int client_block_size[SDIOD_MAX_IOFUNCS];	/* Blocksize */
 	u8 num_funcs;	/* Supported funcs on client */
 	u32 com_cis_ptr;
@@ -161,10 +157,6 @@ struct brcmf_sdio_dev {
 	void *bus;
 };
 
-/* Enable/disable SD interrupt */
-extern int brcmf_sdcard_intr_enable(struct brcmf_sdio_dev *sdiodev);
-extern int brcmf_sdcard_intr_disable(struct brcmf_sdio_dev *sdiodev);
-
 /* Register/deregister device interrupt handler. */
 extern int
 brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev,
@@ -278,14 +270,6 @@ extern int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev);
 /* Function to return current window addr */
 extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev);
 
-/* Allocate/init/free per-OS private data */
-extern int  brcmf_sdioh_osinit(struct sdioh_info *sd);
-extern void brcmf_sdioh_osfree(struct sdioh_info *sd);
-
-/* Core interrupt enable/disable of device interrupts */
-extern void brcmf_sdioh_dev_intr_on(struct sdioh_info *sd);
-extern void brcmf_sdioh_dev_intr_off(struct sdioh_info *sd);
-
 /* attach, return handler on success, NULL if failed.
  *  The handler shall be provided by all subsequent calls. No local cache
  *  cfghdl points to the starting address of pci device mapped memory
@@ -299,10 +283,6 @@ brcmf_sdioh_interrupt_register(struct sdioh_info *si,
 
 extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *si);
 
-/* enable or disable SD interrupt */
-extern int
-brcmf_sdioh_interrupt_set(struct sdioh_info *si, bool enable_disable);
-
 /* read or write one byte using cmd52 */
 extern int
 brcmf_sdioh_request_byte(struct sdioh_info *si, uint rw, uint fnc, uint addr,
Signature · 1 line
1.7.4.1
#22 lore raw

PATCH 20/29 staging: brcm80211: remove function pointer of interrupt isr in brcmfmac

In reply to Arend van Spriel

From: Franky Lin <[email protected]>

The use of function pointer of bus interrupt isr is no longer needed in fullmac as there is only one available isr.

---
 drivers/staging/brcm80211/brcmfmac/bcmsdh.c       |    5 ++---
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |   19 +++----------------
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c     |    3 ++-
 drivers/staging/brcm80211/brcmfmac/sdio_host.h    |   10 +++-------
 4 files changed, 10 insertions(+), 27 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh.c +2 -3
index 3a6c015..c9893e9 100644
@@ -53,10 +53,9 @@ brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev, const char *name,
 				    len, set);
 }
 
-int brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev,
-			  void (*fn)(void *), void *argh)
+int brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev)
 {
-	return brcmf_sdioh_interrupt_register(sdiodev->sdioh, fn, argh);
+	return brcmf_sdioh_interrupt_register(sdiodev->sdioh);
 }
 
 int brcmf_sdcard_intr_dereg(struct brcmf_sdio_dev *sdiodev)
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +3 -16
index db43b09..1256847 100644
@@ -228,19 +228,9 @@ extern int brcmf_sdioh_detach(struct sdioh_info *sd)
 
 /* Configure callback to client when we receive client interrupt */
 extern int
-brcmf_sdioh_interrupt_register(struct sdioh_info *sd, void (*fn)(void *),
-			       void *argh)
+brcmf_sdioh_interrupt_register(struct sdioh_info *sd)
 {
 	BRCMF_TRACE(("%s: Entering\n", __func__));
-	if (fn == NULL) {
-		BRCMF_ERROR(("%s: interrupt handler is NULL, not registering\n",
-			__func__));
-		return -EINVAL;
-	}
-
-	sd->intr_handler = fn;
-	sd->intr_handler_arg = argh;
-	sd->intr_handler_valid = true;
 
 	/* register and unmask irq */
 	if (gInstance->func[2]) {
@@ -277,10 +267,6 @@ extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *sd)
 		sdio_release_host(gInstance->func[2]);
 	}
 
-	sd->intr_handler_valid = false;
-	sd->intr_handler = NULL;
-	sd->intr_handler_arg = NULL;
-
 	return 0;
 }
 
@@ -877,6 +863,7 @@ brcmf_sdioh_card_regread(struct sdioh_info *sd, int func, u32 regaddr,
 static void brcmf_sdioh_irqhandler(struct sdio_func *func)
 {
 	struct sdioh_info *sd;
+	struct brcmf_sdio_dev *sdiodev = dev_get_drvdata(&func->card->dev);
 
 	BRCMF_TRACE(("brcmf: ***IRQHandler\n"));
 	sd = gInstance->sd;
@@ -884,7 +871,7 @@ static void brcmf_sdioh_irqhandler(struct sdio_func *func)
 	sdio_release_host(gInstance->func[0]);
 
 	sd->intrcount++;
-	(sd->intr_handler) (sd->intr_handler_arg);
+	brcmf_sdbrcm_isr(sdiodev->bus);
 
 	sdio_claim_host(gInstance->func[0]);
 }
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +2 -1
index 126090b..8bea865 100644
@@ -5424,6 +5424,7 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 		goto fail;
 	}
 	bus->sdiodev = sdiodev;
+	sdiodev->bus = bus;
 	bus->bus = BRCMF_BUS;
 	bus->tx_seq = SDPCM_SEQUENCE_WRAP - 1;
 	bus->usebufpool = false;	/* Use bufpool if allocated,
@@ -5506,7 +5507,7 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 	/* Register interrupt callback, but mask it (not operational yet). */
 	BRCMF_INTR(("%s: disable SDIO interrupts (not interested yet)\n",
 		    __func__));
-	ret = brcmf_sdcard_intr_reg(bus->sdiodev, brcmf_sdbrcm_isr, bus);
+	ret = brcmf_sdcard_intr_reg(bus->sdiodev);
 	if (ret != 0) {
 		BRCMF_ERROR(("%s: FAILED: sdcard_intr_reg returned %d\n",
 			     __func__, ret));
drivers/staging/brcm80211/brcmfmac/sdio_host.h +3 -7
index 4fcba2a..c5a68c0 100644
@@ -124,9 +124,6 @@ struct brcmf_sdreg {
 
 struct sdioh_info {
 	struct osl_info *osh;		/* osh handler */
-	bool intr_handler_valid; /* client driver interrupt handler valid */
-	void (*intr_handler)(void *);	/* registered interrupt handler */
-	void *intr_handler_arg;	/* argument to call interrupt handler */
 
 	uint irq;		/* Client irq */
 	int intrcount;		/* Client interrupts */
@@ -159,8 +156,7 @@ struct brcmf_sdio_dev {
 
 /* Register/deregister device interrupt handler. */
 extern int
-brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev,
-		      void (*fn)(void *), void *argh);
+brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev);
 
 extern int brcmf_sdcard_intr_dereg(struct brcmf_sdio_dev *sdiodev);
 
@@ -278,8 +274,7 @@ extern struct sdioh_info *brcmf_sdioh_attach(void *cfghdl);
 extern int brcmf_sdioh_detach(struct sdioh_info *si);
 
 extern int
-brcmf_sdioh_interrupt_register(struct sdioh_info *si,
-			       void (*sdioh_cb_fn)(void *), void *argh);
+brcmf_sdioh_interrupt_register(struct sdioh_info *si);
 
 extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *si);
 
@@ -328,4 +323,5 @@ extern struct brcmf_sdmmc_instance *gInstance;
 extern void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 				u32 regsva, struct brcmf_sdio_dev *sdiodev);
 extern void brcmf_sdbrcm_disconnect(void *ptr);
+extern void brcmf_sdbrcm_isr(void *arg);
 #endif				/* _BRCM_SDH_H_ */
Signature · 1 line
1.7.4.1
#23 lore raw

PATCH 21/29 staging: brcm80211: cleanup to get rid of 'over 80 character' line

In reply to Arend van Spriel

One checkpatch warning was remaining in the brcmsmac driver. The code has been restructured to get rid of this last checkpatch warning.

---
 drivers/staging/brcm80211/brcmsmac/main.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +5 -6
index f5f914f..2a139aa 100644
@@ -6253,14 +6253,13 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
 
 			/* merge rateset coming in with the current mcsset */
 			if (N_ENAB(wlc->pub)) {
+				struct brcms_bss_info *mcsset_bss;
 				if (bsscfg->associated)
-					memcpy(rs.mcs,
-					       &current_bss->rateset.mcs[0],
-					       MCSSET_LEN);
+					mcsset_bss = current_bss;
 				else
-					memcpy(rs.mcs,
-					       &wlc->default_bss->rateset.mcs[0],
-					       MCSSET_LEN);
+					mcsset_bss = wlc->default_bss;
+				memcpy(rs.mcs, &mcsset_bss->rateset.mcs[0],
+				       MCSSET_LEN);
 			}
 
 			bcmerror = brcms_c_set_rateset(wlc, &rs);
Signature · 1 line
1.7.4.1
#25 lore raw

PATCH 23/29 staging: brcm80211: replaced void *btparam into struct pci_dev *btparam

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

Code cleanup. Since the softmac driver only supports a PCI(e) bus, the void * could be replaced with a less generic type.

---
 drivers/staging/brcm80211/brcmsmac/aiutils.c     |    8 +++++---
 drivers/staging/brcm80211/brcmsmac/aiutils.h     |    4 +++-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |    6 +++---
 drivers/staging/brcm80211/brcmsmac/main.c        |    9 +++++----
 drivers/staging/brcm80211/brcmsmac/pub.h         |    2 +-
 5 files changed, 17 insertions(+), 12 deletions(-)
drivers/staging/brcm80211/brcmsmac/aiutils.c +5 -3
index 37edd1c..9cfb492 100644
@@ -861,7 +861,8 @@ u32 ai_core_sflags(struct si_pub *sih, u32 mask, u32 val)
 /* *************** from siutils.c ************** */
 /* local prototypes */
 static struct si_info *ai_doattach(struct si_info *sii, void *regs,
-				   void *sdh, char **vars, uint *varsz);
+				   struct pci_dev *sdh,
+				   char **vars, uint *varsz);
 static bool ai_buscore_prep(struct si_info *sii);
 static bool ai_buscore_setup(struct si_info *sii, struct chipcregs *cc,
 			     u32 savewin, uint *origidx, void *regs);
@@ -881,7 +882,8 @@ static bool ai_ispcie(struct si_info *sii);
  * vars - pointer to a pointer area for "environment" variables
  * varsz - pointer to int to return the size of the vars
  */
-struct si_pub *ai_attach(void *regs, void *sdh, char **vars, uint *varsz)
+struct si_pub *
+ai_attach(void *regs, struct pci_dev *sdh, char **vars, uint *varsz)
 {
 	struct si_info *sii;
 
@@ -1052,7 +1054,7 @@ static __used void ai_nvram_process(struct si_info *sii, char *pvars)
 }
 
 static struct si_info *ai_doattach(struct si_info *sii,
-				   void *regs, void *pbus,
+				   void *regs, struct pci_dev *pbus,
 				   char **vars, uint *varsz)
 {
 	struct si_pub *sih = &sii->pub;
drivers/staging/brcm80211/brcmsmac/aiutils.h +3 -1
index 076b4c8..101ab92 100644
@@ -446,6 +446,8 @@ struct si_pub {
 #define	IS_SIM(chippkg)	\
 	((chippkg == HDLSIM_PKG_ID) || (chippkg == HWSIM_PKG_ID))
 
+struct pci_dev;
+
 struct gpioh_item {
 	void *arg;
 	bool level;
@@ -515,7 +517,7 @@ extern u32 ai_addrspacesize(struct si_pub *sih, uint asidx);
 extern void ai_write_wrap_reg(struct si_pub *sih, u32 offset, u32 val);
 
 /* === exported functions === */
-extern struct si_pub *ai_attach(void *regs, void *sdh, char **vars,
+extern struct si_pub *ai_attach(void *regs, struct pci_dev *sdh, char **vars,
 				uint *varsz);
 extern void ai_detach(struct si_pub *sih);
 extern bool ai_pci_war16165(struct si_pub *sih);
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +3 -3
index 571186a..80c7025 100644
@@ -754,7 +754,7 @@ static int brcms_set_hint(struct brcms_info *wl, char *abbrev)
  */
 static struct brcms_info *brcms_attach(u16 vendor, u16 device,
 				       unsigned long regs,
-				       void *btparam, uint irq)
+				       struct pci_dev *btparam, uint irq)
 {
 	struct brcms_info *wl = NULL;
 	int unit, err;
@@ -794,11 +794,11 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device,
 	spin_lock_init(&wl->isr_lock);
 
 	/* prepare ucode */
-	if (brcms_request_fw(wl, (struct pci_dev *)btparam) < 0) {
+	if (brcms_request_fw(wl, btparam) < 0) {
 		wiphy_err(wl->wiphy, "%s: Failed to find firmware usually in "
 			  "%s\n", KBUILD_MODNAME, "/lib/firmware/brcm");
 		brcms_release_fw(wl);
-		brcms_remove((struct pci_dev *)btparam);
+		brcms_remove(btparam);
 		return NULL;
 	}
 
drivers/staging/brcm80211/brcmsmac/main.c +5 -4
index fb9f13f..d011ed6 100644
@@ -313,7 +313,7 @@ struct brcms_b_state;
 
 static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
 			  uint unit, bool piomode, void *regsva,
-			  void *btparam);
+			  struct pci_dev *btparam);
 
 /* up/down, reset, clk */
 static void brcms_b_reset(struct brcms_hardware *wlc_hw);
@@ -4301,7 +4301,7 @@ struct brcms_pub *brcms_c_pub(void *wlc)
  *    put the whole chip in reset(driver down state), no clock
  */
 int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, uint unit,
-		   bool piomode, void *regsva, void *btparam)
+		   bool piomode, void *regsva, struct pci_dev *btparam)
 {
 	struct brcms_hardware *wlc_hw;
 	struct d11regs *regs;
@@ -4644,8 +4644,9 @@ int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, uint unit,
 /*
  * The common driver entry routine. Error codes should be unique
  */
-void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
-		 bool piomode, void *regsva, void *btparam, uint *perr)
+void *
+brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
+	       bool piomode, void *regsva, struct pci_dev *btparam, uint *perr)
 {
 	struct brcms_c_info *wlc;
 	uint err = 0;
drivers/staging/brcm80211/brcmsmac/pub.h +1 -1
index 5e15c67..bfbb261 100644
@@ -551,7 +551,7 @@ struct brcms_antselcfg {
 /* common functions for every port */
 extern void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device,
 			uint unit, bool piomode, void *regsva,
-			void *btparam, uint *perr);
+			struct pci_dev *btparam, uint *perr);
 extern uint brcms_c_detach(struct brcms_c_info *wlc);
 extern int brcms_c_up(struct brcms_c_info *wlc);
 extern uint brcms_c_down(struct brcms_c_info *wlc);
Signature · 1 line
1.7.4.1
#27 lore raw

PATCH 25/29 staging: brcm80211: removed brcms_c_module_unregister() call in ampdu.c

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

The AMPDU module was never registered, so it does not have to be unregistered.

---
 drivers/staging/brcm80211/brcmsmac/ampdu.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/brcm80211/brcmsmac/ampdu.c +0 -1
index 64bbc24..3c0fa13 100644
@@ -243,7 +243,6 @@ void brcms_c_ampdu_detach(struct ampdu_info *ampdu)
 	for (i = 0; i < AMPDU_INI_FREE; i++)
 		kfree(ampdu->ini_free[i]);
 
-	brcms_c_module_unregister(ampdu->wlc->pub, "ampdu", ampdu);
 	kfree(ampdu);
 }
 
Signature · 1 line
1.7.4.1
#29 lore raw

PATCH 27/29 staging: brcm80211: SPARC build error fix

In reply to Arend van Spriel

From: Pieter-Paul Giesberts <[email protected]>

Due to missing memset function declaration.

---
 drivers/staging/brcm80211/brcmsmac/otp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/staging/brcm80211/brcmsmac/otp.c +1 -0
index 975d80c..b6ff767 100644
@@ -16,6 +16,7 @@
 
 #include <linux/io.h>
 #include <linux/errno.h>
+#include <linux/string.h>
 
 #include <brcm_hw_ids.h>
 #include <chipcommon.h>
Signature · 1 line
1.7.4.1
#6 lore raw

PATCH 6/29 staging: brcm80211: reformat long lines in brcmsmac to 80 columns

In reply to Arend van Spriel

Linux coding style strongly suggest to limit length of source lines to 80 characters. This commit correct this for the brcmsmac sources.

---
 drivers/staging/brcm80211/brcmsmac/aiutils.c     |  191 ++++---
 drivers/staging/brcm80211/brcmsmac/aiutils.h     |   21 +-
 drivers/staging/brcm80211/brcmsmac/ampdu.c       |  196 ++++--
 drivers/staging/brcm80211/brcmsmac/antsel.c      |   15 +-
 drivers/staging/brcm80211/brcmsmac/channel.c     |  151 +++--
 drivers/staging/brcm80211/brcmsmac/channel.h     |   15 +-
 drivers/staging/brcm80211/brcmsmac/d11.h         |  617 ++++++++++++--------
 drivers/staging/brcm80211/brcmsmac/dma.c         |  247 +++++---
 drivers/staging/brcm80211/brcmsmac/dma.h         |   15 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |   26 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h |    9 +-
 drivers/staging/brcm80211/brcmsmac/main.c        |  701 ++++++++++++++--------
 drivers/staging/brcm80211/brcmsmac/main.h        |  696 +++++++++++++--------
 drivers/staging/brcm80211/brcmsmac/otp.c         |   32 +-
 drivers/staging/brcm80211/brcmsmac/otp.h         |    3 +-
 drivers/staging/brcm80211/brcmsmac/phy_shim.c    |    9 +-
 drivers/staging/brcm80211/brcmsmac/phy_shim.h    |   60 ++-
 drivers/staging/brcm80211/brcmsmac/pmu.c         |   10 +-
 drivers/staging/brcm80211/brcmsmac/pub.h         |  186 ++++---
 drivers/staging/brcm80211/brcmsmac/rate.c        |  104 ++--
 drivers/staging/brcm80211/brcmsmac/rate.h        |  141 +++--
 drivers/staging/brcm80211/brcmsmac/scb.h         |   35 +-
 drivers/staging/brcm80211/brcmsmac/srom.c        |   70 ++-
 drivers/staging/brcm80211/brcmsmac/stf.c         |   54 ++-
 drivers/staging/brcm80211/brcmsmac/types.h       |  182 ++++--
 25 files changed, 2394 insertions(+), 1392 deletions(-)
drivers/staging/brcm80211/brcmsmac/aiutils.c +123 -68
index bc4e2e1..4b1c60f 100644
@@ -28,48 +28,68 @@
 #include "aiutils.h"
 
 /* slow_clk_ctl */
-#define SCC_SS_MASK		0x00000007	/* slow clock source mask */
-#define	SCC_SS_LPO		0x00000000	/* source of slow clock is LPO */
-#define	SCC_SS_XTAL		0x00000001	/* source of slow clock is crystal */
-#define	SCC_SS_PCI		0x00000002	/* source of slow clock is PCI */
-#define SCC_LF			0x00000200	/* LPOFreqSel, 1: 160Khz, 0: 32KHz */
-#define SCC_LP			0x00000400	/* LPOPowerDown, 1: LPO is disabled,
-						 * 0: LPO is enabled
-						 */
-#define SCC_FS			0x00000800	/* ForceSlowClk, 1: sb/cores running on slow clock,
-						 * 0: power logic control
-						 */
-#define SCC_IP			0x00001000	/* IgnorePllOffReq, 1/0: power logic ignores/honors
-						 * PLL clock disable requests from core
-						 */
-#define SCC_XC			0x00002000	/* XtalControlEn, 1/0: power logic does/doesn't
-						 * disable crystal when appropriate
-						 */
-#define SCC_XP			0x00004000	/* XtalPU (RO), 1/0: crystal running/disabled */
-#define SCC_CD_MASK		0xffff0000	/* ClockDivider (SlowClk = 1/(4+divisor)) */
+ /* slow clock source mask */
+#define SCC_SS_MASK		0x00000007
+ /* source of slow clock is LPO */
+#define	SCC_SS_LPO		0x00000000
+ /* source of slow clock is crystal */
+#define	SCC_SS_XTAL		0x00000001
+ /* source of slow clock is PCI */
+#define	SCC_SS_PCI		0x00000002
+ /* LPOFreqSel, 1: 160Khz, 0: 32KHz */
+#define SCC_LF			0x00000200
+ /* LPOPowerDown, 1: LPO is disabled, 0: LPO is enabled */
+#define SCC_LP			0x00000400
+ /* ForceSlowClk, 1: sb/cores running on slow clock, 0: power logic control */
+#define SCC_FS			0x00000800
+ /* IgnorePllOffReq, 1/0:
+  *  power logic ignores/honors PLL clock disable requests from core
+  */
+#define SCC_IP			0x00001000
+ /* XtalControlEn, 1/0:
+  *  power logic does/doesn't disable crystal when appropriate
+  */
+#define SCC_XC			0x00002000
+ /* XtalPU (RO), 1/0: crystal running/disabled */
+#define SCC_XP			0x00004000
+ /* ClockDivider (SlowClk = 1/(4+divisor)) */
+#define SCC_CD_MASK		0xffff0000
 #define SCC_CD_SHIFT		16
 
 /* system_clk_ctl */
-#define	SYCC_IE			0x00000001	/* ILPen: Enable Idle Low Power */
-#define	SYCC_AE			0x00000002	/* ALPen: Enable Active Low Power */
-#define	SYCC_FP			0x00000004	/* ForcePLLOn */
-#define	SYCC_AR			0x00000008	/* Force ALP (or HT if ALPen is not set */
-#define	SYCC_HR			0x00000010	/* Force HT */
-#define SYCC_CD_MASK		0xffff0000	/* ClkDiv  (ILP = 1/(4 * (divisor + 1)) */
+ /* ILPen: Enable Idle Low Power */
+#define	SYCC_IE			0x00000001
+ /* ALPen: Enable Active Low Power */
+#define	SYCC_AE			0x00000002
+ /* ForcePLLOn */
+#define	SYCC_FP			0x00000004
+ /* Force ALP (or HT if ALPen is not set */
+#define	SYCC_AR			0x00000008
+ /* Force HT */
+#define	SYCC_HR			0x00000010
+ /* ClkDiv  (ILP = 1/(4 * (divisor + 1)) */
+#define SYCC_CD_MASK		0xffff0000
 #define SYCC_CD_SHIFT		16
 
 #define CST4329_SPROM_OTP_SEL_MASK	0x00000003
-#define CST4329_DEFCIS_SEL		0	/* OTP is powered up, use def. CIS, no SPROM */
-#define CST4329_SPROM_SEL		1	/* OTP is powered up, SPROM is present */
-#define CST4329_OTP_SEL			2	/* OTP is powered up, no SPROM */
-#define CST4329_OTP_PWRDN		3	/* OTP is powered down, SPROM is present */
+ /* OTP is powered up, use def. CIS, no SPROM */
+#define CST4329_DEFCIS_SEL		0
+ /* OTP is powered up, SPROM is present */
+#define CST4329_SPROM_SEL		1
+ /* OTP is powered up, no SPROM */
+#define CST4329_OTP_SEL			2
+ /* OTP is powered down, SPROM is present */
+#define CST4329_OTP_PWRDN		3
+
 #define CST4329_SPI_SDIO_MODE_MASK	0x00000004
 #define CST4329_SPI_SDIO_MODE_SHIFT	2
 
 /* 43224 chip-specific ChipControl register bits */
 #define CCTRL43224_GPIO_TOGGLE          0x8000
-#define CCTRL_43224A0_12MA_LED_DRIVE    0x00F000F0	/* 12 mA drive strength */
-#define CCTRL_43224B0_12MA_LED_DRIVE    0xF0	/* 12 mA drive strength for later 43224s */
+ /* 12 mA drive strength */
+#define CCTRL_43224A0_12MA_LED_DRIVE    0x00F000F0
+ /* 12 mA drive strength for later 43224s */
+#define CCTRL_43224B0_12MA_LED_DRIVE    0xF0
 
 /* 43236 Chip specific ChipStatus register bits */
 #define CST43236_SFLASH_MASK		0x00000040
@@ -78,29 +98,44 @@
 #define CST43236_BP_CLK			0x00000200	/* 120/96Mbps */
 #define CST43236_BOOT_MASK		0x00001800
 #define CST43236_BOOT_SHIFT		11
-#define CST43236_BOOT_FROM_SRAM		0	/* boot from SRAM, ARM in reset */
-#define CST43236_BOOT_FROM_ROM		1	/* boot from ROM */
-#define CST43236_BOOT_FROM_FLASH	2	/* boot from FLASH */
+#define CST43236_BOOT_FROM_SRAM		0 /* boot from SRAM, ARM in reset */
+#define CST43236_BOOT_FROM_ROM		1 /* boot from ROM */
+#define CST43236_BOOT_FROM_FLASH	2 /* boot from FLASH */
 #define CST43236_BOOT_FROM_INVALID	3
 
 /* 4331 chip-specific ChipControl register bits */
-#define CCTRL4331_BT_COEXIST		(1<<0)	/* 0 disable */
-#define CCTRL4331_SECI			(1<<1)	/* 0 SECI is disabled (JATG functional) */
-#define CCTRL4331_EXT_LNA		(1<<2)	/* 0 disable */
-#define CCTRL4331_SPROM_GPIO13_15       (1<<3)	/* sprom/gpio13-15 mux */
-#define CCTRL4331_EXTPA_EN		(1<<4)	/* 0 ext pa disable, 1 ext pa enabled */
-#define CCTRL4331_GPIOCLK_ON_SPROMCS	(1<<5)	/* set drive out GPIO_CLK on sprom_cs pin */
-#define CCTRL4331_PCIE_MDIO_ON_SPROMCS	(1<<6)	/* use sprom_cs pin as PCIE mdio interface */
-#define CCTRL4331_EXTPA_ON_GPIO2_5	(1<<7)	/* aband extpa will be at gpio2/5 and sprom_dout */
-#define CCTRL4331_OVR_PIPEAUXCLKEN	(1<<8)	/* override core control on pipe_AuxClkEnable */
-#define CCTRL4331_OVR_PIPEAUXPWRDOWN	(1<<9)	/* override core control on pipe_AuxPowerDown */
-#define CCTRL4331_PCIE_AUXCLKEN		(1<<10)	/* pcie_auxclkenable */
-#define CCTRL4331_PCIE_PIPE_PLLDOWN	(1<<11)	/* pcie_pipe_pllpowerdown */
-#define CCTRL4331_BT_SHD0_ON_GPIO4	(1<<16)	/* enable bt_shd0 at gpio4 */
-#define CCTRL4331_BT_SHD1_ON_GPIO5	(1<<17)	/* enable bt_shd1 at gpio5 */
+ /* 0 disable */
+#define CCTRL4331_BT_COEXIST		(1<<0)
+ /* 0 SECI is disabled (JTAG functional) */
+#define CCTRL4331_SECI			(1<<1)
+ /* 0 disable */
+#define CCTRL4331_EXT_LNA		(1<<2)
+ /* sprom/gpio13-15 mux */
+#define CCTRL4331_SPROM_GPIO13_15       (1<<3)
+ /* 0 ext pa disable, 1 ext pa enabled */
+#define CCTRL4331_EXTPA_EN		(1<<4)
+ /* set drive out GPIO_CLK on sprom_cs pin */
+#define CCTRL4331_GPIOCLK_ON_SPROMCS	(1<<5)
+ /* use sprom_cs pin as PCIE mdio interface */
+#define CCTRL4331_PCIE_MDIO_ON_SPROMCS	(1<<6)
+ /* aband extpa will be at gpio2/5 and sprom_dout */
+#define CCTRL4331_EXTPA_ON_GPIO2_5	(1<<7)
+ /* override core control on pipe_AuxClkEnable */
+#define CCTRL4331_OVR_PIPEAUXCLKEN	(1<<8)
+ /* override core control on pipe_AuxPowerDown */
+#define CCTRL4331_OVR_PIPEAUXPWRDOWN	(1<<9)
+ /* pcie_auxclkenable */
+#define CCTRL4331_PCIE_AUXCLKEN		(1<<10)
+ /* pcie_pipe_pllpowerdown */
+#define CCTRL4331_PCIE_PIPE_PLLDOWN	(1<<11)
+ /* enable bt_shd0 at gpio4 */
+#define CCTRL4331_BT_SHD0_ON_GPIO4	(1<<16)
+ /* enable bt_shd1 at gpio5 */
+#define CCTRL4331_BT_SHD1_ON_GPIO5	(1<<17)
 
 /* 4331 Chip specific ChipStatus register bits */
-#define	CST4331_XTAL_FREQ		0x00000001	/* crystal frequency 20/40Mhz */
+ /* crystal frequency 20/40Mhz */
+#define	CST4331_XTAL_FREQ		0x00000001
 #define	CST4331_SPROM_PRESENT		0x00000002
 #define	CST4331_OTP_PRESENT		0x00000004
 #define	CST4331_LDO_RF			0x00000008
@@ -110,19 +145,26 @@
 #define	CST4319_SPI_CPULESSUSB		0x00000001
 #define	CST4319_SPI_CLK_POL		0x00000002
 #define	CST4319_SPI_CLK_PH		0x00000008
-#define	CST4319_SPROM_OTP_SEL_MASK	0x000000c0	/* gpio [7:6], SDIO CIS selection */
+ /* gpio [7:6], SDIO CIS selection */
+#define	CST4319_SPROM_OTP_SEL_MASK	0x000000c0
 #define	CST4319_SPROM_OTP_SEL_SHIFT	6
-#define	CST4319_DEFCIS_SEL		0x00000000	/* use default CIS, OTP is powered up */
-#define	CST4319_SPROM_SEL		0x00000040	/* use SPROM, OTP is powered up */
-#define	CST4319_OTP_SEL			0x00000080	/* use OTP, OTP is powered up */
-#define	CST4319_OTP_PWRDN		0x000000c0	/* use SPROM, OTP is powered down */
-#define	CST4319_SDIO_USB_MODE		0x00000100	/* gpio [8], sdio/usb mode */
+ /* use default CIS, OTP is powered up */
+#define	CST4319_DEFCIS_SEL		0x00000000
+ /* use SPROM, OTP is powered up */
+#define	CST4319_SPROM_SEL		0x00000040
+ /* use OTP, OTP is powered up */
+#define	CST4319_OTP_SEL			0x00000080
+ /* use SPROM, OTP is powered down */
+#define	CST4319_OTP_PWRDN		0x000000c0
+ /* gpio [8], sdio/usb mode */
+#define	CST4319_SDIO_USB_MODE		0x00000100
 #define	CST4319_REMAP_SEL_MASK		0x00000600
 #define	CST4319_ILPDIV_EN		0x00000800
 #define	CST4319_XTAL_PD_POL		0x00001000
 #define	CST4319_LPO_SEL			0x00002000
 #define	CST4319_RES_INIT_MODE		0x0000c000
-#define	CST4319_PALDO_EXTPNP		0x00010000	/* PALDO is configured with external PNP */
+ /* PALDO is configured with external PNP */
+#define	CST4319_PALDO_EXTPNP		0x00010000
 #define	CST4319_CBUCK_MODE_MASK		0x00060000
 #define CST4319_CBUCK_MODE_BURST	0x00020000
 #define CST4319_CBUCK_MODE_LPBURST	0x00060000
@@ -153,7 +195,8 @@
 #define	CST4313_SPROM_OTP_SEL_SHIFT		0
 
 /* 4313 Chip specific ChipControl register bits */
-#define CCTRL_4313_12MA_LED_DRIVE    0x00000007	/* 12 mA drive strengh for later 4313 */
+ /* 12 mA drive strengh for later 4313 */
+#define CCTRL_4313_12MA_LED_DRIVE    0x00000007
 
 #define BCM47162_DMP() ((sih->chip == BCM47162_CHIP_ID) && \
 		(sih->chiprev == 0) && \
@@ -227,9 +270,12 @@
 #define	SD_SG32			0x00000008
 #define	SD_SZ_ALIGN		0x00000fff
 
-#define	PCI_CFG_GPIO_SCS	0x10	/* PCI config space bit 4 for 4306c0 slow clock source */
-#define PCI_CFG_GPIO_XTAL	0x40	/* PCI config space GPIO 14 for Xtal power-up */
-#define PCI_CFG_GPIO_PLL	0x80	/* PCI config space GPIO 15 for PLL power-down */
+/* PCI config space bit 4 for 4306c0 slow clock source */
+#define	PCI_CFG_GPIO_SCS	0x10
+/* PCI config space GPIO 14 for Xtal power-up */
+#define PCI_CFG_GPIO_XTAL	0x40
+/* PCI config space GPIO 15 for PLL power-down */
+#define PCI_CFG_GPIO_PLL	0x80
 
 /* power control defines */
 #define PLL_DELAY		150	/* us pll on delay */
@@ -468,7 +514,8 @@ void ai_scan(struct si_pub *sih, void *regs)
 	}
 	eromlim = eromptr + (ER_REMAPCONTROL / sizeof(u32));
 
-	SI_VMSG(("ai_scan: regs = 0x%p, erombase = 0x%08x, eromptr = 0x%p, eromlim = 0x%p\n", regs, erombase, eromptr, eromlim));
+	SI_VMSG(("ai_scan: regs = 0x%p, erombase = 0x%08x, eromptr = 0x%p, "
+		 "eromlim = 0x%p\n", regs, erombase, eromptr, eromlim));
 	while (eromptr < eromlim) {
 		u32 cia, cib, cid, mfg, crev, nmw, nsw, nmp, nsp;
 		u32 mpd, asd, addrl, addrh, sizel, sizeh;
@@ -502,7 +549,9 @@ void ai_scan(struct si_pub *sih, void *regs)
 		nmp = (cib & CIB_NMP_MASK) >> CIB_NMP_SHIFT;
 		nsp = (cib & CIB_NSP_MASK) >> CIB_NSP_SHIFT;
 
-		SI_VMSG(("Found component 0x%04x/0x%04x rev %d at erom addr 0x%p, with nmw = %d, " "nsw = %d, nmp = %d & nsp = %d\n", mfg, cid, crev, base, nmw, nsw, nmp, nsp));
+		SI_VMSG(("Found component 0x%04x/0x%04x rev %d at erom addr "
+			 "0x%p, with nmw = %d, nsw = %d, nmp = %d & nsp = %d\n",
+			 mfg, cid, crev, base, nmw, nsw, nmp, nsp));
 
 		if (((mfg == MFGID_ARM) && (cid == DEF_AI_COMP)) || (nsp == 0))
 			continue;
@@ -526,7 +575,8 @@ void ai_scan(struct si_pub *sih, void *regs)
 		for (i = 0; i < nmp; i++) {
 			mpd = get_erom_ent(sih, &eromptr, ER_VALID, ER_VALID);
 			if ((mpd & ER_TAG) != ER_MP) {
-				SI_ERROR(("Not enough MP entries for component 0x%x\n", cid));
+				SI_ERROR(("Not enough MP entries for "
+					  "component 0x%x\n", cid));
 				goto error;
 			}
 			SI_VMSG(("  Master port %d, mp: %d id: %d\n", i,
@@ -549,7 +599,8 @@ void ai_scan(struct si_pub *sih, void *regs)
 				br = true;
 			else if ((addrh != 0) || (sizeh != 0)
 				 || (sizel != SI_CORE_SIZE)) {
-				SI_ERROR(("First Slave ASD for core 0x%04x malformed " "(0x%08x)\n", cid, asd));
+				SI_ERROR(("First Slave ASD for core 0x%04x "
+					  "malformed (0x%08x)\n", cid, asd));
 				goto error;
 			}
 		}
@@ -704,7 +755,8 @@ u32 ai_addrspace(struct si_pub *sih, uint asidx)
 	else if (asidx == 1)
 		return sii->coresba2[cidx];
 	else {
-		SI_ERROR(("%s: Need to parse the erom again to find addr space %d\n", __func__, asidx));
+		SI_ERROR(("%s: Need to parse the erom again to find addr "
+			  "space %d\n", __func__, asidx));
 		return 0;
 	}
 }
@@ -723,7 +775,8 @@ u32 ai_addrspacesize(struct si_pub *sih, uint asidx)
 	else if (asidx == 1)
 		return sii->coresba2_size[cidx];
 	else {
-		SI_ERROR(("%s: Need to parse the erom again to find addr space %d\n", __func__, asidx));
+		SI_ERROR(("%s: Need to parse the erom again to find addr "
+			  "space %d\n", __func__, asidx));
 		return 0;
 	}
 }
@@ -735,7 +788,8 @@ uint ai_flag(struct si_pub *sih)
 
 	sii = SI_INFO(sih);
 	if (BCM47162_DMP()) {
-		SI_ERROR(("%s: Attempting to read MIPS DMP registers on 47162a0", __func__));
+		SI_ERROR(("%s: Attempting to read MIPS DMP registers "
+			  "on 47162a0", __func__));
 		return sii->curidx;
 	}
 	ai = sii->curwrap;
@@ -833,7 +887,8 @@ u32 ai_core_sflags(struct si_pub *sih, u32 mask, u32 val)
 
 	sii = SI_INFO(sih);
 	if (BCM47162_DMP()) {
-		SI_ERROR(("%s: Accessing MIPS DMP register (iostatus) on 47162a0", __func__));
+		SI_ERROR(("%s: Accessing MIPS DMP register (iostatus) "
+			  "on 47162a0", __func__));
 		return 0;
 	}
 
drivers/staging/brcm80211/brcmsmac/aiutils.h +14 -7
index f881b44..4c682a5 100644
@@ -242,16 +242,23 @@
 #define	SRC_PRESENT		0x00000001
 
 /* 4330 chip-specific ChipStatus register bits */
-#define CST4330_CHIPMODE_SDIOD(cs)	(((cs) & 0x7) < 6)	/* SDIO || gSPI */
-#define CST4330_CHIPMODE_USB20D(cs)	(((cs) & 0x7) >= 6)	/* USB || USBDA */
-#define CST4330_CHIPMODE_SDIO(cs)	(((cs) & 0x4) == 0)	/* SDIO */
-#define CST4330_CHIPMODE_GSPI(cs)	(((cs) & 0x6) == 4)	/* gSPI */
-#define CST4330_CHIPMODE_USB(cs)	(((cs) & 0x7) == 6)	/* USB packet-oriented */
-#define CST4330_CHIPMODE_USBDA(cs)	(((cs) & 0x7) == 7)	/* USB Direct Access */
+ /* SDIO || gSPI */
+#define CST4330_CHIPMODE_SDIOD(cs)	(((cs) & 0x7) < 6)
+ /* USB || USBDA */
+#define CST4330_CHIPMODE_USB20D(cs)	(((cs) & 0x7) >= 6)
+ /* SDIO */
+#define CST4330_CHIPMODE_SDIO(cs)	(((cs) & 0x4) == 0)
+ /* gSPI */
+#define CST4330_CHIPMODE_GSPI(cs)	(((cs) & 0x6) == 4)
+ /* USB packet-oriented */
+#define CST4330_CHIPMODE_USB(cs)	(((cs) & 0x7) == 6)
+ /* USB Direct Access */
+#define CST4330_CHIPMODE_USBDA(cs)	(((cs) & 0x7) == 7)
 #define	CST4330_OTP_PRESENT		0x00000010
 #define	CST4330_LPO_AUTODET_EN		0x00000020
 #define	CST4330_ARMREMAP_0		0x00000040
-#define	CST4330_SPROM_PRESENT		0x00000080	/* takes priority over OTP if both set */
+ /* takes priority over OTP if both set */
+#define	CST4330_SPROM_PRESENT		0x00000080
 #define	CST4330_ILPDIV_EN		0x00000100
 #define	CST4330_LPO_SEL			0x00000200
 #define	CST4330_RES_INIT_MODE_SHIFT	10
drivers/staging/brcm80211/brcmsmac/ampdu.c +131 -65

293 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/antsel.c +12 -3
index 5a5d5d6..23e0453 100644
@@ -259,7 +259,10 @@ static u8 brcms_c_antsel_id2antcfg(struct antsel_info *asi, u8 id)
 	return antcfg;
 }
 
-/* boardlevel antenna selection: convert ant_cfg to mimo_antsel (ucode interface) */
+/*
+ * boardlevel antenna selection:
+ *   convert ant_cfg to mimo_antsel (ucode interface)
+ */
 static u16 brcms_c_antsel_antcfg2antsel(struct antsel_info *asi, u8 ant_cfg)
 {
 	u8 idx = BRCMS_ANTIDX_11N(BRCMS_ANTSEL_11N(ant_cfg));
@@ -293,7 +296,10 @@ static int brcms_c_antsel_cfgupd(struct antsel_info *asi,
 	ant_cfg = antsel->ant_config[ANT_SELCFG_TX_DEF];
 	mimo_antsel = brcms_c_antsel_antcfg2antsel(asi, ant_cfg);
 	brcms_c_write_shm(wlc, M_MIMO_ANTSEL_TXDFLT, mimo_antsel);
-	/* Update driver stats for currently selected default tx/rx antenna config */
+	/*
+	 * Update driver stats for currently selected
+	 * default tx/rx antenna config
+	 */
 	asi->antcfg_cur.ant_config[ANT_SELCFG_TX_DEF] = ant_cfg;
 
 	/* 2) Update RX antconfig for all frames that are not unicast data
@@ -302,7 +308,10 @@ static int brcms_c_antsel_cfgupd(struct antsel_info *asi,
 	ant_cfg = antsel->ant_config[ANT_SELCFG_RX_DEF];
 	mimo_antsel = brcms_c_antsel_antcfg2antsel(asi, ant_cfg);
 	brcms_c_write_shm(wlc, M_MIMO_ANTSEL_RXDFLT, mimo_antsel);
-	/* Update driver stats for currently selected default tx/rx antenna config */
+	/*
+	 * Update driver stats for currently selected
+	 * default tx/rx antenna config
+	 */
 	asi->antcfg_cur.ant_config[ANT_SELCFG_RX_DEF] = ant_cfg;
 
 	return 0;
drivers/staging/brcm80211/brcmsmac/channel.c +96 -55

289 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/channel.h +8 -7
index c9452be..3e85844 100644
@@ -40,12 +40,14 @@
  */
 
 /* macro to get 2.4 GHz channel group index for tx power */
-#define CHANNEL_POWER_IDX_2G_CCK(c) (((c) < 2) ? 0 : (((c) < 11) ? 1 : 2))	/* cck index */
-#define CHANNEL_POWER_IDX_2G_OFDM(c) (((c) < 2) ? 3 : (((c) < 11) ? 4 : 5))	/* ofdm index */
+#define CHANNEL_POWER_IDX_2G_CCK(c) (((c) < 2) ? 0 : (((c) < 11) ? 1 : 2))
+#define CHANNEL_POWER_IDX_2G_OFDM(c) (((c) < 2) ? 3 : (((c) < 11) ? 4 : 5))
 
 /* macro to get 5 GHz channel group index for tx power */
-#define CHANNEL_POWER_IDX_5G(c) \
-	(((c) < 52) ? 0 : (((c) < 62) ? 1 : (((c) < 100) ? 2 : (((c) < 149) ? 3 : 4))))
+#define CHANNEL_POWER_IDX_5G(c) (((c) < 52) ? 0 : \
+				 (((c) < 62) ? 1 : \
+				 (((c) < 100) ? 2 : \
+				 (((c) < 149) ? 3 : 4))))
 
 /* max of BAND_5G_PWR_LVLS and 6 for 2.4 GHz */
 #define BRCMS_MAXPWR_TBL_SIZE		6
@@ -67,9 +69,8 @@ struct locale_info {
 	u8 restricted_channels;
 	/* Max tx pwr in qdBm for each sub-band */
 	s8 maxpwr[BRCMS_MAXPWR_TBL_SIZE];
-	s8 pub_maxpwr[BAND_5G_PWR_LVLS];	/* Country IE advertised max tx pwr in dBm
-						 * per sub-band
-						 */
+	/* Country IE advertised max tx pwr in dBm per sub-band */
+	s8 pub_maxpwr[BAND_5G_PWR_LVLS];
 	u8 flags;
 };
 
drivers/staging/brcm80211/brcmsmac/d11.h +377 -240

855 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/dma.c +154 -93

465 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/dma.h +8 -7
index 334f2eb..4a33028 100644
@@ -39,12 +39,12 @@ struct dma32diag {	/* diag access */
 
 /* dma registers per channel(xmt or rcv) */
 struct dma64regs {
-	u32 control;		/* enable, et al */
-	u32 ptr;		/* last descriptor posted to chip */
-	u32 addrlow;		/* descriptor ring base address low 32-bits (8K aligned) */
-	u32 addrhigh;	/* descriptor ring base address bits 63:32 (8K aligned) */
-	u32 status0;		/* current descriptor, xmt state */
-	u32 status1;		/* active descriptor, xmt error */
+	u32 control;	/* enable, et al */
+	u32 ptr;	/* last descriptor posted to chip */
+	u32 addrlow;	/* desc ring base address low 32-bits (8K aligned) */
+	u32 addrhigh;	/* desc ring base address bits 63:32 (8K aligned) */
+	u32 status0;	/* current descriptor, xmt state */
+	u32 status1;	/* active descriptor, xmt error */
 };
 
 /* map/unmap direction */
@@ -172,7 +172,8 @@ extern const struct di_fcn_s dma64proc;
 #define dma_rxactive(di)                (dma64proc.rxactive(di))
 #define dma_txrotate(di)                (dma64proc.txrotate(di))
 #define dma_counterreset(di)            (dma64proc.counterreset(di))
-#define dma_ctrlflags(di, mask, flags)  (dma64proc.ctrlflags((di), (mask), (flags)))
+#define dma_ctrlflags(di, mask, flags) \
+	(dma64proc.ctrlflags((di), (mask), (flags)))
 #define dma_txpending(di)		(dma64proc.txpending(di))
 #define dma_txcommitted(di)		(dma64proc.txcommitted(di))
 
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +18 -8
index a9ad95a..6439fd9 100644
@@ -605,7 +605,10 @@ brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	    IEEE80211_HT_CAP_SGI_20 |
 	    IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_40MHZ_INTOLERANT;
 
-	/* minstrel_ht initiates addBA on our behalf by calling ieee80211_start_tx_ba_session() */
+	/*
+	 * minstrel_ht initiates addBA on our behalf by calling
+	 * ieee80211_start_tx_ba_session()
+	 */
 	return 0;
 }
 
@@ -643,7 +646,10 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw,
 				  tid);
 			return -EINVAL;
 		}
-		/* Future improvement: Use the starting sequence number provided ... */
+		/*
+		 * Future improvement:
+		 *   Use the starting sequence number provided ...
+		 */
 		*ssn = 0;
 		ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
 		break;
@@ -1018,8 +1024,9 @@ static struct ieee80211_supported_band brcms_band_5GHz_nphy = {
 	.bitrates = legacy_ratetable + 4,
 	.n_bitrates = ARRAY_SIZE(legacy_ratetable) - 4,
 	.ht_cap = {
-		   /* use IEEE80211_HT_CAP_* from include/linux/ieee80211.h */
-		   .cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_40MHZ_INTOLERANT,	/* No 40 mhz yet */
+		   .cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 |
+			  IEEE80211_HT_CAP_SGI_40 |
+			  IEEE80211_HT_CAP_40MHZ_INTOLERANT, /* No 40 mhz yet */
 		   .ht_supported = true,
 		   .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K,
 		   .ampdu_density = AMPDU_DEF_MPDU_DENSITY,
@@ -1085,7 +1092,8 @@ static int ieee_hw_init(struct ieee80211_hw *hw)
 	hw->queues = N_TX_QUEUES;
 	hw->max_rates = 2;	/* Primary rate and 1 fallback rate */
 
-	hw->channel_change_time = 7 * 1000;	/* channel change time is dependent on chip and band  */
+	/* channel change time is dependent on chip and band  */
+	hw->channel_change_time = 7 * 1000;
 	hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
 
 	hw->rate_control_algorithm = "minstrel_ht";
@@ -1360,8 +1368,9 @@ static void brcms_free(struct brcms_info *wl)
 	}
 
 	/*
-	 * unregister_netdev() calls get_stats() which may read chip registers
-	 * so we cannot unmap the chip registers until after calling unregister_netdev() .
+	 * unregister_netdev() calls get_stats() which may read chip
+	 * registers so we cannot unmap the chip registers until
+	 * after calling unregister_netdev() .
 	 */
 	if (wl->regsva && wl->bcm_bustype != SDIO_BUS &&
 	    wl->bcm_bustype != JTAG_BUS)
@@ -1631,7 +1640,8 @@ struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
 	return t;
 }
 
-/* BMAC_NOTE: Add timer adds only the kernel timer since it's going to be more accurate
+/*
+ * adds only the kernel timer since it's going to be more accurate
  * as well as it's easier to make it periodic
  *
  * precondition: perimeter lock has been acquired
drivers/staging/brcm80211/brcmsmac/mac80211_if.h +2 -7
index 40e3d37..0d91366 100644
@@ -23,11 +23,6 @@
 /* softmac ioctl definitions */
 #define BRCMS_SET_SHORTSLOT_OVERRIDE		146
 
-
-/* BMAC Note: High-only driver is no longer working in softirq context as it needs to block and
- * sleep so perimeter lock has to be a semaphore instead of spinlock. This requires timers to be
- * submitted to workqueue instead of being on kernel timer
- */
 struct brcms_timer {
 	struct timer_list timer;
 	struct brcms_info *wl;
@@ -56,8 +51,8 @@ struct brcms_firmware {
 };
 
 struct brcms_info {
-	struct brcms_pub *pub;		/* pointer to public wlc state */
-	void *wlc;		/* pointer to private common os-independent data */
+	struct brcms_pub *pub;	/* pointer to public wlc state */
+	void *wlc;		/* pointer to private common data */
 	u32 magic;
 
 	int irq;
drivers/staging/brcm80211/brcmsmac/main.c +464 -237

605 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/main.h +429 -267

696 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/otp.c +22 -10
index 03f9856..975d80c 100644

Lines of this file are not shown. View the raw message.

drivers/staging/brcm80211/brcmsmac/otp.h +2 -1
index f6d3a56..4d79246 100644

Lines of this file are not shown. View the raw message.

drivers/staging/brcm80211/brcmsmac/phy_shim.c +5 -4
index 56824f4..a882139 100644

Lines of this file are not shown. View the raw message.

drivers/staging/brcm80211/brcmsmac/phy_shim.h +37 -23

60 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/pmu.c +6 -4
index ec53a08..f5e1085 100644

Lines of this file are not shown. View the raw message.

drivers/staging/brcm80211/brcmsmac/pub.h +109 -77

186 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/rate.c +58 -46

104 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/rate.h +98 -43

141 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/scb.h +19 -16
index d6c8328..22ef8e8 100644

Lines of this file are not shown. View the raw message.

drivers/staging/brcm80211/brcmsmac/srom.c +41 -29

70 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/stf.c +36 -18

54 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/types.h +125 -57

182 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.

#24 lore raw

PATCH 22/29 staging: brcm80211: removed unused bus code from softmac

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

Code cleanup. For the softmac, the 'bustype' in use is always PCI_BUS. Hence code related to dealing with different bus types (eg: PCI_BUS, JTAG_BUS, SI_BUS) could be removed.

---
 drivers/staging/brcm80211/brcmsmac/aiutils.c     |  480 +++++++---------------
 drivers/staging/brcm80211/brcmsmac/aiutils.h     |   12 +-
 drivers/staging/brcm80211/brcmsmac/dma.c         |   13 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |   17 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h |    3 +-
 drivers/staging/brcm80211/brcmsmac/main.c        |  111 ++---
 drivers/staging/brcm80211/brcmsmac/nicpci.c      |    4 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |   17 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h |    1 -
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h |    3 +-
 drivers/staging/brcm80211/brcmsmac/pub.h         |    2 +-
 drivers/staging/brcm80211/brcmsmac/srom.c        |    5 +-
 drivers/staging/brcm80211/brcmsmac/srom.h        |    4 +-
 drivers/staging/brcm80211/brcmsmac/types.h       |    5 +-
 14 files changed, 227 insertions(+), 450 deletions(-)
drivers/staging/brcm80211/brcmsmac/aiutils.c +152 -328
index 4b1c60f..37edd1c 100644
@@ -12,7 +12,10 @@
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * File contents: support functions for PCI/PCIe
  */
+
 #include <linux/delay.h>
 #include <linux/pci.h>
 
@@ -488,30 +491,12 @@ void ai_scan(struct si_pub *sih, void *regs)
 
 	erombase = R_REG(&cc->eromptr);
 
-	switch (sih->bustype) {
-	case SI_BUS:
-		eromptr = (u32 *) REG_MAP(erombase, SI_CORE_SIZE);
-		break;
-
-	case PCI_BUS:
-		/* Set wrappers address */
-		sii->curwrap = (void *)((unsigned long)regs + SI_CORE_SIZE);
-
-		/* Now point the window at the erom */
-		pci_write_config_dword(sii->pbus, PCI_BAR0_WIN, erombase);
-		eromptr = regs;
-		break;
-
-	case SPI_BUS:
-	case SDIO_BUS:
-		eromptr = (u32 *)(unsigned long)erombase;
-		break;
+	/* Set wrappers address */
+	sii->curwrap = (void *)((unsigned long)regs + SI_CORE_SIZE);
 
-	default:
-		SI_ERROR(("Don't know how to do AXI enumertion on bus %d\n",
-			  sih->bustype));
-		return;
-	}
+	/* Now point the window at the erom */
+	pci_write_config_dword(sii->pbus, PCI_BAR0_WIN, erombase);
+	eromptr = regs;
 	eromlim = eromptr + (ER_REMAPCONTROL / sizeof(u32));
 
 	SI_VMSG(("ai_scan: regs = 0x%p, erombase = 0x%08x, eromptr = 0x%p, "
@@ -684,7 +669,8 @@ void ai_scan(struct si_pub *sih, void *regs)
 	return;
 }
 
-/* This function changes the logical "focus" to the indicated core.
+/*
+ * This function changes the logical "focus" to the indicated core.
  * Return the current core's virtual address.
  */
 void *ai_setcoreidx(struct si_pub *sih, uint coreidx)
@@ -692,47 +678,17 @@ void *ai_setcoreidx(struct si_pub *sih, uint coreidx)
 	struct si_info *sii = SI_INFO(sih);
 	u32 addr = sii->coresba[coreidx];
 	u32 wrap = sii->wrapba[coreidx];
-	void *regs;
 
 	if (coreidx >= sii->numcores)
 		return NULL;
 
-	switch (sih->bustype) {
-	case SI_BUS:
-		/* map new one */
-		if (!sii->regs[coreidx])
-			sii->regs[coreidx] = REG_MAP(addr, SI_CORE_SIZE);
-
-		sii->curmap = regs = sii->regs[coreidx];
-		if (!sii->wrappers[coreidx])
-			sii->wrappers[coreidx] = REG_MAP(wrap, SI_CORE_SIZE);
-
-		sii->curwrap = sii->wrappers[coreidx];
-		break;
-
-	case PCI_BUS:
-		/* point bar0 window */
-		pci_write_config_dword(sii->pbus, PCI_BAR0_WIN, addr);
-		regs = sii->curmap;
-		/* point bar0 2nd 4KB window */
-		pci_write_config_dword(sii->pbus, PCI_BAR0_WIN2, wrap);
-		break;
-
-	case SPI_BUS:
-	case SDIO_BUS:
-		sii->curmap = regs = (void *)(unsigned long)addr;
-		sii->curwrap = (void *)(unsigned long)wrap;
-		break;
-
-	default:
-		regs = NULL;
-		break;
-	}
-
-	sii->curmap = regs;
+	/* point bar0 window */
+	pci_write_config_dword(sii->pbus, PCI_BAR0_WIN, addr);
+	/* point bar0 2nd 4KB window */
+	pci_write_config_dword(sii->pbus, PCI_BAR0_WIN2, wrap);
 	sii->curidx = coreidx;
 
-	return regs;
+	return sii->curmap;
 }
 
 /* Return the number of address spaces in current core */
@@ -905,12 +861,10 @@ u32 ai_core_sflags(struct si_pub *sih, u32 mask, u32 val)
 /* *************** from siutils.c ************** */
 /* local prototypes */
 static struct si_info *ai_doattach(struct si_info *sii, void *regs,
-			      uint bustype, void *sdh, char **vars,
-			      uint *varsz);
-static bool ai_buscore_prep(struct si_info *sii, uint bustype);
+				   void *sdh, char **vars, uint *varsz);
+static bool ai_buscore_prep(struct si_info *sii);
 static bool ai_buscore_setup(struct si_info *sii, struct chipcregs *cc,
-			     uint bustype, u32 savewin, uint *origidx,
-			     void *regs);
+			     u32 savewin, uint *origidx, void *regs);
 static void ai_nvram_process(struct si_info *sii, char *pvars);
 
 /* dev path concatenation util */
@@ -919,20 +873,15 @@ static char *ai_devpathvar(struct si_pub *sih, char *var, int len,
 static bool _ai_clkctl_cc(struct si_info *sii, uint mode);
 static bool ai_ispcie(struct si_info *sii);
 
-/* global variable to indicate reservation/release of gpio's */
-static u32 ai_gpioreservation;
-
 /*
  * Allocate a si handle.
  * devid - pci device id (used to determine chip#)
  * osh - opaque OS handle
  * regs - virtual address of initial core registers
- * bustype - pci/sb/sdio/etc
  * vars - pointer to a pointer area for "environment" variables
  * varsz - pointer to int to return the size of the vars
  */
-struct si_pub *ai_attach(void *regs, uint bustype,
-		void *sdh, char **vars, uint *varsz)
+struct si_pub *ai_attach(void *regs, void *sdh, char **vars, uint *varsz)
 {
 	struct si_info *sii;
 
@@ -943,8 +892,7 @@ struct si_pub *ai_attach(void *regs, uint bustype,
 		return NULL;
 	}
 
-	if (ai_doattach(sii, regs, bustype, sdh, vars, varsz) ==
-	    NULL) {
+	if (ai_doattach(sii, regs, sdh, vars, varsz) == NULL) {
 		kfree(sii);
 		return NULL;
 	}
@@ -957,17 +905,17 @@ struct si_pub *ai_attach(void *regs, uint bustype,
 /* global kernel resource */
 static struct si_info ksii;
 
-static bool ai_buscore_prep(struct si_info *sii, uint bustype)
+static bool ai_buscore_prep(struct si_info *sii)
 {
 	/* kludge to enable the clock on the 4306 which lacks a slowclock */
-	if (bustype == PCI_BUS && !ai_ispcie(sii))
+	if (!ai_ispcie(sii))
 		ai_clkctl_xtal(&sii->pub, XTAL | PLL, ON);
 	return true;
 }
 
 static bool
-ai_buscore_setup(struct si_info *sii, struct chipcregs *cc, uint bustype,
-		 u32 savewin, uint *origidx, void *regs)
+ai_buscore_setup(struct si_info *sii, struct chipcregs *cc, u32 savewin,
+		 uint *origidx, void *regs)
 {
 	bool pci, pcie;
 	uint i;
@@ -1015,16 +963,14 @@ ai_buscore_setup(struct si_info *sii, struct chipcregs *cc, uint bustype,
 		SI_VMSG(("CORE[%d]: id 0x%x rev %d base 0x%x regs 0x%p\n",
 			 i, cid, crev, sii->coresba[i], sii->regs[i]));
 
-		if (bustype == PCI_BUS) {
-			if (cid == PCI_CORE_ID) {
-				pciidx = i;
-				pcirev = crev;
-				pci = true;
-			} else if (cid == PCIE_CORE_ID) {
-				pcieidx = i;
-				pcierev = crev;
-				pcie = true;
-			}
+		if (cid == PCI_CORE_ID) {
+			pciidx = i;
+			pcirev = crev;
+			pci = true;
+		} else if (cid == PCIE_CORE_ID) {
+			pcieidx = i;
+			pcierev = crev;
+			pcie = true;
 		}
 
 		/* find the core idx before entering this func. */
@@ -1053,21 +999,19 @@ ai_buscore_setup(struct si_info *sii, struct chipcregs *cc, uint bustype,
 		 sii->pub.buscoretype, sii->pub.buscorerev));
 
 	/* fixup necessary chip/core configurations */
-	if (sii->pub.bustype == PCI_BUS) {
-		if (SI_FAST(sii)) {
-			if (!sii->pch) {
-				sii->pch = (void *)pcicore_init(
-					&sii->pub, sii->pbus,
-					(void *)PCIEREGS(sii));
-				if (sii->pch == NULL)
-					return false;
-			}
-		}
-		if (ai_pci_fixcfg(&sii->pub)) {
-			SI_ERROR(("si_doattach: si_pci_fixcfg failed\n"));
-			return false;
+	if (SI_FAST(sii)) {
+		if (!sii->pch) {
+			sii->pch = (void *)pcicore_init(
+				&sii->pub, sii->pbus,
+				(void *)PCIEREGS(sii));
+			if (sii->pch == NULL)
+				return false;
 		}
 	}
+	if (ai_pci_fixcfg(&sii->pub)) {
+		SI_ERROR(("si_doattach: si_pci_fixcfg failed\n"));
+		return false;
+	}
 
 	/* return to the original core */
 	ai_setcoreidx(&sii->pub, *origidx);
@@ -1075,47 +1019,31 @@ ai_buscore_setup(struct si_info *sii, struct chipcregs *cc, uint bustype,
 	return true;
 }
 
+/*
+ * get boardtype and boardrev
+ */
 static __used void ai_nvram_process(struct si_info *sii, char *pvars)
 {
 	uint w = 0;
 
-	/* get boardtype and boardrev */
-	switch (sii->pub.bustype) {
-	case PCI_BUS:
-		/* do a pci config read to get subsystem id and subvendor id */
-		pci_read_config_dword(sii->pbus, PCI_SUBSYSTEM_VENDOR_ID, &w);
-		/* Let nvram variables override subsystem Vend/ID */
-		sii->pub.boardvendor = (u16)ai_getdevpathintvar(&sii->pub,
-			"boardvendor");
-		if (sii->pub.boardvendor == 0)
-			sii->pub.boardvendor = w & 0xffff;
-		else
-			SI_ERROR(("Overriding boardvendor: 0x%x instead of "
-				  "0x%x\n", sii->pub.boardvendor, w & 0xffff));
-		sii->pub.boardtype = (u16)ai_getdevpathintvar(&sii->pub,
-			"boardtype");
-		if (sii->pub.boardtype == 0)
-			sii->pub.boardtype = (w >> 16) & 0xffff;
-		else
-			SI_ERROR(("Overriding boardtype: 0x%x instead of 0x%x\n"
-				  , sii->pub.boardtype, (w >> 16) & 0xffff));
-		break;
-
-		sii->pub.boardvendor = getintvar(pvars, "manfid");
-		sii->pub.boardtype = getintvar(pvars, "prodid");
-		break;
+	/* do a pci config read to get subsystem id and subvendor id */
+	pci_read_config_dword(sii->pbus, PCI_SUBSYSTEM_VENDOR_ID, &w);
+	/* Let nvram variables override subsystem Vend/ID */
+	sii->pub.boardvendor = (u16)ai_getdevpathintvar(&sii->pub,
+							"boardvendor");
+	if (sii->pub.boardvendor == 0)
+		sii->pub.boardvendor = w & 0xffff;
+	else
+		SI_ERROR(("Overriding boardvendor: 0x%x instead of "
+			  "0x%x\n", sii->pub.boardvendor, w & 0xffff));
 
-	case SI_BUS:
-	case JTAG_BUS:
-		sii->pub.boardvendor = PCI_VENDOR_ID_BROADCOM;
-		sii->pub.boardtype = getintvar(pvars, "prodid");
-		if (pvars == NULL || (sii->pub.boardtype == 0)) {
-			sii->pub.boardtype = getintvar(NULL, "boardtype");
-			if (sii->pub.boardtype == 0)
-				sii->pub.boardtype = 0xffff;
-		}
-		break;
-	}
+	sii->pub.boardtype = (u16)ai_getdevpathintvar(&sii->pub,
+		"boardtype");
+	if (sii->pub.boardtype == 0)
+		sii->pub.boardtype = (w >> 16) & 0xffff;
+	else
+		SI_ERROR(("Overriding boardtype: 0x%x instead of 0x%x\n"
+			  , sii->pub.boardtype, (w >> 16) & 0xffff));
 
 	if (sii->pub.boardtype == 0)
 		SI_ERROR(("si_doattach: unknown board type\n"));
@@ -1124,8 +1052,8 @@ static __used void ai_nvram_process(struct si_info *sii, char *pvars)
 }
 
 static struct si_info *ai_doattach(struct si_info *sii,
-			      void *regs, uint bustype, void *pbus,
-			      char **vars, uint *varsz)
+				   void *regs, void *pbus,
+				   char **vars, uint *varsz)
 {
 	struct si_pub *sih = &sii->pub;
 	u32 w, savewin;
@@ -1143,35 +1071,18 @@ static struct si_info *ai_doattach(struct si_info *sii,
 	sii->curmap = regs;
 	sii->pbus = pbus;
 
-	/* check to see if we are a si core mimic'ing a pci core */
-	if (bustype == PCI_BUS) {
-		pci_read_config_dword(sii->pbus, PCI_SPROM_CONTROL,  &w);
-		if (w == 0xffffffff) {
-			SI_ERROR(("%s: incoming bus is PCI but it's a lie, "
-				" switching to SI devid:0x%x\n",
-				__func__, devid));
-			bustype = SI_BUS;
-		}
-	}
-
 	/* find Chipcommon address */
-	if (bustype == PCI_BUS) {
-		pci_read_config_dword(sii->pbus, PCI_BAR0_WIN, &savewin);
-		if (!GOODCOREADDR(savewin, SI_ENUM_BASE))
-			savewin = SI_ENUM_BASE;
-		pci_write_config_dword(sii->pbus, PCI_BAR0_WIN,
-				       SI_ENUM_BASE);
-		cc = (struct chipcregs *) regs;
-	} else {
-		cc = (struct chipcregs *) REG_MAP(SI_ENUM_BASE, SI_CORE_SIZE);
-	}
+	pci_read_config_dword(sii->pbus, PCI_BAR0_WIN, &savewin);
+	if (!GOODCOREADDR(savewin, SI_ENUM_BASE))
+		savewin = SI_ENUM_BASE;
 
-	sih->bustype = bustype;
+	pci_write_config_dword(sii->pbus, PCI_BAR0_WIN,
+			       SI_ENUM_BASE);
+	cc = (struct chipcregs *) regs;
 
 	/* bus/core/clk setup for register access */
-	if (!ai_buscore_prep(sii, bustype)) {
-		SI_ERROR(("si_doattach: si_core_clk_prep failed %d\n",
-			  bustype));
+	if (!ai_buscore_prep(sii)) {
+		SI_ERROR(("si_doattach: si_core_clk_prep failed\n"));
 		return NULL;
 	}
 
@@ -1207,14 +1118,13 @@ static struct si_info *ai_doattach(struct si_info *sii,
 	}
 	/* bus/core/clk setup */
 	origidx = SI_CC_IDX;
-	if (!ai_buscore_setup(sii, cc, bustype, savewin, &origidx, regs)) {
+	if (!ai_buscore_setup(sii, cc, savewin, &origidx, regs)) {
 		SI_ERROR(("si_doattach: si_buscore_setup failed\n"));
 		goto exit;
 	}
 
 	/* Init nvram from sprom/otp if they exist */
-	if (srom_var_init
-	    (&sii->pub, bustype, regs, vars, varsz)) {
+	if (srom_var_init(&sii->pub, regs, vars, varsz)) {
 		SI_ERROR(("si_doattach: srom_var_init failed: bad srom\n"));
 		goto exit;
 	}
@@ -1283,12 +1193,11 @@ static struct si_info *ai_doattach(struct si_info *sii,
 	}
 
 	return sii;
+
  exit:
-	if (sih->bustype == PCI_BUS) {
-		if (sii->pch)
-			pcicore_deinit(sii->pch);
-		sii->pch = NULL;
-	}
+	if (sii->pch)
+		pcicore_deinit(sii->pch);
+	sii->pch = NULL;
 
 	return NULL;
 }
@@ -1297,7 +1206,6 @@ static struct si_info *ai_doattach(struct si_info *sii,
 void ai_detach(struct si_pub *sih)
 {
 	struct si_info *sii;
-	uint idx;
 
 	struct si_pub *si_local = NULL;
 	memcpy(&si_local, &sih, sizeof(struct si_pub **));
@@ -1307,18 +1215,9 @@ void ai_detach(struct si_pub *sih)
 	if (sii == NULL)
 		return;
 
-	if (sih->bustype == SI_BUS)
-		for (idx = 0; idx < SI_MAXCORES; idx++)
-			if (sii->regs[idx]) {
-				iounmap(sii->regs[idx]);
-				sii->regs[idx] = NULL;
-			}
-
-	if (sih->bustype == PCI_BUS) {
-		if (sii->pch)
-			pcicore_deinit(sii->pch);
-		sii->pch = NULL;
-	}
+	if (sii->pch)
+		pcicore_deinit(sii->pch);
+	sii->pch = NULL;
 
 	if (sii != &ksii)
 		kfree(sii);
@@ -1483,43 +1382,29 @@ uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,
 	if (coreidx >= SI_MAXCORES)
 		return 0;
 
-	if (sih->bustype == SI_BUS) {
-		/* If internal bus, we can always get at everything */
+	/*
+	 * If pci/pcie, we can get at pci/pcie regs
+	 * and on newer cores to chipc
+	 */
+	if ((sii->coreid[coreidx] == CC_CORE_ID) && SI_FAST(sii)) {
+		/* Chipc registers are mapped at 12KB */
 		fast = true;
-		/* map if does not exist */
-		if (!sii->regs[coreidx])
-			sii->regs[coreidx] = REG_MAP(sii->coresba[coreidx],
-						     SI_CORE_SIZE);
-
-		r = (u32 *) ((unsigned char *) sii->regs[coreidx] + regoff);
-	} else if (sih->bustype == PCI_BUS) {
+		r = (u32 *)((char *)sii->curmap +
+			    PCI_16KB0_CCREGS_OFFSET + regoff);
+	} else if (sii->pub.buscoreidx == coreidx) {
 		/*
-		 * If pci/pcie, we can get at pci/pcie regs
-		 * and on newer cores to chipc
+		 * pci registers are at either in the last 2KB of
+		 * an 8KB window or, in pcie and pci rev 13 at 8KB
 		 */
-		if ((sii->coreid[coreidx] == CC_CORE_ID) && SI_FAST(sii)) {
-			/* Chipc registers are mapped at 12KB */
-
-			fast = true;
-			r = (u32 *) ((char *)sii->curmap +
-					PCI_16KB0_CCREGS_OFFSET + regoff);
-		} else if (sii->pub.buscoreidx == coreidx) {
-			/*
-			 * pci registers are at either in the last 2KB of
-			 * an 8KB window or, in pcie and pci rev 13 at 8KB
-			 */
-			fast = true;
-			if (SI_FAST(sii))
-				r = (u32 *) ((char *)sii->curmap +
-						PCI_16KB0_PCIREGS_OFFSET +
-						regoff);
-			else
-				r = (u32 *) ((char *)sii->curmap +
-						((regoff >= SBCONFIGOFF) ?
-						 PCI_BAR0_PCISBR_OFFSET :
-						 PCI_BAR0_PCIREGS_OFFSET) +
-						regoff);
-		}
+		fast = true;
+		if (SI_FAST(sii))
+			r = (u32 *)((char *)sii->curmap +
+				    PCI_16KB0_PCIREGS_OFFSET + regoff);
+		else
+			r = (u32 *)((char *)sii->curmap +
+				    ((regoff >= SBCONFIGOFF) ?
+				      PCI_BAR0_PCISBR_OFFSET :
+				      PCI_BAR0_PCIREGS_OFFSET) + regoff);
 	}
 
 	if (!fast) {
@@ -1615,12 +1500,10 @@ static uint ai_slowclk_src(struct si_info *sii)
 	u32 val;
 
 	if (sii->pub.ccrev < 6) {
-		if (sii->pub.bustype == PCI_BUS) {
-			pci_read_config_dword(sii->pbus, PCI_GPIO_OUT,
-					      &val);
-			if (val & PCI_CFG_GPIO_SCS)
-				return SCC_SS_PCI;
-		}
+		pci_read_config_dword(sii->pbus, PCI_GPIO_OUT,
+				      &val);
+		if (val & PCI_CFG_GPIO_SCS)
+			return SCC_SS_PCI;
 		return SCC_SS_XTAL;
 	} else if (sii->pub.ccrev < 10) {
 		cc = (struct chipcregs *) ai_setcoreidx(&sii->pub, sii->curidx);
@@ -1791,63 +1674,56 @@ int ai_clkctl_xtal(struct si_pub *sih, uint what, bool on)
 
 	sii = SI_INFO(sih);
 
-	switch (sih->bustype) {
-
-	case PCI_BUS:
-		/* pcie core doesn't have any mapping to control the xtal pu */
-		if (PCIE(sii))
-			return -1;
+	/* pcie core doesn't have any mapping to control the xtal pu */
+	if (PCIE(sii))
+		return -1;
 
-		pci_read_config_dword(sii->pbus, PCI_GPIO_IN, &in);
-		pci_read_config_dword(sii->pbus, PCI_GPIO_OUT, &out);
-		pci_read_config_dword(sii->pbus, PCI_GPIO_OUTEN, &outen);
+	pci_read_config_dword(sii->pbus, PCI_GPIO_IN, &in);
+	pci_read_config_dword(sii->pbus, PCI_GPIO_OUT, &out);
+	pci_read_config_dword(sii->pbus, PCI_GPIO_OUTEN, &outen);
 
-		/*
-		 * Avoid glitching the clock if GPRS is already using it.
-		 * We can't actually read the state of the PLLPD so we infer it
-		 * by the value of XTAL_PU which *is* readable via gpioin.
-		 */
-		if (on && (in & PCI_CFG_GPIO_XTAL))
-			return 0;
+	/*
+	 * Avoid glitching the clock if GPRS is already using it.
+	 * We can't actually read the state of the PLLPD so we infer it
+	 * by the value of XTAL_PU which *is* readable via gpioin.
+	 */
+	if (on && (in & PCI_CFG_GPIO_XTAL))
+		return 0;
 
-		if (what & XTAL)
-			outen |= PCI_CFG_GPIO_XTAL;
-		if (what & PLL)
-			outen |= PCI_CFG_GPIO_PLL;
-
-		if (on) {
-			/* turn primary xtal on */
-			if (what & XTAL) {
-				out |= PCI_CFG_GPIO_XTAL;
-				if (what & PLL)
-					out |= PCI_CFG_GPIO_PLL;
-				pci_write_config_dword(sii->pbus,
-						       PCI_GPIO_OUT, out);
-				pci_write_config_dword(sii->pbus,
-						       PCI_GPIO_OUTEN, outen);
-				udelay(XTAL_ON_DELAY);
-			}
+	if (what & XTAL)
+		outen |= PCI_CFG_GPIO_XTAL;
+	if (what & PLL)
+		outen |= PCI_CFG_GPIO_PLL;
 
-			/* turn pll on */
-			if (what & PLL) {
-				out &= ~PCI_CFG_GPIO_PLL;
-				pci_write_config_dword(sii->pbus,
-						       PCI_GPIO_OUT, out);
-				mdelay(2);
-			}
-		} else {
-			if (what & XTAL)
-				out &= ~PCI_CFG_GPIO_XTAL;
+	if (on) {
+		/* turn primary xtal on */
+		if (what & XTAL) {
+			out |= PCI_CFG_GPIO_XTAL;
 			if (what & PLL)
 				out |= PCI_CFG_GPIO_PLL;
 			pci_write_config_dword(sii->pbus,
 					       PCI_GPIO_OUT, out);
 			pci_write_config_dword(sii->pbus,
 					       PCI_GPIO_OUTEN, outen);
+			udelay(XTAL_ON_DELAY);
 		}
 
-	default:
-		return -1;
+		/* turn pll on */
+		if (what & PLL) {
+			out &= ~PCI_CFG_GPIO_PLL;
+			pci_write_config_dword(sii->pbus,
+					       PCI_GPIO_OUT, out);
+			mdelay(2);
+		}
+	} else {
+		if (what & XTAL)
+			out &= ~PCI_CFG_GPIO_XTAL;
+		if (what & PLL)
+			out |= PCI_CFG_GPIO_PLL;
+		pci_write_config_dword(sii->pbus,
+				       PCI_GPIO_OUT, out);
+		pci_write_config_dword(sii->pbus,
+				       PCI_GPIO_OUTEN, outen);
 	}
 
 	return 0;
@@ -1893,12 +1769,6 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode)
 	if (!fast) {
 		INTR_OFF(sii, intr_val);
 		origidx = sii->curidx;
-
-		if ((sii->pub.bustype == SI_BUS) &&
-		    ai_setcore(&sii->pub, MIPS33_CORE_ID, 0) &&
-		    (ai_corerev(&sii->pub) <= 7) && (sii->pub.ccrev >= 10))
-			goto done;
-
 		cc = (struct chipcregs *) ai_setcore(&sii->pub, CC_CORE_ID, 0);
 	} else {
 		cc = (struct chipcregs *) CCREGS_FAST(sii);
@@ -1969,7 +1839,7 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode)
 	return mode == CLK_FAST;
 }
 
-/* Build device path. Support SI, PCI, and JTAG for now. */
+/* Build device path */
 int ai_devpath(struct si_pub *sih, char *path, int size)
 {
 	int slen;
@@ -1977,22 +1847,9 @@ int ai_devpath(struct si_pub *sih, char *path, int size)
 	if (!path || size <= 0)
 		return -1;
 
-	switch (sih->bustype) {
-	case SI_BUS:
-	case JTAG_BUS:
-		slen = snprintf(path, (size_t) size, "sb/%u/", ai_coreidx(sih));
-		break;
-	case PCI_BUS:
-		slen = snprintf(path, (size_t) size, "pci/%u/%u/",
-			((struct pci_dev *)((SI_INFO(sih))->pbus))->bus->number,
-			PCI_SLOT(
-			    ((struct pci_dev *)((SI_INFO(sih))->pbus))->devfn));
-		break;
-
-	default:
-		slen = -1;
-		break;
-	}
+	slen = snprintf(path, (size_t) size, "pci/%u/%u/",
+		((struct pci_dev *)((SI_INFO(sih))->pbus))->bus->number,
+		PCI_SLOT(((struct pci_dev *)((SI_INFO(sih))->pbus))->devfn));
 
 	if (slen < 0 || slen >= size) {
 		path[0] = '\0';
@@ -2015,15 +1872,11 @@ char *ai_getdevpathvar(struct si_pub *sih, const char *name)
 /* Get a variable, but only if it has a devpath prefix */
 int ai_getdevpathintvar(struct si_pub *sih, const char *name)
 {
-#if defined(BCMBUSTYPE) && (BCMBUSTYPE == SI_BUS)
-	return getintvar(NULL, name);
-#else
 	char varname[SI_DEVPATH_BUFSZ + 32];
 
 	ai_devpathvar(sih, varname, sizeof(varname), name);
 
 	return getintvar(NULL, varname);
-#endif
 }
 
 char *ai_getnvramflvar(struct si_pub *sih, const char *name)
@@ -2061,9 +1914,6 @@ static bool ai_ispcie(struct si_info *sii)
 {
 	u8 cap_ptr;
 
-	if (sii->pub.bustype != PCI_BUS)
-		return false;
-
 	cap_ptr =
 	    pcicore_find_pci_capability(sii->pbus, PCI_CAP_ID_EXP, NULL,
 					NULL);
@@ -2088,10 +1938,6 @@ void ai_pci_up(struct si_pub *sih)
 
 	sii = SI_INFO(sih);
 
-	/* if not pci bus, we're done */
-	if (sih->bustype != PCI_BUS)
-		return;
-
 	if (PCI_FORCEHT(sii))
 		_ai_clkctl_cc(sii, CLK_FAST);
 
@@ -2117,10 +1963,6 @@ void ai_pci_down(struct si_pub *sih)
 
 	sii = SI_INFO(sih);
 
-	/* if not pci bus, we're done */
-	if (sih->bustype != PCI_BUS)
-		return;
-
 	/* release FORCEHT since chip is going to "down" state */
 	if (PCI_FORCEHT(sii))
 		_ai_clkctl_cc(sii, CLK_DYNAMIC);
@@ -2141,9 +1983,6 @@ void ai_pci_setup(struct si_pub *sih, uint coremask)
 
 	sii = SI_INFO(sih);
 
-	if (sii->pub.bustype != PCI_BUS)
-		return;
-
 	if (PCI(sii)) {
 		/* get current core index */
 		idx = sii->curidx;
@@ -2208,18 +2047,6 @@ u32 ai_gpiocontrol(struct si_pub *sih, u32 mask, u32 val, u8 priority)
 {
 	uint regoff;
 
-	regoff = 0;
-
-	/* gpios could be shared on router platforms
-	 * ignore reservation if it's high priority (e.g., test apps)
-	 */
-	if ((priority != GPIO_HI_PRIORITY) &&
-	    (sih->bustype == SI_BUS) && (val || mask)) {
-		mask = priority ? (ai_gpioreservation & mask) :
-		    ((ai_gpioreservation | mask) & ~(ai_gpioreservation));
-		val &= mask;
-	}
-
 	regoff = offsetof(struct chipcregs, gpiocontrol);
 	return ai_corereg(sih, SI_CC_IDX, regoff, mask, val);
 }
@@ -2283,13 +2110,10 @@ bool ai_deviceremoved(struct si_pub *sih)
 
 	sii = SI_INFO(sih);
 
-	switch (sih->bustype) {
-	case PCI_BUS:
-		pci_read_config_dword(sii->pbus, PCI_VENDOR_ID, &w);
-		if ((w & 0xFFFF) != PCI_VENDOR_ID_BROADCOM)
-			return true;
-		break;
-	}
+	pci_read_config_dword(sii->pbus, PCI_VENDOR_ID, &w);
+	if ((w & 0xFFFF) != PCI_VENDOR_ID_BROADCOM)
+		return true;
+
 	return false;
 }
 
drivers/staging/brcm80211/brcmsmac/aiutils.h +4 -8
index 4c682a5..076b4c8 100644
@@ -330,10 +330,8 @@
 #define	ILP_DIV_5MHZ		0	/* ILP = 5 MHz */
 #define	ILP_DIV_1MHZ		4	/* ILP = 1 MHz */
 
-#define PCI(si)		(((si)->pub.bustype == PCI_BUS) &&	\
-			 ((si)->pub.buscoretype == PCI_CORE_ID))
-#define PCIE(si)	(((si)->pub.bustype == PCI_BUS) &&	\
-			 ((si)->pub.buscoretype == PCIE_CORE_ID))
+#define PCI(si)		((si)->pub.buscoretype == PCI_CORE_ID)
+#define PCIE(si)	((si)->pub.buscoretype == PCIE_CORE_ID)
 #define PCI_FORCEHT(si)	\
 	(PCIE(si) && (si->pub.chip == BCM4716_CHIP_ID))
 
@@ -351,7 +349,6 @@
  *   public (read-only) portion of aiutils handle returned by si_attach()
  */
 struct si_pub {
-	uint bustype;		/* SI_BUS, PCI_BUS */
 	uint buscoretype;	/* PCI_CORE_ID, PCIE_CORE_ID, PCMCIA_CORE_ID */
 	uint buscorerev;	/* buscore rev */
 	uint buscoreidx;	/* buscore index */
@@ -518,9 +515,8 @@ extern u32 ai_addrspacesize(struct si_pub *sih, uint asidx);
 extern void ai_write_wrap_reg(struct si_pub *sih, u32 offset, u32 val);
 
 /* === exported functions === */
-extern struct si_pub *ai_attach(void *regs, uint bustype,
-		       void *sdh, char **vars, uint *varsz);
-
+extern struct si_pub *ai_attach(void *regs, void *sdh, char **vars,
+				uint *varsz);
 extern void ai_detach(struct si_pub *sih);
 extern bool ai_pci_war16165(struct si_pub *sih);
 
drivers/staging/brcm80211/brcmsmac/dma.c +5 -8
index 48a053c..64d7639 100644
@@ -451,14 +451,11 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
 	 */
 	di->ddoffsetlow = 0;
 	di->dataoffsetlow = 0;
-	/* for pci bus, add offset */
-	if (sih->bustype == PCI_BUS) {
-		/* pcie with DMA64 */
-		di->ddoffsetlow = 0;
-		di->ddoffsethigh = SI_PCIE_DMA_H32;
-		di->dataoffsetlow = di->ddoffsetlow;
-		di->dataoffsethigh = di->ddoffsethigh;
-	}
+	/* add offset for pcie with DMA64 bus */
+	di->ddoffsetlow = 0;
+	di->ddoffsethigh = SI_PCIE_DMA_H32;
+	di->dataoffsetlow = di->ddoffsetlow;
+	di->dataoffsethigh = di->ddoffsethigh;
 #if defined(__mips__) && defined(IL_BIGENDIAN)
 	di->dataoffsetlow = di->dataoffsetlow + SI_SDRAM_SWAPPED;
 #endif				/* defined(__mips__) && defined(IL_BIGENDIAN) */
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +4 -13
index a708306..571186a 100644
@@ -754,7 +754,7 @@ static int brcms_set_hint(struct brcms_info *wl, char *abbrev)
  */
 static struct brcms_info *brcms_attach(u16 vendor, u16 device,
 				       unsigned long regs,
-			    uint bustype, void *btparam, uint irq)
+				       void *btparam, uint irq)
 {
 	struct brcms_info *wl = NULL;
 	int unit, err;
@@ -785,14 +785,6 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device,
 
 	base_addr = regs;
 
-	if (bustype == PCI_BUS || bustype == RPC_BUS) {
-		/* Do nothing */
-	} else {
-		bustype = PCI_BUS;
-		BCMMSG(wl->wiphy, "force to PCI\n");
-	}
-	wl->bcm_bustype = bustype;
-
 	wl->regsva = ioremap_nocache(base_addr, PCI_BAR0_WINSZ);
 	if (wl->regsva == NULL) {
 		wiphy_err(wl->wiphy, "wl%d: ioremap() failed\n", unit);
@@ -812,7 +804,7 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device,
 
 	/* common load-time initialization */
 	wl->wlc = brcms_c_attach((void *)wl, vendor, device, unit, false,
-			     wl->regsva, wl->bcm_bustype, btparam, &err);
+				 wl->regsva, btparam, &err);
 	brcms_release_fw(wl);
 	if (!wl->wlc) {
 		wiphy_err(wl->wiphy, "%s: attach() failed with code %d\n",
@@ -1155,7 +1147,7 @@ brcms_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	memset(hw->priv, 0, sizeof(*wl));
 
 	wl = brcms_attach(pdev->vendor, pdev->device,
-			  pci_resource_start(pdev, 0), PCI_BUS, pdev,
+			  pci_resource_start(pdev, 0), pdev,
 			  pdev->irq);
 
 	if (!wl) {
@@ -1372,8 +1364,7 @@ static void brcms_free(struct brcms_info *wl)
 	 * registers so we cannot unmap the chip registers until
 	 * after calling unregister_netdev() .
 	 */
-	if (wl->regsva && wl->bcm_bustype != SDIO_BUS &&
-	    wl->bcm_bustype != JTAG_BUS)
+	if (wl->regsva)
 		iounmap((void *)wl->regsva);
 
 	wl->regsva = NULL;
drivers/staging/brcm80211/brcmsmac/mac80211_if.h +1 -2
index 01fce54..c574723 100644
@@ -60,8 +60,7 @@ struct brcms_info {
 	spinlock_t lock;	/* per-device perimeter lock */
 	spinlock_t isr_lock;	/* per-device ISR synchronization lock */
 
-	/* bus type and regsva for unmap in brcms_free() */
-	uint bcm_bustype;	/* bus type */
+	/* regsva for unmap in brcms_free() */
 	void *regsva;		/* opaque chip registers virtual address */
 
 	/* timer related fields */
drivers/staging/brcm80211/brcmsmac/main.c +46 -65

214 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/nicpci.c +1 -3
index ab67546..8249ea9 100644
@@ -213,9 +213,7 @@ struct pcicore_info {
 
 /* debug/trace */
 #define	PCI_ERROR(args)
-#define PCIE_PUB(sih)							\
-	(((sih)->bustype == PCI_BUS) &&					\
-	 ((sih)->buscoretype == PCIE_CORE_ID))
+#define PCIE_PUB(sih) ((sih)->buscoretype == PCIE_CORE_ID)
 
 /* routines to access mdio slave device registers */
 static bool pcie_mdiosetblock(struct pcicore_info *pi, uint blk);
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +6 -11
index 831c2fe..c00178d 100644
@@ -279,11 +279,9 @@ void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
 		W_REG(&pi->regs->phy4wdatalo, val);
 	}
 
-	if (pi->sh->bustype == PCI_BUS) {
-		if (++pi->phy_wreg >= pi->phy_wreg_limit) {
-			(void)R_REG(&pi->regs->maccontrol);
-			pi->phy_wreg = 0;
-		}
+	if (++pi->phy_wreg >= pi->phy_wreg_limit) {
+		(void)R_REG(&pi->regs->maccontrol);
+		pi->phy_wreg = 0;
 	}
 }
 
@@ -390,11 +388,9 @@ void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
 #else
 	W_REG((u32 *)(&regs->phyregaddr),
 	      addr | (val << 16));
-	if (pi->sh->bustype == PCI_BUS) {
-		if (++pi->phy_wreg >= pi->phy_wreg_limit) {
-			pi->phy_wreg = 0;
-			(void)R_REG(&regs->phyversion);
-		}
+	if (++pi->phy_wreg >= pi->phy_wreg_limit) {
+		pi->phy_wreg = 0;
+		(void)R_REG(&regs->phyversion);
 	}
 #endif
 }
@@ -496,7 +492,6 @@ struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp)
 	sh->boardvendor = shp->boardvendor;
 	sh->boardflags = shp->boardflags;
 	sh->boardflags2 = shp->boardflags2;
-	sh->bustype = shp->bustype;
 	sh->buscorerev = shp->buscorerev;
 
 	sh->fast_timer = PHY_SW_TIMER_FAST;
drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h +0 -1
index 42e0cf0..1dbfaa3 100644
@@ -166,7 +166,6 @@ struct shared_phy_params {
 	struct phy_shim_info *physhim;
 	uint unit;
 	uint corerev;
-	uint bustype;
 	uint buscorerev;
 	char *vars;
 	u16 vid;
drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +1 -2
index bcc6d83..b98d76b 100644
@@ -565,7 +565,6 @@ struct shared_phy {
 	uint boardvendor;
 	u32 boardflags;
 	u32 boardflags2;
-	uint bustype;
 	uint buscorerev;
 	uint fast_timer;
 	uint slow_timer;
@@ -1182,7 +1181,7 @@ extern void wlc_phy_table_write_nphy(struct brcms_phy *pi, u32, u32, u32,
 	 (pi->ipa5g_on && CHSPEC_IS5G(pi->radio_chanspec)))
 
 #define BRCMS_PHY_WAR_PR51571(pi) \
-	if (((pi)->sh->bustype == PCI_BUS) && NREV_LT((pi)->pubpi.phy_rev, 3)) \
+	if (NREV_LT((pi)->pubpi.phy_rev, 3)) \
 		(void)R_REG(&(pi)->regs->maccontrol)
 
 extern void wlc_phy_cal_perical_nphy_run(struct brcms_phy *pi, u8 caltype);
drivers/staging/brcm80211/brcmsmac/pub.h +1 -1
index 8da7250..5e15c67 100644
@@ -550,7 +550,7 @@ struct brcms_antselcfg {
 
 /* common functions for every port */
 extern void *brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device,
-			uint unit, bool piomode, void *regsva, uint bustype,
+			uint unit, bool piomode, void *regsva,
 			void *btparam, uint *perr);
 extern uint brcms_c_detach(struct brcms_c_info *wlc);
 extern int brcms_c_up(struct brcms_c_info *wlc);
drivers/staging/brcm80211/brcmsmac/srom.c +2 -3
index 40a3156..060f06f 100644
@@ -860,8 +860,7 @@ static int varbuf_append(struct brcms_varbuf *b, const char *fmt, ...)
  * Initialize local vars from the right source for this platform.
  * Return 0 on success, nonzero on error.
  */
-int srom_var_init(struct si_pub *sih, uint bustype, void *curmap,
-		  char **vars, uint *count)
+int srom_var_init(struct si_pub *sih, void *curmap, char **vars, uint *count)
 {
 	uint len;
 
@@ -873,7 +872,7 @@ int srom_var_init(struct si_pub *sih, uint bustype, void *curmap,
 	*vars = NULL;
 	*count = 0;
 
-	if (curmap != NULL && bustype == PCI_BUS)
+	if (curmap != NULL)
 		return initvars_srom_pci(sih, curmap, vars, count);
 
 	return -EINVAL;
drivers/staging/brcm80211/brcmsmac/srom.h +2 -2
index efc4d1e..dd51156 100644
@@ -20,8 +20,8 @@
 #include "types.h"
 
 /* Prototypes */
-extern int srom_var_init(struct si_pub *sih, uint bus, void *curmap,
-			 char **vars, uint *count);
+extern int srom_var_init(struct si_pub *sih, void *curmap, char **vars,
+			 uint *count);
 
 extern int srom_read(struct si_pub *sih, uint bus, void *curmap,
 		     uint byteoff, uint nbytes, u16 *buf, bool check_crc);
drivers/staging/brcm80211/brcmsmac/types.h +2 -3
index 7c07cfd..6c51329 100644
@@ -19,14 +19,13 @@
 
 #include <linux/types.h>
 
+#if 0
 /* Bus types */
-#define	SI_BUS			0	/* SOC Interconnect */
-#define	PCI_BUS			1	/* PCI target */
 #define SDIO_BUS		3	/* SDIO target */
-#define JTAG_BUS		4	/* JTAG */
 #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
Signature · 1 line
1.7.4.1
#30 lore raw

PATCH 28/29 staging: brcm80211: remove target platform limitations for drivers

In reply to Arend van Spriel

Several issue have been reported building the driver on big endian systems. Following commits were done on driver Kconfig:

d462039 Staging: brcm80211: disable drivers except for X86 or MIPS platforms 15e5201 Staging: brcm80211: disable drivers for PPC platforms

These problems have been resolved so the added 'depends' lines in the Kconfig have been removed.

Compile tested it for following architectures:
little endian

	x86
	x86_64
	arm
	mips
big endian
	ppc64
	sparc64
	mips
---
 drivers/staging/brcm80211/Kconfig |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/staging/brcm80211/Kconfig +0 -2
index 379cf16..f4cf9b2 100644
@@ -7,7 +7,6 @@ config BRCMSMAC
 	default n
 	depends on PCI
 	depends on WLAN && MAC80211
-	depends on X86 || MIPS
 	select BRCMUTIL
 	select FW_LOADER
 	select CRC_CCITT
@@ -21,7 +20,6 @@ config BRCMFMAC
 	default n
 	depends on MMC
 	depends on WLAN && CFG80211
-	depends on X86 || MIPS
 	select BRCMUTIL
 	select FW_LOADER
 	select WIRELESS_EXT
Signature · 1 line
1.7.4.1
#26 lore raw

PATCH 24/29 staging: brcm80211: removed void * from ai_ functions

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

Code cleanup. Replaced void * by less generic pointer types.

---
 drivers/staging/brcm80211/brcmsmac/aiutils.c |   46 +++++++++++++-------------
 drivers/staging/brcm80211/brcmsmac/aiutils.h |    5 +--
 drivers/staging/brcm80211/brcmsmac/pmu.c     |    4 +-
 3 files changed, 26 insertions(+), 29 deletions(-)
drivers/staging/brcm80211/brcmsmac/aiutils.c +23 -23
index 9cfb492..3d392a3 100644
@@ -483,16 +483,16 @@ static void ai_hwfixup(struct si_info *sii)
 }
 
 /* parse the enumeration rom to identify all cores */
-void ai_scan(struct si_pub *sih, void *regs)
+void ai_scan(struct si_pub *sih, struct chipcregs *cc)
 {
 	struct si_info *sii = SI_INFO(sih);
-	struct chipcregs *cc = (struct chipcregs *) regs;
 	u32 erombase, *eromptr, *eromlim;
+	void *regs = cc;
 
 	erombase = R_REG(&cc->eromptr);
 
 	/* Set wrappers address */
-	sii->curwrap = (void *)((unsigned long)regs + SI_CORE_SIZE);
+	sii->curwrap = (void *)((unsigned long)cc + SI_CORE_SIZE);
 
 	/* Now point the window at the erom */
 	pci_write_config_dword(sii->pbus, PCI_BAR0_WIN, erombase);
@@ -671,7 +671,10 @@ void ai_scan(struct si_pub *sih, void *regs)
 
 /*
  * This function changes the logical "focus" to the indicated core.
- * Return the current core's virtual address.
+ * Return the current core's virtual address. Since each core starts with the
+ * same set of registers (BIST, clock control, etc), the returned address
+ * contains the first register of this 'common' register block (not to be
+ * confused with 'common core').
  */
 void *ai_setcoreidx(struct si_pub *sih, uint coreidx)
 {
@@ -864,8 +867,7 @@ static struct si_info *ai_doattach(struct si_info *sii, void *regs,
 				   struct pci_dev *sdh,
 				   char **vars, uint *varsz);
 static bool ai_buscore_prep(struct si_info *sii);
-static bool ai_buscore_setup(struct si_info *sii, struct chipcregs *cc,
-			     u32 savewin, uint *origidx, void *regs);
+static bool ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx);
 static void ai_nvram_process(struct si_info *sii, char *pvars);
 
 /* dev path concatenation util */
@@ -916,12 +918,12 @@ static bool ai_buscore_prep(struct si_info *sii)
 }
 
 static bool
-ai_buscore_setup(struct si_info *sii, struct chipcregs *cc, u32 savewin,
-		 uint *origidx, void *regs)
+ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx)
 {
 	bool pci, pcie;
 	uint i;
 	uint pciidx, pcieidx, pcirev, pcierev;
+	struct chipcregs *cc;
 
 	cc = ai_setcoreidx(&sii->pub, SI_CC_IDX);
 
@@ -977,7 +979,7 @@ ai_buscore_setup(struct si_info *sii, struct chipcregs *cc, u32 savewin,
 
 		/* find the core idx before entering this func. */
 		if ((savewin && (savewin == sii->coresba[i])) ||
-		    (regs == sii->regs[i]))
+		    (cc == sii->regs[i]))
 			*origidx = i;
 	}
 
@@ -1003,9 +1005,8 @@ ai_buscore_setup(struct si_info *sii, struct chipcregs *cc, u32 savewin,
 	/* fixup necessary chip/core configurations */
 	if (SI_FAST(sii)) {
 		if (!sii->pch) {
-			sii->pch = (void *)pcicore_init(
-				&sii->pub, sii->pbus,
-				(void *)PCIEREGS(sii));
+			sii->pch = pcicore_init(&sii->pub, sii->pbus,
+						(void *)PCIEREGS(sii));
 			if (sii->pch == NULL)
 				return false;
 		}
@@ -1108,7 +1109,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
 	if (socitype == SOCI_AI) {
 		SI_MSG(("Found chip type AI (0x%08x)\n", w));
 		/* pass chipc address instead of original core base */
-		ai_scan(&sii->pub, (void *)cc);
+		ai_scan(&sii->pub, cc);
 	} else {
 		SI_ERROR(("Found chip of unknown type (0x%08x)\n", w));
 		return NULL;
@@ -1120,13 +1121,13 @@ static struct si_info *ai_doattach(struct si_info *sii,
 	}
 	/* bus/core/clk setup */
 	origidx = SI_CC_IDX;
-	if (!ai_buscore_setup(sii, cc, savewin, &origidx, regs)) {
+	if (!ai_buscore_setup(sii, savewin, &origidx)) {
 		SI_ERROR(("si_doattach: si_buscore_setup failed\n"));
 		goto exit;
 	}
 
 	/* Init nvram from sprom/otp if they exist */
-	if (srom_var_init(&sii->pub, regs, vars, varsz)) {
+	if (srom_var_init(&sii->pub, cc, vars, varsz)) {
 		SI_ERROR(("si_doattach: srom_var_init failed: bad srom\n"));
 		goto exit;
 	}
@@ -1327,9 +1328,9 @@ void *ai_switch_core(struct si_pub *sih, uint coreid, uint *origidx,
 		 */
 		*origidx = coreid;
 		if (coreid == CC_CORE_ID)
-			return (void *)CCREGS_FAST(sii);
+			return CCREGS_FAST(sii);
 		else if (coreid == sih->buscoretype)
-			return (void *)PCIEREGS(sii);
+			return PCIEREGS(sii);
 	}
 	INTR_OFF(sii, *intr_val);
 	*origidx = sii->curidx;
@@ -1553,9 +1554,8 @@ ai_slowclk_freq(struct si_info *sii, bool max_freq, struct chipcregs *cc)
 	return 0;
 }
 
-static void ai_clkctl_setdelay(struct si_info *sii, void *chipcregs)
+static void ai_clkctl_setdelay(struct si_info *sii, struct chipcregs *cc)
 {
-	struct chipcregs *cc = (struct chipcregs *) chipcregs;
 	uint slowmaxfreq, pll_delay, slowclk;
 	uint pll_on_delay, fref_sel_delay;
 
@@ -1611,7 +1611,7 @@ void ai_clkctl_init(struct si_pub *sih)
 		SET_REG(&cc->system_clk_ctl, SYCC_CD_MASK,
 			(ILP_DIV_1MHZ << SYCC_CD_SHIFT));
 
-	ai_clkctl_setdelay(sii, (void *)cc);
+	ai_clkctl_setdelay(sii, cc);
 
 	if (!fast)
 		ai_setcoreidx(sih, origidx);
@@ -1979,7 +1979,7 @@ void ai_pci_down(struct si_pub *sih)
 void ai_pci_setup(struct si_pub *sih, uint coremask)
 {
 	struct si_info *sii;
-	void *regs = NULL;
+	struct sbpciregs *regs = NULL;
 	u32 siflag = 0, w;
 	uint idx = 0;
 
@@ -2025,7 +2025,7 @@ void ai_pci_setup(struct si_pub *sih, uint coremask)
 int ai_pci_fixcfg(struct si_pub *sih)
 {
 	uint origidx;
-	void *regs = NULL;
+	struct sbpciregs *regs = NULL;
 
 	struct si_info *sii = SI_INFO(sih);
 
@@ -2095,7 +2095,7 @@ void ai_epa_4313war(struct si_pub *sih)
 	sii = SI_INFO(sih);
 	origidx = ai_coreidx(sih);
 
-	cc = (struct chipcregs *) ai_setcore(sih, CC_CORE_ID, 0);
+	cc = ai_setcore(sih, CC_CORE_ID, 0);
 
 	/* EPA Fix */
 	W_REG(&cc->gpiocontrol,
drivers/staging/brcm80211/brcmsmac/aiutils.h +1 -4
index 101ab92..84c6901 100644
@@ -468,7 +468,7 @@ struct si_info {
 	/* check if interrupts are enabled */
 	bool (*intrsenabled_fn) (void *intr_arg);
 
-	void *pch;		/* PCI/E core handle */
+	struct pcicore_info *pch; /* PCI/E core handle */
 
 	char *vars;
 	uint varsz;
@@ -495,15 +495,12 @@ struct si_info {
 };
 
 /* AMBA Interconnect exported externs */
-extern void ai_scan(struct si_pub *sih, void *regs);
-
 extern uint ai_flag(struct si_pub *sih);
 extern void ai_setint(struct si_pub *sih, int siflag);
 extern uint ai_coreidx(struct si_pub *sih);
 extern uint ai_corevendor(struct si_pub *sih);
 extern uint ai_corerev(struct si_pub *sih);
 extern bool ai_iscoreup(struct si_pub *sih);
-extern void *ai_setcoreidx(struct si_pub *sih, uint coreidx);
 extern u32 ai_core_cflags(struct si_pub *sih, u32 mask, u32 val);
 extern void ai_core_cflags_wo(struct si_pub *sih, u32 mask, u32 val);
 extern u32 ai_core_sflags(struct si_pub *sih, u32 mask, u32 val);
drivers/staging/brcm80211/brcmsmac/pmu.c +2 -2
index f5e1085..cdeaa4e 100644
@@ -320,8 +320,8 @@ void si_pmu_spuravoid(struct si_pub *sih, u8 spuravoid)
 	uint origidx, intr_val;
 
 	/* Remember original core before switch to chipc */
-	cc = (struct chipcregs *) ai_switch_core(sih, CC_CORE_ID, &origidx,
-					    &intr_val);
+	cc = (struct chipcregs *)
+			ai_switch_core(sih, CC_CORE_ID, &origidx, &intr_val);
 
 	/* update the pll changes */
 	si_pmu_spuravoid_pllupdate(sih, cc, spuravoid);
Signature · 1 line
1.7.4.1
#28 lore raw

PATCH 26/29 staging: brcm80211: removed watchdog function from softmac

In reply to Arend van Spriel

From: Roland Vossen <[email protected]>

Code cleanup. Watchdog function served no purpose since it had an empty body.

---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |   14 +-------------
 drivers/staging/brcm80211/brcmsmac/main.c        |   11 ++---------
 drivers/staging/brcm80211/brcmsmac/main.h        |    2 --
 drivers/staging/brcm80211/brcmsmac/pub.h         |    5 ++---
 4 files changed, 5 insertions(+), 27 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +1 -13
index 80c7025..b63dedf 100644
@@ -60,8 +60,6 @@ static void _brcms_timer(struct brcms_timer *t);
 static int ieee_hw_init(struct ieee80211_hw *hw);
 static int ieee_hw_rate_init(struct ieee80211_hw *hw);
 
-static int wl_linux_watchdog(void *ctx);
-
 /* Flags we support */
 #define MAC_FILTERS (FIF_PROMISC_IN_BSS | \
 	FIF_ALLMULTI | \
@@ -827,7 +825,7 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device,
 	wl->irq = irq;
 
 	/* register module */
-	brcms_c_module_register(wl->pub, "linux", wl, wl_linux_watchdog, NULL);
+	brcms_c_module_register(wl->pub, "linux", wl, NULL);
 
 	if (ieee_hw_init(hw)) {
 		wiphy_err(wl->wiphy, "wl%d: %s: ieee_hw_init failed!\n", unit,
@@ -1700,16 +1698,6 @@ void brcms_free_timer(struct brcms_info *wl, struct brcms_timer *t)
 
 }
 
-/*
- * runs in software irq context
- *
- * precondition: perimeter lock is not acquired
- */
-static int wl_linux_watchdog(void *ctx)
-{
-	return 0;
-}
-
 struct firmware_hdr {
 	u32 offset;
 	u32 len;
drivers/staging/brcm80211/brcmsmac/main.c +2 -9
index d011ed6..bdc7fb4 100644
@@ -5374,12 +5374,6 @@ static void brcms_c_watchdog(void *arg)
 			cfg->tk_cm_bt--;
 	END_FOREACH_BSS()
 
-	/* Call any registered watchdog handlers */
-	for (i = 0; i < BRCMS_MAXMODULES; i++) {
-		if (wlc->modulecb[i].watchdog_fn)
-			wlc->modulecb[i].watchdog_fn(wlc->modulecb[i].hdl);
-	}
-
 	if (BRCMS_ISNPHY(wlc->band) && !wlc->pub->tempsense_disable &&
 	    ((wlc->pub->now - wlc->tempsense_lasttime) >=
 	     BRCMS_TEMPSENSE_PERIOD)) {
@@ -6325,8 +6319,8 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
  * register watchdog and down handlers.
  */
 int brcms_c_module_register(struct brcms_pub *pub,
-		const char *name, void *hdl,
-		int (*w_fn)(void *handle), int (*d_fn)(void *handle))
+			    const char *name, void *hdl,
+			    int (*d_fn)(void *handle))
 {
 	struct brcms_c_info *wlc = (struct brcms_c_info *) pub->wlc;
 	int i;
@@ -6337,7 +6331,6 @@ int brcms_c_module_register(struct brcms_pub *pub,
 			strncpy(wlc->modulecb[i].name, name,
 				sizeof(wlc->modulecb[i].name) - 1);
 			wlc->modulecb[i].hdl = hdl;
-			wlc->modulecb[i].watchdog_fn = w_fn;
 			wlc->modulecb[i].down_fn = d_fn;
 			return 0;
 		}
drivers/staging/brcm80211/brcmsmac/main.h +0 -2
index 0fd061b..e2febe0 100644
@@ -462,8 +462,6 @@ struct modulecb {
 	const struct brcmu_iovar *iovars;
 	/* handle passed when handler 'doiovar' is called */
 	void *hdl;
-	/* watchdog handler */
-	int (*watchdog_fn)(void *handle);
 
 	/* IOVar handler
 	 *
drivers/staging/brcm80211/brcmsmac/pub.h +2 -3
index bfbb261..40efee6 100644
@@ -614,9 +614,8 @@ extern void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc);
 extern void brcms_c_mctrl(struct brcms_c_info *wlc, u32 mask, u32 val);
 
 extern int brcms_c_module_register(struct brcms_pub *pub,
-			       const char *name, void *hdl,
-			       int (*watchdog_fn)(void *handle),
-			       int (*down_fn)(void *handle));
+				   const char *name, void *hdl,
+				   int (*down_fn)(void *handle));
 
 extern int brcms_c_module_unregister(struct brcms_pub *pub, const char *name,
 				 void *hdl);
Signature · 1 line
1.7.4.1
#31 lore raw

PATCH 29/29 staging: brcm80211: updated TODO file

In reply to Arend van Spriel

The only remaining TODO item has been tackled so it was removed. No other TODO items left.

---
 drivers/staging/brcm80211/TODO |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/staging/brcm80211/TODO +0 -4
index e2e2ef9..7f68762 100644
@@ -4,10 +4,6 @@ Bugs
 ====
 - none known at this moment
 
-brcmfmac
-=====================
-- ASSERTS deprecated in mainline, replace by warning + error handling
-
 brcm80211 info page
 =====================
 http://linuxwireless.org/en/users/Drivers/brcm80211
Signature · 1 line
1.7.4.1
#9 lore raw

Re: [PATCH 09/29] staging: brcm80211: remove code for unsupported chip

In reply to Arend van Spriel
Quoted 4 lines · Arend van Spriel

From: Franky Lin <[email protected]>

Currently fullmac only support bcm4329. Remove dead code for unsupported chip.

This description doesn't match the code at all.

Sorry that I'm looking at this so long after you sent it...

regards,
dan carpenter

Quoted 30 lines
---
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +2 -0
index 16ea6e8..2a9efc3 100644
@@ -980,6 +980,8 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
 			return -ENOMEM;
 		sdiodev->func1 = func;
 		dev_set_drvdata(&func->card->dev, sdiodev);
+
+		atomic_set(&brcmf_mmc_suspend, false);
 	}
 
 	gInstance->func[func->num] = func;
Signature · 7 lines
1.7.4.1


_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
#14 lore raw

Re: [PATCH 13/29] staging: brcm80211: revisited END_FOREACH_BSS macro

In reply to Arend van Spriel

drivers/staging/brcm80211/brcmsmac/main.c void brcms_c_init(struct brcms_c_info *wlc) · line 3348

Quoted 6 lines · Arend van Spriel
drivers/staging/brcm80211/brcmsmac/main.c +1 -1
@@ -3345,7 +3345,7 @@ void brcms_c_init(struct brcms_c_info *wlc)
 	FOREACH_BSS(wlc, i, bsscfg)
 		brcms_c_set_mac(bsscfg);
 		brcms_c_set_bssid(bsscfg);
-	END_FOREACH_BSS
+	END_FOREACH_BSS()

These would look nicer with a semicolon on the end.

	END_FOREACH_BSS();

That looks like c.

I quite liked my way with the extra { } chars.

	FOREACH_BSS(wlc, i, bsscfg) {
		brcms_c_set_mac(bsscfg);
		brcms_c_set_bssid(bsscfg);
	} END_FOREACH_BSS();

Emacs gets the indenting wrong without the braces. We use that style of for each loop in the Sparse project.

But I'm fairly sick of this macro so at this point, I'm fine with whatever. :P

regards,
dan carpenter

#15 lore raw

Re: [PATCH 13/29] staging: brcm80211: revisited END_FOREACH_BSS macro

Quoted 15 lines · Dan Carpenter

drivers/staging/brcm80211/brcmsmac/main.c void brcms_c_init(struct brcms_c_info *wlc) · line 3348

Quoted 6 lines · Arend van Spriel
drivers/staging/brcm80211/brcmsmac/main.c +1 -1
@@ -3345,7 +3345,7 @@ void brcms_c_init(struct brcms_c_info *wlc)
 	FOREACH_BSS(wlc, i, bsscfg)
 		brcms_c_set_mac(bsscfg);
 		brcms_c_set_bssid(bsscfg);
-	END_FOREACH_BSS
+	END_FOREACH_BSS()

These would look nicer with a semicolon on the end.

	END_FOREACH_BSS();
That looks like c.
I quite liked my way with the extra { } chars.
	FOREACH_BSS(wlc, i, bsscfg) {
		brcms_c_set_mac(bsscfg);
		brcms_c_set_bssid(bsscfg);
	} END_FOREACH_BSS();
Quoted 2 lines

Emacs gets the indenting wrong without the braces. We use that style of for each loop in the Sparse project.

I too think it's better with braces and it's not just emacs. Anything that looks at indentation gets this wrong without the braces.

Quoted 2 lines

But I'm fairly sick of this macro so at this point, I'm fine with whatever. :P

I'm with Dan, but I'm not sick like he is...