Skip to content

Commit

Permalink
Merge branch 'omap_hsmmc' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
storulf committed Oct 30, 2017
2 parents 0b07194 + ddde0e7 commit 35ed78a
Show file tree
Hide file tree
Showing 7 changed files with 668 additions and 28 deletions.
16 changes: 16 additions & 0 deletions Documentation/devicetree/bindings/mmc/sdhci-omap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
* TI OMAP SDHCI Controller

Refer to mmc.txt for standard MMC bindings.

Required properties:
- compatible: Should be "ti,dra7-sdhci" for DRA7 and DRA72 controllers
- ti,hwmods: Must be "mmc<n>", <n> is controller instance starting 1

Example:
mmc1: mmc@4809c000 {
compatible = "ti,dra7-sdhci";
reg = <0x4809c000 0x400>;
ti,hwmods = "mmc1";
bus-width = <4>;
vmmc-supply = <&vmmc>; /* phandle to regulator node */
};
6 changes: 6 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -12049,6 +12049,12 @@ L: [email protected]
S: Maintained
F: drivers/mmc/host/sdhci-spear.c

SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) TI OMAP DRIVER
M: Kishon Vijay Abraham I <[email protected]>
L: [email protected]
S: Maintained
F: drivers/mmc/host/sdhci-omap.c

SECURE ENCRYPTING DEVICE (SED) OPAL DRIVER
M: Scott Bauer <[email protected]>
M: Jonathan Derrick <[email protected]>
Expand Down
12 changes: 12 additions & 0 deletions drivers/mmc/host/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -899,3 +899,15 @@ config MMC_SDHCI_XENON
This selects Marvell Xenon eMMC/SD/SDIO SDHCI.
If you have a controller with this interface, say Y or M here.
If unsure, say N.

config MMC_SDHCI_OMAP
tristate "TI SDHCI Controller Support"
depends on MMC_SDHCI_PLTFM && OF
help
This selects the Secure Digital Host Controller Interface (SDHCI)
support present in TI's DRA7 SOCs. The controller supports
SD/MMC/SDIO devices.

If you have a controller with this interface, say Y or M here.

If unsure, say N.
1 change: 1 addition & 0 deletions drivers/mmc/host/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ obj-$(CONFIG_MMC_SDHCI_MSM) += sdhci-msm.o
obj-$(CONFIG_MMC_SDHCI_ST) += sdhci-st.o
obj-$(CONFIG_MMC_SDHCI_MICROCHIP_PIC32) += sdhci-pic32.o
obj-$(CONFIG_MMC_SDHCI_BRCMSTB) += sdhci-brcmstb.o
obj-$(CONFIG_MMC_SDHCI_OMAP) += sdhci-omap.o

ifeq ($(CONFIG_CB710_DEBUG),y)
CFLAGS-cb710-mmc += -DDEBUG
Expand Down
33 changes: 8 additions & 25 deletions drivers/mmc/host/omap_hsmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,6 @@
#define OMAP_MMC_MAX_CLOCK 52000000
#define DRIVER_NAME "omap_hsmmc"

#define VDD_1V8 1800000 /* 180000 uV */
#define VDD_3V0 3000000 /* 300000 uV */
#define VDD_165_195 (ffs(MMC_VDD_165_195) - 1)

/*
* One controller can have multiple slots, like on some omap boards using
* omap.c controller driver. Luckily this is not currently done on any known
Expand Down Expand Up @@ -308,26 +304,14 @@ static int omap_hsmmc_disable_supply(struct mmc_host *mmc)
return ret;
}

static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
int vdd)
static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on)
{
int ret;

if (IS_ERR(host->pbias))
return 0;

if (power_on) {
if (vdd <= VDD_165_195)
ret = regulator_set_voltage(host->pbias, VDD_1V8,
VDD_1V8);
else
ret = regulator_set_voltage(host->pbias, VDD_3V0,
VDD_3V0);
if (ret < 0) {
dev_err(host->dev, "pbias set voltage fail\n");
return ret;
}

if (host->pbias_enabled == 0) {
ret = regulator_enable(host->pbias);
if (ret) {
Expand All @@ -350,8 +334,7 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
return 0;
}

static int omap_hsmmc_set_power(struct omap_hsmmc_host *host, int power_on,
int vdd)
static int omap_hsmmc_set_power(struct omap_hsmmc_host *host, int power_on)
{
struct mmc_host *mmc = host->mmc;
int ret = 0;
Expand All @@ -363,7 +346,7 @@ static int omap_hsmmc_set_power(struct omap_hsmmc_host *host, int power_on,
if (IS_ERR(mmc->supply.vmmc))
return 0;

ret = omap_hsmmc_set_pbias(host, false, 0);
ret = omap_hsmmc_set_pbias(host, false);
if (ret)
return ret;

Expand All @@ -385,7 +368,7 @@ static int omap_hsmmc_set_power(struct omap_hsmmc_host *host, int power_on,
if (ret)
return ret;

ret = omap_hsmmc_set_pbias(host, true, vdd);
ret = omap_hsmmc_set_pbias(host, true);
if (ret)
goto err_set_voltage;
} else {
Expand Down Expand Up @@ -1220,11 +1203,11 @@ static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
clk_disable_unprepare(host->dbclk);

/* Turn the power off */
ret = omap_hsmmc_set_power(host, 0, 0);
ret = omap_hsmmc_set_power(host, 0);

/* Turn the power ON with given VDD 1.8 or 3.0v */
if (!ret)
ret = omap_hsmmc_set_power(host, 1, vdd);
ret = omap_hsmmc_set_power(host, 1);
if (host->dbclk)
clk_prepare_enable(host->dbclk);

Expand Down Expand Up @@ -1621,10 +1604,10 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if (ios->power_mode != host->power_mode) {
switch (ios->power_mode) {
case MMC_POWER_OFF:
omap_hsmmc_set_power(host, 0, 0);
omap_hsmmc_set_power(host, 0);
break;
case MMC_POWER_UP:
omap_hsmmc_set_power(host, 1, ios->vdd);
omap_hsmmc_set_power(host, 1);
break;
case MMC_POWER_ON:
do_send_init_stream = 1;
Expand Down
Loading

0 comments on commit 35ed78a

Please sign in to comment.