All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC V2 0/4] dw_mmc platform specific private data init
@ 2013-08-23 11:15 Yuvaraj Kumar C D
  2013-08-23 11:15 ` [RFC V2 1/4] mmc: dw_mmc: exynos: move the exynos private init Yuvaraj Kumar C D
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Yuvaraj Kumar C D @ 2013-08-23 11:15 UTC (permalink / raw)
  To: linux-mmc, linux-samsung-soc, cjb, jh80.chung, tgih.jun, alim.akhtar
  Cc: ks.giri, t.figa, Yuvaraj Kumar C D

changes from V1:
	1.Added a new RFC patch 
		mmc: dw_mmc: socfpga: move socfpga private init
	2.Avoid code duplication in
		mmc: dw_mmc: exynos: add a quirk for SMU.

Yuvaraj Kumar C D (4):
  mmc: dw_mmc: exynos: move the exynos private init
  mmc: dw_mmc: socfpga: move socfpga private init
  mmc: dw_mmc: move the platform specific init call
  mmc: dw_mmc: exynos: add a quirk for SMU.

 drivers/mmc/host/dw_mmc-exynos.c  |   60 ++++++++++++++++++++++++++++---------
 drivers/mmc/host/dw_mmc-pltfm.c   |    7 -----
 drivers/mmc/host/dw_mmc-socfpga.c |   29 +++++++++---------
 drivers/mmc/host/dw_mmc.c         |   12 ++++++++
 include/linux/mmc/dw_mmc.h        |    2 ++
 5 files changed, 74 insertions(+), 36 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [RFC V2 1/4] mmc: dw_mmc: exynos: move the exynos private init
  2013-08-23 11:15 [RFC V2 0/4] dw_mmc platform specific private data init Yuvaraj Kumar C D
@ 2013-08-23 11:15 ` Yuvaraj Kumar C D
  2013-08-23 13:44   ` Jaehoon Chung
  2013-08-23 11:15 ` [RFC V2 2/4] mmc: dw_mmc: socfpga: move socfpga " Yuvaraj Kumar C D
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Yuvaraj Kumar C D @ 2013-08-23 11:15 UTC (permalink / raw)
  To: linux-mmc, linux-samsung-soc, cjb, jh80.chung, tgih.jun, alim.akhtar
  Cc: ks.giri, t.figa, Yuvaraj Kumar C D

Currently platform specific private data initialisation is done by
dw_mci_exynos_priv_init and dw_mci_exynos_parse_dt.As we already have
separate platform specific device tree parser dw_mci_exynos_parse_dt,
move the dw_mci_exynos_priv_init code to dw_mci_exynos_parse_dt.
We can use the dw_mci_exynos_priv_init to do some actual platform
specific initialisation of SMU and etc.

changes since V1: none

Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
---
 drivers/mmc/host/dw_mmc-exynos.c |   31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
index 9990f98..19c845b 100644
--- a/drivers/mmc/host/dw_mmc-exynos.c
+++ b/drivers/mmc/host/dw_mmc-exynos.c
@@ -72,22 +72,8 @@ static struct dw_mci_exynos_compatible {
 
 static int dw_mci_exynos_priv_init(struct dw_mci *host)
 {
-	struct dw_mci_exynos_priv_data *priv;
-	int idx;
-
-	priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv) {
-		dev_err(host->dev, "mem alloc failed for private data\n");
-		return -ENOMEM;
-	}
-
-	for (idx = 0; idx < ARRAY_SIZE(exynos_compat); idx++) {
-		if (of_device_is_compatible(host->dev->of_node,
-					exynos_compat[idx].compatible))
-			priv->ctrl_type = exynos_compat[idx].ctrl_type;
-	}
+	struct dw_mci_exynos_priv_data *priv = host->priv;
 
-	host->priv = priv;
 	return 0;
 }
 
@@ -177,12 +163,24 @@ static void dw_mci_exynos_set_ios(struct dw_mci *host, struct mmc_ios *ios)
 
 static int dw_mci_exynos_parse_dt(struct dw_mci *host)
 {
-	struct dw_mci_exynos_priv_data *priv = host->priv;
+	struct dw_mci_exynos_priv_data *priv;
 	struct device_node *np = host->dev->of_node;
 	u32 timing[2];
 	u32 div = 0;
+	int idx;
 	int ret;
 
+	priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv) {
+		dev_err(host->dev, "mem alloc failed for private data\n");
+		return -ENOMEM;
+	}
+
+	for (idx = 0; idx < ARRAY_SIZE(exynos_compat); idx++) {
+		if (of_device_is_compatible(np, exynos_compat[idx].compatible))
+			priv->ctrl_type = exynos_compat[idx].ctrl_type;
+	}
+
 	of_property_read_u32(np, "samsung,dw-mshc-ciu-div", &div);
 	priv->ciu_div = div;
 
@@ -199,6 +197,7 @@ static int dw_mci_exynos_parse_dt(struct dw_mci *host)
 		return ret;
 
 	priv->ddr_timing = SDMMC_CLKSEL_TIMING(timing[0], timing[1], div);
+	host->priv = priv;
 	return 0;
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [RFC V2 2/4] mmc: dw_mmc: socfpga: move socfpga private init
  2013-08-23 11:15 [RFC V2 0/4] dw_mmc platform specific private data init Yuvaraj Kumar C D
  2013-08-23 11:15 ` [RFC V2 1/4] mmc: dw_mmc: exynos: move the exynos private init Yuvaraj Kumar C D
@ 2013-08-23 11:15 ` Yuvaraj Kumar C D
  2013-08-23 11:15 ` [RFC V2 3/4] mmc: dw_mmc: move the platform specific init call Yuvaraj Kumar C D
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Yuvaraj Kumar C D @ 2013-08-23 11:15 UTC (permalink / raw)
  To: linux-mmc, linux-samsung-soc, cjb, jh80.chung, tgih.jun, alim.akhtar
  Cc: ks.giri, t.figa, Yuvaraj Kumar C D

Currently platform specific private data initialisation is done by
dw_mci_socfpga_priv_init and dw_mci_socfpga_parse_dt.As we already have
separate platform specific device tree parser dw_mci_socfpga_parse_dt,
move the dw_mci_socfpga_priv_init code to dw_mci_socfpga_parse_dt.
We can use the dw_mci_socfpga_priv_init to do some actual platform
specific initialisation.

This patch is compile tested only.

Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
---
 drivers/mmc/host/dw_mmc-socfpga.c |   29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-socfpga.c b/drivers/mmc/host/dw_mmc-socfpga.c
index 14b5961..953f260 100644
--- a/drivers/mmc/host/dw_mmc-socfpga.c
+++ b/drivers/mmc/host/dw_mmc-socfpga.c
@@ -38,20 +38,6 @@ struct dw_mci_socfpga_priv_data {
 
 static int dw_mci_socfpga_priv_init(struct dw_mci *host)
 {
-	struct dw_mci_socfpga_priv_data *priv;
-
-	priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv) {
-		dev_err(host->dev, "mem alloc failed for private data\n");
-		return -ENOMEM;
-	}
-
-	priv->sysreg = syscon_regmap_lookup_by_compatible("altr,sys-mgr");
-	if (IS_ERR(priv->sysreg)) {
-		dev_err(host->dev, "regmap for altr,sys-mgr lookup failed.\n");
-		return PTR_ERR(priv->sysreg);
-	}
-	host->priv = priv;
 
 	return 0;
 }
@@ -79,12 +65,24 @@ static void dw_mci_socfpga_prepare_command(struct dw_mci *host, u32 *cmdr)
 
 static int dw_mci_socfpga_parse_dt(struct dw_mci *host)
 {
-	struct dw_mci_socfpga_priv_data *priv = host->priv;
+	struct dw_mci_socfpga_priv_data *priv;
 	struct device_node *np = host->dev->of_node;
 	u32 timing[2];
 	u32 div = 0;
 	int ret;
 
+	priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv) {
+		dev_err(host->dev, "mem alloc failed for private data\n");
+		return -ENOMEM;
+	}
+
+	priv->sysreg = syscon_regmap_lookup_by_compatible("altr,sys-mgr");
+	if (IS_ERR(priv->sysreg)) {
+		dev_err(host->dev, "regmap for altr,sys-mgr lookup failed.\n");
+		return PTR_ERR(priv->sysreg);
+	}
+
 	ret = of_property_read_u32(np, "altr,dw-mshc-ciu-div", &div);
 	if (ret)
 		dev_info(host->dev, "No dw-mshc-ciu-div specified, assuming 1");
@@ -96,6 +94,7 @@ static int dw_mci_socfpga_parse_dt(struct dw_mci *host)
 		return ret;
 
 	priv->hs_timing = SYSMGR_SDMMC_CTRL_SET(timing[0], timing[1]);
+	host->priv = priv;
 	return 0;
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [RFC V2 3/4] mmc: dw_mmc: move the platform specific init call
  2013-08-23 11:15 [RFC V2 0/4] dw_mmc platform specific private data init Yuvaraj Kumar C D
  2013-08-23 11:15 ` [RFC V2 1/4] mmc: dw_mmc: exynos: move the exynos private init Yuvaraj Kumar C D
  2013-08-23 11:15 ` [RFC V2 2/4] mmc: dw_mmc: socfpga: move socfpga " Yuvaraj Kumar C D
@ 2013-08-23 11:15 ` Yuvaraj Kumar C D
  2013-08-23 13:45   ` Jaehoon Chung
  2013-08-23 11:15 ` [RFC V2 4/4] mmc: dw_mmc: exynos: add a quirk for SMU Yuvaraj Kumar C D
  2013-08-28  5:46 ` [RFC V2 0/4] dw_mmc platform specific private data init Alim Akhtar
  4 siblings, 1 reply; 13+ messages in thread
From: Yuvaraj Kumar C D @ 2013-08-23 11:15 UTC (permalink / raw)
  To: linux-mmc, linux-samsung-soc, cjb, jh80.chung, tgih.jun, alim.akhtar
  Cc: ks.giri, t.figa, Yuvaraj Kumar C D

Current platform specific private data initialisation call
dw_mci_exynos_priv_init can be used to do platform specific
initialisation of SMU and others in future.So the drv_data->init
call has moved to dw_mci_probe.

changes since V1: none

Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
---
 drivers/mmc/host/dw_mmc-pltfm.c |    7 -------
 drivers/mmc/host/dw_mmc.c       |    9 +++++++++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c
index ee52556..a570da4 100644
--- a/drivers/mmc/host/dw_mmc-pltfm.c
+++ b/drivers/mmc/host/dw_mmc-pltfm.c
@@ -38,7 +38,6 @@ int dw_mci_pltfm_register(struct platform_device *pdev,
 {
 	struct dw_mci *host;
 	struct resource	*regs;
-	int ret;
 
 	host = devm_kzalloc(&pdev->dev, sizeof(struct dw_mci), GFP_KERNEL);
 	if (!host)
@@ -58,12 +57,6 @@ int dw_mci_pltfm_register(struct platform_device *pdev,
 	if (IS_ERR(host->regs))
 		return PTR_ERR(host->regs);
 
-	if (drv_data && drv_data->init) {
-		ret = drv_data->init(host);
-		if (ret)
-			return ret;
-	}
-
 	platform_set_drvdata(pdev, host);
 	return dw_mci_probe(host);
 }
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index ee5f167..0c0cada 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2222,6 +2222,15 @@ int dw_mci_probe(struct dw_mci *host)
 		host->bus_hz = clk_get_rate(host->ciu_clk);
 	}
 
+	if (drv_data && drv_data->init) {
+		ret = drv_data->init(host);
+		if (ret) {
+			dev_err(host->dev,
+				"implementation specific init failed\n");
+			goto err_clk_ciu;
+		}
+	}
+
 	if (drv_data && drv_data->setup_clock) {
 		ret = drv_data->setup_clock(host);
 		if (ret) {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [RFC V2 4/4] mmc: dw_mmc: exynos: add a quirk for SMU.
  2013-08-23 11:15 [RFC V2 0/4] dw_mmc platform specific private data init Yuvaraj Kumar C D
                   ` (2 preceding siblings ...)
  2013-08-23 11:15 ` [RFC V2 3/4] mmc: dw_mmc: move the platform specific init call Yuvaraj Kumar C D
@ 2013-08-23 11:15 ` Yuvaraj Kumar C D
  2013-08-23 12:55   ` Jaehoon Chung
  2013-08-28  5:46 ` [RFC V2 0/4] dw_mmc platform specific private data init Alim Akhtar
  4 siblings, 1 reply; 13+ messages in thread
From: Yuvaraj Kumar C D @ 2013-08-23 11:15 UTC (permalink / raw)
  To: linux-mmc, linux-samsung-soc, cjb, jh80.chung, tgih.jun, alim.akhtar
  Cc: ks.giri, t.figa, Yuvaraj Kumar C D

Exynos5420 Mobile Storage Host controller has Security Management Unit
(SMU) for channel 0 and channel 1 (mainly for eMMC).This patch adds a
quirk to bypass SMU as it is not being used yet.

This patch is on top of the below patch by Doug Anderson.
mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT

changes since V1:
	1.avoid code duplication by calling dw_mci_exynos_priv_init in
	  resume path.

Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
---
 drivers/mmc/host/dw_mmc-exynos.c |   33 +++++++++++++++++++++++++++++++++
 drivers/mmc/host/dw_mmc.c        |    3 +++
 include/linux/mmc/dw_mmc.h       |    2 ++
 3 files changed, 38 insertions(+)

diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
index 19c845b..8e70fc6 100644
--- a/drivers/mmc/host/dw_mmc-exynos.c
+++ b/drivers/mmc/host/dw_mmc-exynos.c
@@ -35,6 +35,25 @@
 #define EXYNOS4210_FIXED_CIU_CLK_DIV	2
 #define EXYNOS4412_FIXED_CIU_CLK_DIV	4
 
+/* Block number in eMMC */
+#define DWMCI_BLOCK_NUM			0xFFFFFFFF
+
+#define SDMMC_EMMCP_BASE		0x1000
+#define SDMMC_MPSECURITY		(SDMMC_EMMCP_BASE + 0x0010)
+#define SDMMC_MPSBEGIN0			(SDMMC_EMMCP_BASE + 0x0200)
+#define SDMMC_MPSEND0			(SDMMC_EMMCP_BASE + 0x0204)
+#define SDMMC_MPSCTRL0			(SDMMC_EMMCP_BASE + 0x020C)
+
+/* SMU control bits */
+#define DWMCI_MPSCTRL_SECURE_READ_BIT		BIT(7)
+#define DWMCI_MPSCTRL_SECURE_WRITE_BIT		BIT(6)
+#define DWMCI_MPSCTRL_NON_SECURE_READ_BIT	BIT(5)
+#define DWMCI_MPSCTRL_NON_SECURE_WRITE_BIT	BIT(4)
+#define DWMCI_MPSCTRL_USE_FUSE_KEY		BIT(3)
+#define DWMCI_MPSCTRL_ECB_MODE			BIT(2)
+#define DWMCI_MPSCTRL_ENCRYPTION		BIT(1)
+#define DWMCI_MPSCTRL_VALID			BIT(0)
+
 /* Variations in Exynos specific dw-mshc controller */
 enum dw_mci_exynos_type {
 	DW_MCI_TYPE_EXYNOS4210,
@@ -74,6 +93,16 @@ static int dw_mci_exynos_priv_init(struct dw_mci *host)
 {
 	struct dw_mci_exynos_priv_data *priv = host->priv;
 
+	if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS5420 &&
+		host->pdata->quirks & DW_MCI_QUIRK_BYPASS_SMU) {
+		mci_writel(host, MPSBEGIN0, 0);
+		mci_writel(host, MPSEND0, DWMCI_BLOCK_NUM);
+		mci_writel(host, MPSCTRL0, DWMCI_MPSCTRL_SECURE_WRITE_BIT |
+			DWMCI_MPSCTRL_NON_SECURE_READ_BIT |
+			DWMCI_MPSCTRL_VALID |
+			DWMCI_MPSCTRL_NON_SECURE_WRITE_BIT);
+	}
+
 	return 0;
 }
 
@@ -106,7 +135,11 @@ static int dw_mci_exynos_suspend(struct device *dev)
 static int dw_mci_exynos_resume(struct device *dev)
 {
 	struct dw_mci *host = dev_get_drvdata(dev);
+	struct dw_mci_exynos_priv_data *priv = host->priv;
 
+	if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS5420 &&
+		host->pdata->quirks & DW_MCI_QUIRK_BYPASS_SMU)
+		dw_mci_exynos_priv_init(host);
 	return dw_mci_resume(host);
 }
 
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 0c0cada..49df69f 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2107,6 +2107,9 @@ static struct dw_mci_of_quirks {
 	}, {
 		.quirk	= "broken-cd",
 		.id	= DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
+	}, {
+		.quirk	= "bypass-smu",
+		.id	= DW_MCI_QUIRK_BYPASS_SMU,
 	},
 };
 
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 198f0fa..2d3f83f 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -209,6 +209,8 @@ struct dw_mci_dma_ops {
 #define DW_MCI_QUIRK_HIGHSPEED			BIT(2)
 /* Unreliable card detection */
 #define DW_MCI_QUIRK_BROKEN_CARD_DETECTION	BIT(3)
+/*Bypass the Security management unit*/
+#define DW_MCI_QUIRK_BYPASS_SMU			BIT(4)
 
 /* Slot level quirks */
 /* This slot has no write protect */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [RFC V2 4/4] mmc: dw_mmc: exynos: add a quirk for SMU.
  2013-08-23 11:15 ` [RFC V2 4/4] mmc: dw_mmc: exynos: add a quirk for SMU Yuvaraj Kumar C D
@ 2013-08-23 12:55   ` Jaehoon Chung
  2013-08-23 13:14     ` Yuvaraj Kumar
  0 siblings, 1 reply; 13+ messages in thread
From: Jaehoon Chung @ 2013-08-23 12:55 UTC (permalink / raw)
  To: Yuvaraj Kumar C D
  Cc: linux-mmc, linux-samsung-soc, cjb, tgih.jun, alim.akhtar,
	ks.giri, t.figa, Yuvaraj Kumar C D

Hi Yuvaraj,

Is there dependency with other patch?
I didn't see the defined "DW_MCI_TYPE_EXYNOS5420".
If i missed something, let me know.

Best Regards,
Jaehoon Chung

On 08/23/2013 08:15 PM, Yuvaraj Kumar C D wrote:
> Exynos5420 Mobile Storage Host controller has Security Management Unit
> (SMU) for channel 0 and channel 1 (mainly for eMMC).This patch adds a
> quirk to bypass SMU as it is not being used yet.
> 
> This patch is on top of the below patch by Doug Anderson.
> mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT
> 
> changes since V1:
> 	1.avoid code duplication by calling dw_mci_exynos_priv_init in
> 	  resume path.
> 
> Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc-exynos.c |   33 +++++++++++++++++++++++++++++++++
>  drivers/mmc/host/dw_mmc.c        |    3 +++
>  include/linux/mmc/dw_mmc.h       |    2 ++
>  3 files changed, 38 insertions(+)
> 
> diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
> index 19c845b..8e70fc6 100644
> --- a/drivers/mmc/host/dw_mmc-exynos.c
> +++ b/drivers/mmc/host/dw_mmc-exynos.c
> @@ -35,6 +35,25 @@
>  #define EXYNOS4210_FIXED_CIU_CLK_DIV	2
>  #define EXYNOS4412_FIXED_CIU_CLK_DIV	4
>  
> +/* Block number in eMMC */
> +#define DWMCI_BLOCK_NUM			0xFFFFFFFF
> +
> +#define SDMMC_EMMCP_BASE		0x1000
> +#define SDMMC_MPSECURITY		(SDMMC_EMMCP_BASE + 0x0010)
> +#define SDMMC_MPSBEGIN0			(SDMMC_EMMCP_BASE + 0x0200)
> +#define SDMMC_MPSEND0			(SDMMC_EMMCP_BASE + 0x0204)
> +#define SDMMC_MPSCTRL0			(SDMMC_EMMCP_BASE + 0x020C)
> +
> +/* SMU control bits */
> +#define DWMCI_MPSCTRL_SECURE_READ_BIT		BIT(7)
> +#define DWMCI_MPSCTRL_SECURE_WRITE_BIT		BIT(6)
> +#define DWMCI_MPSCTRL_NON_SECURE_READ_BIT	BIT(5)
> +#define DWMCI_MPSCTRL_NON_SECURE_WRITE_BIT	BIT(4)
> +#define DWMCI_MPSCTRL_USE_FUSE_KEY		BIT(3)
> +#define DWMCI_MPSCTRL_ECB_MODE			BIT(2)
> +#define DWMCI_MPSCTRL_ENCRYPTION		BIT(1)
> +#define DWMCI_MPSCTRL_VALID			BIT(0)
> +
>  /* Variations in Exynos specific dw-mshc controller */
>  enum dw_mci_exynos_type {
>  	DW_MCI_TYPE_EXYNOS4210,
> @@ -74,6 +93,16 @@ static int dw_mci_exynos_priv_init(struct dw_mci *host)
>  {
>  	struct dw_mci_exynos_priv_data *priv = host->priv;
>  
> +	if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS5420 &&
> +		host->pdata->quirks & DW_MCI_QUIRK_BYPASS_SMU) {
> +		mci_writel(host, MPSBEGIN0, 0);
> +		mci_writel(host, MPSEND0, DWMCI_BLOCK_NUM);
> +		mci_writel(host, MPSCTRL0, DWMCI_MPSCTRL_SECURE_WRITE_BIT |
> +			DWMCI_MPSCTRL_NON_SECURE_READ_BIT |
> +			DWMCI_MPSCTRL_VALID |
> +			DWMCI_MPSCTRL_NON_SECURE_WRITE_BIT);
> +	}
> +
>  	return 0;
>  }
>  
> @@ -106,7 +135,11 @@ static int dw_mci_exynos_suspend(struct device *dev)
>  static int dw_mci_exynos_resume(struct device *dev)
>  {
>  	struct dw_mci *host = dev_get_drvdata(dev);
> +	struct dw_mci_exynos_priv_data *priv = host->priv;
>  
> +	if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS5420 &&
> +		host->pdata->quirks & DW_MCI_QUIRK_BYPASS_SMU)
> +		dw_mci_exynos_priv_init(host);
>  	return dw_mci_resume(host);
>  }
>  
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 0c0cada..49df69f 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -2107,6 +2107,9 @@ static struct dw_mci_of_quirks {
>  	}, {
>  		.quirk	= "broken-cd",
>  		.id	= DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
> +	}, {
> +		.quirk	= "bypass-smu",
> +		.id	= DW_MCI_QUIRK_BYPASS_SMU,
>  	},
>  };
>  
> diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
> index 198f0fa..2d3f83f 100644
> --- a/include/linux/mmc/dw_mmc.h
> +++ b/include/linux/mmc/dw_mmc.h
> @@ -209,6 +209,8 @@ struct dw_mci_dma_ops {
>  #define DW_MCI_QUIRK_HIGHSPEED			BIT(2)
>  /* Unreliable card detection */
>  #define DW_MCI_QUIRK_BROKEN_CARD_DETECTION	BIT(3)
> +/*Bypass the Security management unit*/
> +#define DW_MCI_QUIRK_BYPASS_SMU			BIT(4)
>  
>  /* Slot level quirks */
>  /* This slot has no write protect */
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC V2 4/4] mmc: dw_mmc: exynos: add a quirk for SMU.
  2013-08-23 12:55   ` Jaehoon Chung
@ 2013-08-23 13:14     ` Yuvaraj Kumar
  0 siblings, 0 replies; 13+ messages in thread
From: Yuvaraj Kumar @ 2013-08-23 13:14 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: linux-mmc, linux-samsung-soc, Chris Ball, Seungwon Jeon,
	Alim Akhtar, ks.giri, Tomasz Figa, Yuvaraj Kumar C D

Hi Jaehoon,

Yes,Its depend on the below patch.
mmc: dw_mmc: exynos: Add a new compatible string for exynos5420
http://permalink.gmane.org/gmane.linux.kernel.mmc/21060

Best Regards
Yuvaraj

On Fri, Aug 23, 2013 at 6:25 PM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> Hi Yuvaraj,
>
> Is there dependency with other patch?
> I didn't see the defined "DW_MCI_TYPE_EXYNOS5420".
> If i missed something, let me know.
>
> Best Regards,
> Jaehoon Chung
>
> On 08/23/2013 08:15 PM, Yuvaraj Kumar C D wrote:
>> Exynos5420 Mobile Storage Host controller has Security Management Unit
>> (SMU) for channel 0 and channel 1 (mainly for eMMC).This patch adds a
>> quirk to bypass SMU as it is not being used yet.
>>
>> This patch is on top of the below patch by Doug Anderson.
>> mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT
>>
>> changes since V1:
>>       1.avoid code duplication by calling dw_mci_exynos_priv_init in
>>         resume path.
>>
>> Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
>> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
>> ---
>>  drivers/mmc/host/dw_mmc-exynos.c |   33 +++++++++++++++++++++++++++++++++
>>  drivers/mmc/host/dw_mmc.c        |    3 +++
>>  include/linux/mmc/dw_mmc.h       |    2 ++
>>  3 files changed, 38 insertions(+)
>>
>> diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
>> index 19c845b..8e70fc6 100644
>> --- a/drivers/mmc/host/dw_mmc-exynos.c
>> +++ b/drivers/mmc/host/dw_mmc-exynos.c
>> @@ -35,6 +35,25 @@
>>  #define EXYNOS4210_FIXED_CIU_CLK_DIV 2
>>  #define EXYNOS4412_FIXED_CIU_CLK_DIV 4
>>
>> +/* Block number in eMMC */
>> +#define DWMCI_BLOCK_NUM                      0xFFFFFFFF
>> +
>> +#define SDMMC_EMMCP_BASE             0x1000
>> +#define SDMMC_MPSECURITY             (SDMMC_EMMCP_BASE + 0x0010)
>> +#define SDMMC_MPSBEGIN0                      (SDMMC_EMMCP_BASE + 0x0200)
>> +#define SDMMC_MPSEND0                        (SDMMC_EMMCP_BASE + 0x0204)
>> +#define SDMMC_MPSCTRL0                       (SDMMC_EMMCP_BASE + 0x020C)
>> +
>> +/* SMU control bits */
>> +#define DWMCI_MPSCTRL_SECURE_READ_BIT                BIT(7)
>> +#define DWMCI_MPSCTRL_SECURE_WRITE_BIT               BIT(6)
>> +#define DWMCI_MPSCTRL_NON_SECURE_READ_BIT    BIT(5)
>> +#define DWMCI_MPSCTRL_NON_SECURE_WRITE_BIT   BIT(4)
>> +#define DWMCI_MPSCTRL_USE_FUSE_KEY           BIT(3)
>> +#define DWMCI_MPSCTRL_ECB_MODE                       BIT(2)
>> +#define DWMCI_MPSCTRL_ENCRYPTION             BIT(1)
>> +#define DWMCI_MPSCTRL_VALID                  BIT(0)
>> +
>>  /* Variations in Exynos specific dw-mshc controller */
>>  enum dw_mci_exynos_type {
>>       DW_MCI_TYPE_EXYNOS4210,
>> @@ -74,6 +93,16 @@ static int dw_mci_exynos_priv_init(struct dw_mci *host)
>>  {
>>       struct dw_mci_exynos_priv_data *priv = host->priv;
>>
>> +     if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS5420 &&
>> +             host->pdata->quirks & DW_MCI_QUIRK_BYPASS_SMU) {
>> +             mci_writel(host, MPSBEGIN0, 0);
>> +             mci_writel(host, MPSEND0, DWMCI_BLOCK_NUM);
>> +             mci_writel(host, MPSCTRL0, DWMCI_MPSCTRL_SECURE_WRITE_BIT |
>> +                     DWMCI_MPSCTRL_NON_SECURE_READ_BIT |
>> +                     DWMCI_MPSCTRL_VALID |
>> +                     DWMCI_MPSCTRL_NON_SECURE_WRITE_BIT);
>> +     }
>> +
>>       return 0;
>>  }
>>
>> @@ -106,7 +135,11 @@ static int dw_mci_exynos_suspend(struct device *dev)
>>  static int dw_mci_exynos_resume(struct device *dev)
>>  {
>>       struct dw_mci *host = dev_get_drvdata(dev);
>> +     struct dw_mci_exynos_priv_data *priv = host->priv;
>>
>> +     if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS5420 &&
>> +             host->pdata->quirks & DW_MCI_QUIRK_BYPASS_SMU)
>> +             dw_mci_exynos_priv_init(host);
>>       return dw_mci_resume(host);
>>  }
>>
>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
>> index 0c0cada..49df69f 100644
>> --- a/drivers/mmc/host/dw_mmc.c
>> +++ b/drivers/mmc/host/dw_mmc.c
>> @@ -2107,6 +2107,9 @@ static struct dw_mci_of_quirks {
>>       }, {
>>               .quirk  = "broken-cd",
>>               .id     = DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
>> +     }, {
>> +             .quirk  = "bypass-smu",
>> +             .id     = DW_MCI_QUIRK_BYPASS_SMU,
>>       },
>>  };
>>
>> diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
>> index 198f0fa..2d3f83f 100644
>> --- a/include/linux/mmc/dw_mmc.h
>> +++ b/include/linux/mmc/dw_mmc.h
>> @@ -209,6 +209,8 @@ struct dw_mci_dma_ops {
>>  #define DW_MCI_QUIRK_HIGHSPEED                       BIT(2)
>>  /* Unreliable card detection */
>>  #define DW_MCI_QUIRK_BROKEN_CARD_DETECTION   BIT(3)
>> +/*Bypass the Security management unit*/
>> +#define DW_MCI_QUIRK_BYPASS_SMU                      BIT(4)
>>
>>  /* Slot level quirks */
>>  /* This slot has no write protect */
>>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC V2 1/4] mmc: dw_mmc: exynos: move the exynos private init
  2013-08-23 11:15 ` [RFC V2 1/4] mmc: dw_mmc: exynos: move the exynos private init Yuvaraj Kumar C D
@ 2013-08-23 13:44   ` Jaehoon Chung
  2013-08-26  9:20     ` Yuvaraj Kumar
  0 siblings, 1 reply; 13+ messages in thread
From: Jaehoon Chung @ 2013-08-23 13:44 UTC (permalink / raw)
  To: Yuvaraj Kumar C D
  Cc: linux-mmc, linux-samsung-soc, cjb, tgih.jun, alim.akhtar,
	ks.giri, t.figa, Yuvaraj Kumar C D

Hi Yuvaraj,

On 08/23/2013 08:15 PM, Yuvaraj Kumar C D wrote:
> Currently platform specific private data initialisation is done by
> dw_mci_exynos_priv_init and dw_mci_exynos_parse_dt.As we already have
> separate platform specific device tree parser dw_mci_exynos_parse_dt,
> move the dw_mci_exynos_priv_init code to dw_mci_exynos_parse_dt.
> We can use the dw_mci_exynos_priv_init to do some actual platform
> specific initialisation of SMU and etc.
> 
> changes since V1: none
> 
> Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc-exynos.c |   31 +++++++++++++++----------------
>  1 file changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
> index 9990f98..19c845b 100644
> --- a/drivers/mmc/host/dw_mmc-exynos.c
> +++ b/drivers/mmc/host/dw_mmc-exynos.c
> @@ -72,22 +72,8 @@ static struct dw_mci_exynos_compatible {
>  
>  static int dw_mci_exynos_priv_init(struct dw_mci *host)
>  {
> -	struct dw_mci_exynos_priv_data *priv;
> -	int idx;
> -
> -	priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
> -	if (!priv) {
> -		dev_err(host->dev, "mem alloc failed for private data\n");
> -		return -ENOMEM;
> -	}
> -
> -	for (idx = 0; idx < ARRAY_SIZE(exynos_compat); idx++) {
> -		if (of_device_is_compatible(host->dev->of_node,
> -					exynos_compat[idx].compatible))
> -			priv->ctrl_type = exynos_compat[idx].ctrl_type;
> -	}
> +	struct dw_mci_exynos_priv_data *priv = host->priv;
>  
> -	host->priv = priv;
>  	return 0;
>  }
>  
> @@ -177,12 +163,24 @@ static void dw_mci_exynos_set_ios(struct dw_mci *host, struct mmc_ios *ios)
>  
>  static int dw_mci_exynos_parse_dt(struct dw_mci *host)
>  {
> -	struct dw_mci_exynos_priv_data *priv = host->priv;
> +	struct dw_mci_exynos_priv_data *priv;
>  	struct device_node *np = host->dev->of_node;
>  	u32 timing[2];
>  	u32 div = 0;
> +	int idx;
>  	int ret;
>  
> +	priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv) {
> +		dev_err(host->dev, "mem alloc failed for private data\n");
> +		return -ENOMEM;
> +	}
> +
> +	for (idx = 0; idx < ARRAY_SIZE(exynos_compat); idx++) {
> +		if (of_device_is_compatible(np, exynos_compat[idx].compatible))
> +			priv->ctrl_type = exynos_compat[idx].ctrl_type;
> +	}
> +
>  	of_property_read_u32(np, "samsung,dw-mshc-ciu-div", &div);
>  	priv->ciu_div = div;
>  
> @@ -199,6 +197,7 @@ static int dw_mci_exynos_parse_dt(struct dw_mci *host)
>  		return ret;
>  
>  	priv->ddr_timing = SDMMC_CLKSEL_TIMING(timing[0], timing[1], div);
> +	host->priv = priv;

I'm not sure whether my thinking is right or not.
if host->pdata is present, then dw_mci_parse_dt() didn't called at dw_mci_probe.
then how host->priv set to priv?

Best Regards,
Jaehoon Chung

>  	return 0;
>  }
>  
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC V2 3/4] mmc: dw_mmc: move the platform specific init call
  2013-08-23 11:15 ` [RFC V2 3/4] mmc: dw_mmc: move the platform specific init call Yuvaraj Kumar C D
@ 2013-08-23 13:45   ` Jaehoon Chung
  0 siblings, 0 replies; 13+ messages in thread
From: Jaehoon Chung @ 2013-08-23 13:45 UTC (permalink / raw)
  To: Yuvaraj Kumar C D
  Cc: linux-mmc, linux-samsung-soc, cjb, tgih.jun, alim.akhtar,
	ks.giri, t.figa, Yuvaraj Kumar C D

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

On 08/23/2013 08:15 PM, Yuvaraj Kumar C D wrote:
> Current platform specific private data initialisation call
> dw_mci_exynos_priv_init can be used to do platform specific
> initialisation of SMU and others in future.So the drv_data->init
> call has moved to dw_mci_probe.
> 
> changes since V1: none
> 
> Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc-pltfm.c |    7 -------
>  drivers/mmc/host/dw_mmc.c       |    9 +++++++++
>  2 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c
> index ee52556..a570da4 100644
> --- a/drivers/mmc/host/dw_mmc-pltfm.c
> +++ b/drivers/mmc/host/dw_mmc-pltfm.c
> @@ -38,7 +38,6 @@ int dw_mci_pltfm_register(struct platform_device *pdev,
>  {
>  	struct dw_mci *host;
>  	struct resource	*regs;
> -	int ret;
>  
>  	host = devm_kzalloc(&pdev->dev, sizeof(struct dw_mci), GFP_KERNEL);
>  	if (!host)
> @@ -58,12 +57,6 @@ int dw_mci_pltfm_register(struct platform_device *pdev,
>  	if (IS_ERR(host->regs))
>  		return PTR_ERR(host->regs);
>  
> -	if (drv_data && drv_data->init) {
> -		ret = drv_data->init(host);
> -		if (ret)
> -			return ret;
> -	}
> -
>  	platform_set_drvdata(pdev, host);
>  	return dw_mci_probe(host);
>  }
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index ee5f167..0c0cada 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -2222,6 +2222,15 @@ int dw_mci_probe(struct dw_mci *host)
>  		host->bus_hz = clk_get_rate(host->ciu_clk);
>  	}
>  
> +	if (drv_data && drv_data->init) {
> +		ret = drv_data->init(host);
> +		if (ret) {
> +			dev_err(host->dev,
> +				"implementation specific init failed\n");
> +			goto err_clk_ciu;
> +		}
> +	}
> +
>  	if (drv_data && drv_data->setup_clock) {
>  		ret = drv_data->setup_clock(host);
>  		if (ret) {
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC V2 1/4] mmc: dw_mmc: exynos: move the exynos private init
  2013-08-23 13:44   ` Jaehoon Chung
@ 2013-08-26  9:20     ` Yuvaraj Kumar
  2013-08-27  2:34       ` Jaehoon Chung
  0 siblings, 1 reply; 13+ messages in thread
From: Yuvaraj Kumar @ 2013-08-26  9:20 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: linux-mmc, linux-samsung-soc, Chris Ball, Seungwon Jeon,
	Alim Akhtar, ks.giri, Tomasz Figa, Yuvaraj Kumar C D, thomas.ab

On Fri, Aug 23, 2013 at 7:14 PM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> Hi Yuvaraj,
>
> On 08/23/2013 08:15 PM, Yuvaraj Kumar C D wrote:
>> Currently platform specific private data initialisation is done by
>> dw_mci_exynos_priv_init and dw_mci_exynos_parse_dt.As we already have
>> separate platform specific device tree parser dw_mci_exynos_parse_dt,
>> move the dw_mci_exynos_priv_init code to dw_mci_exynos_parse_dt.
>> We can use the dw_mci_exynos_priv_init to do some actual platform
>> specific initialisation of SMU and etc.
>>
>> changes since V1: none
>>
>> Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
>> ---
>>  drivers/mmc/host/dw_mmc-exynos.c |   31 +++++++++++++++----------------
>>  1 file changed, 15 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
>> index 9990f98..19c845b 100644
>> --- a/drivers/mmc/host/dw_mmc-exynos.c
>> +++ b/drivers/mmc/host/dw_mmc-exynos.c
>> @@ -72,22 +72,8 @@ static struct dw_mci_exynos_compatible {
>>
>>  static int dw_mci_exynos_priv_init(struct dw_mci *host)
>>  {
>> -     struct dw_mci_exynos_priv_data *priv;
>> -     int idx;
>> -
>> -     priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
>> -     if (!priv) {
>> -             dev_err(host->dev, "mem alloc failed for private data\n");
>> -             return -ENOMEM;
>> -     }
>> -
>> -     for (idx = 0; idx < ARRAY_SIZE(exynos_compat); idx++) {
>> -             if (of_device_is_compatible(host->dev->of_node,
>> -                                     exynos_compat[idx].compatible))
>> -                     priv->ctrl_type = exynos_compat[idx].ctrl_type;
>> -     }
>> +     struct dw_mci_exynos_priv_data *priv = host->priv;
>>
>> -     host->priv = priv;
>>       return 0;
>>  }
>>
>> @@ -177,12 +163,24 @@ static void dw_mci_exynos_set_ios(struct dw_mci *host, struct mmc_ios *ios)
>>
>>  static int dw_mci_exynos_parse_dt(struct dw_mci *host)
>>  {
>> -     struct dw_mci_exynos_priv_data *priv = host->priv;
>> +     struct dw_mci_exynos_priv_data *priv;
>>       struct device_node *np = host->dev->of_node;
>>       u32 timing[2];
>>       u32 div = 0;
>> +     int idx;
>>       int ret;
>>
>> +     priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
>> +     if (!priv) {
>> +             dev_err(host->dev, "mem alloc failed for private data\n");
>> +             return -ENOMEM;
>> +     }
>> +
>> +     for (idx = 0; idx < ARRAY_SIZE(exynos_compat); idx++) {
>> +             if (of_device_is_compatible(np, exynos_compat[idx].compatible))
>> +                     priv->ctrl_type = exynos_compat[idx].ctrl_type;
>> +     }
>> +
>>       of_property_read_u32(np, "samsung,dw-mshc-ciu-div", &div);
>>       priv->ciu_div = div;
>>
>> @@ -199,6 +197,7 @@ static int dw_mci_exynos_parse_dt(struct dw_mci *host)
>>               return ret;
>>
>>       priv->ddr_timing = SDMMC_CLKSEL_TIMING(timing[0], timing[1], div);
>> +     host->priv = priv;
>
> I'm not sure whether my thinking is right or not.
> if host->pdata is present, then dw_mci_parse_dt() didn't called at dw_mci_probe.
Yes, you are right.
> then how host->priv set to priv?
Earlier host->priv set to priv in both non-DT and DT case.True, with
this patch it does it only in DT case.
Is there any platform/board which still uses dw_mmc and its platform
extension driver with non DT case?
I found a reference of non-DT case where host->pdata is present in
dw_mmc-pci.c driver but does not
use platform extension driver (exynos/socfpga).
>
> Best Regards,
> Jaehoon Chung
>
>>       return 0;
>>  }
>>
>>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC V2 1/4] mmc: dw_mmc: exynos: move the exynos private init
  2013-08-26  9:20     ` Yuvaraj Kumar
@ 2013-08-27  2:34       ` Jaehoon Chung
  2013-08-27  6:03         ` Yuvaraj Kumar
  0 siblings, 1 reply; 13+ messages in thread
From: Jaehoon Chung @ 2013-08-27  2:34 UTC (permalink / raw)
  To: Yuvaraj Kumar
  Cc: Jaehoon Chung, linux-mmc, linux-samsung-soc, Chris Ball,
	Seungwon Jeon, Alim Akhtar, ks.giri, Tomasz Figa,
	Yuvaraj Kumar C D, thomas.ab

Dear Yuvaraj,

On 08/26/2013 06:20 PM, Yuvaraj Kumar wrote:
> On Fri, Aug 23, 2013 at 7:14 PM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> Hi Yuvaraj,
>>
>> On 08/23/2013 08:15 PM, Yuvaraj Kumar C D wrote:
>>> Currently platform specific private data initialisation is done by
>>> dw_mci_exynos_priv_init and dw_mci_exynos_parse_dt.As we already have
>>> separate platform specific device tree parser dw_mci_exynos_parse_dt,
>>> move the dw_mci_exynos_priv_init code to dw_mci_exynos_parse_dt.
>>> We can use the dw_mci_exynos_priv_init to do some actual platform
>>> specific initialisation of SMU and etc.
>>>
>>> changes since V1: none
>>>
>>> Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
>>> ---
>>>  drivers/mmc/host/dw_mmc-exynos.c |   31 +++++++++++++++----------------
>>>  1 file changed, 15 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
>>> index 9990f98..19c845b 100644
>>> --- a/drivers/mmc/host/dw_mmc-exynos.c
>>> +++ b/drivers/mmc/host/dw_mmc-exynos.c
>>> @@ -72,22 +72,8 @@ static struct dw_mci_exynos_compatible {
>>>
>>>  static int dw_mci_exynos_priv_init(struct dw_mci *host)
>>>  {
>>> -     struct dw_mci_exynos_priv_data *priv;
>>> -     int idx;
>>> -
>>> -     priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
>>> -     if (!priv) {
>>> -             dev_err(host->dev, "mem alloc failed for private data\n");
>>> -             return -ENOMEM;
>>> -     }
>>> -
>>> -     for (idx = 0; idx < ARRAY_SIZE(exynos_compat); idx++) {
>>> -             if (of_device_is_compatible(host->dev->of_node,
>>> -                                     exynos_compat[idx].compatible))
>>> -                     priv->ctrl_type = exynos_compat[idx].ctrl_type;
>>> -     }
>>> +     struct dw_mci_exynos_priv_data *priv = host->priv;
>>>
>>> -     host->priv = priv;
>>>       return 0;
>>>  }
>>>
>>> @@ -177,12 +163,24 @@ static void dw_mci_exynos_set_ios(struct dw_mci *host, struct mmc_ios *ios)
>>>
>>>  static int dw_mci_exynos_parse_dt(struct dw_mci *host)
>>>  {
>>> -     struct dw_mci_exynos_priv_data *priv = host->priv;
>>> +     struct dw_mci_exynos_priv_data *priv;
>>>       struct device_node *np = host->dev->of_node;
>>>       u32 timing[2];
>>>       u32 div = 0;
>>> +     int idx;
>>>       int ret;
>>>
>>> +     priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
>>> +     if (!priv) {
>>> +             dev_err(host->dev, "mem alloc failed for private data\n");
>>> +             return -ENOMEM;
>>> +     }
>>> +
>>> +     for (idx = 0; idx < ARRAY_SIZE(exynos_compat); idx++) {
>>> +             if (of_device_is_compatible(np, exynos_compat[idx].compatible))
>>> +                     priv->ctrl_type = exynos_compat[idx].ctrl_type;
>>> +     }
>>> +
>>>       of_property_read_u32(np, "samsung,dw-mshc-ciu-div", &div);
>>>       priv->ciu_div = div;
>>>
>>> @@ -199,6 +197,7 @@ static int dw_mci_exynos_parse_dt(struct dw_mci *host)
>>>               return ret;
>>>
>>>       priv->ddr_timing = SDMMC_CLKSEL_TIMING(timing[0], timing[1], div);
>>> +     host->priv = priv;
>>
>> I'm not sure whether my thinking is right or not.
>> if host->pdata is present, then dw_mci_parse_dt() didn't called at dw_mci_probe.
> Yes, you are right.
>> then how host->priv set to priv?
> Earlier host->priv set to priv in both non-DT and DT case.True, with
> this patch it does it only in DT case.
> Is there any platform/board which still uses dw_mmc and its platform
> extension driver with non DT case?
You're right. i didn't see the extension driver with non DT-case?
Then we can also modify the host->pdata into dw_mci_probe().

Best Regards,
Jaehoon Chung
> I found a reference of non-DT case where host->pdata is present in
> dw_mmc-pci.c driver but does not
> use platform extension driver (exynos/socfpga).
>>
>> Best Regards,
>> Jaehoon Chung
>>
>>>       return 0;
>>>  }
>>>
>>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC V2 1/4] mmc: dw_mmc: exynos: move the exynos private init
  2013-08-27  2:34       ` Jaehoon Chung
@ 2013-08-27  6:03         ` Yuvaraj Kumar
  0 siblings, 0 replies; 13+ messages in thread
From: Yuvaraj Kumar @ 2013-08-27  6:03 UTC (permalink / raw)
  To: Jaehoon Chung, shashidharh
  Cc: linux-mmc, linux-samsung-soc, Chris Ball, Seungwon Jeon,
	Alim Akhtar, ks.giri, Tomasz Figa, Yuvaraj Kumar C D, thomas.ab

On Tue, Aug 27, 2013 at 8:04 AM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> Dear Yuvaraj,
>
> On 08/26/2013 06:20 PM, Yuvaraj Kumar wrote:
>> On Fri, Aug 23, 2013 at 7:14 PM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>>> Hi Yuvaraj,
>>>
>>> On 08/23/2013 08:15 PM, Yuvaraj Kumar C D wrote:
>>>> Currently platform specific private data initialisation is done by
>>>> dw_mci_exynos_priv_init and dw_mci_exynos_parse_dt.As we already have
>>>> separate platform specific device tree parser dw_mci_exynos_parse_dt,
>>>> move the dw_mci_exynos_priv_init code to dw_mci_exynos_parse_dt.
>>>> We can use the dw_mci_exynos_priv_init to do some actual platform
>>>> specific initialisation of SMU and etc.
>>>>
>>>> changes since V1: none
>>>>
>>>> Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
>>>> ---
>>>>  drivers/mmc/host/dw_mmc-exynos.c |   31 +++++++++++++++----------------
>>>>  1 file changed, 15 insertions(+), 16 deletions(-)
>>>>
>>>> diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
>>>> index 9990f98..19c845b 100644
>>>> --- a/drivers/mmc/host/dw_mmc-exynos.c
>>>> +++ b/drivers/mmc/host/dw_mmc-exynos.c
>>>> @@ -72,22 +72,8 @@ static struct dw_mci_exynos_compatible {
>>>>
>>>>  static int dw_mci_exynos_priv_init(struct dw_mci *host)
>>>>  {
>>>> -     struct dw_mci_exynos_priv_data *priv;
>>>> -     int idx;
>>>> -
>>>> -     priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
>>>> -     if (!priv) {
>>>> -             dev_err(host->dev, "mem alloc failed for private data\n");
>>>> -             return -ENOMEM;
>>>> -     }
>>>> -
>>>> -     for (idx = 0; idx < ARRAY_SIZE(exynos_compat); idx++) {
>>>> -             if (of_device_is_compatible(host->dev->of_node,
>>>> -                                     exynos_compat[idx].compatible))
>>>> -                     priv->ctrl_type = exynos_compat[idx].ctrl_type;
>>>> -     }
>>>> +     struct dw_mci_exynos_priv_data *priv = host->priv;
>>>>
>>>> -     host->priv = priv;
>>>>       return 0;
>>>>  }
>>>>
>>>> @@ -177,12 +163,24 @@ static void dw_mci_exynos_set_ios(struct dw_mci *host, struct mmc_ios *ios)
>>>>
>>>>  static int dw_mci_exynos_parse_dt(struct dw_mci *host)
>>>>  {
>>>> -     struct dw_mci_exynos_priv_data *priv = host->priv;
>>>> +     struct dw_mci_exynos_priv_data *priv;
>>>>       struct device_node *np = host->dev->of_node;
>>>>       u32 timing[2];
>>>>       u32 div = 0;
>>>> +     int idx;
>>>>       int ret;
>>>>
>>>> +     priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
>>>> +     if (!priv) {
>>>> +             dev_err(host->dev, "mem alloc failed for private data\n");
>>>> +             return -ENOMEM;
>>>> +     }
>>>> +
>>>> +     for (idx = 0; idx < ARRAY_SIZE(exynos_compat); idx++) {
>>>> +             if (of_device_is_compatible(np, exynos_compat[idx].compatible))
>>>> +                     priv->ctrl_type = exynos_compat[idx].ctrl_type;
>>>> +     }
>>>> +
>>>>       of_property_read_u32(np, "samsung,dw-mshc-ciu-div", &div);
>>>>       priv->ciu_div = div;
>>>>
>>>> @@ -199,6 +197,7 @@ static int dw_mci_exynos_parse_dt(struct dw_mci *host)
>>>>               return ret;
>>>>
>>>>       priv->ddr_timing = SDMMC_CLKSEL_TIMING(timing[0], timing[1], div);
>>>> +     host->priv = priv;
>>>
>>> I'm not sure whether my thinking is right or not.
>>> if host->pdata is present, then dw_mci_parse_dt() didn't called at dw_mci_probe.
>> Yes, you are right.
>>> then how host->priv set to priv?
>> Earlier host->priv set to priv in both non-DT and DT case.True, with
>> this patch it does it only in DT case.
>> Is there any platform/board which still uses dw_mmc and its platform
>> extension driver with non DT case?
> You're right. i didn't see the extension driver with non DT-case?
> Then we can also modify the host->pdata into dw_mci_probe().
I think its not necessary becuase dw_mmc-pci.c driver calls
dw_mci_probe with host->pdata NOT NULL.
Only dwmmc platform extension driver (exynos/socfpga) which are
basically DT based uses host->priv .
>
> Best Regards,
> Jaehoon Chung
>> I found a reference of non-DT case where host->pdata is present in
>> dw_mmc-pci.c driver but does not
>> use platform extension driver (exynos/socfpga).
>>>
>>> Best Regards,
>>> Jaehoon Chung
>>>
>>>>       return 0;
>>>>  }
>>>>
>>>>
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC V2 0/4] dw_mmc platform specific private data init
  2013-08-23 11:15 [RFC V2 0/4] dw_mmc platform specific private data init Yuvaraj Kumar C D
                   ` (3 preceding siblings ...)
  2013-08-23 11:15 ` [RFC V2 4/4] mmc: dw_mmc: exynos: add a quirk for SMU Yuvaraj Kumar C D
@ 2013-08-28  5:46 ` Alim Akhtar
  4 siblings, 0 replies; 13+ messages in thread
From: Alim Akhtar @ 2013-08-28  5:46 UTC (permalink / raw)
  To: Yuvaraj Kumar C D
  Cc: linux-mmc, linux-samsung-soc, Chris Ball, Jaehoon Chung,
	Seungwon Jeon, Alim Akhtar, Girish K S, t.figa,
	Yuvaraj Kumar C D

Hi Yuvaraj

On Fri, Aug 23, 2013 at 4:45 PM, Yuvaraj Kumar C D <yuvaraj.cd@gmail.com> wrote:
> changes from V1:
>         1.Added a new RFC patch
>                 mmc: dw_mmc: socfpga: move socfpga private init
>         2.Avoid code duplication in
>                 mmc: dw_mmc: exynos: add a quirk for SMU.
>
> Yuvaraj Kumar C D (4):
>   mmc: dw_mmc: exynos: move the exynos private init
>   mmc: dw_mmc: socfpga: move socfpga private init
>   mmc: dw_mmc: move the platform specific init call
>   mmc: dw_mmc: exynos: add a quirk for SMU.
>
>  drivers/mmc/host/dw_mmc-exynos.c  |   60 ++++++++++++++++++++++++++++---------
>  drivers/mmc/host/dw_mmc-pltfm.c   |    7 -----
>  drivers/mmc/host/dw_mmc-socfpga.c |   29 +++++++++---------
>  drivers/mmc/host/dw_mmc.c         |   12 ++++++++
>  include/linux/mmc/dw_mmc.h        |    2 ++
>  5 files changed, 74 insertions(+), 36 deletions(-)

Tested this serise on exynos5420.
Tested-by: Alim Akhtar <alim.akhtar@samsung.com>

>
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Regards,
Alim

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-08-28  5:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-23 11:15 [RFC V2 0/4] dw_mmc platform specific private data init Yuvaraj Kumar C D
2013-08-23 11:15 ` [RFC V2 1/4] mmc: dw_mmc: exynos: move the exynos private init Yuvaraj Kumar C D
2013-08-23 13:44   ` Jaehoon Chung
2013-08-26  9:20     ` Yuvaraj Kumar
2013-08-27  2:34       ` Jaehoon Chung
2013-08-27  6:03         ` Yuvaraj Kumar
2013-08-23 11:15 ` [RFC V2 2/4] mmc: dw_mmc: socfpga: move socfpga " Yuvaraj Kumar C D
2013-08-23 11:15 ` [RFC V2 3/4] mmc: dw_mmc: move the platform specific init call Yuvaraj Kumar C D
2013-08-23 13:45   ` Jaehoon Chung
2013-08-23 11:15 ` [RFC V2 4/4] mmc: dw_mmc: exynos: add a quirk for SMU Yuvaraj Kumar C D
2013-08-23 12:55   ` Jaehoon Chung
2013-08-23 13:14     ` Yuvaraj Kumar
2013-08-28  5:46 ` [RFC V2 0/4] dw_mmc platform specific private data init Alim Akhtar

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.