* [PATCH 00/15] staging: brcm80211: big-endian support and cleanup
@ 2011-08-15 13:34 Arend van Spriel
2011-08-15 13:34 ` [PATCH 01/15] staging: brcm80211: got rid of several void pointers for softmac PCI Arend van Spriel
` (15 more replies)
0 siblings, 16 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel
This patch series fixes several issues found on big-endian platform (Sparc,
PowerPC, and MIPS) and some changes to code specific to broadcom MIPS
platforms. Other patches are cleanup items to get rid of void pointer
usage in the drivers.
This series applies to staging-next and depends on the following patch set:
Message-ID: <1313156101-16817-1-git-send-email-arend@broadcom.com>
Arend van Spriel (6):
staging: brcm80211: remove W_SM and R_SM macros from dma.c
staging: brcm80211: remove PHYSADDR macro from dma.c
staging: brcm80211: replace BUS_SWAP32 macro with cpu_to_le32()
staging: brcm80211: remove mips specific include from dma.c
staging: brcm80211: restrict register access method for bcm47xx
staging: brcm80211: restrict MIPS dma bug workaround to BCM47XX
Franky Lin (1):
staging: brcm80211: void * cleanup in fullmac
Henry Ptasinski (3):
staging: brcm80211: fix off-by-one error in swap functions
staging: brcm80211: Remove swaps in R_REG and W_REG macros
staging: brcm80211: Fix handling of firmware and inits on big-endian
platforms
Roland Vossen (5):
staging: brcm80211: got rid of several void pointers for softmac PCI
staging: brcm80211: replaced void pointers in dma functions
staging: brcm80211: replaced void pointers in otp functions
staging: brcm80211: got rid of several void pointers in softmac
staging: brcm80211: removed unused MIPS specific SDRAM swap window
drivers/staging/brcm80211/brcmfmac/dhd.h | 5 +-
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 14 +-
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 6 +-
drivers/staging/brcm80211/brcmsmac/aiutils.c | 10 +-
drivers/staging/brcm80211/brcmsmac/aiutils.h | 4 +-
drivers/staging/brcm80211/brcmsmac/ampdu.c | 14 --
drivers/staging/brcm80211/brcmsmac/dma.c | 169 ++++++++--------------
drivers/staging/brcm80211/brcmsmac/dma.h | 12 +-
drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 28 ++--
drivers/staging/brcm80211/brcmsmac/mac80211_if.h | 4 +-
drivers/staging/brcm80211/brcmsmac/main.c | 70 +++++----
drivers/staging/brcm80211/brcmsmac/main.h | 23 +---
drivers/staging/brcm80211/brcmsmac/nicpci.c | 61 ++++-----
drivers/staging/brcm80211/brcmsmac/nicpci.h | 30 +++--
drivers/staging/brcm80211/brcmsmac/otp.c | 90 +++++-------
drivers/staging/brcm80211/brcmsmac/otp.h | 12 +-
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 2 +-
drivers/staging/brcm80211/brcmsmac/phy_shim.c | 7 +-
drivers/staging/brcm80211/brcmsmac/phy_shim.h | 3 +-
drivers/staging/brcm80211/brcmsmac/pub.h | 16 +--
drivers/staging/brcm80211/brcmsmac/scb.h | 1 -
drivers/staging/brcm80211/brcmsmac/srom.c | 6 +-
drivers/staging/brcm80211/brcmsmac/types.h | 23 +---
23 files changed, 258 insertions(+), 352 deletions(-)
--
1.7.4.1
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 01/15] staging: brcm80211: got rid of several void pointers for softmac PCI
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 02/15] staging: brcm80211: replaced void pointers in dma functions Arend van Spriel
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Roland Vossen, Arend van Spriel
From: Roland Vossen <rvossen@broadcom.com>
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>
---
drivers/staging/brcm80211/brcmsmac/aiutils.c | 10 +++--
drivers/staging/brcm80211/brcmsmac/aiutils.h | 2 +-
drivers/staging/brcm80211/brcmsmac/dma.c | 2 +-
drivers/staging/brcm80211/brcmsmac/nicpci.c | 61 +++++++++++---------------
drivers/staging/brcm80211/brcmsmac/nicpci.h | 30 ++++++++-----
5 files changed, 53 insertions(+), 52 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.c b/drivers/staging/brcm80211/brcmsmac/aiutils.c
index 3d392a3..c9c41a5 100644
--- a/drivers/staging/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/staging/brcm80211/brcmsmac/aiutils.c
@@ -1850,7 +1850,7 @@ int ai_devpath(struct si_pub *sih, char *path, int size)
return -1;
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));
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)
{
uint origidx;
- struct sbpciregs *regs = NULL;
-
+ void *regs = NULL;
struct si_info *sii = SI_INFO(sih);
/* 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 */
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 */
ai_setcoreidx(&sii->pub, origidx);
diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.h b/drivers/staging/brcm80211/brcmsmac/aiutils.h
index 84c6901..7ea42af 100644
--- a/drivers/staging/brcm80211/brcmsmac/aiutils.h
+++ b/drivers/staging/brcm80211/brcmsmac/aiutils.h
@@ -459,7 +459,7 @@ struct gpioh_item {
/* misc si info needed by some of the routines */
struct si_info {
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 */
void *intr_arg; /* interrupt callback function arg */
u32 (*intrsoff_fn) (void *intr_arg); /* turns chip interrupts off */
diff --git a/drivers/staging/brcm80211/brcmsmac/dma.c b/drivers/staging/brcm80211/brcmsmac/dma.c
index 64d7639..10a25d2 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.c
+++ b/drivers/staging/brcm80211/brcmsmac/dma.c
@@ -252,7 +252,7 @@ struct dma_info {
uint *msg_level; /* message level pointer */
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 addrext; /* this dma engine supports DmaExtendedAddrChanges */
diff --git a/drivers/staging/brcm80211/brcmsmac/nicpci.c b/drivers/staging/brcm80211/brcmsmac/nicpci.c
index 8249ea9..2d46e70 100644
--- a/drivers/staging/brcm80211/brcmsmac/nicpci.c
+++ b/drivers/staging/brcm80211/brcmsmac/nicpci.c
@@ -245,7 +245,8 @@ static void pcie_war_pci_setup(struct pcicore_info *pi);
/* Initialize the PCI core.
* 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;
@@ -271,7 +272,7 @@ void *pcicore_init(struct si_pub *sih, void *pdev, void *regs)
return pi;
}
-void pcicore_deinit(void *pch)
+void pcicore_deinit(struct pcicore_info *pch)
{
kfree(pch);
}
@@ -279,7 +280,7 @@ void pcicore_deinit(void *pch)
/* 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 */
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)
{
u8 cap_id;
@@ -484,9 +485,8 @@ pcie_mdiowrite(struct pcicore_info *pi, uint physmedia, uint regaddr, uint val)
}
/* ***** 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;
u8 offset;
@@ -536,7 +536,7 @@ static void pcie_clkreq_upd(struct pcicore_info *pi, uint state)
switch (state) {
case SI_DOATTACH:
if (PCIE_ASPM(sih))
- pcie_clkreq((void *)pi, 1, 0);
+ pcie_clkreq(pi, 1, 0);
break;
case SI_PCIDOWN:
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),
~0x40, 0);
} else if (pi->pcie_pr42767) {
- pcie_clkreq((void *)pi, 1, 1);
+ pcie_clkreq(pi, 1, 1);
}
break;
case SI_PCIUP:
@@ -559,7 +559,7 @@ static void pcie_clkreq_upd(struct pcicore_info *pi, uint state)
offsetof(struct chipcregs, chipcontrol_data),
~0x40, 0x40);
} else if (PCIE_ASPM(sih)) { /* disable clkreq */
- pcie_clkreq((void *)pi, 1, 0);
+ pcie_clkreq(pi, 1, 0);
}
break;
}
@@ -729,9 +729,8 @@ static void pcie_war_pci_setup(struct pcicore_info *pi)
}
/* ***** 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;
/* 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))
return;
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))
return;
@@ -779,9 +774,8 @@ void pcicore_up(void *pch, int state)
/* When the device is going to enter D3 state
* (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;
if (!pi || !PCIE_ASPM(pi->sih))
@@ -794,10 +788,8 @@ void pcicore_sleep(void *pch)
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))
return;
@@ -808,21 +800,12 @@ void pcicore_down(void *pch, int state)
}
/* 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 sbpciregs *pciregs = regs;
- struct sbpcieregs *pcieregs = regs;
- u16 val16, *reg16 = NULL;
+ u16 val16;
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);
val16 = R_REG(reg16);
if (((val16 & SRSH_PI_MASK) >> SRSH_PI_SHIFT) != (u16)pciidx) {
@@ -832,11 +815,19 @@ void pcicore_fixcfg(void *pch, void *regs)
}
}
+void pcicore_fixcfg_pci(struct pcicore_info *pi, struct sbpciregs *pciregs)
+{
+ 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(void *pch, void *regs)
+void pcicore_pci_setup(struct pcicore_info *pi, struct sbpciregs *pciregs)
{
- struct pcicore_info *pi = pch;
- struct sbpciregs *pciregs = regs;
u32 w;
OR_REG(&pciregs->sbtopci2, SBTOPCI_PREF | SBTOPCI_BURST);
diff --git a/drivers/staging/brcm80211/brcmsmac/nicpci.h b/drivers/staging/brcm80211/brcmsmac/nicpci.h
index f71f842..3082db0 100644
--- a/drivers/staging/brcm80211/brcmsmac/nicpci.h
+++ b/drivers/staging/brcm80211/brcmsmac/nicpci.h
@@ -70,16 +70,24 @@
#define SRSH_PI_MASK 0xf000 /* bit 15:12 */
#define SRSH_PI_SHIFT 12 /* bit 15:12 */
-extern void *pcicore_init(struct si_pub *sih, void *pdev, void *regs);
-extern void pcicore_deinit(void *pch);
-extern void pcicore_attach(void *pch, char *pvars, int state);
-extern void pcicore_hwup(void *pch);
-extern void pcicore_up(void *pch, int state);
-extern void pcicore_sleep(void *pch);
-extern void pcicore_down(void *pch, int state);
-extern u8 pcicore_find_pci_capability(void *dev, u8 req_cap_id,
- unsigned char *buf, u32 *buflen);
-extern void pcicore_fixcfg(void *pch, void *regs);
-extern void pcicore_pci_setup(void *pch, void *regs);
+struct sbpciregs;
+struct sbpcieregs;
+
+extern struct pcicore_info *pcicore_init(struct si_pub *sih,
+ struct pci_dev *pdev, void *regs);
+extern void pcicore_deinit(struct pcicore_info *pch);
+extern void pcicore_attach(struct pcicore_info *pch, char *pvars, int state);
+extern void pcicore_hwup(struct pcicore_info *pch);
+extern void pcicore_up(struct pcicore_info *pch, int state);
+extern void pcicore_sleep(struct pcicore_info *pch);
+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_ */
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 02/15] staging: brcm80211: replaced void pointers in dma functions
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
2011-08-15 13:34 ` [PATCH 01/15] staging: brcm80211: got rid of several void pointers for softmac PCI Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 03/15] staging: brcm80211: replaced void pointers in otp functions Arend van Spriel
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Roland Vossen, Arend van Spriel
From: Roland Vossen <rvossen@broadcom.com>
Code cleanup. Replaced 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>
---
drivers/staging/brcm80211/brcmsmac/dma.c | 31 +++++++++++++++--------------
drivers/staging/brcm80211/brcmsmac/dma.h | 4 +-
drivers/staging/brcm80211/brcmsmac/main.c | 4 +-
3 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/dma.c b/drivers/staging/brcm80211/brcmsmac/dma.c
index 10a25d2..3cb9e68 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.c
+++ b/drivers/staging/brcm80211/brcmsmac/dma.c
@@ -275,7 +275,8 @@ struct dma_info {
u16 ntxd; /* # tx descriptors tunable */
u16 txin; /* index of next descriptor to reclaim */
u16 txout; /* index of next descriptor to post */
- void **txp; /* pointer to parallel array of pointers to packets */
+ /* pointer to parallel array of pointers to packets */
+ struct sk_buff **txp;
struct dma_seg_map *txp_dmah; /* DMA MAP meta-data handle */
/* Aligned physical address of descriptor ring */
unsigned long txdpa;
@@ -291,7 +292,8 @@ struct dma_info {
u16 nrxd; /* # rx descriptors tunable */
u16 rxin; /* index of next descriptor to reclaim */
u16 rxout; /* index of next descriptor to post */
- void **rxp; /* pointer to parallel array of pointers to packets */
+ /* pointer to parallel array of pointers to packets */
+ struct sk_buff **rxp;
struct dma_seg_map *rxp_dmah; /* DMA MAP meta-data handle */
/* Aligned physical address of descriptor ring */
unsigned long rxdpa;
@@ -367,7 +369,7 @@ static bool _dma_alloc(struct dma_info *di, uint direction);
static void _dma_ddtable_init(struct dma_info *di, uint direction,
unsigned long pa);
static void _dma_rxenable(struct dma_info *di);
-static void *_dma_getnextrxp(struct dma_info *di, bool forceall);
+static struct sk_buff *_dma_getnextrxp(struct dma_info *di, bool forceall);
static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags);
static u8 dma_align_sizetobits(uint size);
static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size,
@@ -376,7 +378,7 @@ 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 void *dma64_getnextrxp(struct dma_info *di, bool forceall);
+static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall);
static bool dma64_rxidle(struct dma_info *di);
static bool _dma64_addrext(struct dma64regs *dma64regs);
@@ -776,8 +778,7 @@ void dma_rxinit(struct dma_pub *pub)
di->rxin = di->rxout = 0;
/* clear rx descriptor ring */
- memset((void *)di->rxd64, '\0',
- (di->nrxd * sizeof(struct dma64desc)));
+ memset(di->rxd64, '\0', di->nrxd * sizeof(struct dma64desc));
/* DMA engine with out alignment requirement requires table to be inited
* before enabling the engine
@@ -822,7 +823,7 @@ static void _dma_rxenable(struct dma_info *di)
* buffer data. After it reaches the max size of buffer, the data continues
* in next DMA descriptor buffer WITHOUT DMA header
*/
-void *dma_rx(struct dma_pub *pub)
+struct sk_buff *dma_rx(struct dma_pub *pub)
{
struct dma_info *di = (struct dma_info *)pub;
struct sk_buff *p, *head, *tail;
@@ -976,7 +977,7 @@ bool dma_rxfill(struct dma_pub *pub)
void dma_rxreclaim(struct dma_pub *pub)
{
struct dma_info *di = (struct dma_info *)pub;
- void *p;
+ struct sk_buff *p;
DMA_TRACE(("%s: dma_rxreclaim\n", di->name));
@@ -984,7 +985,7 @@ void dma_rxreclaim(struct dma_pub *pub)
brcmu_pkt_buf_free_skb(p);
}
-static void *_dma_getnextrxp(struct dma_info *di, bool forceall)
+static struct sk_buff *_dma_getnextrxp(struct dma_info *di, bool forceall)
{
if (di->nrxd == 0)
return NULL;
@@ -1100,7 +1101,7 @@ void dma_txinit(struct dma_pub *pub)
di->dma.txavail = di->ntxd - 1;
/* clear tx descriptor ring */
- memset((void *)di->txd64, '\0', (di->ntxd * sizeof(struct dma64desc)));
+ memset(di->txd64, '\0', (di->ntxd * sizeof(struct dma64desc)));
/* DMA engine with out alignment requirement requires table to be inited
* before enabling the engine
@@ -1155,7 +1156,7 @@ bool dma_txsuspended(struct dma_pub *pub)
void dma_txreclaim(struct dma_pub *pub, enum txd_range range)
{
struct dma_info *di = (struct dma_info *)pub;
- void *p;
+ struct sk_buff *p;
DMA_TRACE(("%s: dma_txreclaim %s\n", di->name,
(range == DMA_RANGE_ALL) ? "all" :
@@ -1406,12 +1407,12 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit)
* 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.
*/
-void *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
+struct sk_buff *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;
+ struct sk_buff *txp;
DMA_TRACE(("%s: dma_getnexttxp %s\n", di->name,
(range == DMA_RANGE_ALL) ? "all" :
@@ -1499,10 +1500,10 @@ void *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
return NULL;
}
-static void *dma64_getnextrxp(struct dma_info *di, bool forceall)
+static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall)
{
uint i, curr;
- void *rxp;
+ struct sk_buff *rxp;
unsigned long pa;
i = di->rxin;
diff --git a/drivers/staging/brcm80211/brcmsmac/dma.h b/drivers/staging/brcm80211/brcmsmac/dma.h
index 3b23517..134402c 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.h
+++ b/drivers/staging/brcm80211/brcmsmac/dma.h
@@ -80,7 +80,7 @@ extern struct dma_pub *dma_attach(char *name, struct si_pub *sih,
uint nrxpost, uint rxoffset, uint *msg_level);
void dma_rxinit(struct dma_pub *pub);
-void *dma_rx(struct dma_pub *pub);
+struct sk_buff *dma_rx(struct dma_pub *pub);
bool dma_rxfill(struct dma_pub *pub);
bool dma_rxreset(struct dma_pub *pub);
bool dma_txreset(struct dma_pub *pub);
@@ -93,7 +93,7 @@ void dma_txreclaim(struct dma_pub *pub, enum txd_range range);
void dma_rxreclaim(struct dma_pub *pub);
void dma_detach(struct dma_pub *pub);
unsigned long dma_getvar(struct dma_pub *pub, const char *name);
-void *dma_getnexttxp(struct dma_pub *pub, enum txd_range range);
+struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range);
void dma_counterreset(struct dma_pub *pub);
void dma_walk_packets(struct dma_pub *dmah, void (*callback_fnc)
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index bdc7fb4..c462377 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -239,8 +239,8 @@
#define DMAREG(wlc_hw, direction, fifonum) \
((direction == DMA_TX) ? \
- (void *)&(wlc_hw->regs->fifo64regs[fifonum].dmaxmt) : \
- (void *)&(wlc_hw->regs->fifo64regs[fifonum].dmarcv))
+ &(wlc_hw->regs->fifo64regs[fifonum].dmaxmt) : \
+ &(wlc_hw->regs->fifo64regs[fifonum].dmarcv))
#define APHY_SLOT_TIME 9
#define BPHY_SLOT_TIME 20
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 03/15] staging: brcm80211: replaced void pointers in otp functions
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
2011-08-15 13:34 ` [PATCH 01/15] staging: brcm80211: got rid of several void pointers for softmac PCI Arend van Spriel
2011-08-15 13:34 ` [PATCH 02/15] staging: brcm80211: replaced void pointers in dma functions Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 04/15] staging: brcm80211: got rid of several void pointers in softmac Arend van Spriel
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Roland Vossen, Arend van Spriel
From: Roland Vossen <rvossen@broadcom.com>
Code cleanup. Otp is 'One Time Programmable' functionality. Replaced void
pointers 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>
---
drivers/staging/brcm80211/brcmsmac/otp.c | 90 ++++++++++++-----------------
drivers/staging/brcm80211/brcmsmac/otp.h | 12 ++--
2 files changed, 44 insertions(+), 58 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/otp.c b/drivers/staging/brcm80211/brcmsmac/otp.c
index b6ff767..1e0093c 100644
--- a/drivers/staging/brcm80211/brcmsmac/otp.c
+++ b/drivers/staging/brcm80211/brcmsmac/otp.c
@@ -66,13 +66,13 @@
/* OTP function struct */
struct otp_fn_s {
- int (*size)(void *oh);
- u16 (*read_bit)(void *oh, struct chipcregs *cc, uint off);
- void *(*init)(struct si_pub *sih);
- int (*read_region)(struct si_pub *sih, int region, u16 *data,
+ int (*size)(struct otpinfo *oi);
+ u16 (*read_bit)(struct otpinfo *oi, struct chipcregs *cc, uint off);
+ struct otpinfo *(*init)(struct si_pub *sih);
+ int (*read_region)(struct otpinfo *oi, int region, u16 *data,
uint *wlen);
- int (*nvread)(void *oh, char *data, uint *len);
- int (*status)(void *oh);
+ int (*nvread)(struct otpinfo *oi, char *data, uint *len);
+ int (*status)(struct otpinfo *oi);
};
struct otpinfo {
@@ -148,31 +148,24 @@ static struct otpinfo otpinfo;
#define OTP4315_SWREG_SZ 178 /* 178 bytes */
#define OTP_SZ_FU_144 (144/8) /* 144 bits */
-static int ipxotp_status(void *oh)
+static int ipxotp_status(struct otpinfo *oi)
{
- struct otpinfo *oi = (struct otpinfo *) oh;
return (int)(oi->status);
}
/* Return size in bytes */
-static int ipxotp_size(void *oh)
+static int ipxotp_size(struct otpinfo *oi)
{
- struct otpinfo *oi = (struct otpinfo *) oh;
return (int)oi->wsize * 2;
}
-static u16 ipxotp_otpr(void *oh, struct chipcregs *cc, uint wn)
+static u16 ipxotp_otpr(struct otpinfo *oi, struct chipcregs *cc, uint wn)
{
- struct otpinfo *oi;
-
- oi = (struct otpinfo *) oh;
-
return R_REG(&cc->sromotp[wn]);
}
-static u16 ipxotp_read_bit(void *oh, struct chipcregs *cc, uint off)
+static u16 ipxotp_read_bit(struct otpinfo *oi, struct chipcregs *cc, uint off)
{
- struct otpinfo *oi = (struct otpinfo *) oh;
uint k, row, col;
u32 otpp, st;
@@ -300,7 +293,7 @@ static void _ipxotp_init(struct otpinfo *oi, struct chipcregs *cc)
oi->flim = oi->wsize;
}
-static void *ipxotp_init(struct si_pub *sih)
+static struct otpinfo *ipxotp_init(struct si_pub *sih)
{
uint idx;
struct chipcregs *cc;
@@ -355,12 +348,12 @@ static void *ipxotp_init(struct si_pub *sih)
ai_setcoreidx(sih, idx);
- return (void *)oi;
+ return oi;
}
-static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen)
+static int
+ipxotp_read_region(struct otpinfo *oi, int region, u16 *data, uint *wlen)
{
- struct otpinfo *oi = (struct otpinfo *) oh;
uint idx;
struct chipcregs *cc;
uint base, i, sz;
@@ -436,27 +429,27 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen)
/* Read the data */
for (i = 0; i < sz; i++)
- data[i] = ipxotp_otpr(oh, cc, base + i);
+ data[i] = ipxotp_otpr(oi, cc, base + i);
ai_setcoreidx(oi->sih, idx);
*wlen = sz;
return 0;
}
-static int ipxotp_nvread(void *oh, char *data, uint *len)
+static int ipxotp_nvread(struct otpinfo *oi, char *data, uint *len)
{
return -ENOTSUPP;
}
static struct otp_fn_s ipxotp_fn = {
- (int (*)(void *)) ipxotp_size,
- (u16 (*)(void *, struct chipcregs *, uint)) ipxotp_read_bit,
+ (int (*)(struct otpinfo *)) ipxotp_size,
+ (u16 (*)(struct otpinfo *, struct chipcregs *, uint)) ipxotp_read_bit,
- (void *(*)(struct si_pub *)) ipxotp_init,
- (int (*)(struct si_pub *, int, u16 *, uint *)) ipxotp_read_region,
- (int (*)(void *, char *, uint *)) ipxotp_nvread,
+ (struct otpinfo *(*)(struct si_pub *)) ipxotp_init,
+ (int (*)(struct otpinfo *, int, u16 *, uint *)) ipxotp_read_region,
+ (int (*)(struct otpinfo *, char *, uint *)) ipxotp_nvread,
- (int (*)(void *)) ipxotp_status
+ (int (*)(struct otpinfo *)) ipxotp_status
};
/*
@@ -468,34 +461,29 @@ static struct otp_fn_s ipxotp_fn = {
* otp_nvread()
*/
-int otp_status(void *oh)
+int otp_status(struct otpinfo *oi)
{
- struct otpinfo *oi = (struct otpinfo *) oh;
-
- return oi->fn->status(oh);
+ return oi->fn->status(oi);
}
-int otp_size(void *oh)
+int otp_size(struct otpinfo *oi)
{
- struct otpinfo *oi = (struct otpinfo *) oh;
-
- return oi->fn->size(oh);
+ return oi->fn->size(oi);
}
-u16 otp_read_bit(void *oh, uint offset)
+u16 otp_read_bit(struct otpinfo *oi, uint offset)
{
- struct otpinfo *oi = (struct otpinfo *) oh;
uint idx = ai_coreidx(oi->sih);
struct chipcregs *cc = ai_setcoreidx(oi->sih, SI_CC_IDX);
- u16 readBit = (u16) oi->fn->read_bit(oh, cc, offset);
+ u16 readBit = (u16) oi->fn->read_bit(oi, cc, offset);
ai_setcoreidx(oi->sih, idx);
return readBit;
}
-void *otp_init(struct si_pub *sih)
+struct otpinfo *otp_init(struct si_pub *sih)
{
struct otpinfo *oi;
- void *ret = NULL;
+ struct otpinfo *ret = NULL;
oi = &otpinfo;
memset(oi, 0, sizeof(struct otpinfo));
@@ -516,9 +504,8 @@ void *otp_init(struct si_pub *sih)
}
int
-otp_read_region(struct si_pub *sih, int region, u16 *data,
- uint *wlen) {
- void *oh;
+otp_read_region(struct si_pub *sih, int region, u16 *data, uint *wlen) {
+ struct otpinfo *oi;
int err = 0;
if (ai_is_otp_disabled(sih)) {
@@ -526,22 +513,19 @@ otp_read_region(struct si_pub *sih, int region, u16 *data,
goto out;
}
- oh = otp_init(sih);
- if (oh == NULL) {
+ oi = otp_init(sih);
+ if (oi == NULL) {
err = -EBADE;
goto out;
}
- err = (((struct otpinfo *) oh)->fn->read_region)
- (oh, region, data, wlen);
+ err = ((oi)->fn->read_region)(oi, region, data, wlen);
out:
return err;
}
-int otp_nvread(void *oh, char *data, uint *len)
+int otp_nvread(struct otpinfo *oi, char *data, uint *len)
{
- struct otpinfo *oi = (struct otpinfo *) oh;
-
- return oi->fn->nvread(oh, data, len);
+ return oi->fn->nvread(oi, data, len);
}
diff --git a/drivers/staging/brcm80211/brcmsmac/otp.h b/drivers/staging/brcm80211/brcmsmac/otp.h
index 4d79246..938100e 100644
--- a/drivers/staging/brcm80211/brcmsmac/otp.h
+++ b/drivers/staging/brcm80211/brcmsmac/otp.h
@@ -36,13 +36,15 @@
/* OTP usage */
#define OTP4325_FM_DISABLED_OFFSET 188
+struct otpinfo;
+
/* Exported functions */
-extern int otp_status(void *oh);
-extern int otp_size(void *oh);
-extern u16 otp_read_bit(void *oh, uint offset);
-extern void *otp_init(struct si_pub *sih);
+extern int otp_status(struct otpinfo *oi);
+extern int otp_size(struct otpinfo *oi);
+extern u16 otp_read_bit(struct otpinfo *oi, uint offset);
+extern struct otpinfo *otp_init(struct si_pub *sih);
extern int otp_read_region(struct si_pub *sih, int region, u16 *data,
uint *wlen);
-extern int otp_nvread(void *oh, char *data, uint *len);
+extern int otp_nvread(struct otpinfo *oi, char *data, uint *len);
#endif /* _BRCM_OTP_H_ */
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 04/15] staging: brcm80211: got rid of several void pointers in softmac
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (2 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 03/15] staging: brcm80211: replaced void pointers in otp functions Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 05/15] staging: brcm80211: void * cleanup in fullmac Arend van Spriel
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Roland Vossen, Arend van Spriel
From: Roland Vossen <rvossen@broadcom.com>
Code cleanup. Replaced void pointers 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>
---
drivers/staging/brcm80211/brcmsmac/ampdu.c | 14 -------
drivers/staging/brcm80211/brcmsmac/dma.c | 1 -
drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 4 +-
drivers/staging/brcm80211/brcmsmac/mac80211_if.h | 4 +-
drivers/staging/brcm80211/brcmsmac/main.c | 45 +++++++++++-----------
drivers/staging/brcm80211/brcmsmac/main.h | 23 ++---------
drivers/staging/brcm80211/brcmsmac/phy_shim.c | 7 ++-
drivers/staging/brcm80211/brcmsmac/phy_shim.h | 3 +-
drivers/staging/brcm80211/brcmsmac/pub.h | 16 +++----
drivers/staging/brcm80211/brcmsmac/scb.h | 1 -
10 files changed, 44 insertions(+), 74 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/ampdu.c b/drivers/staging/brcm80211/brcmsmac/ampdu.c
index 3c0fa13..6fc1591 100644
--- a/drivers/staging/brcm80211/brcmsmac/ampdu.c
+++ b/drivers/staging/brcm80211/brcmsmac/ampdu.c
@@ -109,7 +109,6 @@ struct brcms_fifo_info {
* rx_factor: maximum rx ampdu factor (0-3) ==> 2^(13+x) bytes
* ffpld_rsvd: number of bytes to reserve for preload
* max_txlen: max size of ampdu per mcs, bw and sgi
- * ini_free: array of ini's to be freed on detach
* mfbr: enable multiple fallback rate
* tx_max_funl: underflows should be kept such that
* (tx_max_funfl*underflows) < tx frames
@@ -132,7 +131,6 @@ struct ampdu_info {
u8 rx_factor;
u32 ffpld_rsvd;
u32 max_txlen[MCS_TABLE_SIZE][2][2];
- void *ini_free[AMPDU_INI_FREE];
bool mfbr;
u32 tx_max_funl;
struct brcms_fifo_info fifo_tb[NUM_FFPLD_FIFO];
@@ -231,18 +229,6 @@ struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc)
void brcms_c_ampdu_detach(struct ampdu_info *ampdu)
{
- int i;
-
- if (!ampdu)
- return;
-
- /*
- * free all ini's which were to be freed on
- * callbacks which were never called
- */
- for (i = 0; i < AMPDU_INI_FREE; i++)
- kfree(ampdu->ini_free[i]);
-
kfree(ampdu);
}
diff --git a/drivers/staging/brcm80211/brcmsmac/dma.c b/drivers/staging/brcm80211/brcmsmac/dma.c
index 3cb9e68..815329c 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.c
+++ b/drivers/staging/brcm80211/brcmsmac/dma.c
@@ -229,7 +229,6 @@ struct dma_seg {
};
struct dma_seg_map {
- void *oshdmah; /* Opaque handle for OSL to store its information */
uint origsize; /* Size of the virtual packet */
uint nsegs;
struct dma_seg segs[MAX_DMA_SEGS];
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index a4d46dd..e465749 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -802,7 +802,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->wlc = brcms_c_attach(wl, vendor, device, unit, false,
wl->regsva, btparam, &err);
brcms_release_fw(wl);
if (!wl->wlc) {
@@ -1782,7 +1782,7 @@ static int brcms_request_fw(struct brcms_info *wl, struct pci_dev *pdev)
char fw_name[100];
int i;
- memset((void *)&wl->fw, 0, sizeof(struct brcms_firmware));
+ memset(&wl->fw, 0, sizeof(struct brcms_firmware));
for (i = 0; i < MAX_FW_IMAGES; i++) {
if (brcms_firmwares[i] == NULL)
break;
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.h b/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
index c574723..fcd711a 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
@@ -51,8 +51,8 @@ struct brcms_firmware {
};
struct brcms_info {
- struct brcms_pub *pub; /* pointer to public wlc state */
- void *wlc; /* pointer to private common data */
+ struct brcms_pub *pub; /* pointer to public wlc state */
+ struct brcms_c_info *wlc; /* pointer to private common data */
u32 magic;
int irq;
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index c462377..d6837d3 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -367,9 +367,9 @@ static u32 brcms_c_wlintrsoff(struct brcms_c_info *wlc);
static void brcms_c_wlintrsrestore(struct brcms_c_info *wlc, u32 macintmask);
static void brcms_c_gpio_init(struct brcms_c_info *wlc);
static void brcms_c_write_hw_bcntemplate0(struct brcms_hardware *wlc_hw,
- void *bcn, int len);
+ u16 bcn[], int len);
static void brcms_c_write_hw_bcntemplate1(struct brcms_hardware *wlc_hw,
- void *bcn, int len);
+ u16 bcn[], int len);
static void brcms_b_bsinit(struct brcms_c_info *wlc, u16 chanspec);
static u32 brcms_c_setband_inact(struct brcms_c_info *wlc, uint bandunit);
static void brcms_b_setband(struct brcms_hardware *wlc_hw, uint bandunit,
@@ -457,6 +457,8 @@ static uint brcms_c_down_del_timer(struct brcms_c_info *wlc);
static void brcms_c_ofdm_rateset_war(struct brcms_c_info *wlc);
static int _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
struct brcms_c_if *wlcif);
+static void brcms_c_write_hw_bcntemplates(struct brcms_c_info *wlc, u16 bcn[],
+ int len, bool both);
const u8 prio2fifo[NUMPRIO] = {
TX_AC_BE_FIFO, /* 0 BE AC_BE Best Effort */
@@ -1375,7 +1377,7 @@ void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw)
}
static void
-brcms_c_write_hw_bcntemplate0(struct brcms_hardware *wlc_hw, void *bcn,
+brcms_c_write_hw_bcntemplate0(struct brcms_hardware *wlc_hw, u16 bcn[],
int len)
{
struct d11regs *regs = wlc_hw->regs;
@@ -1389,7 +1391,7 @@ brcms_c_write_hw_bcntemplate0(struct brcms_hardware *wlc_hw, void *bcn,
}
static void
-brcms_c_write_hw_bcntemplate1(struct brcms_hardware *wlc_hw, void *bcn,
+brcms_c_write_hw_bcntemplate1(struct brcms_hardware *wlc_hw, u16 bcn[],
int len)
{
struct d11regs *regs = wlc_hw->regs;
@@ -4287,9 +4289,9 @@ static uint brcms_c_attach_module(struct brcms_c_info *wlc)
return err;
}
-struct brcms_pub *brcms_c_pub(void *wlc)
+struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc)
{
- return ((struct brcms_c_info *) wlc)->pub;
+ return wlc->pub;
}
#define CHIP_SUPPORTS_11N(wlc) 1
@@ -4644,7 +4646,7 @@ 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 *
+struct brcms_c_info *
brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
bool piomode, void *regsva, struct pci_dev *btparam, uint *perr)
{
@@ -4884,7 +4886,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
if (perr)
*perr = 0;
- return (void *)wlc;
+ return wlc;
fail:
wiphy_err(wl->wiphy, "wl%d: %s: failed with err %d\n",
@@ -6319,7 +6321,7 @@ _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,
+ const char *name, struct brcms_info *hdl,
int (*d_fn)(void *handle))
{
struct brcms_c_info *wlc = (struct brcms_c_info *) pub->wlc;
@@ -6340,8 +6342,8 @@ int brcms_c_module_register(struct brcms_pub *pub,
}
/* unregister module callbacks */
-int
-brcms_c_module_unregister(struct brcms_pub *pub, const char *name, void *hdl)
+int brcms_c_module_unregister(struct brcms_pub *pub, const char *name,
+ struct brcms_info *hdl)
{
struct brcms_c_info *wlc = (struct brcms_c_info *) pub->wlc;
int i;
@@ -6668,8 +6670,8 @@ static u16 brcms_c_rate_shm_offset(struct brcms_c_info *wlc, u8 rate)
*
* Returns true if packet consumed (queued), false if not.
*/
-bool
-brcms_c_prec_enq(struct brcms_c_info *wlc, struct pktq *q, void *pkt, int prec)
+bool brcms_c_prec_enq(struct brcms_c_info *wlc, struct pktq *q,
+ struct sk_buff *pkt, int prec)
{
return brcms_c_prec_enq_head(wlc, q, pkt, prec, false);
}
@@ -6721,10 +6723,9 @@ brcms_c_prec_enq_head(struct brcms_c_info *wlc, struct pktq *q,
return true;
}
-void brcms_c_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu,
- uint prec)
+void brcms_c_txq_enq(struct brcms_c_info *wlc, struct scb *scb,
+ struct sk_buff *sdu, uint prec)
{
- struct brcms_c_info *wlc = (struct brcms_c_info *) ctx;
struct brcms_txq_info *qi = wlc->pkt_queue; /* Check me */
struct pktq *q = &qi->q;
int prio;
@@ -6767,7 +6768,6 @@ brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu,
{
u8 prio;
uint fifo;
- void *pkt;
struct scb *scb = &global_scb;
struct ieee80211_hdr *d11_header = (struct ieee80211_hdr *)(sdu->data);
@@ -6778,12 +6778,11 @@ brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu,
prio = ieee80211_is_data(d11_header->frame_control) ? sdu->priority :
MAXPRIO;
fifo = prio2fifo[prio];
- pkt = sdu;
if (unlikely
(brcms_c_d11hdrs_mac80211(
- wlc, hw, pkt, scb, 0, 1, fifo, 0, NULL, 0)))
+ wlc, hw, sdu, scb, 0, 1, fifo, 0, NULL, 0)))
return -EINVAL;
- brcms_c_txq_enq(wlc, scb, pkt, BRCMS_PRIO_TO_PREC(prio));
+ brcms_c_txq_enq(wlc, scb, sdu, BRCMS_PRIO_TO_PREC(prio));
brcms_c_send_q(wlc);
return 0;
}
@@ -8969,7 +8968,7 @@ int brcms_c_get_header_len()
/* mac is assumed to be suspended at this point */
void
-brcms_b_write_hw_bcntemplates(struct brcms_hardware *wlc_hw, void *bcn,
+brcms_b_write_hw_bcntemplates(struct brcms_hardware *wlc_hw, u16 bcn[],
int len, bool both)
{
struct d11regs *regs = wlc_hw->regs;
@@ -9424,8 +9423,8 @@ void brcms_c_write_template_ram(struct brcms_c_info *wlc, int offset, int len,
brcms_b_write_template_ram(wlc->hw, offset, len, buf);
}
-void brcms_c_write_hw_bcntemplates(struct brcms_c_info *wlc, void *bcn, int len,
- bool both)
+void brcms_c_write_hw_bcntemplates(struct brcms_c_info *wlc, u16 bcn[], int len,
+ bool both)
{
brcms_b_write_hw_bcntemplates(wlc->hw, bcn, len, both);
}
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index e2febe0..433e6a9 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -461,7 +461,7 @@ struct modulecb {
/* iovar table */
const struct brcmu_iovar *iovars;
/* handle passed when handler 'doiovar' is called */
- void *hdl;
+ struct brcms_info *hdl;
/* IOVar handler
*
@@ -491,15 +491,6 @@ struct modulecb {
};
-/* dump control blocks */
-struct dumpcb_s {
- const char *name; /* dump name */
- /* 'wl dump' handler */
- int (*dump_fn)(void *handle, struct brcmu_strbuf *b);
- void *dump_fn_arg;
- struct dumpcb_s *next;
-};
-
struct edcf_acparam {
u8 ACI;
u8 ECW;
@@ -580,8 +571,8 @@ struct brcms_hardware {
char *vars; /* "environment" name=value */
uint vars_size; /* size of vars, free vars on detach */
struct d11regs *regs; /* pointer to device registers */
- void *physhim; /* phy shim layer handler */
- void *phy_sh; /* pointer to shared phy state */
+ struct phy_shim_info *physhim; /* phy shim layer handler */
+ struct shared_phy *phy_sh; /* pointer to shared phy state */
struct brcms_hw_band *band;/* pointer to active per-band state */
/* band state per phy/radio */
struct brcms_hw_band *bandstate[MAXBANDS];
@@ -1082,16 +1073,14 @@ extern void brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo,
bool commit, s8 txpktpend);
extern void brcms_c_txfifo_complete(struct brcms_c_info *wlc, uint fifo,
s8 txpktpend);
-extern void brcms_c_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu,
- uint prec);
+extern void brcms_c_txq_enq(struct brcms_c_info *wlc, struct scb *scb,
+ struct sk_buff *sdu, uint prec);
extern void brcms_c_info_init(struct brcms_c_info *wlc, int unit);
extern void brcms_c_print_txstatus(struct tx_status *txs);
extern int brcms_c_xmtfifo_sz_get(struct brcms_c_info *wlc, uint fifo,
uint *blocks);
extern void brcms_c_write_template_ram(struct brcms_c_info *wlc, int offset,
int len, void *buf);
-extern void brcms_c_write_hw_bcntemplates(struct brcms_c_info *wlc, void *bcn,
- int len, bool both);
extern void brcms_c_pllreq(struct brcms_c_info *wlc, bool set, u32 req_bit);
extern void brcms_c_reset_bmac_done(struct brcms_c_info *wlc);
@@ -1168,8 +1157,6 @@ extern void brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc,
extern bool brcms_c_ismpc(struct brcms_c_info *wlc);
extern bool brcms_c_is_non_delay_mpc(struct brcms_c_info *wlc);
extern void brcms_c_radio_mpc_upd(struct brcms_c_info *wlc);
-extern bool brcms_c_prec_enq(struct brcms_c_info *wlc, struct pktq *q,
- void *pkt, int prec);
extern bool brcms_c_prec_enq_head(struct brcms_c_info *wlc, struct pktq *q,
struct sk_buff *pkt, int prec, bool head);
extern u16 brcms_c_phytxctl1_calc(struct brcms_c_info *wlc, u32 rspec);
diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.c b/drivers/staging/brcm80211/brcmsmac/phy_shim.c
index ec88867..31c9374 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy_shim.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.c
@@ -31,12 +31,13 @@
/* PHY SHIM module specific state */
struct phy_shim_info {
struct brcms_hardware *wlc_hw; /* pointer to main wlc_hw structure */
- void *wlc; /* pointer to main wlc structure */
- void *wl; /* pointer to os-specific private state */
+ struct brcms_c_info *wlc; /* pointer to main wlc structure */
+ struct brcms_info *wl; /* pointer to os-specific private state */
};
struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw,
- void *wl, void *wlc) {
+ struct brcms_info *wl,
+ struct brcms_c_info *wlc) {
struct phy_shim_info *physhim = NULL;
physhim = kzalloc(sizeof(struct phy_shim_info), GFP_ATOMIC);
diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.h b/drivers/staging/brcm80211/brcmsmac/phy_shim.h
index 14c56f9..d88c820 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy_shim.h
+++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.h
@@ -125,7 +125,8 @@
struct brcms_phy;
extern struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw,
- void *wl, void *wlc);
+ struct brcms_info *wl,
+ struct brcms_c_info *wlc);
extern void wlc_phy_shim_detach(struct phy_shim_info *physhim);
/* PHY to WL utility functions */
diff --git a/drivers/staging/brcm80211/brcmsmac/pub.h b/drivers/staging/brcm80211/brcmsmac/pub.h
index 40efee6..c2ab1a3 100644
--- a/drivers/staging/brcm80211/brcmsmac/pub.h
+++ b/drivers/staging/brcm80211/brcmsmac/pub.h
@@ -228,8 +228,7 @@ struct brcms_bss_info {
* The wlc handle points at this.
*/
struct brcms_pub {
- void *wlc;
-
+ struct brcms_c_info *wlc;
struct ieee80211_hw *ieee_hw;
struct scb *global_scb;
struct scb_ampdu *global_ampdu;
@@ -549,9 +548,9 @@ 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,
- struct pci_dev *btparam, uint *perr);
+struct brcms_c_info *
+brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
+ bool piomode, void *regsva, 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);
@@ -588,7 +587,7 @@ extern void brcms_c_set_addrmatch(struct brcms_c_info *wlc,
extern void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
const struct ieee80211_tx_queue_params *arg,
bool suspend);
-extern struct brcms_pub *brcms_c_pub(void *wlc);
+extern struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc);
/* common functions for every port */
extern void brcms_c_mhf(struct brcms_c_info *wlc, u8 idx, u16 mask, u16 val,
@@ -614,11 +613,10 @@ 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,
+ const char *name, struct brcms_info *hdl,
int (*down_fn)(void *handle));
-
extern int brcms_c_module_unregister(struct brcms_pub *pub, const char *name,
- void *hdl);
+ struct brcms_info *hdl);
extern void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc);
extern void brcms_c_enable_mac(struct brcms_c_info *wlc);
extern void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state);
diff --git a/drivers/staging/brcm80211/brcmsmac/scb.h b/drivers/staging/brcm80211/brcmsmac/scb.h
index 22ef8e8..efa5047 100644
--- a/drivers/staging/brcm80211/brcmsmac/scb.h
+++ b/drivers/staging/brcm80211/brcmsmac/scb.h
@@ -63,7 +63,6 @@ struct scb {
u32 flags2; /* various bit flags2 as defined below */
u8 state; /* current state bitfield of auth/assoc process */
u8 ea[ETH_ALEN]; /* station address */
- void *fragbuf[NUMPRIO]; /* defragmentation buffer per prio */
uint fragresid[NUMPRIO];/* #bytes unused in frag buffer per prio */
u16 seqctl[NUMPRIO]; /* seqctl of last received frame (for dups) */
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 05/15] staging: brcm80211: void * cleanup in fullmac
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (3 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 04/15] staging: brcm80211: got rid of several void pointers in softmac Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 06/15] staging: brcm80211: remove W_SM and R_SM macros from dma.c Arend van Spriel
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Franky Lin, Arend van Spriel
From: Franky Lin <frankyl@broadcom.com>
Remove improper usage of void * in dhd_linux.c and dhd_sdio.c
Reported-by: Julian Calaby <julian.calaby@gmail.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 5 +++--
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 14 +++++++-------
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 6 +++---
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index ae8a9a6..ee09c17 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -760,8 +760,9 @@ extern int brcmf_c_host_event(struct brcmf_info *drvr_priv, int *idx,
extern void brcmf_c_init(void);
-extern int brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, void *handle,
- char *name, u8 *mac_addr, u32 flags, u8 bssidx);
+extern int brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx,
+ struct net_device *net, char *name, u8 *mac_addr,
+ u32 flags, u8 bssidx);
extern void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx);
/* Send packet to dongle via data channel */
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index ca26cc1..b8f9922 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -978,7 +978,7 @@ static int brcmf_netdev_ioctl_entry(struct net_device *net, struct ifreq *ifr,
return -1;
if (cmd == SIOCETHTOOL)
- return brcmf_ethtool(drvr_priv, (void *)ifr->ifr_data);
+ return brcmf_ethtool(drvr_priv, ifr->ifr_data);
if (cmd != SIOCDEVPRIVATE)
return -EOPNOTSUPP;
@@ -1140,12 +1140,12 @@ static int brcmf_netdev_open(struct net_device *net)
}
int
-brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, void *handle, char *name,
- u8 *mac_addr, u32 flags, u8 bssidx)
+brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, struct net_device *net,
+ char *name, u8 *mac_addr, u32 flags, u8 bssidx)
{
struct brcmf_if *ifp;
- BRCMF_TRACE(("%s: idx %d, handle->%p\n", __func__, ifidx, handle));
+ BRCMF_TRACE(("%s: idx %d, handle->%p\n", __func__, ifidx, net));
ifp = drvr_priv->iflist[ifidx];
if (!ifp) {
@@ -1163,12 +1163,12 @@ brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, void *handle, char *name,
if (mac_addr != NULL)
memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN);
- if (handle == NULL) {
+ if (net == NULL) {
ifp->state = BRCMF_E_IF_ADD;
ifp->idx = ifidx;
wake_up(&drvr_priv->sysioc_waitq);
} else
- ifp->net = (struct net_device *)handle;
+ ifp->net = net;
return 0;
}
@@ -1228,7 +1228,7 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
strcat(net->name, "%d");
}
- if (brcmf_add_if(drvr_priv, 0, (void *)net, net->name, NULL, 0, 0) ==
+ if (brcmf_add_if(drvr_priv, 0, net, net->name, NULL, 0, 0) ==
BRCMF_BAD_IF)
goto fail;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index cc321d6..7632a0e 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -910,7 +910,7 @@ static int brcmf_sdbrcm_send_buf(struct brcmf_bus *bus, u32 addr, uint fn,
uint flags, u8 *buf, uint nbytes,
struct sk_buff *pkt);
-static bool brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus, void *card);
+static bool brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus);
static int _brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus);
static int brcmf_sdbrcm_download_code_file(struct brcmf_bus *bus);
@@ -3100,7 +3100,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
/* try to download image and nvram to the dongle */
if (drvr->busstate == BRCMF_BUS_DOWN) {
- if (!(brcmf_sdbrcm_download_firmware(bus, bus->sdiodev)))
+ if (!(brcmf_sdbrcm_download_firmware(bus)))
return -1;
}
@@ -5122,7 +5122,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus)
}
static bool
-brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus, void *card)
+brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus)
{
bool ret;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 06/15] staging: brcm80211: remove W_SM and R_SM macros from dma.c
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (4 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 05/15] staging: brcm80211: void * cleanup in fullmac Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 07/15] staging: brcm80211: remove PHYSADDR macro " Arend van Spriel
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel
The macros W_SM and R_SM are not doing much conversion of the macro
parameters and complicate code readability without good cause. It
is more clear to remove usage of the macros expanding it in the source
code.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmsmac/dma.c | 54 ++++++++++++++----------------
1 files changed, 25 insertions(+), 29 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/dma.c b/drivers/staging/brcm80211/brcmsmac/dma.c
index 815329c..9ac3867 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.c
+++ b/drivers/staging/brcm80211/brcmsmac/dma.c
@@ -219,9 +219,6 @@ static uint dma_msg_level;
#define DI_INFO(dmah) ((dma_info_t *)dmah)
-#define R_SM(r) (*(r))
-#define W_SM(r, v) (*(r) = (v))
-
/* One physical DMA segment */
struct dma_seg {
unsigned long addr;
@@ -593,13 +590,12 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring,
#else
if ((di->dataoffsetlow == 0) || !(PHYSADDRLO(pa) & PCI32ADDR_HIGH)) {
#endif /* defined(__mips__) && defined(IL_BIGENDIAN) */
-
- W_SM(&ddring[outidx].addrlow,
- BUS_SWAP32(PHYSADDRLO(pa) + di->dataoffsetlow));
- W_SM(&ddring[outidx].addrhigh,
- BUS_SWAP32(PHYSADDRHI(pa) + di->dataoffsethigh));
- W_SM(&ddring[outidx].ctrl1, BUS_SWAP32(*flags));
- W_SM(&ddring[outidx].ctrl2, BUS_SWAP32(ctrl2));
+ ddring[outidx].addrlow =
+ BUS_SWAP32(PHYSADDRLO(pa) + di->dataoffsetlow);
+ ddring[outidx].addrhigh =
+ BUS_SWAP32(PHYSADDRHI(pa) + di->dataoffsethigh);
+ ddring[outidx].ctrl1 = BUS_SWAP32(*flags);
+ ddring[outidx].ctrl2 = BUS_SWAP32(ctrl2);
} else {
/* address extension for 32-bit PCI */
u32 ae;
@@ -608,17 +604,17 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring,
PHYSADDRLO(pa) &= ~PCI32ADDR_HIGH;
ctrl2 |= (ae << D64_CTRL2_AE_SHIFT) & D64_CTRL2_AE;
- W_SM(&ddring[outidx].addrlow,
- BUS_SWAP32(PHYSADDRLO(pa) + di->dataoffsetlow));
- W_SM(&ddring[outidx].addrhigh,
- BUS_SWAP32(0 + di->dataoffsethigh));
- W_SM(&ddring[outidx].ctrl1, BUS_SWAP32(*flags));
- W_SM(&ddring[outidx].ctrl2, BUS_SWAP32(ctrl2));
+ ddring[outidx].addrlow =
+ BUS_SWAP32(PHYSADDRLO(pa) + di->dataoffsetlow);
+ ddring[outidx].addrhigh =
+ BUS_SWAP32(0 + di->dataoffsethigh);
+ ddring[outidx].ctrl1 = BUS_SWAP32(*flags);
+ ddring[outidx].ctrl2 = BUS_SWAP32(ctrl2);
}
if (di->dma.dmactrlflags & DMA_CTRL_PEN) {
if (DMA64_DD_PARITY(&ddring[outidx]))
- W_SM(&ddring[outidx].ctrl2,
- BUS_SWAP32(ctrl2 | D64_CTRL2_PARITY));
+ ddring[outidx].ctrl2 =
+ BUS_SWAP32(ctrl2 | D64_CTRL2_PARITY);
}
}
@@ -1369,8 +1365,8 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit)
/* if last txd eof not set, fix it */
if (!(flags & D64_CTRL1_EOF))
- W_SM(&di->txd64[PREVTXD(txout)].ctrl1,
- BUS_SWAP32(flags | D64_CTRL1_IOC | D64_CTRL1_EOF));
+ di->txd64[PREVTXD(txout)].ctrl1 =
+ BUS_SWAP32(flags | D64_CTRL1_IOC | D64_CTRL1_EOF);
/* save the packet */
di->txp[PREVTXD(txout)] = p0;
@@ -1456,10 +1452,10 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
uint size, j, nsegs;
PHYSADDRLOSET(pa,
- (BUS_SWAP32(R_SM(&di->txd64[i].addrlow)) -
+ (BUS_SWAP32(di->txd64[i].addrlow) -
di->dataoffsetlow));
PHYSADDRHISET(pa,
- (BUS_SWAP32(R_SM(&di->txd64[i].addrhigh)) -
+ (BUS_SWAP32(di->txd64[i].addrhigh) -
di->dataoffsethigh));
if (DMASGLIST_ENAB) {
@@ -1468,14 +1464,14 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
nsegs = map->nsegs;
} else {
size =
- (BUS_SWAP32(R_SM(&di->txd64[i].ctrl2)) &
+ (BUS_SWAP32(di->txd64[i].ctrl2) &
D64_CTRL2_BC_MASK);
nsegs = 1;
}
for (j = nsegs; j > 0; j--) {
- W_SM(&di->txd64[i].addrlow, 0xdeadbeef);
- W_SM(&di->txd64[i].addrhigh, 0xdeadbeef);
+ di->txd64[i].addrlow = 0xdeadbeef;
+ di->txd64[i].addrhigh = 0xdeadbeef;
txp = di->txp[i];
di->txp[i] = NULL;
@@ -1524,17 +1520,17 @@ static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall)
di->rxp[i] = NULL;
PHYSADDRLOSET(pa,
- (BUS_SWAP32(R_SM(&di->rxd64[i].addrlow)) -
+ (BUS_SWAP32(di->rxd64[i].addrlow) -
di->dataoffsetlow));
PHYSADDRHISET(pa,
- (BUS_SWAP32(R_SM(&di->rxd64[i].addrhigh)) -
+ (BUS_SWAP32(di->rxd64[i].addrhigh) -
di->dataoffsethigh));
/* clear this packet from the descriptor ring */
pci_unmap_single(di->pbus, pa, di->rxbufsize, PCI_DMA_FROMDEVICE);
- W_SM(&di->rxd64[i].addrlow, 0xdeadbeef);
- W_SM(&di->rxd64[i].addrhigh, 0xdeadbeef);
+ di->rxd64[i].addrlow = 0xdeadbeef;
+ di->rxd64[i].addrhigh = 0xdeadbeef;
di->rxin = NEXTRXD(i);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 07/15] staging: brcm80211: remove PHYSADDR macro from dma.c
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (5 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 06/15] staging: brcm80211: remove W_SM and R_SM macros from dma.c Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 08/15] staging: brcm80211: replace BUS_SWAP32 macro with cpu_to_le32() Arend van Spriel
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel
Four macros with PHYSADDR name prefix are not doing a lot and
complicate code readability. These have been expanded in the source
code and consequently removed the definitions.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmsmac/dma.c | 95 +++++++++---------------------
1 files changed, 29 insertions(+), 66 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/dma.c b/drivers/staging/brcm80211/brcmsmac/dma.c
index 9ac3867..64d311f 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.c
+++ b/drivers/staging/brcm80211/brcmsmac/dma.c
@@ -196,14 +196,6 @@
#define DMA_NONE(args)
-#define PHYSADDRHI(_pa) (0)
-#define PHYSADDRHISET(_pa, _val)
-#define PHYSADDRLO(_pa) ((_pa))
-#define PHYSADDRLOSET(_pa, _val) \
- do { \
- (_pa) = (_val); \
- } while (0)
-
#define d64txregs dregs.d64_u.txregs_64
#define d64rxregs dregs.d64_u.rxregs_64
#define txd64 dregs.d64_u.txd_64
@@ -522,16 +514,14 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
}
if ((di->ddoffsetlow != 0) && !di->addrext) {
- if (PHYSADDRLO(di->txdpa) > SI_PCI_DMA_SZ) {
+ if (di->txdpa > SI_PCI_DMA_SZ) {
DMA_ERROR(("%s: dma_attach: txdpa 0x%x: addrext not "
- "supported\n", di->name,
- (u32)PHYSADDRLO(di->txdpa)));
+ "supported\n", di->name, (u32)di->txdpa));
goto fail;
}
- if (PHYSADDRLO(di->rxdpa) > SI_PCI_DMA_SZ) {
+ if (di->rxdpa > SI_PCI_DMA_SZ) {
DMA_ERROR(("%s: dma_attach: rxdpa 0x%x: addrext not "
- "supported\n", di->name,
- (u32)PHYSADDRLO(di->rxdpa)));
+ "supported\n", di->name, (u32)di->rxdpa));
goto fail;
}
}
@@ -586,28 +576,24 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring,
/* PCI bus with big(>1G) physical address, use address extension */
#if defined(__mips__) && defined(IL_BIGENDIAN)
if ((di->dataoffsetlow == SI_SDRAM_SWAPPED)
- || !(PHYSADDRLO(pa) & PCI32ADDR_HIGH)) {
+ || !(pa & PCI32ADDR_HIGH)) {
#else
- if ((di->dataoffsetlow == 0) || !(PHYSADDRLO(pa) & PCI32ADDR_HIGH)) {
+ if ((di->dataoffsetlow == 0) || !(pa & PCI32ADDR_HIGH)) {
#endif /* defined(__mips__) && defined(IL_BIGENDIAN) */
- ddring[outidx].addrlow =
- BUS_SWAP32(PHYSADDRLO(pa) + di->dataoffsetlow);
- ddring[outidx].addrhigh =
- BUS_SWAP32(PHYSADDRHI(pa) + di->dataoffsethigh);
+ ddring[outidx].addrlow = BUS_SWAP32(pa + di->dataoffsetlow);
+ ddring[outidx].addrhigh = BUS_SWAP32(di->dataoffsethigh);
ddring[outidx].ctrl1 = BUS_SWAP32(*flags);
ddring[outidx].ctrl2 = BUS_SWAP32(ctrl2);
} else {
/* address extension for 32-bit PCI */
u32 ae;
- ae = (PHYSADDRLO(pa) & PCI32ADDR_HIGH) >> PCI32ADDR_HIGH_SHIFT;
- PHYSADDRLO(pa) &= ~PCI32ADDR_HIGH;
+ ae = (pa & PCI32ADDR_HIGH) >> PCI32ADDR_HIGH_SHIFT;
+ pa &= ~PCI32ADDR_HIGH;
ctrl2 |= (ae << D64_CTRL2_AE_SHIFT) & D64_CTRL2_AE;
- ddring[outidx].addrlow =
- BUS_SWAP32(PHYSADDRLO(pa) + di->dataoffsetlow);
- ddring[outidx].addrhigh =
- BUS_SWAP32(0 + di->dataoffsethigh);
+ ddring[outidx].addrlow = BUS_SWAP32(pa + di->dataoffsetlow);
+ ddring[outidx].addrhigh = BUS_SWAP32(di->dataoffsethigh);
ddring[outidx].ctrl1 = BUS_SWAP32(*flags);
ddring[outidx].ctrl2 = BUS_SWAP32(ctrl2);
}
@@ -716,45 +702,36 @@ _dma_ddtable_init(struct dma_info *di, uint direction, unsigned long pa)
{
if (!di->aligndesc_4k) {
if (direction == DMA_TX)
- di->xmtptrbase = PHYSADDRLO(pa);
+ di->xmtptrbase = pa;
else
- di->rcvptrbase = PHYSADDRLO(pa);
+ di->rcvptrbase = pa;
}
if ((di->ddoffsetlow == 0)
- || !(PHYSADDRLO(pa) & PCI32ADDR_HIGH)) {
+ || !(pa & PCI32ADDR_HIGH)) {
if (direction == DMA_TX) {
- W_REG(&di->d64txregs->addrlow,
- (PHYSADDRLO(pa) + di->ddoffsetlow));
- W_REG(&di->d64txregs->addrhigh,
- (PHYSADDRHI(pa) + di->ddoffsethigh));
+ W_REG(&di->d64txregs->addrlow, pa + di->ddoffsetlow);
+ W_REG(&di->d64txregs->addrhigh, di->ddoffsethigh);
} else {
- W_REG(&di->d64rxregs->addrlow,
- (PHYSADDRLO(pa) + di->ddoffsetlow));
- W_REG(&di->d64rxregs->addrhigh,
- (PHYSADDRHI(pa) + di->ddoffsethigh));
+ W_REG(&di->d64rxregs->addrlow, pa + di->ddoffsetlow);
+ W_REG(&di->d64rxregs->addrhigh, di->ddoffsethigh);
}
} else {
/* DMA64 32bits address extension */
u32 ae;
/* shift the high bit(s) from pa to ae */
- ae = (PHYSADDRLO(pa) & PCI32ADDR_HIGH) >>
- PCI32ADDR_HIGH_SHIFT;
- PHYSADDRLO(pa) &= ~PCI32ADDR_HIGH;
+ ae = (pa & PCI32ADDR_HIGH) >> PCI32ADDR_HIGH_SHIFT;
+ pa &= ~PCI32ADDR_HIGH;
if (direction == DMA_TX) {
- W_REG(&di->d64txregs->addrlow,
- (PHYSADDRLO(pa) + di->ddoffsetlow));
- W_REG(&di->d64txregs->addrhigh,
- di->ddoffsethigh);
+ W_REG(&di->d64txregs->addrlow, pa + di->ddoffsetlow);
+ W_REG(&di->d64txregs->addrhigh, di->ddoffsethigh);
SET_REG(&di->d64txregs->control,
D64_XC_AE, (ae << D64_XC_AE_SHIFT));
} else {
- W_REG(&di->d64rxregs->addrlow,
- (PHYSADDRLO(pa) + di->ddoffsetlow));
- W_REG(&di->d64rxregs->addrhigh,
- di->ddoffsethigh);
+ W_REG(&di->d64rxregs->addrlow, pa + di->ddoffsetlow);
+ W_REG(&di->d64rxregs->addrhigh, di->ddoffsethigh);
SET_REG(&di->d64rxregs->control,
D64_RC_AE, (ae << D64_RC_AE_SHIFT));
}
@@ -1196,9 +1173,7 @@ static bool dma64_alloc(struct dma_info *di, uint direction)
di->txd64 = (struct dma64desc *)
roundup((unsigned long)va, align);
di->txdalign = (uint) ((s8 *)di->txd64 - (s8 *) va);
- PHYSADDRLOSET(di->txdpa,
- PHYSADDRLO(di->txdpaorig) + di->txdalign);
- PHYSADDRHISET(di->txdpa, PHYSADDRHI(di->txdpaorig));
+ di->txdpa = di->txdpaorig + di->txdalign;
di->txdalloc = alloced;
} else {
va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits,
@@ -1212,9 +1187,7 @@ static bool dma64_alloc(struct dma_info *di, uint direction)
di->rxd64 = (struct dma64desc *)
roundup((unsigned long)va, align);
di->rxdalign = (uint) ((s8 *)di->rxd64 - (s8 *) va);
- PHYSADDRLOSET(di->rxdpa,
- PHYSADDRLO(di->rxdpaorig) + di->rxdalign);
- PHYSADDRHISET(di->rxdpa, PHYSADDRHI(di->rxdpaorig));
+ di->rxdpa = di->rxdpaorig + di->rxdalign;
di->rxdalloc = alloced;
}
@@ -1451,12 +1424,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
struct dma_seg_map *map = NULL;
uint size, j, nsegs;
- PHYSADDRLOSET(pa,
- (BUS_SWAP32(di->txd64[i].addrlow) -
- di->dataoffsetlow));
- PHYSADDRHISET(pa,
- (BUS_SWAP32(di->txd64[i].addrhigh) -
- di->dataoffsethigh));
+ pa = BUS_SWAP32(di->txd64[i].addrlow) - di->dataoffsetlow;
if (DMASGLIST_ENAB) {
map = &di->txp_dmah[i];
@@ -1519,12 +1487,7 @@ static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall)
rxp = di->rxp[i];
di->rxp[i] = NULL;
- PHYSADDRLOSET(pa,
- (BUS_SWAP32(di->rxd64[i].addrlow) -
- di->dataoffsetlow));
- PHYSADDRHISET(pa,
- (BUS_SWAP32(di->rxd64[i].addrhigh) -
- di->dataoffsethigh));
+ pa = BUS_SWAP32(di->rxd64[i].addrlow) - di->dataoffsetlow;
/* clear this packet from the descriptor ring */
pci_unmap_single(di->pbus, pa, di->rxbufsize, PCI_DMA_FROMDEVICE);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 08/15] staging: brcm80211: replace BUS_SWAP32 macro with cpu_to_le32()
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (6 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 07/15] staging: brcm80211: remove PHYSADDR macro " Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 09/15] staging: brcm80211: fix off-by-one error in swap functions Arend van Spriel
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel
The macro BUS_SWAP32(a) expanded to (a) which was fine for a little
endian system. For big endian platform this should do as the name
implies. As the driver is intended for PCI which is little-endian
the macro cpu_to_le32() can be used instead.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmsmac/dma.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/dma.c b/drivers/staging/brcm80211/brcmsmac/dma.c
index 64d311f..aa4d9cf 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.c
+++ b/drivers/staging/brcm80211/brcmsmac/dma.c
@@ -580,10 +580,10 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring,
#else
if ((di->dataoffsetlow == 0) || !(pa & PCI32ADDR_HIGH)) {
#endif /* defined(__mips__) && defined(IL_BIGENDIAN) */
- ddring[outidx].addrlow = BUS_SWAP32(pa + di->dataoffsetlow);
- ddring[outidx].addrhigh = BUS_SWAP32(di->dataoffsethigh);
- ddring[outidx].ctrl1 = BUS_SWAP32(*flags);
- ddring[outidx].ctrl2 = BUS_SWAP32(ctrl2);
+ ddring[outidx].addrlow = cpu_to_le32(pa + di->dataoffsetlow);
+ ddring[outidx].addrhigh = cpu_to_le32(di->dataoffsethigh);
+ ddring[outidx].ctrl1 = cpu_to_le32(*flags);
+ ddring[outidx].ctrl2 = cpu_to_le32(ctrl2);
} else {
/* address extension for 32-bit PCI */
u32 ae;
@@ -592,15 +592,15 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring,
pa &= ~PCI32ADDR_HIGH;
ctrl2 |= (ae << D64_CTRL2_AE_SHIFT) & D64_CTRL2_AE;
- ddring[outidx].addrlow = BUS_SWAP32(pa + di->dataoffsetlow);
- ddring[outidx].addrhigh = BUS_SWAP32(di->dataoffsethigh);
- ddring[outidx].ctrl1 = BUS_SWAP32(*flags);
- ddring[outidx].ctrl2 = BUS_SWAP32(ctrl2);
+ ddring[outidx].addrlow = cpu_to_le32(pa + di->dataoffsetlow);
+ ddring[outidx].addrhigh = cpu_to_le32(di->dataoffsethigh);
+ ddring[outidx].ctrl1 = cpu_to_le32(*flags);
+ ddring[outidx].ctrl2 = cpu_to_le32(ctrl2);
}
if (di->dma.dmactrlflags & DMA_CTRL_PEN) {
if (DMA64_DD_PARITY(&ddring[outidx]))
ddring[outidx].ctrl2 =
- BUS_SWAP32(ctrl2 | D64_CTRL2_PARITY);
+ cpu_to_le32(ctrl2 | D64_CTRL2_PARITY);
}
}
@@ -1339,7 +1339,7 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit)
/* if last txd eof not set, fix it */
if (!(flags & D64_CTRL1_EOF))
di->txd64[PREVTXD(txout)].ctrl1 =
- BUS_SWAP32(flags | D64_CTRL1_IOC | D64_CTRL1_EOF);
+ cpu_to_le32(flags | D64_CTRL1_IOC | D64_CTRL1_EOF);
/* save the packet */
di->txp[PREVTXD(txout)] = p0;
@@ -1424,7 +1424,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
struct dma_seg_map *map = NULL;
uint size, j, nsegs;
- pa = BUS_SWAP32(di->txd64[i].addrlow) - di->dataoffsetlow;
+ pa = cpu_to_le32(di->txd64[i].addrlow) - di->dataoffsetlow;
if (DMASGLIST_ENAB) {
map = &di->txp_dmah[i];
@@ -1432,7 +1432,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
nsegs = map->nsegs;
} else {
size =
- (BUS_SWAP32(di->txd64[i].ctrl2) &
+ (cpu_to_le32(di->txd64[i].ctrl2) &
D64_CTRL2_BC_MASK);
nsegs = 1;
}
@@ -1487,7 +1487,7 @@ static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall)
rxp = di->rxp[i];
di->rxp[i] = NULL;
- pa = BUS_SWAP32(di->rxd64[i].addrlow) - di->dataoffsetlow;
+ pa = cpu_to_le32(di->rxd64[i].addrlow) - di->dataoffsetlow;
/* clear this packet from the descriptor ring */
pci_unmap_single(di->pbus, pa, di->rxbufsize, PCI_DMA_FROMDEVICE);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 09/15] staging: brcm80211: fix off-by-one error in swap functions
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (7 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 08/15] staging: brcm80211: replace BUS_SWAP32 macro with cpu_to_le32() Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 10/15] staging: brcm80211: Remove swaps in R_REG and W_REG macros Arend van Spriel
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Henry Ptasinski, Arend van Spriel
From: Henry Ptasinski <henryp@broadcom.com>
The original implementation iterated over the data in buf+1 through buf+size,
whereas it should have been over the data in buf through buf+size-1.
Tested on Mac G5 PPC and BCM63281.
Signed-off-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Tested-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmsmac/srom.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
index 060f06f..7a17f59 100644
--- a/drivers/staging/brcm80211/brcmsmac/srom.c
+++ b/drivers/staging/brcm80211/brcmsmac/srom.c
@@ -880,13 +880,15 @@ int srom_var_init(struct si_pub *sih, void *curmap, char **vars, uint *count)
static inline void ltoh16_buf(u16 *buf, unsigned int size)
{
- for (size /= 2; size; size--)
+ size /= 2;
+ while (size--)
*(buf + size) = le16_to_cpu(*(buf + size));
}
static inline void htol16_buf(u16 *buf, unsigned int size)
{
- for (size /= 2; size; size--)
+ size /= 2;
+ while (size--)
*(buf + size) = cpu_to_le16(*(buf + size));
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 10/15] staging: brcm80211: Remove swaps in R_REG and W_REG macros
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (8 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 09/15] staging: brcm80211: fix off-by-one error in swap functions Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 11/15] staging: brcm80211: Fix handling of firmware and inits on big-endian platforms Arend van Spriel
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Henry Ptasinski, Arend van Spriel
From: Henry Ptasinski <henryp@broadcom.com>
Swapping the addresses is unnecessary, since the swaps are handled by the
underlying platform code (i.e. readb() etc. handle any necessary swapping).
Tested on Mac G5 PPC and BCM63281.
Signed-off-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Tested-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmsmac/types.h | 19 ++++---------------
1 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/types.h b/drivers/staging/brcm80211/brcmsmac/types.h
index c0d41cc..ad874a7 100644
--- a/drivers/staging/brcm80211/brcmsmac/types.h
+++ b/drivers/staging/brcm80211/brcmsmac/types.h
@@ -329,28 +329,17 @@ do { \
* 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
-#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 R_REG(r) \
({ \
__typeof(*(r)) __osl_v; \
switch (sizeof(*(r))) { \
case sizeof(u8): \
- __osl_v = readb((u8 *)(SWP3(r))); \
+ __osl_v = readb((u8 *)(r)); \
break; \
case sizeof(u16): \
- __osl_v = readw((u16 *)(SWP2(r))); \
+ __osl_v = readw((u16 *)(r)); \
break; \
case sizeof(u32): \
__osl_v = readl((u32 *)(r)); \
@@ -362,10 +351,10 @@ do { \
#define W_REG(r, v) do { \
switch (sizeof(*(r))) { \
case sizeof(u8): \
- writeb((u8)(v), (u8 *)(SWP3(r))); \
+ writeb((u8)(v), (u8 *)(r)); \
break; \
case sizeof(u16): \
- writew((u16)(v), (u16 *)(SWP2(r))); \
+ writew((u16)(v), (u16 *)(r)); \
break; \
case sizeof(u32): \
writel((u32)(v), (u32 *)(r)); \
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 11/15] staging: brcm80211: Fix handling of firmware and inits on big-endian platforms
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (9 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 10/15] staging: brcm80211: Remove swaps in R_REG and W_REG macros Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 12/15] staging: brcm80211: remove mips specific include from dma.c Arend van Spriel
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Henry Ptasinski, Arend van Spriel
From: Henry Ptasinski <henryp@broadcom.com>
The firmware files are encoded as little-endian. Do the appropriate swapping
for big-endian platforms.
Tested on Mac G5 PPC and BCM63281.
Signed-off-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Tested-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 24 ++++++++++++---------
drivers/staging/brcm80211/brcmsmac/main.c | 21 ++++++++++++------
2 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index e465749..7179edd 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -1722,15 +1722,17 @@ int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, u32 idx)
hdr = (struct firmware_hdr *)wl->fw.fw_hdr[i]->data;
for (entry = 0; entry < wl->fw.hdr_num_entries[i];
entry++, hdr++) {
- if (hdr->idx == idx) {
- pdata = wl->fw.fw_bin[i]->data + hdr->offset;
- *pbuf = kmalloc(hdr->len, GFP_ATOMIC);
+ u32 len = le32_to_cpu(hdr->len);
+ if (le32_to_cpu(hdr->idx) == idx) {
+ pdata = wl->fw.fw_bin[i]->data +
+ le32_to_cpu(hdr->offset);
+ *pbuf = kmalloc(len, GFP_ATOMIC);
if (*pbuf == NULL) {
wiphy_err(wl->wiphy, "fail to alloc %d"
- " bytes\n", hdr->len);
+ " bytes\n", len);
goto fail;
}
- memcpy(*pbuf, pdata, hdr->len);
+ memcpy(*pbuf, pdata, len);
return 0;
}
}
@@ -1755,14 +1757,15 @@ int brcms_ucode_init_uint(struct brcms_info *wl, u32 *data, u32 idx)
hdr = (struct firmware_hdr *)wl->fw.fw_hdr[i]->data;
for (entry = 0; entry < wl->fw.hdr_num_entries[i];
entry++, hdr++) {
- if (hdr->idx == idx) {
- pdata = wl->fw.fw_bin[i]->data + hdr->offset;
- if (hdr->len != 4) {
+ if (le32_to_cpu(hdr->idx) == idx) {
+ pdata = wl->fw.fw_bin[i]->data +
+ le32_to_cpu(hdr->offset);
+ if (le32_to_cpu(hdr->len) != 4) {
wiphy_err(wl->wiphy,
"ERROR: fw hdr len\n");
return -ENOMSG;
}
- *data = *((u32 *) pdata);
+ *data = le32_to_cpu(*((u32 *) pdata));
return 0;
}
}
@@ -1868,7 +1871,8 @@ int brcms_check_firmwares(struct brcms_info *wl)
ucode_hdr = (struct firmware_hdr *)fw_hdr->data;
for (entry = 0; entry < wl->fw.hdr_num_entries[i] &&
!rc; entry++, ucode_hdr++) {
- if (ucode_hdr->offset + ucode_hdr->len >
+ if (le32_to_cpu(ucode_hdr->offset) +
+ le32_to_cpu(ucode_hdr->len) >
fw->size) {
wiphy_err(wl->wiphy,
"%s: conflicting bin/hdr\n",
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index d6837d3..c625c25 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -2033,7 +2033,8 @@ static void brcms_ucode_write(struct brcms_hardware *wlc_hw, const u32 ucode[],
W_REG(®s->objaddr, (OBJADDR_AUTO_INC | OBJADDR_UCM_SEL));
(void)R_REG(®s->objaddr);
for (i = 0; i < count; i++)
- W_REG(®s->objdata, ucode[i]);
+ W_REG(®s->objdata, le32_to_cpu(ucode[i]));
+
}
static void brcms_c_write_inits(struct brcms_hardware *wlc_hw,
@@ -2041,18 +2042,24 @@ static void brcms_c_write_inits(struct brcms_hardware *wlc_hw,
{
int i;
u8 *base;
+ u8 *addr;
+ u16 size;
+ u32 value;
BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit);
base = (u8 *)wlc_hw->regs;
for (i = 0; inits[i].addr != 0xffff; i++) {
- if (inits[i].size == 2)
- W_REG((u16 *)(base + inits[i].addr),
- inits[i].value);
- else if (inits[i].size == 4)
- W_REG((u32 *)(base + inits[i].addr),
- inits[i].value);
+ size = le16_to_cpu(inits[i].size);
+ addr = base + le16_to_cpu(inits[i].addr);
+ value = le32_to_cpu(inits[i].value);
+ if (size == 2)
+ W_REG((u16 *)addr, value);
+ else if (size == 4)
+ W_REG((u32 *)addr, value);
+ else
+ break;
}
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 12/15] staging: brcm80211: remove mips specific include from dma.c
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (10 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 11/15] staging: brcm80211: Fix handling of firmware and inits on big-endian platforms Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 13/15] staging: brcm80211: restrict register access method for bcm47xx Arend van Spriel
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel
The include <asm/addrspace.h> has been removed as it is not
needed. None of the definitions from it are used in the source
file.
Tested on BCM63281.
Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Tested-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmsmac/dma.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/dma.c b/drivers/staging/brcm80211/brcmsmac/dma.c
index aa4d9cf..bda36c7 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.c
+++ b/drivers/staging/brcm80211/brcmsmac/dma.c
@@ -18,10 +18,6 @@
#include <linux/delay.h>
#include <linux/pci.h>
-#if defined(__mips__)
-#include <asm/addrspace.h>
-#endif
-
#include <brcmu_utils.h>
#include <aiutils.h>
#include "types.h"
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 13/15] staging: brcm80211: restrict register access method for bcm47xx
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (11 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 12/15] staging: brcm80211: remove mips specific include from dma.c Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 14/15] staging: brcm80211: restrict MIPS dma bug workaround to BCM47XX Arend van Spriel
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel
The driver contained conditional code for resolving issue with
dma transaction reordering. This code was conditionalized using
__mips__ macro, but it actually is specific to bcm47xx chips.
This patch replaces it for the more speficic CONFIG_BCM47XX macro.
Tested on BCM63281.
Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Tested-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 2 +-
drivers/staging/brcm80211/brcmsmac/types.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
index c00178d..448afae 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -380,7 +380,7 @@ void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
regs = pi->regs;
-#ifdef __mips__
+#ifdef CONFIG_BCM47XX
W_REG_FLUSH(®s->phyregaddr, addr);
W_REG(®s->phyregdata, val);
if (addr == 0x72)
diff --git a/drivers/staging/brcm80211/brcmsmac/types.h b/drivers/staging/brcm80211/brcmsmac/types.h
index ad874a7..d44db56 100644
--- a/drivers/staging/brcm80211/brcmsmac/types.h
+++ b/drivers/staging/brcm80211/brcmsmac/types.h
@@ -362,7 +362,7 @@ do { \
} \
} while (0)
-#ifdef __mips__
+#ifdef CONFIG_BCM47XX
/*
* bcm4716 (which includes 4717 & 4718), plus 4706 on PCIe can reorder
* transactions. As a fix, a read after write is performed on certain places
@@ -371,7 +371,7 @@ do { \
#define W_REG_FLUSH(r, v) ({ W_REG((r), (v)); (void)R_REG(r); })
#else
#define W_REG_FLUSH(r, v) W_REG((r), (v))
-#endif /* __mips__ */
+#endif /* CONFIG_BCM47XX */
#define AND_REG(r, v) W_REG((r), R_REG(r) & (v))
#define OR_REG(r, v) W_REG((r), R_REG(r) | (v))
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 14/15] staging: brcm80211: restrict MIPS dma bug workaround to BCM47XX
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (12 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 13/15] staging: brcm80211: restrict register access method for bcm47xx Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-15 13:34 ` [PATCH 15/15] staging: brcm80211: removed unused MIPS specific SDRAM swap window Arend van Spriel
2011-08-23 20:09 ` [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Greg KH
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel
The inline function dma_spin_for_len() was defined for MIPS platforms
but the problem only occurs with dma of the PCI core in bcm47xx chips.
This patch restricts the function further to BCM47XX platforms only.
Tested on BCM63281.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Tested-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmsmac/dma.h | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/dma.h b/drivers/staging/brcm80211/brcmsmac/dma.h
index 134402c..2ce5963 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.h
+++ b/drivers/staging/brcm80211/brcmsmac/dma.h
@@ -100,21 +100,21 @@ void dma_walk_packets(struct dma_pub *dmah, void (*callback_fnc)
(void *pkt, void *arg_a), void *arg_a);
/*
- * DMA(Bug) on some chips seems to declare that the packet is ready, but the
- * packet length is not updated yet (by DMA) on the expected time.
+ * DMA(Bug) on bcm47xx chips seems to declare that the packet is ready, but
+ * the packet length is not updated yet (by DMA) on the expected time.
* Workaround is to hold processor till DMA updates the length, and stay off
* the bus to allow DMA update the length in buffer
*/
static inline void dma_spin_for_len(uint len, struct sk_buff *head)
{
-#if defined(__mips__)
+#if defined(CONFIG_BCM47XX)
if (!len) {
while (!(len = *(u16 *) KSEG1ADDR(head->data)))
udelay(1);
*(u16 *) (head->data) = cpu_to_le16((u16) len);
}
-#endif /* defined(__mips__) */
+#endif /* defined(CONFIG_BCM47XX) */
}
#endif /* _BRCM_DMA_H_ */
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 15/15] staging: brcm80211: removed unused MIPS specific SDRAM swap window
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (13 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 14/15] staging: brcm80211: restrict MIPS dma bug workaround to BCM47XX Arend van Spriel
@ 2011-08-15 13:34 ` Arend van Spriel
2011-08-23 20:09 ` [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Greg KH
15 siblings, 0 replies; 17+ messages in thread
From: Arend van Spriel @ 2011-08-15 13:34 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless, Roland Vossen, Arend van Spriel
From: Roland Vossen <rvossen@broadcom.com>
Certain Mips based, big endian Broadcom products contain a memory window
for endianness swap purposes. However, this is too system specific for
this driver as there are more big endian platforms to support. Thus, this
'window' functionality is not to be used and can be removed.
The swap window would be a performance improvement and could be provided
with a dedicated mapping function in the platform specific code.
Tested on BCM63281.
Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Tested-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmsmac/aiutils.h | 2 --
drivers/staging/brcm80211/brcmsmac/dma.c | 8 --------
2 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.h b/drivers/staging/brcm80211/brcmsmac/aiutils.h
index 7ea42af..375c06f 100644
--- a/drivers/staging/brcm80211/brcmsmac/aiutils.h
+++ b/drivers/staging/brcm80211/brcmsmac/aiutils.h
@@ -30,8 +30,6 @@
#define SI_PCI_MEM_SZ (64 * 1024 * 1024)
/* Host Mode sb2pcitranslation1 (64 MB) */
#define SI_PCI_CFG 0x0c000000
-/* Byteswapped Physical SDRAM */
-#define SI_SDRAM_SWAPPED 0x10000000
/* Region 2 for sdram (512 MB) */
#define SI_SDRAM_R2 0x80000000
diff --git a/drivers/staging/brcm80211/brcmsmac/dma.c b/drivers/staging/brcm80211/brcmsmac/dma.c
index bda36c7..2ef416a 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.c
+++ b/drivers/staging/brcm80211/brcmsmac/dma.c
@@ -442,9 +442,6 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
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) */
/* WAR64450 : DMACtl.Addr ext fields are not supported in SDIOD core. */
if ((ai_coreid(sih) == SDIOD_CORE_ID)
&& ((ai_corerev(sih) > 0) && (ai_corerev(sih) <= 2)))
@@ -570,12 +567,7 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring,
u32 ctrl2 = bufcount & D64_CTRL2_BC_MASK;
/* PCI bus with big(>1G) physical address, use address extension */
-#if defined(__mips__) && defined(IL_BIGENDIAN)
- if ((di->dataoffsetlow == SI_SDRAM_SWAPPED)
- || !(pa & PCI32ADDR_HIGH)) {
-#else
if ((di->dataoffsetlow == 0) || !(pa & PCI32ADDR_HIGH)) {
-#endif /* defined(__mips__) && defined(IL_BIGENDIAN) */
ddring[outidx].addrlow = cpu_to_le32(pa + di->dataoffsetlow);
ddring[outidx].addrhigh = cpu_to_le32(di->dataoffsethigh);
ddring[outidx].ctrl1 = cpu_to_le32(*flags);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 00/15] staging: brcm80211: big-endian support and cleanup
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
` (14 preceding siblings ...)
2011-08-15 13:34 ` [PATCH 15/15] staging: brcm80211: removed unused MIPS specific SDRAM swap window Arend van Spriel
@ 2011-08-23 20:09 ` Greg KH
15 siblings, 0 replies; 17+ messages in thread
From: Greg KH @ 2011-08-23 20:09 UTC (permalink / raw)
To: Arend van Spriel; +Cc: gregkh, devel, linux-wireless
On Mon, Aug 15, 2011 at 03:34:12PM +0200, Arend van Spriel wrote:
> This patch series fixes several issues found on big-endian platform (Sparc,
> PowerPC, and MIPS) and some changes to code specific to broadcom MIPS
> platforms. Other patches are cleanup items to get rid of void pointer
> usage in the drivers.
>
> This series applies to staging-next and depends on the following patch set:
>
> Message-ID: <1313156101-16817-1-git-send-email-arend@broadcom.com>
All applied, thanks,
greg k-h
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2011-08-23 20:10 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-15 13:34 [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Arend van Spriel
2011-08-15 13:34 ` [PATCH 01/15] staging: brcm80211: got rid of several void pointers for softmac PCI Arend van Spriel
2011-08-15 13:34 ` [PATCH 02/15] staging: brcm80211: replaced void pointers in dma functions Arend van Spriel
2011-08-15 13:34 ` [PATCH 03/15] staging: brcm80211: replaced void pointers in otp functions Arend van Spriel
2011-08-15 13:34 ` [PATCH 04/15] staging: brcm80211: got rid of several void pointers in softmac Arend van Spriel
2011-08-15 13:34 ` [PATCH 05/15] staging: brcm80211: void * cleanup in fullmac Arend van Spriel
2011-08-15 13:34 ` [PATCH 06/15] staging: brcm80211: remove W_SM and R_SM macros from dma.c Arend van Spriel
2011-08-15 13:34 ` [PATCH 07/15] staging: brcm80211: remove PHYSADDR macro " Arend van Spriel
2011-08-15 13:34 ` [PATCH 08/15] staging: brcm80211: replace BUS_SWAP32 macro with cpu_to_le32() Arend van Spriel
2011-08-15 13:34 ` [PATCH 09/15] staging: brcm80211: fix off-by-one error in swap functions Arend van Spriel
2011-08-15 13:34 ` [PATCH 10/15] staging: brcm80211: Remove swaps in R_REG and W_REG macros Arend van Spriel
2011-08-15 13:34 ` [PATCH 11/15] staging: brcm80211: Fix handling of firmware and inits on big-endian platforms Arend van Spriel
2011-08-15 13:34 ` [PATCH 12/15] staging: brcm80211: remove mips specific include from dma.c Arend van Spriel
2011-08-15 13:34 ` [PATCH 13/15] staging: brcm80211: restrict register access method for bcm47xx Arend van Spriel
2011-08-15 13:34 ` [PATCH 14/15] staging: brcm80211: restrict MIPS dma bug workaround to BCM47XX Arend van Spriel
2011-08-15 13:34 ` [PATCH 15/15] staging: brcm80211: removed unused MIPS specific SDRAM swap window Arend van Spriel
2011-08-23 20:09 ` [PATCH 00/15] staging: brcm80211: big-endian support and cleanup Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).