@@ -1210,10 +1210,24 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
1210
1210
}
1211
1211
EXPORT_SYMBOL_GPL (sdhci_set_clock );
1212
1212
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 )
1215
1215
{
1216
1216
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
+ {
1217
1231
u8 pwr = 0 ;
1218
1232
1219
1233
if (mode != MMC_POWER_OFF ) {
@@ -1245,7 +1259,6 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
1245
1259
sdhci_writeb (host , 0 , SDHCI_POWER_CONTROL );
1246
1260
if (host -> quirks2 & SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON )
1247
1261
sdhci_runtime_pm_bus_off (host );
1248
- vdd = 0 ;
1249
1262
} else {
1250
1263
/*
1251
1264
* 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,
1276
1289
if (host -> quirks & SDHCI_QUIRK_DELAY_AFTER_POWER )
1277
1290
mdelay (10 );
1278
1291
}
1292
+ }
1293
+ EXPORT_SYMBOL_GPL (sdhci_set_power );
1279
1294
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 );
1285
1306
}
1286
1307
1287
1308
/*****************************************************************************\
@@ -1431,7 +1452,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
1431
1452
}
1432
1453
}
1433
1454
1434
- sdhci_set_power (host , ios -> power_mode , ios -> vdd );
1455
+ __sdhci_set_power (host , ios -> power_mode , ios -> vdd );
1435
1456
1436
1457
if (host -> ops -> platform_send_init_74_clocks )
1437
1458
host -> ops -> platform_send_init_74_clocks (host , ios -> power_mode );
0 commit comments