staging: brcm80211: got rid of several void pointers for softmac PCI
Code cleanup. Replace void * related to PCI functionality by less generic pointer types. Reported-by: Julian Calaby <julian.calaby@gmail.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
cdf853c05d
commit
a51e4478f5
@@ -1850,7 +1850,7 @@ int ai_devpath(struct si_pub *sih, char *path, int size)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
slen = snprintf(path, (size_t) size, "pci/%u/%u/",
|
slen = snprintf(path, (size_t) size, "pci/%u/%u/",
|
||||||
((struct pci_dev *)((SI_INFO(sih))->pbus))->bus->number,
|
(((SI_INFO(sih))->pbus))->bus->number,
|
||||||
PCI_SLOT(((struct pci_dev *)((SI_INFO(sih))->pbus))->devfn));
|
PCI_SLOT(((struct pci_dev *)((SI_INFO(sih))->pbus))->devfn));
|
||||||
|
|
||||||
if (slen < 0 || slen >= size) {
|
if (slen < 0 || slen >= size) {
|
||||||
@@ -2025,8 +2025,7 @@ void ai_pci_setup(struct si_pub *sih, uint coremask)
|
|||||||
int ai_pci_fixcfg(struct si_pub *sih)
|
int ai_pci_fixcfg(struct si_pub *sih)
|
||||||
{
|
{
|
||||||
uint origidx;
|
uint origidx;
|
||||||
struct sbpciregs *regs = NULL;
|
void *regs = NULL;
|
||||||
|
|
||||||
struct si_info *sii = SI_INFO(sih);
|
struct si_info *sii = SI_INFO(sih);
|
||||||
|
|
||||||
/* Fixup PI in SROM shadow area to enable the correct PCI core access */
|
/* Fixup PI in SROM shadow area to enable the correct PCI core access */
|
||||||
@@ -2035,7 +2034,10 @@ int ai_pci_fixcfg(struct si_pub *sih)
|
|||||||
|
|
||||||
/* check 'pi' is correct and fix it if not */
|
/* check 'pi' is correct and fix it if not */
|
||||||
regs = ai_setcore(&sii->pub, sii->pub.buscoretype, 0);
|
regs = ai_setcore(&sii->pub, sii->pub.buscoretype, 0);
|
||||||
pcicore_fixcfg(sii->pch, regs);
|
if (sii->pub.buscoretype == PCIE_CORE_ID)
|
||||||
|
pcicore_fixcfg_pcie(sii->pch, (struct sbpcieregs *)regs);
|
||||||
|
else if (sii->pub.buscoretype == PCI_CORE_ID)
|
||||||
|
pcicore_fixcfg_pci(sii->pch, (struct sbpciregs *)regs);
|
||||||
|
|
||||||
/* restore the original index */
|
/* restore the original index */
|
||||||
ai_setcoreidx(&sii->pub, origidx);
|
ai_setcoreidx(&sii->pub, origidx);
|
||||||
|
@@ -459,7 +459,7 @@ struct gpioh_item {
|
|||||||
/* misc si info needed by some of the routines */
|
/* misc si info needed by some of the routines */
|
||||||
struct si_info {
|
struct si_info {
|
||||||
struct si_pub pub; /* back plane public state (must be first) */
|
struct si_pub pub; /* back plane public state (must be first) */
|
||||||
void *pbus; /* handle to bus (pci/sdio/..) */
|
struct pci_dev *pbus; /* handle to pci bus */
|
||||||
uint dev_coreid; /* the core provides driver functions */
|
uint dev_coreid; /* the core provides driver functions */
|
||||||
void *intr_arg; /* interrupt callback function arg */
|
void *intr_arg; /* interrupt callback function arg */
|
||||||
u32 (*intrsoff_fn) (void *intr_arg); /* turns chip interrupts off */
|
u32 (*intrsoff_fn) (void *intr_arg); /* turns chip interrupts off */
|
||||||
|
@@ -252,7 +252,7 @@ struct dma_info {
|
|||||||
uint *msg_level; /* message level pointer */
|
uint *msg_level; /* message level pointer */
|
||||||
char name[MAXNAMEL]; /* callers name for diag msgs */
|
char name[MAXNAMEL]; /* callers name for diag msgs */
|
||||||
|
|
||||||
void *pbus; /* bus handle */
|
struct pci_dev *pbus; /* bus handle */
|
||||||
|
|
||||||
bool dma64; /* this dma engine is operating in 64-bit mode */
|
bool dma64; /* this dma engine is operating in 64-bit mode */
|
||||||
bool addrext; /* this dma engine supports DmaExtendedAddrChanges */
|
bool addrext; /* this dma engine supports DmaExtendedAddrChanges */
|
||||||
|
@@ -245,7 +245,8 @@ static void pcie_war_pci_setup(struct pcicore_info *pi);
|
|||||||
/* Initialize the PCI core.
|
/* Initialize the PCI core.
|
||||||
* It's caller's responsibility to make sure that this is done only once
|
* It's caller's responsibility to make sure that this is done only once
|
||||||
*/
|
*/
|
||||||
void *pcicore_init(struct si_pub *sih, void *pdev, void *regs)
|
struct pcicore_info *pcicore_init(struct si_pub *sih, struct pci_dev *pdev,
|
||||||
|
void *regs)
|
||||||
{
|
{
|
||||||
struct pcicore_info *pi;
|
struct pcicore_info *pi;
|
||||||
|
|
||||||
@@ -271,7 +272,7 @@ void *pcicore_init(struct si_pub *sih, void *pdev, void *regs)
|
|||||||
return pi;
|
return pi;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcicore_deinit(void *pch)
|
void pcicore_deinit(struct pcicore_info *pch)
|
||||||
{
|
{
|
||||||
kfree(pch);
|
kfree(pch);
|
||||||
}
|
}
|
||||||
@@ -279,7 +280,7 @@ void pcicore_deinit(void *pch)
|
|||||||
/* return cap_offset if requested capability exists in the PCI config space */
|
/* return cap_offset if requested capability exists in the PCI config space */
|
||||||
/* Note that it's caller's responsibility to make sure it's a pci bus */
|
/* Note that it's caller's responsibility to make sure it's a pci bus */
|
||||||
u8
|
u8
|
||||||
pcicore_find_pci_capability(void *dev, u8 req_cap_id,
|
pcicore_find_pci_capability(struct pci_dev *dev, u8 req_cap_id,
|
||||||
unsigned char *buf, u32 *buflen)
|
unsigned char *buf, u32 *buflen)
|
||||||
{
|
{
|
||||||
u8 cap_id;
|
u8 cap_id;
|
||||||
@@ -484,9 +485,8 @@ pcie_mdiowrite(struct pcicore_info *pi, uint physmedia, uint regaddr, uint val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ***** Support functions ***** */
|
/* ***** Support functions ***** */
|
||||||
static u8 pcie_clkreq(void *pch, u32 mask, u32 val)
|
static u8 pcie_clkreq(struct pcicore_info *pi, u32 mask, u32 val)
|
||||||
{
|
{
|
||||||
struct pcicore_info *pi = pch;
|
|
||||||
u32 reg_val;
|
u32 reg_val;
|
||||||
u8 offset;
|
u8 offset;
|
||||||
|
|
||||||
@@ -536,7 +536,7 @@ static void pcie_clkreq_upd(struct pcicore_info *pi, uint state)
|
|||||||
switch (state) {
|
switch (state) {
|
||||||
case SI_DOATTACH:
|
case SI_DOATTACH:
|
||||||
if (PCIE_ASPM(sih))
|
if (PCIE_ASPM(sih))
|
||||||
pcie_clkreq((void *)pi, 1, 0);
|
pcie_clkreq(pi, 1, 0);
|
||||||
break;
|
break;
|
||||||
case SI_PCIDOWN:
|
case SI_PCIDOWN:
|
||||||
if (sih->buscorerev == 6) { /* turn on serdes PLL down */
|
if (sih->buscorerev == 6) { /* turn on serdes PLL down */
|
||||||
@@ -547,7 +547,7 @@ static void pcie_clkreq_upd(struct pcicore_info *pi, uint state)
|
|||||||
offsetof(struct chipcregs, chipcontrol_data),
|
offsetof(struct chipcregs, chipcontrol_data),
|
||||||
~0x40, 0);
|
~0x40, 0);
|
||||||
} else if (pi->pcie_pr42767) {
|
} else if (pi->pcie_pr42767) {
|
||||||
pcie_clkreq((void *)pi, 1, 1);
|
pcie_clkreq(pi, 1, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SI_PCIUP:
|
case SI_PCIUP:
|
||||||
@@ -559,7 +559,7 @@ static void pcie_clkreq_upd(struct pcicore_info *pi, uint state)
|
|||||||
offsetof(struct chipcregs, chipcontrol_data),
|
offsetof(struct chipcregs, chipcontrol_data),
|
||||||
~0x40, 0x40);
|
~0x40, 0x40);
|
||||||
} else if (PCIE_ASPM(sih)) { /* disable clkreq */
|
} else if (PCIE_ASPM(sih)) { /* disable clkreq */
|
||||||
pcie_clkreq((void *)pi, 1, 0);
|
pcie_clkreq(pi, 1, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -729,9 +729,8 @@ static void pcie_war_pci_setup(struct pcicore_info *pi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ***** Functions called during driver state changes ***** */
|
/* ***** Functions called during driver state changes ***** */
|
||||||
void pcicore_attach(void *pch, char *pvars, int state)
|
void pcicore_attach(struct pcicore_info *pi, char *pvars, int state)
|
||||||
{
|
{
|
||||||
struct pcicore_info *pi = pch;
|
|
||||||
struct si_pub *sih = pi->sih;
|
struct si_pub *sih = pi->sih;
|
||||||
|
|
||||||
/* Determine if this board needs override */
|
/* Determine if this board needs override */
|
||||||
@@ -753,20 +752,16 @@ void pcicore_attach(void *pch, char *pvars, int state)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcicore_hwup(void *pch)
|
void pcicore_hwup(struct pcicore_info *pi)
|
||||||
{
|
{
|
||||||
struct pcicore_info *pi = pch;
|
|
||||||
|
|
||||||
if (!pi || !PCIE_PUB(pi->sih))
|
if (!pi || !PCIE_PUB(pi->sih))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pcie_war_pci_setup(pi);
|
pcie_war_pci_setup(pi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcicore_up(void *pch, int state)
|
void pcicore_up(struct pcicore_info *pi, int state)
|
||||||
{
|
{
|
||||||
struct pcicore_info *pi = pch;
|
|
||||||
|
|
||||||
if (!pi || !PCIE_PUB(pi->sih))
|
if (!pi || !PCIE_PUB(pi->sih))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -779,9 +774,8 @@ void pcicore_up(void *pch, int state)
|
|||||||
/* When the device is going to enter D3 state
|
/* When the device is going to enter D3 state
|
||||||
* (or the system is going to enter S3/S4 states)
|
* (or the system is going to enter S3/S4 states)
|
||||||
*/
|
*/
|
||||||
void pcicore_sleep(void *pch)
|
void pcicore_sleep(struct pcicore_info *pi)
|
||||||
{
|
{
|
||||||
struct pcicore_info *pi = pch;
|
|
||||||
u32 w;
|
u32 w;
|
||||||
|
|
||||||
if (!pi || !PCIE_ASPM(pi->sih))
|
if (!pi || !PCIE_ASPM(pi->sih))
|
||||||
@@ -794,10 +788,8 @@ void pcicore_sleep(void *pch)
|
|||||||
pi->pcie_pr42767 = false;
|
pi->pcie_pr42767 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcicore_down(void *pch, int state)
|
void pcicore_down(struct pcicore_info *pi, int state)
|
||||||
{
|
{
|
||||||
struct pcicore_info *pi = pch;
|
|
||||||
|
|
||||||
if (!pi || !PCIE_PUB(pi->sih))
|
if (!pi || !PCIE_PUB(pi->sih))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -808,21 +800,12 @@ void pcicore_down(void *pch, int state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* precondition: current core is sii->buscoretype */
|
/* precondition: current core is sii->buscoretype */
|
||||||
void pcicore_fixcfg(void *pch, void *regs)
|
static void pcicore_fixcfg(struct pcicore_info *pi, u16 *reg16)
|
||||||
{
|
{
|
||||||
struct pcicore_info *pi = pch;
|
|
||||||
struct si_info *sii = SI_INFO(pi->sih);
|
struct si_info *sii = SI_INFO(pi->sih);
|
||||||
struct sbpciregs *pciregs = regs;
|
u16 val16;
|
||||||
struct sbpcieregs *pcieregs = regs;
|
|
||||||
u16 val16, *reg16 = NULL;
|
|
||||||
uint pciidx;
|
uint pciidx;
|
||||||
|
|
||||||
/* check 'pi' is correct and fix it if not */
|
|
||||||
if (sii->pub.buscoretype == PCIE_CORE_ID)
|
|
||||||
reg16 = &pcieregs->sprom[SRSH_PI_OFFSET];
|
|
||||||
else if (sii->pub.buscoretype == PCI_CORE_ID)
|
|
||||||
reg16 = &pciregs->sprom[SRSH_PI_OFFSET];
|
|
||||||
|
|
||||||
pciidx = ai_coreidx(&sii->pub);
|
pciidx = ai_coreidx(&sii->pub);
|
||||||
val16 = R_REG(reg16);
|
val16 = R_REG(reg16);
|
||||||
if (((val16 & SRSH_PI_MASK) >> SRSH_PI_SHIFT) != (u16)pciidx) {
|
if (((val16 & SRSH_PI_MASK) >> SRSH_PI_SHIFT) != (u16)pciidx) {
|
||||||
@@ -832,11 +815,19 @@ void pcicore_fixcfg(void *pch, void *regs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* precondition: current core is pci core */
|
void pcicore_fixcfg_pci(struct pcicore_info *pi, struct sbpciregs *pciregs)
|
||||||
void pcicore_pci_setup(void *pch, void *regs)
|
{
|
||||||
|
pcicore_fixcfg(pi, &pciregs->sprom[SRSH_PI_OFFSET]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pcicore_fixcfg_pcie(struct pcicore_info *pi, struct sbpcieregs *pcieregs)
|
||||||
|
{
|
||||||
|
pcicore_fixcfg(pi, &pcieregs->sprom[SRSH_PI_OFFSET]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* precondition: current core is pci core */
|
||||||
|
void pcicore_pci_setup(struct pcicore_info *pi, struct sbpciregs *pciregs)
|
||||||
{
|
{
|
||||||
struct pcicore_info *pi = pch;
|
|
||||||
struct sbpciregs *pciregs = regs;
|
|
||||||
u32 w;
|
u32 w;
|
||||||
|
|
||||||
OR_REG(&pciregs->sbtopci2, SBTOPCI_PREF | SBTOPCI_BURST);
|
OR_REG(&pciregs->sbtopci2, SBTOPCI_PREF | SBTOPCI_BURST);
|
||||||
|
@@ -70,16 +70,24 @@
|
|||||||
#define SRSH_PI_MASK 0xf000 /* bit 15:12 */
|
#define SRSH_PI_MASK 0xf000 /* bit 15:12 */
|
||||||
#define SRSH_PI_SHIFT 12 /* bit 15:12 */
|
#define SRSH_PI_SHIFT 12 /* bit 15:12 */
|
||||||
|
|
||||||
extern void *pcicore_init(struct si_pub *sih, void *pdev, void *regs);
|
struct sbpciregs;
|
||||||
extern void pcicore_deinit(void *pch);
|
struct sbpcieregs;
|
||||||
extern void pcicore_attach(void *pch, char *pvars, int state);
|
|
||||||
extern void pcicore_hwup(void *pch);
|
extern struct pcicore_info *pcicore_init(struct si_pub *sih,
|
||||||
extern void pcicore_up(void *pch, int state);
|
struct pci_dev *pdev, void *regs);
|
||||||
extern void pcicore_sleep(void *pch);
|
extern void pcicore_deinit(struct pcicore_info *pch);
|
||||||
extern void pcicore_down(void *pch, int state);
|
extern void pcicore_attach(struct pcicore_info *pch, char *pvars, int state);
|
||||||
extern u8 pcicore_find_pci_capability(void *dev, u8 req_cap_id,
|
extern void pcicore_hwup(struct pcicore_info *pch);
|
||||||
unsigned char *buf, u32 *buflen);
|
extern void pcicore_up(struct pcicore_info *pch, int state);
|
||||||
extern void pcicore_fixcfg(void *pch, void *regs);
|
extern void pcicore_sleep(struct pcicore_info *pch);
|
||||||
extern void pcicore_pci_setup(void *pch, void *regs);
|
extern void pcicore_down(struct pcicore_info *pch, int state);
|
||||||
|
extern u8 pcicore_find_pci_capability(struct pci_dev *dev, u8 req_cap_id,
|
||||||
|
unsigned char *buf, u32 *buflen);
|
||||||
|
extern void pcicore_fixcfg_pci(struct pcicore_info *pch,
|
||||||
|
struct sbpciregs *pciregs);
|
||||||
|
extern void pcicore_fixcfg_pcie(struct pcicore_info *pch,
|
||||||
|
struct sbpcieregs *pciregs);
|
||||||
|
extern void pcicore_pci_setup(struct pcicore_info *pch,
|
||||||
|
struct sbpciregs *pciregs);
|
||||||
|
|
||||||
#endif /* _BRCM_NICPCI_H_ */
|
#endif /* _BRCM_NICPCI_H_ */
|
||||||
|
Reference in New Issue
Block a user