diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-07-10 15:21:13 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2013-08-25 00:10:18 -0400 |
commit | 6d6fd3674259d16b735c961743ff28870c46cedc (patch) | |
tree | b93ef646e4343d7ba4baad0ace663b562bbfb01f | |
parent | 967bcb77177cda1a426fdb2350e6ec61bcf5b5eb (diff) |
mmc: sh_mmcif: revision-specific CLK_CTRL2 handling
Some newer MMCIF IP revisions contain a CE_CLK_CTRL2 register, that has to
be set for proper operation. Support for this feature is added in a way to
preserve the current behaviour by default, i.e. when it is not enabled
in platform data. Patch is based on work by Nobuyuki HIRAI.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r-- | drivers/mmc/host/sh_mmcif.c | 4 | ||||
-rw-r--r-- | include/linux/mmc/sh_mmcif.h | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 6fa6868d1030..36629a024aa1 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c | |||
@@ -247,6 +247,7 @@ struct sh_mmcif_host { | |||
247 | bool power; | 247 | bool power; |
248 | bool card_present; | 248 | bool card_present; |
249 | bool ccs_enable; /* Command Completion Signal support */ | 249 | bool ccs_enable; /* Command Completion Signal support */ |
250 | bool clk_ctrl2_enable; | ||
250 | struct mutex thread_lock; | 251 | struct mutex thread_lock; |
251 | 252 | ||
252 | /* DMA support */ | 253 | /* DMA support */ |
@@ -497,6 +498,8 @@ static void sh_mmcif_sync_reset(struct sh_mmcif_host *host) | |||
497 | sh_mmcif_writel(host->addr, MMCIF_CE_VERSION, SOFT_RST_OFF); | 498 | sh_mmcif_writel(host->addr, MMCIF_CE_VERSION, SOFT_RST_OFF); |
498 | if (host->ccs_enable) | 499 | if (host->ccs_enable) |
499 | tmp |= SCCSTO_29; | 500 | tmp |= SCCSTO_29; |
501 | if (host->clk_ctrl2_enable) | ||
502 | sh_mmcif_writel(host->addr, MMCIF_CE_CLK_CTRL2, 0x0F0F0000); | ||
500 | sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, tmp | | 503 | sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, tmp | |
501 | SRSPTO_256 | SRBSYTO_29 | SRWDTO_29); | 504 | SRSPTO_256 | SRBSYTO_29 | SRWDTO_29); |
502 | /* byte swap on */ | 505 | /* byte swap on */ |
@@ -1398,6 +1401,7 @@ static int sh_mmcif_probe(struct platform_device *pdev) | |||
1398 | host->addr = reg; | 1401 | host->addr = reg; |
1399 | host->timeout = msecs_to_jiffies(1000); | 1402 | host->timeout = msecs_to_jiffies(1000); |
1400 | host->ccs_enable = !pd || !pd->ccs_unsupported; | 1403 | host->ccs_enable = !pd || !pd->ccs_unsupported; |
1404 | host->clk_ctrl2_enable = pd && pd->clk_ctrl2_present; | ||
1401 | 1405 | ||
1402 | host->pd = pdev; | 1406 | host->pd = pdev; |
1403 | 1407 | ||
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h index 197ed91f6a0c..ccd8fb2cad52 100644 --- a/include/linux/mmc/sh_mmcif.h +++ b/include/linux/mmc/sh_mmcif.h | |||
@@ -37,6 +37,7 @@ struct sh_mmcif_plat_data { | |||
37 | unsigned int slave_id_rx; | 37 | unsigned int slave_id_rx; |
38 | bool use_cd_gpio : 1; | 38 | bool use_cd_gpio : 1; |
39 | bool ccs_unsupported : 1; | 39 | bool ccs_unsupported : 1; |
40 | bool clk_ctrl2_present : 1; | ||
40 | unsigned int cd_gpio; | 41 | unsigned int cd_gpio; |
41 | u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ | 42 | u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ |
42 | unsigned long caps; | 43 | unsigned long caps; |
@@ -60,6 +61,7 @@ struct sh_mmcif_plat_data { | |||
60 | #define MMCIF_CE_INT_MASK 0x00000044 | 61 | #define MMCIF_CE_INT_MASK 0x00000044 |
61 | #define MMCIF_CE_HOST_STS1 0x00000048 | 62 | #define MMCIF_CE_HOST_STS1 0x00000048 |
62 | #define MMCIF_CE_HOST_STS2 0x0000004C | 63 | #define MMCIF_CE_HOST_STS2 0x0000004C |
64 | #define MMCIF_CE_CLK_CTRL2 0x00000070 | ||
63 | #define MMCIF_CE_VERSION 0x0000007C | 65 | #define MMCIF_CE_VERSION 0x0000007C |
64 | 66 | ||
65 | /* CE_BUF_ACC */ | 67 | /* CE_BUF_ACC */ |