Commit 523894f2 authored by Franky Lin's avatar Franky Lin Committed by John W. Linville

brcm80211: fmac: add corerev function for bcm4330 chip

This patch is part of the series adding new backplane support
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6ca687d9
...@@ -49,6 +49,10 @@ ...@@ -49,6 +49,10 @@
#define SOCI_SB 0 #define SOCI_SB 0
#define SOCI_AI 1 #define SOCI_AI 1
/* EROM CompIdentB */
#define CIB_REV_MASK 0xff000000
#define CIB_REV_SHIFT 24
#define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu)) #define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu))
/* SDIO Pad drive strength to select value mappings */ /* SDIO Pad drive strength to select value mappings */
struct sdiod_drive_str { struct sdiod_drive_str {
...@@ -100,16 +104,30 @@ brcmf_sdio_chip_getinfidx(struct chip_info *ci, u16 coreid) ...@@ -100,16 +104,30 @@ brcmf_sdio_chip_getinfidx(struct chip_info *ci, u16 coreid)
} }
static u32 static u32
brcmf_sdio_chip_corerev(struct brcmf_sdio_dev *sdiodev, brcmf_sdio_sb_corerev(struct brcmf_sdio_dev *sdiodev,
u32 corebase) struct chip_info *ci, u16 coreid)
{ {
u32 regdata; u32 regdata;
u8 idx;
idx = brcmf_sdio_chip_getinfidx(ci, coreid);
regdata = brcmf_sdcard_reg_read(sdiodev, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(corebase, sbidhigh), 4); CORE_SB(ci->c_inf[idx].base, sbidhigh), 4);
return SBCOREREV(regdata); return SBCOREREV(regdata);
} }
static u32
brcmf_sdio_ai_corerev(struct brcmf_sdio_dev *sdiodev,
struct chip_info *ci, u16 coreid)
{
u8 idx;
idx = brcmf_sdio_chip_getinfidx(ci, coreid);
return (ci->c_inf[idx].cib & CIB_REV_MASK) >> CIB_REV_SHIFT;
}
static bool static bool
brcmf_sdio_sb_iscoreup(struct brcmf_sdio_dev *sdiodev, brcmf_sdio_sb_iscoreup(struct brcmf_sdio_dev *sdiodev,
struct chip_info *ci, u16 coreid) struct chip_info *ci, u16 coreid)
...@@ -310,9 +328,11 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev, ...@@ -310,9 +328,11 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev,
switch (ci->socitype) { switch (ci->socitype) {
case SOCI_SB: case SOCI_SB:
ci->iscoreup = brcmf_sdio_sb_iscoreup; ci->iscoreup = brcmf_sdio_sb_iscoreup;
ci->corerev = brcmf_sdio_sb_corerev;
break; break;
case SOCI_AI: case SOCI_AI:
ci->iscoreup = brcmf_sdio_ai_iscoreup; ci->iscoreup = brcmf_sdio_ai_iscoreup;
ci->corerev = brcmf_sdio_ai_corerev;
break; break;
default: default:
brcmf_dbg(ERROR, "socitype %u not supported\n", ci->socitype); brcmf_dbg(ERROR, "socitype %u not supported\n", ci->socitype);
...@@ -378,8 +398,7 @@ brcmf_sdio_chip_buscoresetup(struct brcmf_sdio_dev *sdiodev, ...@@ -378,8 +398,7 @@ brcmf_sdio_chip_buscoresetup(struct brcmf_sdio_dev *sdiodev,
u8 idx; u8 idx;
/* get chipcommon rev */ /* get chipcommon rev */
ci->c_inf[0].rev = ci->c_inf[0].rev = ci->corerev(sdiodev, ci, ci->c_inf[0].id);
brcmf_sdio_chip_corerev(sdiodev, ci->c_inf[0].base);
/* get chipcommon capabilites */ /* get chipcommon capabilites */
ci->c_inf[0].caps = ci->c_inf[0].caps =
...@@ -393,7 +412,7 @@ brcmf_sdio_chip_buscoresetup(struct brcmf_sdio_dev *sdiodev, ...@@ -393,7 +412,7 @@ brcmf_sdio_chip_buscoresetup(struct brcmf_sdio_dev *sdiodev,
ci->pmurev = ci->pmucaps & PCAP_REV_MASK; ci->pmurev = ci->pmucaps & PCAP_REV_MASK;
} }
ci->c_inf[1].rev = brcmf_sdio_chip_corerev(sdiodev, ci->c_inf[1].base); ci->c_inf[1].rev = ci->corerev(sdiodev, ci, ci->c_inf[1].id);
regdata = brcmf_sdcard_reg_read(sdiodev, regdata = brcmf_sdcard_reg_read(sdiodev,
CORE_SB(ci->c_inf[1].base, sbidhigh), 4); CORE_SB(ci->c_inf[1].base, sbidhigh), 4);
ci->c_inf[1].id = (regdata & SSB_IDHIGH_CC) >> SSB_IDHIGH_CC_SHIFT; ci->c_inf[1].id = (regdata & SSB_IDHIGH_CC) >> SSB_IDHIGH_CC_SHIFT;
......
...@@ -60,6 +60,7 @@ struct chip_core_info { ...@@ -60,6 +60,7 @@ struct chip_core_info {
u32 base; u32 base;
u32 wrapbase; u32 wrapbase;
u32 caps; u32 caps;
u32 cib;
}; };
struct chip_info { struct chip_info {
...@@ -75,6 +76,8 @@ struct chip_info { ...@@ -75,6 +76,8 @@ struct chip_info {
bool (*iscoreup)(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci, bool (*iscoreup)(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci,
u16 coreid); u16 coreid);
u32 (*corerev)(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci,
u16 coreid);
}; };
struct sbconfig { struct sbconfig {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment