brcm80211: fmac: abstract chip buscore setup function
authorFranky Lin <frankyl@broadcom.com>
Fri, 4 Nov 2011 21:23:30 +0000 (22:23 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 9 Nov 2011 21:13:57 +0000 (16:13 -0500)
This patch is part of the abstracting chip backplane handle code
series.

Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@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>
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h

index 7bf9778cfeff9c55fc6de744e3d2f514b39a2431..1e01ae254622f187acf2caea4a29545adf57d156 100644 (file)
@@ -83,26 +83,6 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev,
                return -ENODEV;
        }
 
-       regdata = brcmf_sdcard_reg_read(sdiodev,
-               CORE_SB(ci->cccorebase, sbidhigh), 4);
-       ci->ccrev = SBCOREREV(regdata);
-
-       regdata = brcmf_sdcard_reg_read(sdiodev,
-               CORE_CC_REG(ci->cccorebase, pmucapabilities), 4);
-       ci->pmurev = regdata & PCAP_REV_MASK;
-
-       regdata = brcmf_sdcard_reg_read(sdiodev,
-                                       CORE_SB(ci->buscorebase, sbidhigh), 4);
-       ci->buscorerev = SBCOREREV(regdata);
-       ci->buscoretype = (regdata & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT;
-
-       brcmf_dbg(INFO, "ccrev=%d, pmurev=%d, buscore rev/type=%d/0x%x\n",
-                 ci->ccrev, ci->pmurev, ci->buscorerev, ci->buscoretype);
-
-       /* get chipcommon capabilites */
-       ci->cccaps = brcmf_sdcard_reg_read(sdiodev,
-               CORE_CC_REG(ci->cccorebase, capabilities), 4);
-
        return 0;
 }
 
@@ -154,6 +134,37 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev)
        return 0;
 }
 
+static void
+brcmf_sdio_chip_buscoresetup(struct brcmf_sdio_dev *sdiodev,
+                            struct chip_info *ci)
+{
+       u32 regdata;
+
+       /* get chipcommon rev */
+       regdata = brcmf_sdcard_reg_read(sdiodev,
+               CORE_SB(ci->cccorebase, sbidhigh), 4);
+       ci->ccrev = SBCOREREV(regdata);
+
+       /* get chipcommon capabilites */
+       ci->cccaps = brcmf_sdcard_reg_read(sdiodev,
+               CORE_CC_REG(ci->cccorebase, capabilities), 4);
+
+       /* get pmu caps & rev */
+       if (ci->cccaps & CC_CAP_PMU) {
+               ci->pmucaps = brcmf_sdcard_reg_read(sdiodev,
+                       CORE_CC_REG(ci->cccorebase, pmucapabilities), 4);
+               ci->pmurev = ci->pmucaps & PCAP_REV_MASK;
+       }
+
+       regdata = brcmf_sdcard_reg_read(sdiodev,
+                                       CORE_SB(ci->buscorebase, sbidhigh), 4);
+       ci->buscorerev = SBCOREREV(regdata);
+       ci->buscoretype = (regdata & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT;
+
+       brcmf_dbg(INFO, "ccrev=%d, pmurev=%d, buscore rev/type=%d/0x%x\n",
+                 ci->ccrev, ci->pmurev, ci->buscorerev, ci->buscoretype);
+}
+
 int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev,
                           struct chip_info *ci, u32 regs)
 {
@@ -167,5 +178,7 @@ int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev,
        if (ret != 0)
                return ret;
 
+       brcmf_sdio_chip_buscoresetup(sdiodev, ci);
+
        return ret;
 }
index 2d75b8c55de9f3905d454917c52f55718bafbe38..1985e36505593abb05bff1e17c7be2e97ebaeb8c 100644 (file)
@@ -64,6 +64,7 @@ struct chip_info {
        u32 ramcorebase;
        u32 armcorebase;
        u32 pmurev;
+       u32 pmucaps;
        u32 ramsize;
 };