aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmutils.c20
-rw-r--r--drivers/staging/brcm80211/util/hndpmu.c102
-rw-r--r--drivers/staging/brcm80211/util/siutils.c18
3 files changed, 33 insertions, 107 deletions
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmutils.c b/drivers/staging/brcm80211/brcmfmac/bcmutils.c
index 768f4d67631..34c37918ff5 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmutils.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmutils.c
@@ -32,6 +32,7 @@
32#endif /* BCMDRIVER */ 32#endif /* BCMDRIVER */
33#include <bcmendian.h> 33#include <bcmendian.h>
34#include <bcmdevs.h> 34#include <bcmdevs.h>
35#include <bcmnvram.h>
35#include <proto/ethernet.h> 36#include <proto/ethernet.h>
36#include <proto/vlan.h> 37#include <proto/vlan.h>
37#include <proto/bcmip.h> 38#include <proto/bcmip.h>
@@ -1746,6 +1747,25 @@ void bcm_print_bytes(char *name, const uchar *data, int len)
1746 printf("\n"); 1747 printf("\n");
1747} 1748}
1748 1749
1750int getintvar(char *vars, const char *name)
1751{
1752 return 0;
1753}
1754
1755char *bcm_chipname(uint chipid, char *buf, uint len)
1756{
1757 const char *fmt;
1758
1759 fmt = ((chipid > 0xa000) || (chipid < 0x4000)) ? "%d" : "%x";
1760 snprintf(buf, len, fmt, chipid);
1761 return buf;
1762}
1763
1764char *getvar(char *vars, const char *name)
1765{
1766 return NULL;
1767}
1768
1749/* 1769/*
1750 * buffer length needed for wlc_format_ssid 1770 * buffer length needed for wlc_format_ssid
1751 * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL. 1771 * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.
diff --git a/drivers/staging/brcm80211/util/hndpmu.c b/drivers/staging/brcm80211/util/hndpmu.c
index dfc3a3cf6c4..e33cf5dde0e 100644
--- a/drivers/staging/brcm80211/util/hndpmu.c
+++ b/drivers/staging/brcm80211/util/hndpmu.c
@@ -39,96 +39,6 @@
39 */ 39 */
40#define PMU_NONE(args) 40#define PMU_NONE(args)
41 41
42#ifdef BRCM_FULLMAC
43/* SDIO Pad drive strength to select value mappings */
44typedef struct {
45 uint8 strength; /* Pad Drive Strength in mA */
46 uint8 sel; /* Chip-specific select value */
47} sdiod_drive_str_t;
48
49/* SDIO Drive Strength to sel value table for PMU Rev 1 */
50static const sdiod_drive_str_t sdiod_drive_strength_tab1[] = {
51 {4, 0x2},
52 {2, 0x3},
53 {1, 0x0},
54 {0, 0x0} };
55
56/* SDIO Drive Strength to sel value table for PMU Rev 2, 3 */
57static const sdiod_drive_str_t sdiod_drive_strength_tab2[] = {
58 {12, 0x7},
59 {10, 0x6},
60 {8, 0x5},
61 {6, 0x4},
62 {4, 0x2},
63 {2, 0x1},
64 {0, 0x0} };
65
66#define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu))
67
68void
69si_sdiod_drive_strength_init(si_t *sih, osl_t *osh, uint32 drivestrength)
70{
71 chipcregs_t *cc;
72 uint origidx, intr_val = 0;
73 sdiod_drive_str_t *str_tab = NULL;
74 uint32 str_mask = 0;
75 uint32 str_shift = 0;
76
77 if (!(sih->cccaps & CC_CAP_PMU)) {
78 return;
79 }
80
81 /* Remember original core before switch to chipc */
82 cc = (chipcregs_t *) si_switch_core(sih, CC_CORE_ID, &origidx,
83 &intr_val);
84
85 switch (SDIOD_DRVSTR_KEY(sih->chip, sih->pmurev)) {
86 case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 1):
87 str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab1;
88 str_mask = 0x30000000;
89 str_shift = 28;
90 break;
91 case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 2):
92 case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 3):
93 str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab2;
94 str_mask = 0x00003800;
95 str_shift = 11;
96 break;
97
98 default:
99 PMU_MSG(("No SDIO Drive strength init done for chip %x rev %d "
100 "pmurev %d\n", sih->chip, sih->chiprev, sih->pmurev));
101
102 break;
103 }
104
105 if (str_tab != NULL) {
106 uint32 drivestrength_sel = 0;
107 uint32 cc_data_temp;
108 int i;
109
110 for (i = 0; str_tab[i].strength != 0; i++) {
111 if (drivestrength >= str_tab[i].strength) {
112 drivestrength_sel = str_tab[i].sel;
113 break;
114 }
115 }
116
117 W_REG(osh, &cc->chipcontrol_addr, 1);
118 cc_data_temp = R_REG(osh, &cc->chipcontrol_data);
119 cc_data_temp &= ~str_mask;
120 drivestrength_sel <<= str_shift;
121 cc_data_temp |= drivestrength_sel;
122 W_REG(osh, &cc->chipcontrol_data, cc_data_temp);
123
124 PMU_MSG(("SDIO: %dmA drive strength selected, set to 0x%08x\n",
125 drivestrength, cc_data_temp));
126 }
127
128 /* Return to original core */
129 si_restore_core(sih, origidx, intr_val);
130}
131#else /* BRCM_FULLMAC */
132/* PLL controls/clocks */ 42/* PLL controls/clocks */
133static void si_pmu1_pllinit0(si_t *sih, osl_t *osh, chipcregs_t *cc, 43static void si_pmu1_pllinit0(si_t *sih, osl_t *osh, chipcregs_t *cc,
134 uint32 xtal); 44 uint32 xtal);
@@ -2017,6 +1927,17 @@ BCMINITFN(si_sdiod_drive_strength_init) (si_t *sih, osl_t *osh,
2017 &intr_val); 1927 &intr_val);
2018 1928
2019 switch (SDIOD_DRVSTR_KEY(sih->chip, sih->pmurev)) { 1929 switch (SDIOD_DRVSTR_KEY(sih->chip, sih->pmurev)) {
1930 case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 1):
1931 str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab1;
1932 str_mask = 0x30000000;
1933 str_shift = 28;
1934 break;
1935 case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 2):
1936 case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 3):
1937 str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab2;
1938 str_mask = 0x00003800;
1939 str_shift = 11;
1940 break;
2020 case SDIOD_DRVSTR_KEY(BCM4336_CHIP_ID, 8): 1941 case SDIOD_DRVSTR_KEY(BCM4336_CHIP_ID, 8):
2021 str_tab = (sdiod_drive_str_t *) &sdiod_drive_strength_tab3; 1942 str_tab = (sdiod_drive_str_t *) &sdiod_drive_strength_tab3;
2022 str_mask = 0x00003800; 1943 str_mask = 0x00003800;
@@ -2772,4 +2693,3 @@ static void BCMATTACHFN(si_pmu_set_4330_plldivs) (si_t *sih)
2772 (m6div << PMU1_PLL0_PC2_M6DIV_SHIFT)); 2693 (m6div << PMU1_PLL0_PC2_M6DIV_SHIFT));
2773 si_pmu_pllcontrol(sih, PMU1_PLL0_PLLCTL2, ~0, pllc2); 2694 si_pmu_pllcontrol(sih, PMU1_PLL0_PLLCTL2, ~0, pllc2);
2774} 2695}
2775#endif /* BRCM_FULLMAC */
diff --git a/drivers/staging/brcm80211/util/siutils.c b/drivers/staging/brcm80211/util/siutils.c
index dff07cc6765..2cfc88f36f5 100644
--- a/drivers/staging/brcm80211/util/siutils.c
+++ b/drivers/staging/brcm80211/util/siutils.c
@@ -59,16 +59,12 @@ static bool si_buscore_prep(si_info_t *sii, uint bustype, uint devid,
59 void *sdh); 59 void *sdh);
60static bool si_buscore_setup(si_info_t *sii, chipcregs_t *cc, uint bustype, 60static bool si_buscore_setup(si_info_t *sii, chipcregs_t *cc, uint bustype,
61 uint32 savewin, uint *origidx, void *regs); 61 uint32 savewin, uint *origidx, void *regs);
62#ifndef BRCM_FULLMAC
63static void si_nvram_process(si_info_t *sii, char *pvars); 62static void si_nvram_process(si_info_t *sii, char *pvars);
64#endif
65 63
66/* dev path concatenation util */ 64/* dev path concatenation util */
67#ifndef BRCM_FULLMAC
68static char *si_devpathvar(si_t *sih, char *var, int len, const char *name); 65static char *si_devpathvar(si_t *sih, char *var, int len, const char *name);
69static bool _si_clkctl_cc(si_info_t *sii, uint mode); 66static bool _si_clkctl_cc(si_info_t *sii, uint mode);
70static bool si_ispcie(si_info_t *sii); 67static bool si_ispcie(si_info_t *sii);
71#endif
72static uint BCMINITFN(socram_banksize) (si_info_t *sii, sbsocramregs_t *r, 68static uint BCMINITFN(socram_banksize) (si_info_t *sii, sbsocramregs_t *r,
73 uint8 idx, uint8 mtype); 69 uint8 idx, uint8 mtype);
74 70
@@ -311,8 +307,7 @@ BCMATTACHFN(si_buscore_setup) (si_info_t *sii, chipcregs_t *cc, uint bustype,
311 return TRUE; 307 return TRUE;
312} 308}
313 309
314#ifndef BRCM_FULLMAC 310static __used void BCMATTACHFN(si_nvram_process) (si_info_t *sii, char *pvars)
315static void BCMATTACHFN(si_nvram_process) (si_info_t *sii, char *pvars)
316{ 311{
317 uint w = 0; 312 uint w = 0;
318 313
@@ -369,7 +364,6 @@ static void BCMATTACHFN(si_nvram_process) (si_info_t *sii, char *pvars)
369 364
370 sii->pub.boardflags = getintvar(pvars, "boardflags"); 365 sii->pub.boardflags = getintvar(pvars, "boardflags");
371} 366}
372#endif /* !BRCM_FULLMAC */
373 367
374/* this is will make Sonics calls directly, since Sonics is no longer supported in the Si abstraction */ 368/* this is will make Sonics calls directly, since Sonics is no longer supported in the Si abstraction */
375/* this has been customized for the bcm 4329 ONLY */ 369/* this has been customized for the bcm 4329 ONLY */
@@ -1256,7 +1250,6 @@ uint32 BCMINITFN(si_clock_rate) (uint32 pll_type, uint32 n, uint32 m)
1256 } 1250 }
1257} 1251}
1258 1252
1259#ifndef BRCM_FULLMAC
1260uint32 BCMINITFN(si_clock) (si_t *sih) 1253uint32 BCMINITFN(si_clock) (si_t *sih)
1261{ 1254{
1262 si_info_t *sii; 1255 si_info_t *sii;
@@ -1315,7 +1308,6 @@ uint32 BCMINITFN(si_ilp_clock) (si_t *sih)
1315 1308
1316 return ILP_CLOCK; 1309 return ILP_CLOCK;
1317} 1310}
1318#endif
1319 1311
1320/* set chip watchdog reset timer to fire in 'ticks' */ 1312/* set chip watchdog reset timer to fire in 'ticks' */
1321#ifdef BRCM_FULLMAC 1313#ifdef BRCM_FULLMAC
@@ -1394,7 +1386,6 @@ void si_watchdog_ms(si_t *sih, uint32 ms)
1394 si_watchdog(sih, wd_msticks * ms); 1386 si_watchdog(sih, wd_msticks * ms);
1395} 1387}
1396 1388
1397#ifndef BRCM_FULLMAC
1398uint16 BCMATTACHFN(si_d11_devid) (si_t *sih) 1389uint16 BCMATTACHFN(si_d11_devid) (si_t *sih)
1399{ 1390{
1400 si_info_t *sii = SI_INFO(sih); 1391 si_info_t *sii = SI_INFO(sih);
@@ -1918,7 +1909,7 @@ si_pcieserdesreg(si_t *sih, uint32 mdioslave, uint32 offset, uint32 mask,
1918} 1909}
1919 1910
1920/* return TRUE if PCIE capability exists in the pci config space */ 1911/* return TRUE if PCIE capability exists in the pci config space */
1921static bool si_ispcie(si_info_t *sii) 1912static __used bool si_ispcie(si_info_t *sii)
1922{ 1913{
1923 uint8 cap_ptr; 1914 uint8 cap_ptr;
1924 1915
@@ -1964,7 +1955,6 @@ void si_pci_pmeclr(si_t *sih)
1964 1955
1965 pcicore_pmeclr(sii->pch); 1956 pcicore_pmeclr(sii->pch);
1966} 1957}
1967#endif /* !BRCM_FULLMAC */
1968 1958
1969#ifdef BCMSDIO 1959#ifdef BCMSDIO
1970/* initialize the sdio core */ 1960/* initialize the sdio core */
@@ -2005,7 +1995,6 @@ void si_sdio_init(si_t *sih)
2005} 1995}
2006#endif /* BCMSDIO */ 1996#endif /* BCMSDIO */
2007 1997
2008#ifndef BRCM_FULLMAC
2009bool BCMATTACHFN(si_pci_war16165) (si_t *sih) 1998bool BCMATTACHFN(si_pci_war16165) (si_t *sih)
2010{ 1999{
2011 si_info_t *sii; 2000 si_info_t *sii;
@@ -2229,7 +2218,6 @@ int si_pci_fixcfg(si_t *sih)
2229 pcicore_hwup(sii->pch); 2218 pcicore_hwup(sii->pch);
2230 return 0; 2219 return 0;
2231} 2220}
2232#endif /* !BRCM_FULLMAC */
2233 2221
2234/* change logical "focus" to the gpio core for optimized access */ 2222/* change logical "focus" to the gpio core for optimized access */
2235void *si_gpiosetcore(si_t *sih) 2223void *si_gpiosetcore(si_t *sih)
@@ -2870,7 +2858,6 @@ bool si_deviceremoved(si_t *sih)
2870 return FALSE; 2858 return FALSE;
2871} 2859}
2872 2860
2873#ifndef BRCM_FULLMAC
2874bool si_is_sprom_available(si_t *sih) 2861bool si_is_sprom_available(si_t *sih)
2875{ 2862{
2876 if (sih->ccrev >= 31) { 2863 if (sih->ccrev >= 31) {
@@ -3030,4 +3017,3 @@ int si_cis_source(si_t *sih)
3030 return CIS_DEFAULT; 3017 return CIS_DEFAULT;
3031 } 3018 }
3032} 3019}
3033#endif /* BRCM_FULLMAC */