staging: brcm80211: big-endian support and cleanup
cover staging: brcm80211: big-endian support and cleanup
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: <[email protected]>
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(-)
Signature · 1 line
1.7.4.1
PATCH 1/15 staging: brcm80211: got rid of several void pointers for softmac PCI
From: Roland Vossen <[email protected]>
Code cleanup. Replace void * related to PCI functionality by less generic pointer types.
--- 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(-)
drivers/staging/brcm80211/brcmsmac/aiutils.c +6 -4
@@ -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);
drivers/staging/brcm80211/brcmsmac/aiutils.h +1 -1
@@ -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 */
drivers/staging/brcm80211/brcmsmac/dma.c +1 -1
@@ -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 */
drivers/staging/brcm80211/brcmsmac/nicpci.c +26 -35
157 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/nicpci.h +19 -11
@@ -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_ */
Signature · 1 line
1.7.4.1
PATCH 2/15 staging: brcm80211: replaced void pointers in dma functions
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
Code cleanup. Replaced by less generic pointer types.
--- 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(-)
drivers/staging/brcm80211/brcmsmac/dma.c +16 -15
@@ -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;
drivers/staging/brcm80211/brcmsmac/dma.h +2 -2
@@ -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)
drivers/staging/brcm80211/brcmsmac/main.c +2 -2
@@ -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
Signature · 1 line
1.7.4.1
PATCH 3/15 staging: brcm80211: replaced void pointers in otp functions
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
Code cleanup. Otp is 'One Time Programmable' functionality. Replaced void pointers by less generic pointer types.
--- drivers/staging/brcm80211/brcmsmac/otp.c | 90 ++++++++++++----------------- drivers/staging/brcm80211/brcmsmac/otp.h | 12 ++-- 2 files changed, 44 insertions(+), 58 deletions(-)
drivers/staging/brcm80211/brcmsmac/otp.c +37 -53
@@ -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); }
drivers/staging/brcm80211/brcmsmac/otp.h +7 -5
@@ -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_ */
Signature · 1 line
1.7.4.1
PATCH 4/15 staging: brcm80211: got rid of several void pointers in softmac
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
Code cleanup. Replaced void pointers by less generic pointer types.
--- 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(-)
drivers/staging/brcm80211/brcmsmac/ampdu.c +0 -14
@@ -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); }
drivers/staging/brcm80211/brcmsmac/dma.c +0 -1
@@ -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 ];
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +2 -2
@@ -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 ;
drivers/staging/brcm80211/brcmsmac/mac80211_if.h +2 -2
@@ -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;
drivers/staging/brcm80211/brcmsmac/main.c +22 -23
141 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/main.h +5 -18
@@ -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);
drivers/staging/brcm80211/brcmsmac/phy_shim.c +4 -3
@@ -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 );
drivers/staging/brcm80211/brcmsmac/phy_shim.h +2 -1
@@ -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 */
drivers/staging/brcm80211/brcmsmac/pub.h +7 -9
@@ -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);
drivers/staging/brcm80211/brcmsmac/scb.h +0 -1
@@ -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) */
Signature · 1 line
1.7.4.1
PATCH 5/15 staging: brcm80211: void * cleanup in fullmac
In reply to Arend van SprielFrom: Franky Lin <[email protected]>
Remove improper usage of void * in dhd_linux.c and dhd_sdio.c
--- 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(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +3 -2
@@ -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 */
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +7 -7
@@ -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;
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +3 -3
@@ -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;
Signature · 1 line
1.7.4.1
PATCH 6/15 staging: brcm80211: remove W_SM and R_SM macros from dma.c
In reply to Arend van SprielThe 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.
--- drivers/staging/brcm80211/brcmsmac/dma.c | 54 ++++++++++++++---------------- 1 files changed, 25 insertions(+), 29 deletions(-)
drivers/staging/brcm80211/brcmsmac/dma.c +25 -29
@@ -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);
Signature · 1 line
1.7.4.1
PATCH 7/15 staging: brcm80211: remove PHYSADDR macro from dma.c
In reply to Arend van SprielFour 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.
--- drivers/staging/brcm80211/brcmsmac/dma.c | 95 +++++++++--------------------- 1 files changed, 29 insertions(+), 66 deletions(-)
drivers/staging/brcm80211/brcmsmac/dma.c +29 -66
@@ -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 );
Signature · 1 line
1.7.4.1
PATCH 8/15 staging: brcm80211: replace BUS_SWAP32 macro with cpu_to_le32()
In reply to Arend van SprielThe 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.
--- drivers/staging/brcm80211/brcmsmac/dma.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-)
drivers/staging/brcm80211/brcmsmac/dma.c +13 -13
@@ -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 );
Signature · 1 line
1.7.4.1
PATCH 9/15 staging: brcm80211: fix off-by-one error in swap functions
In reply to Arend van SprielFrom: Henry Ptasinski <[email protected]>
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.
--- drivers/staging/brcm80211/brcmsmac/srom.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/staging/brcm80211/brcmsmac/srom.c +4 -2
@@ -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)); }
Signature · 1 line
1.7.4.1
PATCH 10/15 staging: brcm80211: Remove swaps in R_REG and W_REG macros
In reply to Arend van SprielFrom: Henry Ptasinski <[email protected]>
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.
--- drivers/staging/brcm80211/brcmsmac/types.h | 19 ++++--------------- 1 files changed, 4 insertions(+), 15 deletions(-)
drivers/staging/brcm80211/brcmsmac/types.h +4 -15
@@ -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)); \
Signature · 1 line
1.7.4.1
PATCH 11/15 staging: brcm80211: Fix handling of firmware and inits on big-endian platforms
In reply to Arend van SprielFrom: Henry Ptasinski <[email protected]>
The firmware files are encoded as little-endian. Do the appropriate swapping for big-endian platforms.
Tested on Mac G5 PPC and BCM63281.
--- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 24 ++++++++++++--------- drivers/staging/brcm80211/brcmsmac/main.c | 21 ++++++++++++------ 2 files changed, 28 insertions(+), 17 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +14 -10
@@ -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",
drivers/staging/brcm80211/brcmsmac/main.c +14 -7
@@ -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 ; } }
Signature · 1 line
1.7.4.1
PATCH 12/15 staging: brcm80211: remove mips specific include from dma.c
In reply to Arend van SprielThe 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.
--- drivers/staging/brcm80211/brcmsmac/dma.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/staging/brcm80211/brcmsmac/dma.c +0 -4
@@ -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"
Signature · 1 line
1.7.4.1
PATCH 13/15 staging: brcm80211: restrict register access method for bcm47xx
In reply to Arend van SprielThe 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.
--- drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 2 +- drivers/staging/brcm80211/brcmsmac/types.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +1 -1
@@ -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 )
drivers/staging/brcm80211/brcmsmac/types.h +2 -2
@@ -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))
Signature · 1 line
1.7.4.1
PATCH 14/15 staging: brcm80211: restrict MIPS dma bug workaround to BCM47XX
In reply to Arend van SprielThe 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.
--- drivers/staging/brcm80211/brcmsmac/dma.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/brcm80211/brcmsmac/dma.h +4 -4
@@ -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_ */
Signature · 1 line
1.7.4.1
PATCH 15/15 staging: brcm80211: removed unused MIPS specific SDRAM swap window
In reply to Arend van SprielFrom: Roland Vossen <[email protected]>
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.
--- drivers/staging/brcm80211/brcmsmac/aiutils.h | 2 -- drivers/staging/brcm80211/brcmsmac/dma.c | 8 -------- 2 files changed, 0 insertions(+), 10 deletions(-)
drivers/staging/brcm80211/brcmsmac/aiutils.h +0 -2
@@ -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
drivers/staging/brcm80211/brcmsmac/dma.c +0 -8
@@ -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);
Signature · 1 line
1.7.4.1
Quoted 8 lines · 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: <[email protected]>
All applied, thanks,
greg k-h