Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mac80211: brcmsmac: add some patches starting to add support for some…
… more chips git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32020 3c298f89-4303-0410-b956-a3cf2f4a3e73
- Loading branch information
hauke
committed
Jun 1, 2012
1 parent
539cdb7
commit 50498fc
Showing
12 changed files
with
626 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | ||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | ||
@@ -320,9 +320,7 @@ | ||
#define IS_SIM(chippkg) \ | ||
((chippkg == HDLSIM_PKG_ID) || (chippkg == HWSIM_PKG_ID)) | ||
|
||
-#define PCIE(sih) (ai_get_buscoretype(sih) == PCIE_CORE_ID) | ||
- | ||
-#define PCI_FORCEHT(sih) (PCIE(sih) && (ai_get_chip_id(sih) == BCM4716_CHIP_ID)) | ||
+#define PCI_FORCEHT(sih) ((ai_get_buscoretype(sih) == PCIE_CORE_ID) && (ai_get_chip_id(sih) == BCM4716_CHIP_ID)) | ||
|
||
#ifdef DEBUG | ||
#define SI_MSG(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) | ||
@@ -777,7 +775,7 @@ void ai_pci_up(struct si_pub *sih) | ||
bcma_core_set_clockmode(cc, BCMA_CLKMODE_FAST); | ||
} | ||
|
||
- if (PCIE(sih)) | ||
+ if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) | ||
bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, true); | ||
} | ||
|
||
@@ -795,7 +793,7 @@ void ai_pci_down(struct si_pub *sih) | ||
bcma_core_set_clockmode(cc, BCMA_CLKMODE_DYNAMIC); | ||
} | ||
|
||
- if (PCIE(sih)) | ||
+ if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) | ||
bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, false); | ||
} | ||
|
54 changes: 54 additions & 0 deletions
54
package/mac80211/patches/841-brcmsmac-remove-PCI_FORCEHT.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | ||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | ||
@@ -320,8 +320,6 @@ | ||
#define IS_SIM(chippkg) \ | ||
((chippkg == HDLSIM_PKG_ID) || (chippkg == HWSIM_PKG_ID)) | ||
|
||
-#define PCI_FORCEHT(sih) ((ai_get_buscoretype(sih) == PCIE_CORE_ID) && (ai_get_chip_id(sih) == BCM4716_CHIP_ID)) | ||
- | ||
#ifdef DEBUG | ||
#define SI_MSG(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) | ||
#else | ||
@@ -755,9 +753,6 @@ bool ai_clkctl_cc(struct si_pub *sih, en | ||
|
||
sii = (struct si_info *)sih; | ||
|
||
- if (PCI_FORCEHT(sih)) | ||
- return mode == BCMA_CLKMODE_FAST; | ||
- | ||
cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0); | ||
bcma_core_set_clockmode(cc, mode); | ||
return mode == BCMA_CLKMODE_FAST; | ||
@@ -766,15 +761,9 @@ bool ai_clkctl_cc(struct si_pub *sih, en | ||
void ai_pci_up(struct si_pub *sih) | ||
{ | ||
struct si_info *sii; | ||
- struct bcma_device *cc; | ||
|
||
sii = (struct si_info *)sih; | ||
|
||
- if (PCI_FORCEHT(sih)) { | ||
- cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0); | ||
- bcma_core_set_clockmode(cc, BCMA_CLKMODE_FAST); | ||
- } | ||
- | ||
if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) | ||
bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, true); | ||
} | ||
@@ -783,16 +772,9 @@ void ai_pci_up(struct si_pub *sih) | ||
void ai_pci_down(struct si_pub *sih) | ||
{ | ||
struct si_info *sii; | ||
- struct bcma_device *cc; | ||
|
||
sii = (struct si_info *)sih; | ||
|
||
- /* release FORCEHT since chip is going to "down" state */ | ||
- if (PCI_FORCEHT(sih)) { | ||
- cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0); | ||
- bcma_core_set_clockmode(cc, BCMA_CLKMODE_DYNAMIC); | ||
- } | ||
- | ||
if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) | ||
bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, false); | ||
} |
48 changes: 48 additions & 0 deletions
48
package/mac80211/patches/842-brcmsmac-remove-ai_get_buscoretype-and-ai_get_buscor.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | ||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | ||
@@ -471,9 +471,6 @@ ai_buscore_setup(struct si_info *sii, st | ||
sii->pub.pmurev = sii->pub.pmucaps & PCAP_REV_MASK; | ||
} | ||
|
||
- /* figure out buscore */ | ||
- sii->buscore = ai_findcore(&sii->pub, PCIE_CORE_ID, 0); | ||
- | ||
return true; | ||
} | ||
|
||
@@ -807,15 +804,3 @@ bool ai_deviceremoved(struct si_pub *sih | ||
|
||
return false; | ||
} | ||
- | ||
-uint ai_get_buscoretype(struct si_pub *sih) | ||
-{ | ||
- struct si_info *sii = (struct si_info *)sih; | ||
- return sii->buscore->id.id; | ||
-} | ||
- | ||
-uint ai_get_buscorerev(struct si_pub *sih) | ||
-{ | ||
- struct si_info *sii = (struct si_info *)sih; | ||
- return sii->buscore->id.rev; | ||
-} | ||
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | ||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | ||
@@ -168,7 +168,6 @@ struct si_info { | ||
struct si_pub pub; /* back plane public state (must be first) */ | ||
struct bcma_bus *icbus; /* handle to soc interconnect bus */ | ||
struct pci_dev *pcibus; /* handle to pci bus */ | ||
- struct bcma_device *buscore; | ||
|
||
u32 chipst; /* chip status */ | ||
}; | ||
@@ -202,9 +201,6 @@ extern void ai_pci_up(struct si_pub *sih | ||
/* Enable Ex-PA for 4313 */ | ||
extern void ai_epa_4313war(struct si_pub *sih); | ||
|
||
-extern uint ai_get_buscoretype(struct si_pub *sih); | ||
-extern uint ai_get_buscorerev(struct si_pub *sih); | ||
- | ||
static inline u32 ai_get_cccaps(struct si_pub *sih) | ||
{ | ||
return sih->cccaps; |
74 changes: 74 additions & 0 deletions
74
package/mac80211/patches/843-brcmsmac-use-container_of-instead-of-cast.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | ||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | ||
@@ -584,7 +584,7 @@ void ai_detach(struct si_pub *sih) | ||
struct si_pub *si_local = NULL; | ||
memcpy(&si_local, &sih, sizeof(struct si_pub **)); | ||
|
||
- sii = (struct si_info *)sih; | ||
+ sii = container_of(sih, struct si_info, pub); | ||
|
||
if (sii == NULL) | ||
return; | ||
@@ -599,7 +599,7 @@ struct bcma_device *ai_findcore(struct s | ||
struct si_info *sii; | ||
uint found; | ||
|
||
- sii = (struct si_info *)sih; | ||
+ sii = container_of(sih, struct si_info, pub); | ||
|
||
found = 0; | ||
|
||
@@ -622,7 +622,7 @@ uint ai_cc_reg(struct si_pub *sih, uint | ||
u32 w; | ||
struct si_info *sii; | ||
|
||
- sii = (struct si_info *)sih; | ||
+ sii = container_of(sih, struct si_info, pub); | ||
cc = sii->icbus->drv_cc.core; | ||
|
||
/* mask and set */ | ||
@@ -716,7 +716,7 @@ u16 ai_clkctl_fast_pwrup_delay(struct si | ||
uint slowminfreq; | ||
u16 fpdelay; | ||
|
||
- sii = (struct si_info *)sih; | ||
+ sii = container_of(sih, struct si_info, pub); | ||
if (ai_get_cccaps(sih) & CC_CAP_PMU) { | ||
fpdelay = si_pmu_fast_pwrup_delay(sih); | ||
return fpdelay; | ||
@@ -748,7 +748,7 @@ bool ai_clkctl_cc(struct si_pub *sih, en | ||
struct si_info *sii; | ||
struct bcma_device *cc; | ||
|
||
- sii = (struct si_info *)sih; | ||
+ sii = container_of(sih, struct si_info, pub); | ||
|
||
cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0); | ||
bcma_core_set_clockmode(cc, mode); | ||
@@ -759,7 +759,7 @@ void ai_pci_up(struct si_pub *sih) | ||
{ | ||
struct si_info *sii; | ||
|
||
- sii = (struct si_info *)sih; | ||
+ sii = container_of(sih, struct si_info, pub); | ||
|
||
if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) | ||
bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, true); | ||
@@ -770,7 +770,7 @@ void ai_pci_down(struct si_pub *sih) | ||
{ | ||
struct si_info *sii; | ||
|
||
- sii = (struct si_info *)sih; | ||
+ sii = container_of(sih, struct si_info, pub); | ||
|
||
if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) | ||
bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, false); | ||
@@ -793,7 +793,7 @@ bool ai_deviceremoved(struct si_pub *sih | ||
u32 w; | ||
struct si_info *sii; | ||
|
||
- sii = (struct si_info *)sih; | ||
+ sii = container_of(sih, struct si_info, pub); | ||
|
||
if (sii->icbus->hosttype != BCMA_HOSTTYPE_PCI) | ||
return false; |
145 changes: 145 additions & 0 deletions
145
package/mac80211/patches/844-brcmsmac-remove-ai_findcore.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | ||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | ||
@@ -592,27 +592,6 @@ void ai_detach(struct si_pub *sih) | ||
kfree(sii); | ||
} | ||
|
||
-/* return index of coreid or BADIDX if not found */ | ||
-struct bcma_device *ai_findcore(struct si_pub *sih, u16 coreid, u16 coreunit) | ||
-{ | ||
- struct bcma_device *core; | ||
- struct si_info *sii; | ||
- uint found; | ||
- | ||
- sii = container_of(sih, struct si_info, pub); | ||
- | ||
- found = 0; | ||
- | ||
- list_for_each_entry(core, &sii->icbus->cores, list) | ||
- if (core->id.id == coreid) { | ||
- if (found == coreunit) | ||
- return core; | ||
- found++; | ||
- } | ||
- | ||
- return NULL; | ||
-} | ||
- | ||
/* | ||
* read/modify chipcommon core register. | ||
*/ | ||
@@ -689,12 +668,13 @@ ai_clkctl_setdelay(struct si_pub *sih, s | ||
/* initialize power control delay registers */ | ||
void ai_clkctl_init(struct si_pub *sih) | ||
{ | ||
+ struct si_info *sii = container_of(sih, struct si_info, pub); | ||
struct bcma_device *cc; | ||
|
||
if (!(ai_get_cccaps(sih) & CC_CAP_PWR_CTL)) | ||
return; | ||
|
||
- cc = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0); | ||
+ cc = sii->icbus->drv_cc.core;; | ||
if (cc == NULL) | ||
return; | ||
|
||
@@ -726,7 +706,7 @@ u16 ai_clkctl_fast_pwrup_delay(struct si | ||
return 0; | ||
|
||
fpdelay = 0; | ||
- cc = ai_findcore(sih, CC_CORE_ID, 0); | ||
+ cc = sii->icbus->drv_cc.core;; | ||
if (cc) { | ||
slowminfreq = ai_slowclk_freq(sih, false, cc); | ||
fpdelay = (((bcma_read32(cc, CHIPCREGOFFS(pll_on_delay)) + 2) | ||
@@ -750,7 +730,7 @@ bool ai_clkctl_cc(struct si_pub *sih, en | ||
|
||
sii = container_of(sih, struct si_info, pub); | ||
|
||
- cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0); | ||
+ cc = sii->icbus->drv_cc.core;; | ||
bcma_core_set_clockmode(cc, mode); | ||
return mode == BCMA_CLKMODE_FAST; | ||
} | ||
@@ -779,9 +759,10 @@ void ai_pci_down(struct si_pub *sih) | ||
/* Enable BT-COEX & Ex-PA for 4313 */ | ||
void ai_epa_4313war(struct si_pub *sih) | ||
{ | ||
+ struct si_info *sii =container_of(sih, struct si_info, pub); | ||
struct bcma_device *cc; | ||
|
||
- cc = ai_findcore(sih, CC_CORE_ID, 0); | ||
+ cc = sii->icbus->drv_cc.core; | ||
|
||
/* EPA Fix */ | ||
bcma_set32(cc, CHIPCREGOFFS(gpiocontrol), GPIO_CTRL_EPA_EN_MASK); | ||
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | ||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | ||
@@ -182,8 +182,6 @@ struct si_info { | ||
|
||
|
||
/* AMBA Interconnect exported externs */ | ||
-extern struct bcma_device *ai_findcore(struct si_pub *sih, | ||
- u16 coreid, u16 coreunit); | ||
extern u32 ai_core_cflags(struct bcma_device *core, u32 mask, u32 val); | ||
|
||
/* === exported functions === */ | ||
--- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c | ||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c | ||
@@ -142,10 +142,11 @@ static void si_pmu_res_masks(struct si_p | ||
void si_pmu_spuravoid_pllupdate(struct si_pub *sih, u8 spuravoid) | ||
{ | ||
u32 tmp = 0; | ||
+ struct si_info *sii = container_of(sih, struct si_info, pub); | ||
struct bcma_device *core; | ||
|
||
/* switch to chipc */ | ||
- core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0); | ||
+ core = sii->icbus->drv_cc.core; | ||
|
||
switch (ai_get_chip_id(sih)) { | ||
case BCM43224_CHIP_ID: | ||
@@ -286,10 +287,11 @@ u32 si_pmu_alp_clock(struct si_pub *sih) | ||
/* initialize PMU */ | ||
void si_pmu_init(struct si_pub *sih) | ||
{ | ||
+ struct si_info *sii = container_of(sih, struct si_info, pub); | ||
struct bcma_device *core; | ||
|
||
/* select chipc */ | ||
- core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0); | ||
+ core = sii->icbus->drv_cc.core; | ||
|
||
if (ai_get_pmurev(sih) == 1) | ||
bcma_mask32(core, CHIPCREGOFFS(pmucontrol), | ||
@@ -301,11 +303,12 @@ void si_pmu_init(struct si_pub *sih) | ||
/* initialize PMU resources */ | ||
void si_pmu_res_init(struct si_pub *sih) | ||
{ | ||
+ struct si_info *sii = container_of(sih, struct si_info, pub); | ||
struct bcma_device *core; | ||
u32 min_mask = 0, max_mask = 0; | ||
|
||
/* select to chipc */ | ||
- core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0); | ||
+ core = sii->icbus->drv_cc.core; | ||
|
||
/* Determine min/max rsrc masks */ | ||
si_pmu_res_masks(sih, &min_mask, &max_mask); | ||
@@ -328,6 +331,7 @@ void si_pmu_res_init(struct si_pub *sih) | ||
|
||
u32 si_pmu_measure_alpclk(struct si_pub *sih) | ||
{ | ||
+ struct si_info *sii = container_of(sih, struct si_info, pub); | ||
struct bcma_device *core; | ||
u32 alp_khz; | ||
|
||
@@ -335,7 +339,7 @@ u32 si_pmu_measure_alpclk(struct si_pub | ||
return 0; | ||
|
||
/* Remember original core before switch to chipc */ | ||
- core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0); | ||
+ core = sii->icbus->drv_cc.core; | ||
|
||
if (bcma_read32(core, CHIPCREGOFFS(pmustatus)) & PST_EXTLPOAVAIL) { | ||
u32 ilp_ctr, alp_hz; |
Oops, something went wrong.