Skip to content

Commit

Permalink
mmc: rtsx: Call MFD hook to switch output voltage
Browse files Browse the repository at this point in the history
Different card reader has different method to switch output voltage, so
we have to use the callback function provided by MFD driver to switch
output pad voltage.

Signed-off-by: Wei WANG <wei_wang@realsil.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Wei WANG authored and Samuel Ortiz committed Jan 27, 2013
1 parent d817ac4 commit ef85e73
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions drivers/mmc/host/rtsx_pci_sdmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,26 +1060,6 @@ static int sd_wait_voltage_stable_2(struct realtek_pci_sdmmc *host)
return 0;
}

static int sd_change_bank_voltage(struct realtek_pci_sdmmc *host, u8 voltage)
{
struct rtsx_pcr *pcr = host->pcr;
int err;

if (voltage == SD_IO_3V3) {
err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24);
if (err < 0)
return err;
} else if (voltage == SD_IO_1V8) {
err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24);
if (err < 0)
return err;
} else {
return -EINVAL;
}

return 0;
}

static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct realtek_pci_sdmmc *host = mmc_priv(mmc);
Expand All @@ -1098,11 +1078,11 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
rtsx_pci_start_run(pcr);

if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330)
voltage = SD_IO_3V3;
voltage = OUTPUT_3V3;
else
voltage = SD_IO_1V8;
voltage = OUTPUT_1V8;

if (voltage == SD_IO_1V8) {
if (voltage == OUTPUT_1V8) {
err = rtsx_pci_write_register(pcr,
SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B);
if (err < 0)
Expand All @@ -1113,11 +1093,11 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
goto out;
}

err = sd_change_bank_voltage(host, voltage);
err = rtsx_pci_switch_output_voltage(pcr, voltage);
if (err < 0)
goto out;

if (voltage == SD_IO_1V8) {
if (voltage == OUTPUT_1V8) {
err = sd_wait_voltage_stable_2(host);
if (err < 0)
goto out;
Expand Down

0 comments on commit ef85e73

Please sign in to comment.