Skip to content

Commit da29fe2

Browse files
Shinobu Ueharastorulf
authored andcommitted
mmc: tmio: add actual clock support as option
Some controller is supporting actual clock on SD_CLK_CTRL :: DIV[7:0]. Renesas SH-Mobile SDHI doesn't support, but, Renesas R-Car SDHI supports it. This patch adds new TMIO_MMC_CLK_ACTUAL flag for it. [Kuninori Morimoto: tidyuped for upstreaming] Tested-by: Nguyen Xuan Nui <nx-nui@jinso.co.jp> Tested-by: Hiep Cao Minh <cm-hiep@jinso.co.jp> Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent b30d695 commit da29fe2

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

drivers/mmc/host/sh_mobile_sdhi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,14 @@ static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = {
4949
};
5050

5151
static const struct sh_mobile_sdhi_of_data of_rcar_gen1_compatible = {
52-
.tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE,
52+
.tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE |
53+
TMIO_MMC_CLK_ACTUAL,
5354
.capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
5455
};
5556

5657
static const struct sh_mobile_sdhi_of_data of_rcar_gen2_compatible = {
57-
.tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE,
58+
.tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE |
59+
TMIO_MMC_CLK_ACTUAL,
5860
.capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
5961
.capabilities2 = MMC_CAP2_NO_MULTI_READ,
6062
.dma_rx_offset = 0x2000,

drivers/mmc/host/tmio_mmc_pio.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ static void tmio_mmc_set_clock(struct tmio_mmc_host *host,
159159
for (clock = host->mmc->f_min, clk = 0x80000080;
160160
new_clock >= (clock<<1); clk >>= 1)
161161
clock <<= 1;
162+
163+
/* 1/1 clock is option */
164+
if ((host->pdata->flags & TMIO_MMC_CLK_ACTUAL) &&
165+
((clk >> 22) & 0x1))
166+
clk |= 0xff;
162167
}
163168

164169
if (host->set_clk_div)

include/linux/mfd/tmio.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@
9999
*/
100100
#define TMIO_MMC_HAVE_CTL_DMA_REG (1 << 9)
101101

102+
/*
103+
* Some controllers allows to set SDx actual clock
104+
*/
105+
#define TMIO_MMC_CLK_ACTUAL (1 << 10)
106+
102107
int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
103108
int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
104109
void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);

0 commit comments

Comments
 (0)