diff options
author | Franky Lin <frankyl@broadcom.com> | 2011-11-10 14:30:21 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-11-11 14:28:33 -0500 |
commit | 6ca687d9461b25ce2339ba1809ec13ef459d4661 (patch) | |
tree | 38a6361d8483e5a9f1c70ee3b4d86f9dafb0e547 | |
parent | e9ca530a7b183691d9799fd40772c2cd398b494a (diff) |
brcm80211: fmac: add iscoreup function for bcm4330 chip
New type of backplane interconnect support is needed
for bcm4330
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.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c | 50 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h | 6 |
3 files changed, 51 insertions, 9 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 43b44961a41a..5b813361f5f3 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -3120,9 +3120,7 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter) | |||
3120 | (u8 *)&zeros, 4); | 3120 | (u8 *)&zeros, 4); |
3121 | } | 3121 | } |
3122 | } else { | 3122 | } else { |
3123 | idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_INTERNAL_MEM); | 3123 | if (!ci->iscoreup(bus->sdiodev, ci, BCMA_CORE_INTERNAL_MEM)) { |
3124 | if (!brcmf_sdio_chip_iscoreup(bus->sdiodev, | ||
3125 | ci->c_inf[idx].base)) { | ||
3126 | brcmf_dbg(ERROR, "SOCRAM core is down after reset?\n"); | 3124 | brcmf_dbg(ERROR, "SOCRAM core is down after reset?\n"); |
3127 | bcmerror = -EBADE; | 3125 | bcmerror = -EBADE; |
3128 | goto fail; | 3126 | goto fail; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c index 99d00ddc1639..263ad0cb6223 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c | |||
@@ -45,6 +45,10 @@ | |||
45 | ((((sbidh) & SSB_IDHIGH_RCHI) >> SSB_IDHIGH_RCHI_SHIFT) | \ | 45 | ((((sbidh) & SSB_IDHIGH_RCHI) >> SSB_IDHIGH_RCHI_SHIFT) | \ |
46 | ((sbidh) & SSB_IDHIGH_RCLO)) | 46 | ((sbidh) & SSB_IDHIGH_RCLO)) |
47 | 47 | ||
48 | /* SOC Interconnect types (aka chip types) */ | ||
49 | #define SOCI_SB 0 | ||
50 | #define SOCI_AI 1 | ||
51 | |||
48 | #define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu)) | 52 | #define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu)) |
49 | /* SDIO Pad drive strength to select value mappings */ | 53 | /* SDIO Pad drive strength to select value mappings */ |
50 | struct sdiod_drive_str { | 54 | struct sdiod_drive_str { |
@@ -106,19 +110,44 @@ brcmf_sdio_chip_corerev(struct brcmf_sdio_dev *sdiodev, | |||
106 | return SBCOREREV(regdata); | 110 | return SBCOREREV(regdata); |
107 | } | 111 | } |
108 | 112 | ||
109 | bool | 113 | static bool |
110 | brcmf_sdio_chip_iscoreup(struct brcmf_sdio_dev *sdiodev, | 114 | brcmf_sdio_sb_iscoreup(struct brcmf_sdio_dev *sdiodev, |
111 | u32 corebase) | 115 | struct chip_info *ci, u16 coreid) |
112 | { | 116 | { |
113 | u32 regdata; | 117 | u32 regdata; |
118 | u8 idx; | ||
119 | |||
120 | idx = brcmf_sdio_chip_getinfidx(ci, coreid); | ||
114 | 121 | ||
115 | regdata = brcmf_sdcard_reg_read(sdiodev, | 122 | regdata = brcmf_sdcard_reg_read(sdiodev, |
116 | CORE_SB(corebase, sbtmstatelow), 4); | 123 | CORE_SB(ci->c_inf[idx].base, sbtmstatelow), 4); |
117 | regdata &= (SSB_TMSLOW_RESET | SSB_TMSLOW_REJECT | | 124 | regdata &= (SSB_TMSLOW_RESET | SSB_TMSLOW_REJECT | |
118 | SSB_IMSTATE_REJECT | SSB_TMSLOW_CLOCK); | 125 | SSB_IMSTATE_REJECT | SSB_TMSLOW_CLOCK); |
119 | return (SSB_TMSLOW_CLOCK == regdata); | 126 | return (SSB_TMSLOW_CLOCK == regdata); |
120 | } | 127 | } |
121 | 128 | ||
129 | static bool | ||
130 | brcmf_sdio_ai_iscoreup(struct brcmf_sdio_dev *sdiodev, | ||
131 | struct chip_info *ci, u16 coreid) | ||
132 | { | ||
133 | u32 regdata; | ||
134 | u8 idx; | ||
135 | bool ret; | ||
136 | |||
137 | idx = brcmf_sdio_chip_getinfidx(ci, coreid); | ||
138 | |||
139 | regdata = brcmf_sdcard_reg_read(sdiodev, | ||
140 | ci->c_inf[idx].wrapbase+BCMA_IOCTL, 4); | ||
141 | ret = (regdata & (BCMA_IOCTL_FGC | BCMA_IOCTL_CLK)) == BCMA_IOCTL_CLK; | ||
142 | |||
143 | regdata = brcmf_sdcard_reg_read(sdiodev, | ||
144 | ci->c_inf[idx].wrapbase+BCMA_RESET_CTL, | ||
145 | 4); | ||
146 | ret = ret && ((regdata & BCMA_RESET_CTL_RESET) == 0); | ||
147 | |||
148 | return ret; | ||
149 | } | ||
150 | |||
122 | void | 151 | void |
123 | brcmf_sdio_chip_coredisable(struct brcmf_sdio_dev *sdiodev, u32 corebase) | 152 | brcmf_sdio_chip_coredisable(struct brcmf_sdio_dev *sdiodev, u32 corebase) |
124 | { | 153 | { |
@@ -258,6 +287,7 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev, | |||
258 | CORE_CC_REG(ci->c_inf[0].base, chipid), 4); | 287 | CORE_CC_REG(ci->c_inf[0].base, chipid), 4); |
259 | ci->chip = regdata & CID_ID_MASK; | 288 | ci->chip = regdata & CID_ID_MASK; |
260 | ci->chiprev = (regdata & CID_REV_MASK) >> CID_REV_SHIFT; | 289 | ci->chiprev = (regdata & CID_REV_MASK) >> CID_REV_SHIFT; |
290 | ci->socitype = (regdata & CID_TYPE_MASK) >> CID_TYPE_SHIFT; | ||
261 | 291 | ||
262 | brcmf_dbg(INFO, "chipid=0x%x chiprev=%d\n", ci->chip, ci->chiprev); | 292 | brcmf_dbg(INFO, "chipid=0x%x chiprev=%d\n", ci->chip, ci->chiprev); |
263 | 293 | ||
@@ -277,6 +307,18 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev, | |||
277 | return -ENODEV; | 307 | return -ENODEV; |
278 | } | 308 | } |
279 | 309 | ||
310 | switch (ci->socitype) { | ||
311 | case SOCI_SB: | ||
312 | ci->iscoreup = brcmf_sdio_sb_iscoreup; | ||
313 | break; | ||
314 | case SOCI_AI: | ||
315 | ci->iscoreup = brcmf_sdio_ai_iscoreup; | ||
316 | break; | ||
317 | default: | ||
318 | brcmf_dbg(ERROR, "socitype %u not supported\n", ci->socitype); | ||
319 | return -ENODEV; | ||
320 | } | ||
321 | |||
280 | return 0; | 322 | return 0; |
281 | } | 323 | } |
282 | 324 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h index 0ee37ae4c958..557c80df3f7d 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h | |||
@@ -65,12 +65,16 @@ struct chip_core_info { | |||
65 | struct chip_info { | 65 | struct chip_info { |
66 | u32 chip; | 66 | u32 chip; |
67 | u32 chiprev; | 67 | u32 chiprev; |
68 | u32 socitype; | ||
68 | /* core info */ | 69 | /* core info */ |
69 | /* always put chipcommon core at 0, bus core at 1 */ | 70 | /* always put chipcommon core at 0, bus core at 1 */ |
70 | struct chip_core_info c_inf[BRCMF_MAX_CORENUM]; | 71 | struct chip_core_info c_inf[BRCMF_MAX_CORENUM]; |
71 | u32 pmurev; | 72 | u32 pmurev; |
72 | u32 pmucaps; | 73 | u32 pmucaps; |
73 | u32 ramsize; | 74 | u32 ramsize; |
75 | |||
76 | bool (*iscoreup)(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci, | ||
77 | u16 coreid); | ||
74 | }; | 78 | }; |
75 | 79 | ||
76 | struct sbconfig { | 80 | struct sbconfig { |
@@ -115,8 +119,6 @@ struct sbconfig { | |||
115 | 119 | ||
116 | extern void brcmf_sdio_chip_resetcore(struct brcmf_sdio_dev *sdiodev, | 120 | extern void brcmf_sdio_chip_resetcore(struct brcmf_sdio_dev *sdiodev, |
117 | u32 corebase); | 121 | u32 corebase); |
118 | extern bool brcmf_sdio_chip_iscoreup(struct brcmf_sdio_dev *sdiodev, | ||
119 | u32 corebase); | ||
120 | extern void brcmf_sdio_chip_coredisable(struct brcmf_sdio_dev *sdiodev, | 122 | extern void brcmf_sdio_chip_coredisable(struct brcmf_sdio_dev *sdiodev, |
121 | u32 corebase); | 123 | u32 corebase); |
122 | extern int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev, | 124 | extern int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev, |