diff options
author | Rui Miguel Silva <rui.silva@linaro.org> | 2016-07-19 15:41:29 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-07-19 16:38:24 -0700 |
commit | 484a4d667751148654277a3ec93b8f0a327da29d (patch) | |
tree | 70bcb56d7100957578455e682957ae73e2c19c2a | |
parent | 56c78715eaaeba41317a82dc91a037cbbea16736 (diff) | |
download | linux-484a4d667751148654277a3ec93b8f0a327da29d.tar.bz2 |
greybus: sdio: convert vdd kernel values to greybus
We need to convert vdd kernel values to greybus ones. And we get this by
shifting the kernel values by 8.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
-rw-r--r-- | drivers/staging/greybus/sdio.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c index 8d2de7d96eb4..5e5de04047c1 100644 --- a/drivers/staging/greybus/sdio.c +++ b/drivers/staging/greybus/sdio.c @@ -43,6 +43,9 @@ struct gb_sdio_host { #define GB_SDIO_RSP_R1B (GB_SDIO_RSP_PRESENT | GB_SDIO_RSP_CRC | \ GB_SDIO_RSP_OPCODE | GB_SDIO_RSP_BUSY) +/* kernel vdd starts at 0x80 and we need to translate to greybus ones 0x01 */ +#define GB_SDIO_VDD_SHIFT 8 + static inline bool single_op(struct mmc_command *cmd) { uint32_t opcode = cmd->opcode; @@ -574,10 +577,14 @@ static void gb_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) u8 timing; u8 signal_voltage; u8 drv_type; + u32 vdd = 0; mutex_lock(&host->lock); request.clock = cpu_to_le32(ios->clock); - request.vdd = cpu_to_le32(1 << ios->vdd); + + if (ios->vdd) + vdd = 1 << (ios->vdd - GB_SDIO_VDD_SHIFT); + request.vdd = cpu_to_le32(vdd); request.bus_mode = (ios->bus_mode == MMC_BUSMODE_OPENDRAIN ? GB_SDIO_BUSMODE_OPENDRAIN : |