brcm80211: fmac: abstract chip iscoreup function
authorFranky Lin <frankyl@broadcom.com>
Fri, 4 Nov 2011 21:23:36 +0000 (22:23 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 9 Nov 2011 21:14:02 +0000 (16:14 -0500)
Prepare for adding backplane interconnect type 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>
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h

index 868cb9deacaa118d38f2051abfcf2d4ef10a4807..30802a0d5291d4191dfb1703a5c2042a32fd59c3 100644 (file)
@@ -3138,7 +3138,6 @@ brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio_dev *sdiodev, u32 corebase)
 static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter)
 {
        uint retries;
-       u32 regdata;
        int bcmerror = 0;
 
        /* To enter download state, disable ARM and reset SOCRAM.
@@ -3159,11 +3158,8 @@ static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter)
                                         (u8 *)&zeros, 4);
                }
        } else {
-               regdata = brcmf_sdcard_reg_read(bus->sdiodev,
-                       CORE_SB(bus->ci->ramcorebase, sbtmstatelow), 4);
-               regdata &= (SBTML_RESET | SBTML_REJ_MASK |
-                       (SICF_CLOCK_EN << SBTML_SICF_SHIFT));
-               if ((SICF_CLOCK_EN << SBTML_SICF_SHIFT) != regdata) {
+               if (!brcmf_sdio_chip_iscoreup(bus->sdiodev,
+                                             bus->ci->ramcorebase)) {
                        brcmf_dbg(ERROR, "SOCRAM core is down after reset?\n");
                        bcmerror = -EBADE;
                        goto fail;
index 10befbfa7e1f81dcab906e6662fece73f393381f..e0c22c4b8df97c0e618f1c0b1870fd50880a402c 100644 (file)
 #define        SBIDH_VC_MASK           0xffff0000      /* vendor code */
 #define        SBIDH_VC_SHIFT          16
 
+bool
+brcmf_sdio_chip_iscoreup(struct brcmf_sdio_dev *sdiodev,
+                        u32 corebase)
+{
+       u32 regdata;
+
+       regdata = brcmf_sdcard_reg_read(sdiodev,
+                       CORE_SB(corebase, sbtmstatelow), 4);
+       regdata &= (SBTML_RESET | SBTML_REJ_MASK |
+                       (SICF_CLOCK_EN << SBTML_SICF_SHIFT));
+       return ((SICF_CLOCK_EN << SBTML_SICF_SHIFT) == regdata);
+}
+
 void
 brcmf_sdio_chip_coredisable(struct brcmf_sdio_dev *sdiodev, u32 corebase)
 {
index 25ac3857039ecf66e6c50cffa8e6afa0080257dc..9c43e1decf9e6d9eeb995ec3690c2166b26c2c19 100644 (file)
@@ -133,7 +133,8 @@ struct sbconfig {
        u32 sbidhigh;   /* identification */
 };
 
-
+extern bool brcmf_sdio_chip_iscoreup(struct brcmf_sdio_dev *sdiodev,
+                                    u32 corebase);
 extern void brcmf_sdio_chip_coredisable(struct brcmf_sdio_dev *sdiodev,
                                        u32 corebase);
 extern int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev,