All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: linux-mmc@vger.kernel.org
Cc: linux-sh@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com>,
	Simon Horman <horms@verge.net.au>, Chris Ball <cjb@laptop.org>,
	Nobuyuki HIRAI <nobuyuki.hirai.xe@renesas.com>,
	Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Subject: [PATCH 2/6] mmc: sh_mmcif: revision-specific CLK_CTRL2 handling
Date: Wed, 10 Jul 2013 19:21:13 +0000	[thread overview]
Message-ID: <1373484077-10460-3-git-send-email-g.liakhovetski@gmx.de> (raw)
In-Reply-To: <1373484077-10460-1-git-send-email-g.liakhovetski@gmx.de>

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>
---
 drivers/mmc/host/sh_mmcif.c  |    4 ++++
 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 7be20c9..dc3ce52 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -246,6 +246,7 @@ struct sh_mmcif_host {
 	bool power;
 	bool card_present;
 	bool ccs_enable;		/* Command Completion Signal support */
+	bool clk_ctrl2_enable;
 	struct mutex thread_lock;
 
 	/* DMA support */
@@ -490,6 +491,8 @@ static void sh_mmcif_sync_reset(struct sh_mmcif_host *host)
 	sh_mmcif_writel(host->addr, MMCIF_CE_VERSION, SOFT_RST_OFF);
 	if (host->ccs_enable)
 		tmp |= SCCSTO_29;
+	if (host->clk_ctrl2_enable)
+		sh_mmcif_writel(host->addr, MMCIF_CE_CLK_CTRL2, 0x0F0F0000);
 	sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, tmp |
 		SRSPTO_256 | SRBSYTO_29 | SRWDTO_29);
 	/* byte swap on */
@@ -1390,6 +1393,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 	host->addr	= reg;
 	host->timeout	= msecs_to_jiffies(1000);
 	host->ccs_enable = !pd || !pd->ccs_unsupported;
+	host->clk_ctrl2_enable = pd && pd->clk_ctrl2_present;
 
 	host->pd = pdev;
 
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index b2a22b6..d4277d9 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -40,6 +40,7 @@ struct sh_mmcif_plat_data {
 	unsigned int		slave_id_rx;
 	bool			use_cd_gpio : 1;
 	bool			ccs_unsupported : 1;
+	bool			clk_ctrl2_present : 1;
 	unsigned int		cd_gpio;
 	u8			sup_pclk;	/* 1 :SH7757, 0: SH7724/SH7372 */
 	unsigned long		caps;
@@ -63,6 +64,7 @@ struct sh_mmcif_plat_data {
 #define MMCIF_CE_INT_MASK	0x00000044
 #define MMCIF_CE_HOST_STS1	0x00000048
 #define MMCIF_CE_HOST_STS2	0x0000004C
+#define MMCIF_CE_CLK_CTRL2	0x00000070
 #define MMCIF_CE_VERSION	0x0000007C
 
 /* CE_BUF_ACC */
-- 
1.7.2.5


WARNING: multiple messages have this Message-ID (diff)
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: linux-mmc@vger.kernel.org
Cc: linux-sh@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com>,
	Simon Horman <horms@verge.net.au>, Chris Ball <cjb@laptop.org>,
	Nobuyuki HIRAI <nobuyuki.hirai.xe@renesas.com>,
	Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Subject: [PATCH 2/6] mmc: sh_mmcif: revision-specific CLK_CTRL2 handling
Date: Wed, 10 Jul 2013 21:21:13 +0200	[thread overview]
Message-ID: <1373484077-10460-3-git-send-email-g.liakhovetski@gmx.de> (raw)
In-Reply-To: <1373484077-10460-1-git-send-email-g.liakhovetski@gmx.de>

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>
---
 drivers/mmc/host/sh_mmcif.c  |    4 ++++
 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 7be20c9..dc3ce52 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -246,6 +246,7 @@ struct sh_mmcif_host {
 	bool power;
 	bool card_present;
 	bool ccs_enable;		/* Command Completion Signal support */
+	bool clk_ctrl2_enable;
 	struct mutex thread_lock;
 
 	/* DMA support */
@@ -490,6 +491,8 @@ static void sh_mmcif_sync_reset(struct sh_mmcif_host *host)
 	sh_mmcif_writel(host->addr, MMCIF_CE_VERSION, SOFT_RST_OFF);
 	if (host->ccs_enable)
 		tmp |= SCCSTO_29;
+	if (host->clk_ctrl2_enable)
+		sh_mmcif_writel(host->addr, MMCIF_CE_CLK_CTRL2, 0x0F0F0000);
 	sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, tmp |
 		SRSPTO_256 | SRBSYTO_29 | SRWDTO_29);
 	/* byte swap on */
@@ -1390,6 +1393,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 	host->addr	= reg;
 	host->timeout	= msecs_to_jiffies(1000);
 	host->ccs_enable = !pd || !pd->ccs_unsupported;
+	host->clk_ctrl2_enable = pd && pd->clk_ctrl2_present;
 
 	host->pd = pdev;
 
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index b2a22b6..d4277d9 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -40,6 +40,7 @@ struct sh_mmcif_plat_data {
 	unsigned int		slave_id_rx;
 	bool			use_cd_gpio : 1;
 	bool			ccs_unsupported : 1;
+	bool			clk_ctrl2_present : 1;
 	unsigned int		cd_gpio;
 	u8			sup_pclk;	/* 1 :SH7757, 0: SH7724/SH7372 */
 	unsigned long		caps;
@@ -63,6 +64,7 @@ struct sh_mmcif_plat_data {
 #define MMCIF_CE_INT_MASK	0x00000044
 #define MMCIF_CE_HOST_STS1	0x00000048
 #define MMCIF_CE_HOST_STS2	0x0000004C
+#define MMCIF_CE_CLK_CTRL2	0x00000070
 #define MMCIF_CE_VERSION	0x0000007C
 
 /* CE_BUF_ACC */
-- 
1.7.2.5


  parent reply	other threads:[~2013-07-10 19:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10 19:21 [PATCH 0/6] mmc: sh_mmcif: revision-specific CCS and CLK_CTRL2 handling Guennadi Liakhovetski
2013-07-10 19:21 ` Guennadi Liakhovetski
2013-07-10 19:21 ` [PATCH 1/6] mmc: sh_mmcif: revision-specific Command Completion Signal handling Guennadi Liakhovetski
2013-07-10 19:21   ` Guennadi Liakhovetski
2013-07-10 19:21 ` Guennadi Liakhovetski [this message]
2013-07-10 19:21   ` [PATCH 2/6] mmc: sh_mmcif: revision-specific CLK_CTRL2 handling Guennadi Liakhovetski
2013-07-10 19:21 ` [PATCH 3/6] ARM: shmobile: armadillo800eva: disable MMCIF Command Completion Signal Guennadi Liakhovetski
2013-07-10 19:21   ` Guennadi Liakhovetski
2013-09-25  7:12   ` Simon Horman
2013-09-25  7:12     ` Simon Horman
2013-09-25  7:12   ` Simon Horman
2013-09-25  7:12     ` Simon Horman
2013-07-10 19:21 ` [PATCH 4/6] ARM: shmobile: kzm9g: " Guennadi Liakhovetski
2013-07-10 19:21   ` Guennadi Liakhovetski
2013-09-25  7:12   ` Simon Horman
2013-09-25  7:12     ` Simon Horman
2013-07-10 19:21 ` [PATCH 5/6] ARM: shmobile: ape6evm: " Guennadi Liakhovetski
2013-07-10 19:21   ` Guennadi Liakhovetski
2013-09-25  7:12   ` Simon Horman
2013-09-25  7:12     ` Simon Horman
2013-07-10 19:21 ` [PATCH 6/6] ARM: shmobile: lager: disable MMCIF Command Completion Signal, add CLK_CTRL2 Guennadi Liakhovetski
2013-07-10 19:21   ` Guennadi Liakhovetski
2013-09-25  7:12   ` Simon Horman
2013-09-25  7:12     ` Simon Horman
2013-08-25  4:12 ` [PATCH 0/6] mmc: sh_mmcif: revision-specific CCS and CLK_CTRL2 handling Chris Ball
2013-08-25  4:12   ` Chris Ball

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373484077-10460-3-git-send-email-g.liakhovetski@gmx.de \
    --to=g.liakhovetski@gmx.de \
    --cc=cjb@laptop.org \
    --cc=g.liakhovetski+renesas@gmail.com \
    --cc=horms@verge.net.au \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=nobuyuki.hirai.xe@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.