Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278948
b: refs/heads/master
c: 3b758a6
h: refs/heads/master
v: v3
  • Loading branch information
Arend van Spriel authored and John W. Linville committed Dec 13, 2011
1 parent bb16351 commit 1596814
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 185 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e3d5af56e1a50c9bc3c24810e6b25df91d37bc77
refs/heads/master: 3b758a68402fc5b1c2dbc246595dbdc062bf0da9
121 changes: 3 additions & 118 deletions trunk/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,50 +477,6 @@ static void ai_scan(struct si_pub *sih, struct bcma_bus *bus)
}
}

static struct bcma_device *ai_find_bcma_core(struct si_pub *sih, uint coreidx)
{
struct si_info *sii = (struct si_info *)sih;
struct bcma_device *core;

list_for_each_entry(core, &sii->icbus->cores, list) {
if (core->core_index == coreidx)
return core;
}
return NULL;
}
/*
* This function changes the logical "focus" to the indicated core.
* 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 __iomem *ai_setcoreidx(struct si_pub *sih, uint coreidx)
{
struct si_info *sii = (struct si_info *)sih;
struct bcma_device *core;

if (sii->curidx != coreidx) {
core = ai_find_bcma_core(sih, coreidx);
if (core == NULL)
return NULL;

(void)bcma_aread32(core, BCMA_IOST);
sii->curidx = coreidx;
}
return sii->curmap;
}

uint ai_corerev(struct si_pub *sih)
{
struct si_info *sii;
u32 cib;

sii = (struct si_info *)sih;
cib = sii->cib[sii->curidx];
return (cib & CIB_REV_MASK) >> CIB_REV_SHIFT;
}

/* return true if PCIE capability exists in the pci config space */
static bool ai_ispcie(struct si_info *sii)
{
Expand Down Expand Up @@ -579,9 +535,8 @@ ai_buscore_setup(struct si_info *sii, struct bcma_device *cc)
for (i = 0; i < sii->numcores; i++) {
uint cid, crev;

ai_setcoreidx(&sii->pub, i);
cid = ai_coreid(&sii->pub);
crev = ai_corerev(&sii->pub);
cid = sii->coreid[i];
crev = (sii->cib[i] & CIB_REV_MASK) >> CIB_REV_SHIFT;

if (cid == PCI_CORE_ID) {
pciidx = i;
Expand Down Expand Up @@ -804,22 +759,6 @@ void ai_detach(struct si_pub *sih)
kfree(sii);
}

uint ai_coreid(struct si_pub *sih)
{
struct si_info *sii;

sii = (struct si_info *)sih;
return sii->coreid[sii->curidx];
}

uint ai_coreidx(struct si_pub *sih)
{
struct si_info *sii;

sii = (struct si_info *)sih;
return sii->curidx;
}

/* return index of coreid or BADIDX if not found */
struct bcma_device *ai_findcore(struct si_pub *sih, u16 coreid, u16 coreunit)
{
Expand All @@ -842,45 +781,17 @@ struct bcma_device *ai_findcore(struct si_pub *sih, u16 coreid, u16 coreunit)
}

/*
* This function changes logical "focus" to the indicated core;
* must be called with interrupts off.
* Moreover, callers should keep interrupts off during switching
* out of and back to d11 core.
*/
void __iomem *ai_setcore(struct si_pub *sih, uint coreid, uint coreunit)
{
struct bcma_device *core;

core = ai_findcore(sih, coreid, coreunit);
if (core == NULL)
return NULL;

return ai_setcoreidx(sih, core->core_index);
}

/*
* Switch to 'coreidx', issue a single arbitrary 32bit register mask&set
* operation, switch back to the original core, and return the new value.
*
* When using the silicon backplane, no fiddling with interrupts or core
* switches is needed.
*
* Also, when using pci/pcie, we can optimize away the core switching for pci
* registers and (on newer pci cores) chipcommon registers.
* read/modify chipcommon core register.
*/
uint ai_cc_reg(struct si_pub *sih, uint regoff, u32 mask, u32 val)
{
struct bcma_device *cc;
uint origidx = 0;
u32 w;
struct si_info *sii;

sii = (struct si_info *)sih;
cc = sii->icbus->drv_cc.core;

/* save current core index */
origidx = ai_coreidx(&sii->pub);

/* mask and set */
if (mask || val) {
bcma_maskset32(cc, regoff, ~mask, val);
Expand All @@ -889,9 +800,6 @@ uint ai_cc_reg(struct si_pub *sih, uint regoff, u32 mask, u32 val)
/* readback */
w = bcma_read32(cc, regoff);

/* restore core index */
ai_setcoreidx(&sii->pub, origidx);

return w;
}

Expand Down Expand Up @@ -1237,20 +1145,10 @@ void ai_pci_down(struct si_pub *sih)
void ai_pci_setup(struct si_pub *sih, uint coremask)
{
struct si_info *sii;
struct sbpciregs __iomem *regs = NULL;
u32 w;
uint idx = 0;

sii = (struct si_info *)sih;

if (PCI(sih)) {
/* get current core index */
idx = sii->curidx;

/* switch over to pci core */
regs = ai_setcoreidx(sih, sii->buscoreidx);
}

/*
* Enable sb->pci interrupts. Assume
* PCI rev 2.3 support was added in pci core rev 6 and things changed..
Expand All @@ -1264,9 +1162,6 @@ void ai_pci_setup(struct si_pub *sih, uint coremask)

if (PCI(sih)) {
pcicore_pci_setup(sii->pch);

/* switch back to previous core */
ai_setcoreidx(sih, idx);
}
}

Expand All @@ -1276,21 +1171,11 @@ void ai_pci_setup(struct si_pub *sih, uint coremask)
*/
int ai_pci_fixcfg(struct si_pub *sih)
{
uint origidx;
void __iomem *regs = NULL;
struct si_info *sii = (struct si_info *)sih;

/* Fixup PI in SROM shadow area to enable the correct PCI core access */
/* save the current index */
origidx = ai_coreidx(&sii->pub);

/* check 'pi' is correct and fix it if not */
regs = ai_setcore(&sii->pub, ai_get_buscoretype(sih), 0);
pcicore_fixcfg(sii->pch);

/* restore the original index */
ai_setcoreidx(&sii->pub, origidx);

pcicore_hwup(sii->pch);
return 0;
}
Expand Down
7 changes: 0 additions & 7 deletions trunk/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,12 @@ struct si_info {
/* AMBA Interconnect exported externs */
extern struct bcma_device *ai_findcore(struct si_pub *sih,
u16 coreid, u16 coreunit);
extern uint ai_coreidx(struct si_pub *sih);
extern uint ai_corerev(struct si_pub *sih);
extern u32 ai_core_cflags(struct bcma_device *core, u32 mask, u32 val);

/* === exported functions === */
extern struct si_pub *ai_attach(struct bcma_bus *pbus);
extern void ai_detach(struct si_pub *sih);
extern uint ai_coreid(struct si_pub *sih);
extern uint ai_corerev(struct si_pub *sih);
extern uint ai_cc_reg(struct si_pub *sih, uint regoff, u32 mask, u32 val);
extern uint ai_findcoreidx(struct si_pub *sih, uint coreid, uint coreunit);
extern void __iomem *ai_setcoreidx(struct si_pub *sih, uint coreidx);
extern void __iomem *ai_setcore(struct si_pub *sih, uint coreid, uint coreunit);
extern void ai_pci_setup(struct si_pub *sih, uint coremask);
extern void ai_clkctl_init(struct si_pub *sih);
extern u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih);
Expand Down
Loading

0 comments on commit 1596814

Please sign in to comment.