aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorArend van Spriel <arend@broadcom.com>2011-12-08 18:06:49 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-12-13 15:32:19 -0500
commit28a5344261753fadb1731b82c5eeecca708a877c (patch)
tree5f1b249ebe0bd2124889dfbced9f41aa1cf82de8 /drivers
parentcbc80db2922112cf3c77a6121827ad662ea78c2d (diff)
brcm80211: smac: change ai_attach interface taking a bcma_bus object
The ai_attach now takes a bcma_bus object as its parameter to obtain all required information needed for chip control. Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Alwin Beukers <alwin@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/aiutils.c18
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/aiutils.h5
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/main.c2
3 files changed, 14 insertions, 11 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index 5c7311934f63..c1e4f35f2955 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -1022,22 +1022,25 @@ static __used void ai_nvram_process(struct si_info *sii)
1022} 1022}
1023 1023
1024static struct si_info *ai_doattach(struct si_info *sii, 1024static struct si_info *ai_doattach(struct si_info *sii,
1025 void __iomem *regs, struct pci_dev *pbus) 1025 struct bcma_bus *pbus)
1026{ 1026{
1027 void __iomem *regs = pbus->mmio;
1027 struct si_pub *sih = &sii->pub; 1028 struct si_pub *sih = &sii->pub;
1028 u32 w, savewin; 1029 u32 w, savewin;
1029 struct chipcregs __iomem *cc; 1030 struct chipcregs __iomem *cc;
1030 uint socitype; 1031 uint socitype;
1031 uint origidx; 1032 uint origidx;
1032 1033
1034 /* assume the window is looking at chipcommon */
1035 WARN_ON(pbus->mapped_core->id.id != BCMA_CORE_CHIPCOMMON);
1033 memset((unsigned char *) sii, 0, sizeof(struct si_info)); 1036 memset((unsigned char *) sii, 0, sizeof(struct si_info));
1034 1037
1035 savewin = 0; 1038 savewin = 0;
1036 1039
1040 sii->icbus = pbus;
1037 sii->buscoreidx = BADIDX; 1041 sii->buscoreidx = BADIDX;
1038
1039 sii->curmap = regs; 1042 sii->curmap = regs;
1040 sii->pcibus = pbus; 1043 sii->pcibus = pbus->host_pci;
1041 1044
1042 /* find Chipcommon address */ 1045 /* find Chipcommon address */
1043 pci_read_config_dword(sii->pcibus, PCI_BAR0_WIN, &savewin); 1046 pci_read_config_dword(sii->pcibus, PCI_BAR0_WIN, &savewin);
@@ -1160,13 +1163,10 @@ static struct si_info *ai_doattach(struct si_info *sii,
1160} 1163}
1161 1164
1162/* 1165/*
1163 * Allocate a si handle. 1166 * Allocate a si handle and do the attach.
1164 * devid - pci device id (used to determine chip#)
1165 * osh - opaque OS handle
1166 * regs - virtual address of initial core registers
1167 */ 1167 */
1168struct si_pub * 1168struct si_pub *
1169ai_attach(void __iomem *regs, struct pci_dev *sdh) 1169ai_attach(struct bcma_bus *pbus)
1170{ 1170{
1171 struct si_info *sii; 1171 struct si_info *sii;
1172 1172
@@ -1175,7 +1175,7 @@ ai_attach(void __iomem *regs, struct pci_dev *sdh)
1175 if (sii == NULL) 1175 if (sii == NULL)
1176 return NULL; 1176 return NULL;
1177 1177
1178 if (ai_doattach(sii, regs, sdh) == NULL) { 1178 if (ai_doattach(sii, pbus) == NULL) {
1179 kfree(sii); 1179 kfree(sii);
1180 return NULL; 1180 return NULL;
1181 } 1181 }
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
index 0a8e2f735956..1e93599b6047 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
@@ -17,6 +17,8 @@
17#ifndef _BRCM_AIUTILS_H_ 17#ifndef _BRCM_AIUTILS_H_
18#define _BRCM_AIUTILS_H_ 18#define _BRCM_AIUTILS_H_
19 19
20#include <linux/bcma/bcma.h>
21
20#include "types.h" 22#include "types.h"
21 23
22/* 24/*
@@ -170,6 +172,7 @@ struct gpioh_item {
170/* misc si info needed by some of the routines */ 172/* misc si info needed by some of the routines */
171struct si_info { 173struct si_info {
172 struct si_pub pub; /* back plane public state (must be first) */ 174 struct si_pub pub; /* back plane public state (must be first) */
175 struct bcma_bus *icbus; /* handle to soc interconnect bus */
173 struct pci_dev *pcibus; /* handle to pci bus */ 176 struct pci_dev *pcibus; /* handle to pci bus */
174 uint dev_coreid; /* the core provides driver functions */ 177 uint dev_coreid; /* the core provides driver functions */
175 void *intr_arg; /* interrupt callback function arg */ 178 void *intr_arg; /* interrupt callback function arg */
@@ -235,7 +238,7 @@ extern u32 ai_addrspacesize(struct si_pub *sih, uint asidx);
235extern void ai_write_wrap_reg(struct si_pub *sih, u32 offset, u32 val); 238extern void ai_write_wrap_reg(struct si_pub *sih, u32 offset, u32 val);
236 239
237/* === exported functions === */ 240/* === exported functions === */
238extern struct si_pub *ai_attach(void __iomem *regs, struct pci_dev *sdh); 241extern struct si_pub *ai_attach(struct bcma_bus *pbus);
239extern void ai_detach(struct si_pub *sih); 242extern void ai_detach(struct si_pub *sih);
240extern uint ai_coreid(struct si_pub *sih); 243extern uint ai_coreid(struct si_pub *sih);
241extern uint ai_corerev(struct si_pub *sih); 244extern uint ai_corerev(struct si_pub *sih);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index d329c900be79..73bc0ab78320 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -4469,7 +4469,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core,
4469 * Do the hardware portion of the attach. Also initialize software 4469 * Do the hardware portion of the attach. Also initialize software
4470 * state that depends on the particular hardware we are running. 4470 * state that depends on the particular hardware we are running.
4471 */ 4471 */
4472 wlc_hw->sih = ai_attach(core->bus->mmio, core->bus->host_pci); 4472 wlc_hw->sih = ai_attach(core->bus);
4473 if (wlc_hw->sih == NULL) { 4473 if (wlc_hw->sih == NULL) {
4474 wiphy_err(wiphy, "wl%d: brcms_b_attach: si_attach failed\n", 4474 wiphy_err(wiphy, "wl%d: brcms_b_attach: si_attach failed\n",
4475 unit); 4475 unit);