@@ -1210,10 +1210,24 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
12101210}
12111211EXPORT_SYMBOL_GPL (sdhci_set_clock );
12121212
1213- static void sdhci_set_power (struct sdhci_host * host , unsigned char mode ,
1214- unsigned short vdd )
1213+ static void sdhci_set_power_reg (struct sdhci_host * host , unsigned char mode ,
1214+ unsigned short vdd )
12151215{
12161216 struct mmc_host * mmc = host -> mmc ;
1217+
1218+ spin_unlock_irq (& host -> lock );
1219+ mmc_regulator_set_ocr (mmc , mmc -> supply .vmmc , vdd );
1220+ spin_lock_irq (& host -> lock );
1221+
1222+ if (mode != MMC_POWER_OFF )
1223+ sdhci_writeb (host , SDHCI_POWER_ON , SDHCI_POWER_CONTROL );
1224+ else
1225+ sdhci_writeb (host , 0 , SDHCI_POWER_CONTROL );
1226+ }
1227+
1228+ void sdhci_set_power (struct sdhci_host * host , unsigned char mode ,
1229+ unsigned short vdd )
1230+ {
12171231 u8 pwr = 0 ;
12181232
12191233 if (mode != MMC_POWER_OFF ) {
@@ -1245,7 +1259,6 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
12451259 sdhci_writeb (host , 0 , SDHCI_POWER_CONTROL );
12461260 if (host -> quirks2 & SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON )
12471261 sdhci_runtime_pm_bus_off (host );
1248- vdd = 0 ;
12491262 } else {
12501263 /*
12511264 * Spec says that we should clear the power reg before setting
@@ -1276,12 +1289,20 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
12761289 if (host -> quirks & SDHCI_QUIRK_DELAY_AFTER_POWER )
12771290 mdelay (10 );
12781291 }
1292+ }
1293+ EXPORT_SYMBOL_GPL (sdhci_set_power );
12791294
1280- if (!IS_ERR (mmc -> supply .vmmc )) {
1281- spin_unlock_irq (& host -> lock );
1282- mmc_regulator_set_ocr (mmc , mmc -> supply .vmmc , vdd );
1283- spin_lock_irq (& host -> lock );
1284- }
1295+ static void __sdhci_set_power (struct sdhci_host * host , unsigned char mode ,
1296+ unsigned short vdd )
1297+ {
1298+ struct mmc_host * mmc = host -> mmc ;
1299+
1300+ if (host -> ops -> set_power )
1301+ host -> ops -> set_power (host , mode , vdd );
1302+ else if (!IS_ERR (mmc -> supply .vmmc ))
1303+ sdhci_set_power_reg (host , mode , vdd );
1304+ else
1305+ sdhci_set_power (host , mode , vdd );
12851306}
12861307
12871308/*****************************************************************************\
@@ -1431,7 +1452,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
14311452 }
14321453 }
14331454
1434- sdhci_set_power (host , ios -> power_mode , ios -> vdd );
1455+ __sdhci_set_power (host , ios -> power_mode , ios -> vdd );
14351456
14361457 if (host -> ops -> platform_send_init_74_clocks )
14371458 host -> ops -> platform_send_init_74_clocks (host , ios -> power_mode );
0 commit comments