mac80211: brcmsmac: add some patches starting to add support for some more chips
[openwrt/staging/mkresin.git] / package / mac80211 / patches / 844-brcmsmac-remove-ai_findcore.patch
1 --- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
2 +++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
3 @@ -592,27 +592,6 @@ void ai_detach(struct si_pub *sih)
4 kfree(sii);
5 }
6
7 -/* return index of coreid or BADIDX if not found */
8 -struct bcma_device *ai_findcore(struct si_pub *sih, u16 coreid, u16 coreunit)
9 -{
10 - struct bcma_device *core;
11 - struct si_info *sii;
12 - uint found;
13 -
14 - sii = container_of(sih, struct si_info, pub);
15 -
16 - found = 0;
17 -
18 - list_for_each_entry(core, &sii->icbus->cores, list)
19 - if (core->id.id == coreid) {
20 - if (found == coreunit)
21 - return core;
22 - found++;
23 - }
24 -
25 - return NULL;
26 -}
27 -
28 /*
29 * read/modify chipcommon core register.
30 */
31 @@ -689,12 +668,13 @@ ai_clkctl_setdelay(struct si_pub *sih, s
32 /* initialize power control delay registers */
33 void ai_clkctl_init(struct si_pub *sih)
34 {
35 + struct si_info *sii = container_of(sih, struct si_info, pub);
36 struct bcma_device *cc;
37
38 if (!(ai_get_cccaps(sih) & CC_CAP_PWR_CTL))
39 return;
40
41 - cc = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0);
42 + cc = sii->icbus->drv_cc.core;;
43 if (cc == NULL)
44 return;
45
46 @@ -726,7 +706,7 @@ u16 ai_clkctl_fast_pwrup_delay(struct si
47 return 0;
48
49 fpdelay = 0;
50 - cc = ai_findcore(sih, CC_CORE_ID, 0);
51 + cc = sii->icbus->drv_cc.core;;
52 if (cc) {
53 slowminfreq = ai_slowclk_freq(sih, false, cc);
54 fpdelay = (((bcma_read32(cc, CHIPCREGOFFS(pll_on_delay)) + 2)
55 @@ -750,7 +730,7 @@ bool ai_clkctl_cc(struct si_pub *sih, en
56
57 sii = container_of(sih, struct si_info, pub);
58
59 - cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0);
60 + cc = sii->icbus->drv_cc.core;;
61 bcma_core_set_clockmode(cc, mode);
62 return mode == BCMA_CLKMODE_FAST;
63 }
64 @@ -779,9 +759,10 @@ void ai_pci_down(struct si_pub *sih)
65 /* Enable BT-COEX & Ex-PA for 4313 */
66 void ai_epa_4313war(struct si_pub *sih)
67 {
68 + struct si_info *sii =container_of(sih, struct si_info, pub);
69 struct bcma_device *cc;
70
71 - cc = ai_findcore(sih, CC_CORE_ID, 0);
72 + cc = sii->icbus->drv_cc.core;
73
74 /* EPA Fix */
75 bcma_set32(cc, CHIPCREGOFFS(gpiocontrol), GPIO_CTRL_EPA_EN_MASK);
76 --- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
77 +++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
78 @@ -182,8 +182,6 @@ struct si_info {
79
80
81 /* AMBA Interconnect exported externs */
82 -extern struct bcma_device *ai_findcore(struct si_pub *sih,
83 - u16 coreid, u16 coreunit);
84 extern u32 ai_core_cflags(struct bcma_device *core, u32 mask, u32 val);
85
86 /* === exported functions === */
87 --- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
88 +++ b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
89 @@ -142,10 +142,11 @@ static void si_pmu_res_masks(struct si_p
90 void si_pmu_spuravoid_pllupdate(struct si_pub *sih, u8 spuravoid)
91 {
92 u32 tmp = 0;
93 + struct si_info *sii = container_of(sih, struct si_info, pub);
94 struct bcma_device *core;
95
96 /* switch to chipc */
97 - core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0);
98 + core = sii->icbus->drv_cc.core;
99
100 switch (ai_get_chip_id(sih)) {
101 case BCM43224_CHIP_ID:
102 @@ -286,10 +287,11 @@ u32 si_pmu_alp_clock(struct si_pub *sih)
103 /* initialize PMU */
104 void si_pmu_init(struct si_pub *sih)
105 {
106 + struct si_info *sii = container_of(sih, struct si_info, pub);
107 struct bcma_device *core;
108
109 /* select chipc */
110 - core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0);
111 + core = sii->icbus->drv_cc.core;
112
113 if (ai_get_pmurev(sih) == 1)
114 bcma_mask32(core, CHIPCREGOFFS(pmucontrol),
115 @@ -301,11 +303,12 @@ void si_pmu_init(struct si_pub *sih)
116 /* initialize PMU resources */
117 void si_pmu_res_init(struct si_pub *sih)
118 {
119 + struct si_info *sii = container_of(sih, struct si_info, pub);
120 struct bcma_device *core;
121 u32 min_mask = 0, max_mask = 0;
122
123 /* select to chipc */
124 - core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0);
125 + core = sii->icbus->drv_cc.core;
126
127 /* Determine min/max rsrc masks */
128 si_pmu_res_masks(sih, &min_mask, &max_mask);
129 @@ -328,6 +331,7 @@ void si_pmu_res_init(struct si_pub *sih)
130
131 u32 si_pmu_measure_alpclk(struct si_pub *sih)
132 {
133 + struct si_info *sii = container_of(sih, struct si_info, pub);
134 struct bcma_device *core;
135 u32 alp_khz;
136
137 @@ -335,7 +339,7 @@ u32 si_pmu_measure_alpclk(struct si_pub
138 return 0;
139
140 /* Remember original core before switch to chipc */
141 - core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0);
142 + core = sii->icbus->drv_cc.core;
143
144 if (bcma_read32(core, CHIPCREGOFFS(pmustatus)) & PST_EXTLPOAVAIL) {
145 u32 ilp_ctr, alp_hz;