]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/staging/brcm80211/util/hndpmu.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / drivers / staging / brcm80211 / util / hndpmu.c
index a8f3306c1d2b447c87c33e85cbc19e33ea1ef5b2..6cc59a895868816d969e75975f02f98da9614f82 100644 (file)
  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
-#include <linuxver.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#ifdef BRCM_FULLMAC
+#include <linux/netdevice.h>
+#endif
 #include <bcmdefs.h>
 #include <osl.h>
 #include <bcmutils.h>
 #define        PMU_NONE(args)
 
 /* PLL controls/clocks */
-static void si_pmu1_pllinit0(si_t *sih, osl_t *osh, chipcregs_t *cc,
+static void si_pmu1_pllinit0(si_t *sih, struct osl_info *osh, chipcregs_t *cc,
                             u32 xtal);
-static u32 si_pmu1_cpuclk0(si_t *sih, osl_t *osh, chipcregs_t *cc);
-static u32 si_pmu1_alpclk0(si_t *sih, osl_t *osh, chipcregs_t *cc);
+static u32 si_pmu1_cpuclk0(si_t *sih, struct osl_info *osh, chipcregs_t *cc);
+static u32 si_pmu1_alpclk0(si_t *sih, struct osl_info *osh, chipcregs_t *cc);
 
 /* PMU resources */
 static bool si_pmu_res_depfltr_bb(si_t *sih);
 static bool si_pmu_res_depfltr_ncb(si_t *sih);
 static bool si_pmu_res_depfltr_paldo(si_t *sih);
 static bool si_pmu_res_depfltr_npaldo(si_t *sih);
-static u32 si_pmu_res_deps(si_t *sih, osl_t *osh, chipcregs_t *cc,
+static u32 si_pmu_res_deps(si_t *sih, struct osl_info *osh, chipcregs_t *cc,
                              u32 rsrcs, bool all);
-static uint si_pmu_res_uptime(si_t *sih, osl_t *osh, chipcregs_t *cc,
+static uint si_pmu_res_uptime(si_t *sih, struct osl_info *osh, chipcregs_t *cc,
                              u8 rsrc);
 static void si_pmu_res_masks(si_t *sih, u32 * pmin, u32 * pmax);
 static void si_pmu_spuravoid_pllupdate(si_t *sih, chipcregs_t *cc,
-                                      osl_t *osh, u8 spuravoid);
+                                      struct osl_info *osh, u8 spuravoid);
 
 static void si_pmu_set_4330_plldivs(si_t *sih);
 
@@ -101,7 +106,7 @@ void si_pmu_pllupd(si_t *sih)
 }
 
 /* Setup switcher voltage */
-void si_pmu_set_switcher_voltage(si_t *sih, osl_t *osh, u8 bb_voltage,
+void si_pmu_set_switcher_voltage(si_t *sih, struct osl_info *osh, u8 bb_voltage,
                                 u8 rf_voltage)
 {
        chipcregs_t *cc;
@@ -124,14 +129,14 @@ void si_pmu_set_switcher_voltage(si_t *sih, osl_t *osh, u8 bb_voltage,
        si_setcoreidx(sih, origidx);
 }
 
-void si_pmu_set_ldo_voltage(si_t *sih, osl_t *osh, u8 ldo, u8 voltage)
+void si_pmu_set_ldo_voltage(si_t *sih, struct osl_info *osh, u8 ldo, u8 voltage)
 {
        u8 sr_cntl_shift = 0, rc_shift = 0, shift = 0, mask = 0;
        u8 addr = 0;
 
        ASSERT(sih->cccaps & CC_CAP_PMU);
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM4336_CHIP_ID:
                switch (ldo) {
                case SET_LDO_VOLTAGE_CLDO_PWM:
@@ -182,7 +187,7 @@ void si_pmu_set_ldo_voltage(si_t *sih, osl_t *osh, u8 ldo, u8 voltage)
 /* d11 slow to fast clock transition time in slow clock cycles */
 #define D11SCC_SLOW2FAST_TRANSITION    2
 
-u16 si_pmu_fast_pwrup_delay(si_t *sih, osl_t *osh)
+u16 si_pmu_fast_pwrup_delay(si_t *sih, struct osl_info *osh)
 {
        uint delay = PMU_MAX_TRANSITION_DLY;
        chipcregs_t *cc;
@@ -199,7 +204,7 @@ u16 si_pmu_fast_pwrup_delay(si_t *sih, osl_t *osh)
        cc = si_setcoreidx(sih, SI_CC_IDX);
        ASSERT(cc != NULL);
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM43224_CHIP_ID:
        case BCM43225_CHIP_ID:
        case BCM43421_CHIP_ID:
@@ -259,7 +264,7 @@ u16 si_pmu_fast_pwrup_delay(si_t *sih, osl_t *osh)
        return (u16) delay;
 }
 
-u32 si_pmu_force_ilp(si_t *sih, osl_t *osh, bool force)
+u32 si_pmu_force_ilp(si_t *sih, struct osl_info *osh, bool force)
 {
        chipcregs_t *cc;
        uint origidx;
@@ -599,7 +604,7 @@ static void si_pmu_res_masks(si_t *sih, u32 * pmin, u32 * pmax)
        rsrcs = (sih->pmucaps & PCAP_RC_MASK) >> PCAP_RC_SHIFT;
 
        /* determine min/max rsrc masks */
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM43224_CHIP_ID:
        case BCM43225_CHIP_ID:
        case BCM43421_CHIP_ID:
@@ -677,7 +682,7 @@ static void si_pmu_res_masks(si_t *sih, u32 * pmin, u32 * pmax)
 }
 
 /* initialize PMU resources */
-void si_pmu_res_init(si_t *sih, osl_t *osh)
+void si_pmu_res_init(si_t *sih, struct osl_info *osh)
 {
        chipcregs_t *cc;
        uint origidx;
@@ -696,7 +701,7 @@ void si_pmu_res_init(si_t *sih, osl_t *osh)
        cc = si_setcoreidx(sih, SI_CC_IDX);
        ASSERT(cc != NULL);
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM4329_CHIP_ID:
                /* Optimize resources up/down timers */
                if (ISSIM_ENAB(sih)) {
@@ -1095,7 +1100,7 @@ static const pmu1_xtaltab0_t *si_pmu1_xtaltab0(si_t *sih)
 #ifdef BCMDBG
        char chn[8];
 #endif
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM4329_CHIP_ID:
                return pmu1_xtaltab0_880_4329;
        case BCM4319_CHIP_ID:
@@ -1123,7 +1128,7 @@ static const pmu1_xtaltab0_t *si_pmu1_xtaldef0(si_t *sih)
        char chn[8];
 #endif
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM4329_CHIP_ID:
                /* Default to 38400Khz */
                return &pmu1_xtaltab0_880_4329[PMU1_XTALTAB0_880_38400K];
@@ -1155,7 +1160,7 @@ static u32 si_pmu1_pllfvco0(si_t *sih)
        char chn[8];
 #endif
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM4329_CHIP_ID:
                return FVCO_880;
        case BCM4319_CHIP_ID:
@@ -1178,7 +1183,7 @@ static u32 si_pmu1_pllfvco0(si_t *sih)
 
 /* query alp/xtal clock frequency */
 static u32
-si_pmu1_alpclk0(si_t *sih, osl_t *osh, chipcregs_t *cc)
+si_pmu1_alpclk0(si_t *sih, struct osl_info *osh, chipcregs_t *cc)
 {
        const pmu1_xtaltab0_t *xt;
        u32 xf;
@@ -1203,7 +1208,8 @@ si_pmu1_alpclk0(si_t *sih, osl_t *osh, chipcregs_t *cc)
  * case the xtal frequency is unknown to the s/w so we need to call
  * si_pmu1_xtaldef0() wherever it is needed to return a default value.
  */
-static void si_pmu1_pllinit0(si_t *sih, osl_t *osh, chipcregs_t *cc, u32 xtal)
+static void si_pmu1_pllinit0(si_t *sih, struct osl_info *osh, chipcregs_t *cc,
+                            u32 xtal)
 {
        const pmu1_xtaltab0_t *xt;
        u32 tmp;
@@ -1233,8 +1239,8 @@ static void si_pmu1_pllinit0(si_t *sih, osl_t *osh, chipcregs_t *cc, u32 xtal)
         */
        if ((((R_REG(osh, &cc->pmucontrol) & PCTL_XTALFREQ_MASK) >>
              PCTL_XTALFREQ_SHIFT) == xt->xf) &&
-           !((CHIPID(sih->chip) == BCM4319_CHIP_ID)
-             || (CHIPID(sih->chip) == BCM4330_CHIP_ID))) {
+           !((sih->chip == BCM4319_CHIP_ID)
+             || (sih->chip == BCM4330_CHIP_ID))) {
                PMU_MSG(("PLL already programmed for %d.%d MHz\n",
                         xt->fref / 1000, xt->fref % 1000));
                return;
@@ -1244,7 +1250,7 @@ static void si_pmu1_pllinit0(si_t *sih, osl_t *osh, chipcregs_t *cc, u32 xtal)
        PMU_MSG(("Programming PLL for %d.%d MHz\n", xt->fref / 1000,
                 xt->fref % 1000));
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM4329_CHIP_ID:
                /* Change the BBPLL drive strength to 8 for all channels */
                buf_strength = 0x888888;
@@ -1351,11 +1357,11 @@ static void si_pmu1_pllinit0(si_t *sih, osl_t *osh, chipcregs_t *cc, u32 xtal)
              p2div << PMU1_PLL0_PC0_P2DIV_SHIFT) & PMU1_PLL0_PC0_P2DIV_MASK);
        W_REG(osh, &cc->pllcontrol_data, tmp);
 
-       if ((CHIPID(sih->chip) == BCM4330_CHIP_ID))
+       if ((sih->chip == BCM4330_CHIP_ID))
                si_pmu_set_4330_plldivs(sih);
 
-       if ((CHIPID(sih->chip) == BCM4329_CHIP_ID)
-           && (CHIPREV(sih->chiprev) == 0)) {
+       if ((sih->chip == BCM4329_CHIP_ID)
+           && (sih->chiprev == 0)) {
 
                W_REG(osh, &cc->pllcontrol_addr, PMU1_PLL0_PLLCTL1);
                tmp = R_REG(osh, &cc->pllcontrol_data);
@@ -1363,9 +1369,9 @@ static void si_pmu1_pllinit0(si_t *sih, osl_t *osh, chipcregs_t *cc, u32 xtal)
                tmp = tmp | DOT11MAC_880MHZ_CLK_DIVISOR_VAL;
                W_REG(osh, &cc->pllcontrol_data, tmp);
        }
-       if ((CHIPID(sih->chip) == BCM4319_CHIP_ID) ||
-           (CHIPID(sih->chip) == BCM4336_CHIP_ID) ||
-           (CHIPID(sih->chip) == BCM4330_CHIP_ID))
+       if ((sih->chip == BCM4319_CHIP_ID) ||
+           (sih->chip == BCM4336_CHIP_ID) ||
+           (sih->chip == BCM4330_CHIP_ID))
                ndiv_mode = PMU1_PLL0_PC2_NDIV_MODE_MFB;
        else
                ndiv_mode = PMU1_PLL0_PC2_NDIV_MODE_MASH;
@@ -1407,7 +1413,7 @@ static void si_pmu1_pllinit0(si_t *sih, osl_t *osh, chipcregs_t *cc, u32 xtal)
        /* to operate the 4319 usb in 24MHz/48MHz; chipcontrol[2][84:83] needs
         * to be updated.
         */
-       if ((CHIPID(sih->chip) == BCM4319_CHIP_ID)
+       if ((sih->chip == BCM4319_CHIP_ID)
            && (xt->fref != XTAL_FREQ_30000MHZ)) {
                W_REG(osh, &cc->chipcontrol_addr, PMU1_PLL0_CHIPCTL2);
                tmp =
@@ -1436,8 +1442,8 @@ static void si_pmu1_pllinit0(si_t *sih, osl_t *osh, chipcregs_t *cc, u32 xtal)
                PCTL_ILP_DIV_MASK) |
            ((xt->xf << PCTL_XTALFREQ_SHIFT) & PCTL_XTALFREQ_MASK);
 
-       if ((CHIPID(sih->chip) == BCM4329_CHIP_ID)
-           && CHIPREV(sih->chiprev) == 0) {
+       if ((sih->chip == BCM4329_CHIP_ID)
+           && sih->chiprev == 0) {
                /* clear the htstretch before clearing HTReqEn */
                AND_REG(osh, &cc->clkstretch, ~CSTRETCH_HT);
                tmp &= ~PCTL_HT_REQ_EN;
@@ -1448,7 +1454,7 @@ static void si_pmu1_pllinit0(si_t *sih, osl_t *osh, chipcregs_t *cc, u32 xtal)
 
 /* query the CPU clock frequency */
 static u32
-si_pmu1_cpuclk0(si_t *sih, osl_t *osh, chipcregs_t *cc)
+si_pmu1_cpuclk0(si_t *sih, struct osl_info *osh, chipcregs_t *cc)
 {
        u32 tmp, m1div;
 #ifdef BCMDBG
@@ -1502,7 +1508,7 @@ si_pmu1_cpuclk0(si_t *sih, osl_t *osh, chipcregs_t *cc)
 }
 
 /* initialize PLL */
-void si_pmu_pll_init(si_t *sih, osl_t *osh, uint xtalfreq)
+void si_pmu_pll_init(si_t *sih, struct osl_info *osh, uint xtalfreq)
 {
        chipcregs_t *cc;
        uint origidx;
@@ -1517,7 +1523,7 @@ void si_pmu_pll_init(si_t *sih, osl_t *osh, uint xtalfreq)
        cc = si_setcoreidx(sih, SI_CC_IDX);
        ASSERT(cc != NULL);
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM4329_CHIP_ID:
                if (xtalfreq == 0)
                        xtalfreq = 38400;
@@ -1555,7 +1561,7 @@ void si_pmu_pll_init(si_t *sih, osl_t *osh, uint xtalfreq)
 }
 
 /* query alp/xtal clock frequency */
-u32 si_pmu_alp_clock(si_t *sih, osl_t *osh)
+u32 si_pmu_alp_clock(si_t *sih, struct osl_info *osh)
 {
        chipcregs_t *cc;
        uint origidx;
@@ -1571,7 +1577,7 @@ u32 si_pmu_alp_clock(si_t *sih, osl_t *osh)
        cc = si_setcoreidx(sih, SI_CC_IDX);
        ASSERT(cc != NULL);
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM43224_CHIP_ID:
        case BCM43225_CHIP_ID:
        case BCM43421_CHIP_ID:
@@ -1616,7 +1622,7 @@ u32 si_pmu_alp_clock(si_t *sih, osl_t *osh)
  * pllreg "pll0" i.e. 12 for main 6 for phy, 0 for misc.
  */
 static u32
-si_pmu5_clock(si_t *sih, osl_t *osh, chipcregs_t *cc, uint pll0,
+si_pmu5_clock(si_t *sih, struct osl_info *osh, chipcregs_t *cc, uint pll0,
                          uint m) {
        u32 tmp, div, ndiv, p1, p2, fc;
 
@@ -1631,7 +1637,7 @@ si_pmu5_clock(si_t *sih, osl_t *osh, chipcregs_t *cc, uint pll0,
                return 0;
        }
 
-       if (CHIPID(sih->chip) == BCM5357_CHIP_ID) {
+       if (sih->chip == BCM5357_CHIP_ID) {
                /* Detect failure in clock setting */
                if ((R_REG(osh, &cc->chipstatus) & 0x40000) != 0) {
                        return 133 * 1000000;
@@ -1669,7 +1675,7 @@ si_pmu5_clock(si_t *sih, osl_t *osh, chipcregs_t *cc, uint pll0,
 /* For designs that feed the same clock to both backplane
  * and CPU just return the CPU clock speed.
  */
-u32 si_pmu_si_clock(si_t *sih, osl_t *osh)
+u32 si_pmu_si_clock(si_t *sih, struct osl_info *osh)
 {
        chipcregs_t *cc;
        uint origidx;
@@ -1685,7 +1691,7 @@ u32 si_pmu_si_clock(si_t *sih, osl_t *osh)
        cc = si_setcoreidx(sih, SI_CC_IDX);
        ASSERT(cc != NULL);
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM43224_CHIP_ID:
        case BCM43225_CHIP_ID:
        case BCM43421_CHIP_ID:
@@ -1702,7 +1708,7 @@ u32 si_pmu_si_clock(si_t *sih, osl_t *osh)
                                  PMU5_MAINPLL_SI);
                break;
        case BCM4329_CHIP_ID:
-               if (CHIPREV(sih->chiprev) == 0)
+               if (sih->chiprev == 0)
                        clock = 38400 * 1000;
                else
                        clock = si_pmu1_cpuclk0(sih, osh, cc);
@@ -1748,7 +1754,7 @@ u32 si_pmu_si_clock(si_t *sih, osl_t *osh)
 }
 
 /* query CPU clock frequency */
-u32 si_pmu_cpu_clock(si_t *sih, osl_t *osh)
+u32 si_pmu_cpu_clock(si_t *sih, struct osl_info *osh)
 {
        chipcregs_t *cc;
        uint origidx;
@@ -1757,14 +1763,14 @@ u32 si_pmu_cpu_clock(si_t *sih, osl_t *osh)
        ASSERT(sih->cccaps & CC_CAP_PMU);
 
        if ((sih->pmurev >= 5) &&
-           !((CHIPID(sih->chip) == BCM4329_CHIP_ID) ||
-             (CHIPID(sih->chip) == BCM4319_CHIP_ID) ||
-             (CHIPID(sih->chip) == BCM43236_CHIP_ID) ||
-             (CHIPID(sih->chip) == BCM4336_CHIP_ID) ||
-             (CHIPID(sih->chip) == BCM4330_CHIP_ID))) {
+           !((sih->chip == BCM4329_CHIP_ID) ||
+             (sih->chip == BCM4319_CHIP_ID) ||
+             (sih->chip == BCM43236_CHIP_ID) ||
+             (sih->chip == BCM4336_CHIP_ID) ||
+             (sih->chip == BCM4330_CHIP_ID))) {
                uint pll;
 
-               switch (CHIPID(sih->chip)) {
+               switch (sih->chip) {
                case BCM5356_CHIP_ID:
                        pll = PMU5356_MAINPLL_PLL0;
                        break;
@@ -1792,7 +1798,7 @@ u32 si_pmu_cpu_clock(si_t *sih, osl_t *osh)
 }
 
 /* query memory clock frequency */
-u32 si_pmu_mem_clock(si_t *sih, osl_t *osh)
+u32 si_pmu_mem_clock(si_t *sih, struct osl_info *osh)
 {
        chipcregs_t *cc;
        uint origidx;
@@ -1801,14 +1807,14 @@ u32 si_pmu_mem_clock(si_t *sih, osl_t *osh)
        ASSERT(sih->cccaps & CC_CAP_PMU);
 
        if ((sih->pmurev >= 5) &&
-           !((CHIPID(sih->chip) == BCM4329_CHIP_ID) ||
-             (CHIPID(sih->chip) == BCM4319_CHIP_ID) ||
-             (CHIPID(sih->chip) == BCM4330_CHIP_ID) ||
-             (CHIPID(sih->chip) == BCM4336_CHIP_ID) ||
-             (CHIPID(sih->chip) == BCM43236_CHIP_ID))) {
+           !((sih->chip == BCM4329_CHIP_ID) ||
+             (sih->chip == BCM4319_CHIP_ID) ||
+             (sih->chip == BCM4330_CHIP_ID) ||
+             (sih->chip == BCM4336_CHIP_ID) ||
+             (sih->chip == BCM43236_CHIP_ID))) {
                uint pll;
 
-               switch (CHIPID(sih->chip)) {
+               switch (sih->chip) {
                case BCM5356_CHIP_ID:
                        pll = PMU5356_MAINPLL_PLL0;
                        break;
@@ -1841,7 +1847,7 @@ u32 si_pmu_mem_clock(si_t *sih, osl_t *osh)
 
 static u32 ilpcycles_per_sec;
 
-u32 si_pmu_ilp_clock(si_t *sih, osl_t *osh)
+u32 si_pmu_ilp_clock(si_t *sih, struct osl_info *osh)
 {
        if (ISSIM_ENAB(sih))
                return ILP_CLOCK;
@@ -1905,7 +1911,7 @@ static const sdiod_drive_str_t sdiod_drive_strength_tab3[] = {
 #define SDIOD_DRVSTR_KEY(chip, pmu)    (((chip) << 16) | (pmu))
 
 void
-si_sdiod_drive_strength_init(si_t *sih, osl_t *osh,
+si_sdiod_drive_strength_init(si_t *sih, struct osl_info *osh,
                                         u32 drivestrength) {
        chipcregs_t *cc;
        uint origidx, intr_val = 0;
@@ -1976,7 +1982,7 @@ si_sdiod_drive_strength_init(si_t *sih, osl_t *osh,
 }
 
 /* initialize PMU */
-void si_pmu_init(si_t *sih, osl_t *osh)
+void si_pmu_init(si_t *sih, struct osl_info *osh)
 {
        chipcregs_t *cc;
        uint origidx;
@@ -1993,7 +1999,7 @@ void si_pmu_init(si_t *sih, osl_t *osh)
        else if (sih->pmurev >= 2)
                OR_REG(osh, &cc->pmucontrol, PCTL_NOILP_ON_WAIT);
 
-       if ((CHIPID(sih->chip) == BCM4329_CHIP_ID) && (sih->chiprev == 2)) {
+       if ((sih->chip == BCM4329_CHIP_ID) && (sih->chiprev == 2)) {
                /* Fix for 4329b0 bad LPOM state. */
                W_REG(osh, &cc->regcontrol_addr, 2);
                OR_REG(osh, &cc->regcontrol_data, 0x100);
@@ -2008,7 +2014,7 @@ void si_pmu_init(si_t *sih, osl_t *osh)
 
 /* Return up time in ILP cycles for the given resource. */
 static uint
-si_pmu_res_uptime(si_t *sih, osl_t *osh, chipcregs_t *cc,
+si_pmu_res_uptime(si_t *sih, struct osl_info *osh, chipcregs_t *cc,
                              u8 rsrc) {
        u32 deps;
        uint up, i, dup, dmax;
@@ -2045,7 +2051,7 @@ si_pmu_res_uptime(si_t *sih, osl_t *osh, chipcregs_t *cc,
 
 /* Return dependancies (direct or all/indirect) for the given resources */
 static u32
-si_pmu_res_deps(si_t *sih, osl_t *osh, chipcregs_t *cc, u32 rsrcs,
+si_pmu_res_deps(si_t *sih, struct osl_info *osh, chipcregs_t *cc, u32 rsrcs,
                bool all)
 {
        u32 deps = 0;
@@ -2065,7 +2071,7 @@ si_pmu_res_deps(si_t *sih, osl_t *osh, chipcregs_t *cc, u32 rsrcs,
 }
 
 /* power up/down OTP through PMU resources */
-void si_pmu_otp_power(si_t *sih, osl_t *osh, bool on)
+void si_pmu_otp_power(si_t *sih, struct osl_info *osh, bool on)
 {
        chipcregs_t *cc;
        uint origidx;
@@ -2084,7 +2090,7 @@ void si_pmu_otp_power(si_t *sih, osl_t *osh, bool on)
        cc = si_setcoreidx(sih, SI_CC_IDX);
        ASSERT(cc != NULL);
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM4329_CHIP_ID:
                rsrcs = PMURES_BIT(RES4329_OTP_PU);
                break;
@@ -2135,7 +2141,7 @@ void si_pmu_otp_power(si_t *sih, osl_t *osh, bool on)
        si_setcoreidx(sih, origidx);
 }
 
-void si_pmu_rcal(si_t *sih, osl_t *osh)
+void si_pmu_rcal(si_t *sih, struct osl_info *osh)
 {
        chipcregs_t *cc;
        uint origidx;
@@ -2147,7 +2153,7 @@ void si_pmu_rcal(si_t *sih, osl_t *osh)
        cc = si_setcoreidx(sih, SI_CC_IDX);
        ASSERT(cc != NULL);
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM4329_CHIP_ID:{
                        u8 rcal_code;
                        u32 val;
@@ -2218,7 +2224,7 @@ void si_pmu_rcal(si_t *sih, osl_t *osh)
        si_setcoreidx(sih, origidx);
 }
 
-void si_pmu_spuravoid(si_t *sih, osl_t *osh, u8 spuravoid)
+void si_pmu_spuravoid(si_t *sih, struct osl_info *osh, u8 spuravoid)
 {
        chipcregs_t *cc;
        uint origidx, intr_val;
@@ -2230,7 +2236,7 @@ void si_pmu_spuravoid(si_t *sih, osl_t *osh, u8 spuravoid)
        ASSERT(cc != NULL);
 
        /* force the HT off  */
-       if (CHIPID(sih->chip) == BCM4336_CHIP_ID) {
+       if (sih->chip == BCM4336_CHIP_ID) {
                tmp = R_REG(osh, &cc->max_res_mask);
                tmp &= ~RES4336_HT_AVAIL;
                W_REG(osh, &cc->max_res_mask, tmp);
@@ -2244,7 +2250,7 @@ void si_pmu_spuravoid(si_t *sih, osl_t *osh, u8 spuravoid)
        si_pmu_spuravoid_pllupdate(sih, cc, osh, spuravoid);
 
        /* enable HT back on  */
-       if (CHIPID(sih->chip) == BCM4336_CHIP_ID) {
+       if (sih->chip == BCM4336_CHIP_ID) {
                tmp = R_REG(osh, &cc->max_res_mask);
                tmp |= RES4336_HT_AVAIL;
                W_REG(osh, &cc->max_res_mask, tmp);
@@ -2255,7 +2261,7 @@ void si_pmu_spuravoid(si_t *sih, osl_t *osh, u8 spuravoid)
 }
 
 static void
-si_pmu_spuravoid_pllupdate(si_t *sih, chipcregs_t *cc, osl_t *osh,
+si_pmu_spuravoid_pllupdate(si_t *sih, chipcregs_t *cc, struct osl_info *osh,
                           u8 spuravoid)
 {
        u32 tmp = 0;
@@ -2263,14 +2269,14 @@ si_pmu_spuravoid_pllupdate(si_t *sih, chipcregs_t *cc, osl_t *osh,
        u8 bcm5357_bcm43236_p1div[] = { 0x1, 0x5, 0x5 };
        u8 bcm5357_bcm43236_ndiv[] = { 0x30, 0xf6, 0xfc };
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM5357_CHIP_ID:
        case BCM43235_CHIP_ID:
        case BCM43236_CHIP_ID:
        case BCM43238_CHIP_ID:
 
                /* BCM5357 needs to touch PLL1_PLLCTL[02], so offset PLL0_PLLCTL[02] by 6 */
-               phypll_offset = (CHIPID(sih->chip) == BCM5357_CHIP_ID) ? 6 : 0;
+               phypll_offset = (sih->chip == BCM5357_CHIP_ID) ? 6 : 0;
 
                /* RMW only the P1 divider */
                W_REG(osh, &cc->pllcontrol_addr,
@@ -2451,7 +2457,7 @@ si_pmu_spuravoid_pllupdate(si_t *sih, chipcregs_t *cc, osl_t *osh,
        W_REG(osh, &cc->pmucontrol, tmp);
 }
 
-bool si_pmu_is_otp_powered(si_t *sih, osl_t *osh)
+bool si_pmu_is_otp_powered(si_t *sih, struct osl_info *osh)
 {
        uint idx;
        chipcregs_t *cc;
@@ -2462,7 +2468,7 @@ bool si_pmu_is_otp_powered(si_t *sih, osl_t *osh)
        cc = si_setcoreidx(sih, SI_CC_IDX);
        ASSERT(cc != NULL);
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM4329_CHIP_ID:
                st = (R_REG(osh, &cc->res_state) & PMURES_BIT(RES4329_OTP_PU))
                    != 0;
@@ -2503,9 +2509,9 @@ bool si_pmu_is_otp_powered(si_t *sih, osl_t *osh)
 
 void
 #if defined(BCMDBG)
-si_pmu_sprom_enable(si_t *sih, osl_t *osh, bool enable)
+si_pmu_sprom_enable(si_t *sih, struct osl_info *osh, bool enable)
 #else
-si_pmu_sprom_enable(si_t *sih, osl_t *osh, bool enable)
+si_pmu_sprom_enable(si_t *sih, struct osl_info *osh, bool enable)
 #endif
 {
        chipcregs_t *cc;
@@ -2521,7 +2527,7 @@ si_pmu_sprom_enable(si_t *sih, osl_t *osh, bool enable)
 }
 
 /* initialize PMU chip controls and other chip level stuff */
-void si_pmu_chip_init(si_t *sih, osl_t *osh)
+void si_pmu_chip_init(si_t *sih, struct osl_info *osh)
 {
        uint origidx;
 
@@ -2543,11 +2549,11 @@ void si_pmu_chip_init(si_t *sih, osl_t *osh)
 }
 
 /* initialize PMU switch/regulators */
-void si_pmu_swreg_init(si_t *sih, osl_t *osh)
+void si_pmu_swreg_init(si_t *sih, struct osl_info *osh)
 {
        ASSERT(sih->cccaps & CC_CAP_PMU);
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM4336_CHIP_ID:
                /* Reduce CLDO PWM output voltage to 1.2V */
                si_pmu_set_ldo_voltage(sih, osh, SET_LDO_VOLTAGE_CLDO_PWM, 0xe);
@@ -2556,7 +2562,7 @@ void si_pmu_swreg_init(si_t *sih, osl_t *osh)
                                       0xe);
                /* Reduce LNLDO1 output voltage to 1.2V */
                si_pmu_set_ldo_voltage(sih, osh, SET_LDO_VOLTAGE_LNLDO1, 0xe);
-               if (CHIPREV(sih->chiprev) == 0)
+               if (sih->chiprev == 0)
                        si_pmu_regcontrol(sih, 2, 0x400000, 0x400000);
                break;
 
@@ -2573,7 +2579,7 @@ void si_pmu_radio_enable(si_t *sih, bool enable)
 {
        ASSERT(sih->cccaps & CC_CAP_PMU);
 
-       switch (CHIPID(sih->chip)) {
+       switch (sih->chip) {
        case BCM4319_CHIP_ID:
                if (enable)
                        si_write_wrapperreg(sih, AI_OOBSELOUTB74,
@@ -2587,7 +2593,7 @@ void si_pmu_radio_enable(si_t *sih, bool enable)
 
 /* Wait for a particular clock level to be on the backplane */
 u32
-si_pmu_waitforclk_on_backplane(si_t *sih, osl_t *osh, u32 clk,
+si_pmu_waitforclk_on_backplane(si_t *sih, struct osl_info *osh, u32 clk,
                               u32 delay)
 {
        chipcregs_t *cc;
@@ -2616,7 +2622,7 @@ si_pmu_waitforclk_on_backplane(si_t *sih, osl_t *osh, u32 clk,
 
 #define EXT_ILP_HZ 32768
 
-u32 si_pmu_measure_alpclk(si_t *sih, osl_t *osh)
+u32 si_pmu_measure_alpclk(si_t *sih, struct osl_info *osh)
 {
        chipcregs_t *cc;
        uint origidx;