Skip to content

Commit 2f422f9

Browse files
committed
Merge tag 'mmc-v4.6-rc1' of git://git.linaro.org/people/ulf.hansson/mmc
Pull MMC fixes from Ulf Hansson: "Here are a couple of mmc fixes intended for v4.6 rc3: MMC host: - sdhci: Fix regression setting power on Trats2 board - sdhci-pci: Add support and PCI IDs for more Broxton host controllers" * tag 'mmc-v4.6-rc1' of git://git.linaro.org/people/ulf.hansson/mmc: mmc: sdhci-pci: Add support and PCI IDs for more Broxton host controllers mmc: sdhci: Fix regression setting power on Trats2 board
2 parents 6a7c924 + 01d6b2a commit 2f422f9

File tree

5 files changed

+84
-9
lines changed

5 files changed

+84
-9
lines changed

drivers/mmc/host/sdhci-pci-core.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ static int byt_sd_probe_slot(struct sdhci_pci_slot *slot)
390390
slot->cd_idx = 0;
391391
slot->cd_override_level = true;
392392
if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXT_SD ||
393+
slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXTM_SD ||
393394
slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD)
394395
slot->host->mmc_host_ops.get_cd = bxt_get_cd;
395396

@@ -1171,6 +1172,30 @@ static const struct pci_device_id pci_ids[] = {
11711172
.driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd,
11721173
},
11731174

1175+
{
1176+
.vendor = PCI_VENDOR_ID_INTEL,
1177+
.device = PCI_DEVICE_ID_INTEL_BXTM_EMMC,
1178+
.subvendor = PCI_ANY_ID,
1179+
.subdevice = PCI_ANY_ID,
1180+
.driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1181+
},
1182+
1183+
{
1184+
.vendor = PCI_VENDOR_ID_INTEL,
1185+
.device = PCI_DEVICE_ID_INTEL_BXTM_SDIO,
1186+
.subvendor = PCI_ANY_ID,
1187+
.subdevice = PCI_ANY_ID,
1188+
.driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio,
1189+
},
1190+
1191+
{
1192+
.vendor = PCI_VENDOR_ID_INTEL,
1193+
.device = PCI_DEVICE_ID_INTEL_BXTM_SD,
1194+
.subvendor = PCI_ANY_ID,
1195+
.subdevice = PCI_ANY_ID,
1196+
.driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd,
1197+
},
1198+
11741199
{
11751200
.vendor = PCI_VENDOR_ID_INTEL,
11761201
.device = PCI_DEVICE_ID_INTEL_APL_EMMC,

drivers/mmc/host/sdhci-pci.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
#define PCI_DEVICE_ID_INTEL_BXT_SD 0x0aca
2929
#define PCI_DEVICE_ID_INTEL_BXT_EMMC 0x0acc
3030
#define PCI_DEVICE_ID_INTEL_BXT_SDIO 0x0ad0
31+
#define PCI_DEVICE_ID_INTEL_BXTM_SD 0x1aca
32+
#define PCI_DEVICE_ID_INTEL_BXTM_EMMC 0x1acc
33+
#define PCI_DEVICE_ID_INTEL_BXTM_SDIO 0x1ad0
3134
#define PCI_DEVICE_ID_INTEL_APL_SD 0x5aca
3235
#define PCI_DEVICE_ID_INTEL_APL_EMMC 0x5acc
3336
#define PCI_DEVICE_ID_INTEL_APL_SDIO 0x5ad0

drivers/mmc/host/sdhci-pxav3.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,30 @@ static void pxav3_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs)
309309
__func__, uhs, ctrl_2);
310310
}
311311

312+
static void pxav3_set_power(struct sdhci_host *host, unsigned char mode,
313+
unsigned short vdd)
314+
{
315+
struct mmc_host *mmc = host->mmc;
316+
u8 pwr = host->pwr;
317+
318+
sdhci_set_power(host, mode, vdd);
319+
320+
if (host->pwr == pwr)
321+
return;
322+
323+
if (host->pwr == 0)
324+
vdd = 0;
325+
326+
if (!IS_ERR(mmc->supply.vmmc)) {
327+
spin_unlock_irq(&host->lock);
328+
mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
329+
spin_lock_irq(&host->lock);
330+
}
331+
}
332+
312333
static const struct sdhci_ops pxav3_sdhci_ops = {
313334
.set_clock = sdhci_set_clock,
335+
.set_power = pxav3_set_power,
314336
.platform_send_init_74_clocks = pxav3_gen_init_74_clocks,
315337
.get_max_clock = sdhci_pltfm_clk_get_max_clock,
316338
.set_bus_width = sdhci_set_bus_width,

drivers/mmc/host/sdhci.c

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,10 +1210,24 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
12101210
}
12111211
EXPORT_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);

drivers/mmc/host/sdhci.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,8 @@ struct sdhci_ops {
529529
#endif
530530

531531
void (*set_clock)(struct sdhci_host *host, unsigned int clock);
532+
void (*set_power)(struct sdhci_host *host, unsigned char mode,
533+
unsigned short vdd);
532534

533535
int (*enable_dma)(struct sdhci_host *host);
534536
unsigned int (*get_max_clock)(struct sdhci_host *host);
@@ -660,6 +662,8 @@ static inline bool sdhci_sdio_irq_enabled(struct sdhci_host *host)
660662
}
661663

662664
void sdhci_set_clock(struct sdhci_host *host, unsigned int clock);
665+
void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
666+
unsigned short vdd);
663667
void sdhci_set_bus_width(struct sdhci_host *host, int width);
664668
void sdhci_reset(struct sdhci_host *host, u8 mask);
665669
void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing);

0 commit comments

Comments
 (0)