summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2015-05-23 17:43:02 +0000
committerian <ian@FreeBSD.org>2015-05-23 17:43:02 +0000
commite598358ce4ecd13a6ce840fc40f6845722bade6e (patch)
treec630c8a352a21398a253712a4be7c3071c518d63
parentc063f629c5b85ca49413bf3486cf9b5263bbacb8 (diff)
downloadFreeBSD-src-e598358ce4ecd13a6ce840fc40f6845722bade6e.zip
FreeBSD-src-e598358ce4ecd13a6ce840fc40f6845722bade6e.tar.gz
MFC r279359, r279360:
For new eMMC chips, we must signal controller HC capability in OP_COND command. Detect, report and use 8-bit bus if is available.
-rw-r--r--sys/dev/mmc/mmc.c2
-rw-r--r--sys/dev/sdhci/sdhci.c20
2 files changed, 17 insertions, 5 deletions
diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c
index 84475e9..712a2d3 100644
--- a/sys/dev/mmc/mmc.c
+++ b/sys/dev/mmc/mmc.c
@@ -1622,7 +1622,7 @@ mmc_go_discovery(struct mmc_softc *sc)
mmc_send_app_op_cond(sc,
(err ? 0 : MMC_OCR_CCS) | mmcbr_get_ocr(dev), NULL);
} else
- mmc_send_op_cond(sc, mmcbr_get_ocr(dev), NULL);
+ mmc_send_op_cond(sc, MMC_OCR_CCS | mmcbr_get_ocr(dev), NULL);
mmc_discover_cards(sc);
mmc_rescan_cards(sc);
diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c
index 009decd..47d6340 100644
--- a/sys/dev/sdhci/sdhci.c
+++ b/sys/dev/sdhci/sdhci.c
@@ -584,6 +584,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num)
"support voltages.\n");
}
slot->host.caps = MMC_CAP_4_BIT_DATA;
+ if (caps & SDHCI_CAN_DO_8BITBUS)
+ slot->host.caps |= MMC_CAP_8_BIT_DATA;
if (caps & SDHCI_CAN_DO_HISPD)
slot->host.caps |= MMC_CAP_HSPEED;
/* Decide if we have usable DMA. */
@@ -603,9 +605,11 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num)
slot->opt &= ~SDHCI_HAVE_DMA;
if (bootverbose || sdhci_debug) {
- slot_printf(slot, "%uMHz%s 4bits%s%s%s %s\n",
+ slot_printf(slot, "%uMHz%s %s%s%s%s %s\n",
slot->max_clk / 1000000,
(caps & SDHCI_CAN_DO_HISPD) ? " HS" : "",
+ (caps & MMC_CAP_8_BIT_DATA) ? "8bits" :
+ ((caps & MMC_CAP_4_BIT_DATA) ? "4bits" : "1bit"),
(caps & SDHCI_CAN_VDD_330) ? " 3.3V" : "",
(caps & SDHCI_CAN_VDD_300) ? " 3.0V" : "",
(caps & SDHCI_CAN_VDD_180) ? " 1.8V" : "",
@@ -692,11 +696,19 @@ sdhci_generic_update_ios(device_t brdev, device_t reqdev)
}
/* Configure the bus. */
sdhci_set_clock(slot, ios->clock);
- sdhci_set_power(slot, (ios->power_mode == power_off)?0:ios->vdd);
- if (ios->bus_width == bus_width_4)
+ sdhci_set_power(slot, (ios->power_mode == power_off) ? 0 : ios->vdd);
+ if (ios->bus_width == bus_width_8) {
+ slot->hostctrl |= SDHCI_CTRL_8BITBUS;
+ slot->hostctrl &= ~SDHCI_CTRL_4BITBUS;
+ } else if (ios->bus_width == bus_width_4) {
+ slot->hostctrl &= ~SDHCI_CTRL_8BITBUS;
slot->hostctrl |= SDHCI_CTRL_4BITBUS;
- else
+ } else if (ios->bus_width == bus_width_1) {
+ slot->hostctrl &= ~SDHCI_CTRL_8BITBUS;
slot->hostctrl &= ~SDHCI_CTRL_4BITBUS;
+ } else {
+ panic("Invalid bus width: %d", ios->bus_width);
+ }
if (ios->timing == bus_timing_hs &&
!(slot->quirks & SDHCI_QUIRK_DONT_SET_HISPD_BIT))
slot->hostctrl |= SDHCI_CTRL_HISPD;
OpenPOWER on IntegriCloud