aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFranky Lin <frankyl@broadcom.com>2011-11-10 14:30:24 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-11-11 14:28:37 -0500
commitd77e70ff5ace175f19447a1965691a794c27de24 (patch)
tree26614c338b286bb17042f028fd7bfc91d3af8839
parent086a2e0a63eef367dab9b4499ba0cfe3a309ec94 (diff)
brcm80211: fmac: add resetcore function for bcm4330 chip
This patch is part of the series of adding new backplane support Reviewed-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c5
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c45
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h4
3 files changed, 45 insertions, 9 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
index 0d0e28312262..a5d1c35e9d93 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
@@ -3108,8 +3108,7 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter)
3108 3108
3109 ci->coredisable(bus->sdiodev, ci, BCMA_CORE_ARM_CM3); 3109 ci->coredisable(bus->sdiodev, ci, BCMA_CORE_ARM_CM3);
3110 3110
3111 brcmf_sdio_chip_resetcore(bus->sdiodev, ci, 3111 ci->resetcore(bus->sdiodev, ci, BCMA_CORE_INTERNAL_MEM);
3112 BCMA_CORE_INTERNAL_MEM);
3113 3112
3114 /* Clear the top bit of memory */ 3113 /* Clear the top bit of memory */
3115 if (bus->ramsize) { 3114 if (bus->ramsize) {
@@ -3133,7 +3132,7 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter)
3133 w_sdreg32(bus, 0xFFFFFFFF, 3132 w_sdreg32(bus, 0xFFFFFFFF,
3134 offsetof(struct sdpcmd_regs, intstatus), &retries); 3133 offsetof(struct sdpcmd_regs, intstatus), &retries);
3135 3134
3136 brcmf_sdio_chip_resetcore(bus->sdiodev, ci, BCMA_CORE_ARM_CM3); 3135 ci->resetcore(bus->sdiodev, ci, BCMA_CORE_ARM_CM3);
3137 3136
3138 /* Allow HT Clock now that the ARM is running. */ 3137 /* Allow HT Clock now that the ARM is running. */
3139 bus->alp_only = false; 3138 bus->alp_only = false;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
index d2cf8c6811d9..cef9abb40a58 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
@@ -278,9 +278,9 @@ brcmf_sdio_ai_coredisable(struct brcmf_sdio_dev *sdiodev,
278 udelay(1); 278 udelay(1);
279} 279}
280 280
281void 281static void
282brcmf_sdio_chip_resetcore(struct brcmf_sdio_dev *sdiodev, 282brcmf_sdio_sb_resetcore(struct brcmf_sdio_dev *sdiodev,
283 struct chip_info *ci, u16 coreid) 283 struct chip_info *ci, u16 coreid)
284{ 284{
285 u32 regdata; 285 u32 regdata;
286 u8 idx; 286 u8 idx;
@@ -291,7 +291,7 @@ brcmf_sdio_chip_resetcore(struct brcmf_sdio_dev *sdiodev,
291 * Must do the disable sequence first to work for 291 * Must do the disable sequence first to work for
292 * arbitrary current core state. 292 * arbitrary current core state.
293 */ 293 */
294 ci->coredisable(sdiodev, ci, coreid); 294 brcmf_sdio_sb_coredisable(sdiodev, ci, coreid);
295 295
296 /* 296 /*
297 * Now do the initialization sequence. 297 * Now do the initialization sequence.
@@ -301,8 +301,11 @@ brcmf_sdio_chip_resetcore(struct brcmf_sdio_dev *sdiodev,
301 brcmf_sdcard_reg_write(sdiodev, 301 brcmf_sdcard_reg_write(sdiodev,
302 CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4, 302 CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4,
303 SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK | SSB_TMSLOW_RESET); 303 SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK | SSB_TMSLOW_RESET);
304 regdata = brcmf_sdcard_reg_read(sdiodev,
305 CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4);
304 udelay(1); 306 udelay(1);
305 307
308 /* clear any serror */
306 regdata = brcmf_sdcard_reg_read(sdiodev, 309 regdata = brcmf_sdcard_reg_read(sdiodev,
307 CORE_SB(ci->c_inf[idx].base, sbtmstatehigh), 4); 310 CORE_SB(ci->c_inf[idx].base, sbtmstatehigh), 4);
308 if (regdata & SSB_TMSHIGH_SERR) 311 if (regdata & SSB_TMSHIGH_SERR)
@@ -320,12 +323,44 @@ brcmf_sdio_chip_resetcore(struct brcmf_sdio_dev *sdiodev,
320 brcmf_sdcard_reg_write(sdiodev, 323 brcmf_sdcard_reg_write(sdiodev,
321 CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4, 324 CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4,
322 SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK); 325 SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK);
326 regdata = brcmf_sdcard_reg_read(sdiodev,
327 CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4);
323 udelay(1); 328 udelay(1);
324 329
325 /* leave clock enabled */ 330 /* leave clock enabled */
326 brcmf_sdcard_reg_write(sdiodev, 331 brcmf_sdcard_reg_write(sdiodev,
327 CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 332 CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
328 4, SSB_TMSLOW_CLOCK); 333 4, SSB_TMSLOW_CLOCK);
334 regdata = brcmf_sdcard_reg_read(sdiodev,
335 CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4);
336 udelay(1);
337}
338
339static void
340brcmf_sdio_ai_resetcore(struct brcmf_sdio_dev *sdiodev,
341 struct chip_info *ci, u16 coreid)
342{
343 u8 idx;
344 u32 regdata;
345
346 idx = brcmf_sdio_chip_getinfidx(ci, coreid);
347
348 /* must disable first to work for arbitrary current core state */
349 brcmf_sdio_ai_coredisable(sdiodev, ci, coreid);
350
351 /* now do initialization sequence */
352 brcmf_sdcard_reg_write(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
353 4, BCMA_IOCTL_FGC | BCMA_IOCTL_CLK);
354 regdata = brcmf_sdcard_reg_read(sdiodev,
355 ci->c_inf[idx].wrapbase+BCMA_IOCTL, 4);
356 brcmf_sdcard_reg_write(sdiodev, ci->c_inf[idx].wrapbase+BCMA_RESET_CTL,
357 4, 0);
358 udelay(1);
359
360 brcmf_sdcard_reg_write(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
361 4, BCMA_IOCTL_CLK);
362 regdata = brcmf_sdcard_reg_read(sdiodev,
363 ci->c_inf[idx].wrapbase+BCMA_IOCTL, 4);
329 udelay(1); 364 udelay(1);
330} 365}
331 366
@@ -371,11 +406,13 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev,
371 ci->iscoreup = brcmf_sdio_sb_iscoreup; 406 ci->iscoreup = brcmf_sdio_sb_iscoreup;
372 ci->corerev = brcmf_sdio_sb_corerev; 407 ci->corerev = brcmf_sdio_sb_corerev;
373 ci->coredisable = brcmf_sdio_sb_coredisable; 408 ci->coredisable = brcmf_sdio_sb_coredisable;
409 ci->resetcore = brcmf_sdio_sb_resetcore;
374 break; 410 break;
375 case SOCI_AI: 411 case SOCI_AI:
376 ci->iscoreup = brcmf_sdio_ai_iscoreup; 412 ci->iscoreup = brcmf_sdio_ai_iscoreup;
377 ci->corerev = brcmf_sdio_ai_corerev; 413 ci->corerev = brcmf_sdio_ai_corerev;
378 ci->coredisable = brcmf_sdio_ai_coredisable; 414 ci->coredisable = brcmf_sdio_ai_coredisable;
415 ci->resetcore = brcmf_sdio_ai_resetcore;
379 break; 416 break;
380 default: 417 default:
381 brcmf_dbg(ERROR, "socitype %u not supported\n", ci->socitype); 418 brcmf_dbg(ERROR, "socitype %u not supported\n", ci->socitype);
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h
index 22232a8804bd..ce974d76bd92 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h
@@ -80,6 +80,8 @@ struct chip_info {
80 u16 coreid); 80 u16 coreid);
81 void (*coredisable)(struct brcmf_sdio_dev *sdiodev, 81 void (*coredisable)(struct brcmf_sdio_dev *sdiodev,
82 struct chip_info *ci, u16 coreid); 82 struct chip_info *ci, u16 coreid);
83 void (*resetcore)(struct brcmf_sdio_dev *sdiodev,
84 struct chip_info *ci, u16 coreid);
83}; 85};
84 86
85struct sbconfig { 87struct sbconfig {
@@ -122,8 +124,6 @@ struct sbconfig {
122 u32 sbidhigh; /* identification */ 124 u32 sbidhigh; /* identification */
123}; 125};
124 126
125extern void brcmf_sdio_chip_resetcore(struct brcmf_sdio_dev *sdiodev,
126 struct chip_info *ci, u16 coreid);
127extern int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev, 127extern int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev,
128 struct chip_info **ci_ptr, u32 regs); 128 struct chip_info **ci_ptr, u32 regs);
129extern void brcmf_sdio_chip_detach(struct chip_info **ci_ptr); 129extern void brcmf_sdio_chip_detach(struct chip_info **ci_ptr);