|
@@ -3704,120 +3704,6 @@ fail:
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
-/* SDIO Pad drive strength to select value mappings */
|
|
|
|
-struct sdiod_drive_str {
|
|
|
|
- u8 strength; /* Pad Drive Strength in mA */
|
|
|
|
- u8 sel; /* Chip-specific select value */
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-/* SDIO Drive Strength to sel value table for PMU Rev 1 */
|
|
|
|
-static const struct sdiod_drive_str sdiod_drive_strength_tab1[] = {
|
|
|
|
- {
|
|
|
|
- 4, 0x2}, {
|
|
|
|
- 2, 0x3}, {
|
|
|
|
- 1, 0x0}, {
|
|
|
|
- 0, 0x0}
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
-/* SDIO Drive Strength to sel value table for PMU Rev 2, 3 */
|
|
|
|
-static const struct sdiod_drive_str sdiod_drive_strength_tab2[] = {
|
|
|
|
- {
|
|
|
|
- 12, 0x7}, {
|
|
|
|
- 10, 0x6}, {
|
|
|
|
- 8, 0x5}, {
|
|
|
|
- 6, 0x4}, {
|
|
|
|
- 4, 0x2}, {
|
|
|
|
- 2, 0x1}, {
|
|
|
|
- 0, 0x0}
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
-/* SDIO Drive Strength to sel value table for PMU Rev 8 (1.8V) */
|
|
|
|
-static const struct sdiod_drive_str sdiod_drive_strength_tab3[] = {
|
|
|
|
- {
|
|
|
|
- 32, 0x7}, {
|
|
|
|
- 26, 0x6}, {
|
|
|
|
- 22, 0x5}, {
|
|
|
|
- 16, 0x4}, {
|
|
|
|
- 12, 0x3}, {
|
|
|
|
- 8, 0x2}, {
|
|
|
|
- 4, 0x1}, {
|
|
|
|
- 0, 0x0}
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
-#define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu))
|
|
|
|
-
|
|
|
|
-static char *brcmf_chipname(uint chipid, char *buf, uint len)
|
|
|
|
-{
|
|
|
|
- const char *fmt;
|
|
|
|
-
|
|
|
|
- fmt = ((chipid > 0xa000) || (chipid < 0x4000)) ? "%d" : "%x";
|
|
|
|
- snprintf(buf, len, fmt, chipid);
|
|
|
|
- return buf;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static void brcmf_sdbrcm_sdiod_drive_strength_init(struct brcmf_bus *bus,
|
|
|
|
- u32 drivestrength) {
|
|
|
|
- struct sdiod_drive_str *str_tab = NULL;
|
|
|
|
- u32 str_mask = 0;
|
|
|
|
- u32 str_shift = 0;
|
|
|
|
- char chn[8];
|
|
|
|
-
|
|
|
|
- if (!(bus->ci->cccaps & CC_CAP_PMU))
|
|
|
|
- return;
|
|
|
|
-
|
|
|
|
- switch (SDIOD_DRVSTR_KEY(bus->ci->chip, bus->ci->pmurev)) {
|
|
|
|
- case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 1):
|
|
|
|
- str_tab = (struct sdiod_drive_str *)&sdiod_drive_strength_tab1;
|
|
|
|
- str_mask = 0x30000000;
|
|
|
|
- str_shift = 28;
|
|
|
|
- break;
|
|
|
|
- case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 2):
|
|
|
|
- case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 3):
|
|
|
|
- str_tab = (struct sdiod_drive_str *)&sdiod_drive_strength_tab2;
|
|
|
|
- str_mask = 0x00003800;
|
|
|
|
- str_shift = 11;
|
|
|
|
- break;
|
|
|
|
- case SDIOD_DRVSTR_KEY(BCM4336_CHIP_ID, 8):
|
|
|
|
- str_tab = (struct sdiod_drive_str *)&sdiod_drive_strength_tab3;
|
|
|
|
- str_mask = 0x00003800;
|
|
|
|
- str_shift = 11;
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- brcmf_dbg(ERROR, "No SDIO Drive strength init done for chip %s rev %d pmurev %d\n",
|
|
|
|
- brcmf_chipname(bus->ci->chip, chn, 8),
|
|
|
|
- bus->ci->chiprev, bus->ci->pmurev);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (str_tab != NULL) {
|
|
|
|
- u32 drivestrength_sel = 0;
|
|
|
|
- u32 cc_data_temp;
|
|
|
|
- int i;
|
|
|
|
-
|
|
|
|
- for (i = 0; str_tab[i].strength != 0; i++) {
|
|
|
|
- if (drivestrength >= str_tab[i].strength) {
|
|
|
|
- drivestrength_sel = str_tab[i].sel;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- brcmf_sdcard_reg_write(bus->sdiodev,
|
|
|
|
- CORE_CC_REG(bus->ci->cccorebase, chipcontrol_addr),
|
|
|
|
- 4, 1);
|
|
|
|
- cc_data_temp = brcmf_sdcard_reg_read(bus->sdiodev,
|
|
|
|
- CORE_CC_REG(bus->ci->cccorebase, chipcontrol_addr), 4);
|
|
|
|
- cc_data_temp &= ~str_mask;
|
|
|
|
- drivestrength_sel <<= str_shift;
|
|
|
|
- cc_data_temp |= drivestrength_sel;
|
|
|
|
- brcmf_sdcard_reg_write(bus->sdiodev,
|
|
|
|
- CORE_CC_REG(bus->ci->cccorebase, chipcontrol_addr),
|
|
|
|
- 4, cc_data_temp);
|
|
|
|
-
|
|
|
|
- brcmf_dbg(INFO, "SDIO: %dmA drive strength selected, set to 0x%08x\n",
|
|
|
|
- drivestrength, cc_data_temp);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static bool
|
|
static bool
|
|
brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, u32 regsva)
|
|
brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, u32 regsva)
|
|
{
|
|
{
|
|
@@ -3867,7 +3753,8 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, u32 regsva)
|
|
goto fail;
|
|
goto fail;
|
|
}
|
|
}
|
|
|
|
|
|
- brcmf_sdbrcm_sdiod_drive_strength_init(bus, SDIO_DRIVE_STRENGTH);
|
|
|
|
|
|
+ brcmf_sdio_chip_drivestrengthinit(bus->sdiodev, bus->ci,
|
|
|
|
+ SDIO_DRIVE_STRENGTH);
|
|
|
|
|
|
/* Get info on the SOCRAM cores... */
|
|
/* Get info on the SOCRAM cores... */
|
|
bus->ramsize = bus->ci->ramsize;
|
|
bus->ramsize = bus->ci->ramsize;
|