All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc: s5p_sdhci: support the Driver model for Exynos
@ 2016-07-21 12:30 ` Jaehoon Chung
  2016-08-01  2:21   ` Simon Glass
  2016-08-04  0:38   ` Minkyu Kang
  0 siblings, 2 replies; 4+ messages in thread
From: Jaehoon Chung @ 2016-07-21 12:30 UTC (permalink / raw)
  To: u-boot

This patch support the driver model for s5p_sdhci controller.
To support the legacy model, maintained the existing code.

Note: If use the Driver Model, it needs to modify the device-tree.
In future, will update the Device-tree and enable the configuratioin.
(CONFIG_BLK, CONFIG_DM_MMC and CONFING_DM_MMC_OPS)

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/s5p_sdhci.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index 44353c7..8f5fa99 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -16,6 +16,16 @@
 #include <errno.h>
 #include <asm/arch/pinmux.h>
 
+#ifdef CONFIG_DM_MMC
+#include <dm.h>
+struct s5p_sdhci_plat {
+	struct mmc_config cfg;
+	struct mmc mmc;
+};
+
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
 static char *S5P_NAME = "SAMSUNG SDHCI";
 static void s5p_sdhci_set_control_reg(struct sdhci_host *host)
 {
@@ -79,7 +89,11 @@ static int s5p_sdhci_core_init(struct sdhci_host *host)
 	if (host->bus_width == 8)
 		host->host_caps |= MMC_MODE_8BIT;
 
+#ifndef CONFIG_BLK
 	return add_sdhci(host, 52000000, 400000);
+#else
+	return 0;
+#endif
 }
 
 int s5p_sdhci_init(u32 regbase, int index, int bus_width)
@@ -215,3 +229,62 @@ int exynos_mmc_init(const void *blob)
 	return process_nodes(blob, node_list, count);
 }
 #endif
+
+#ifdef CONFIG_DM_MMC
+static int s5p_sdhci_probe(struct udevice *dev)
+{
+	struct s5p_sdhci_plat *plat = dev_get_platdata(dev);
+	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+	struct sdhci_host *host = dev_get_priv(dev);
+	u32 caps;
+	int ret;
+
+	ret = sdhci_get_config(gd->fdt_blob, dev->of_offset, host);
+	if (ret)
+		return ret;
+
+	ret = do_sdhci_init(host);
+	if (ret)
+		return ret;
+
+	caps = sdhci_readl(host, SDHCI_CAPABILITIES);
+	sdhci_setup_cfg(&plat->cfg, host->name, host->bus_width, caps,
+			52000000, 400000, host->version, host->quirks,
+			host->host_caps);
+
+	host->mmc = &plat->mmc;
+	host->mmc->priv = host;
+	host->mmc->dev = dev;
+	upriv->mmc = host->mmc;
+
+	return sdhci_probe(dev);
+}
+
+static int s5p_sdhci_bind(struct udevice *dev)
+{
+	struct s5p_sdhci_plat *plat = dev_get_platdata(dev);
+	int ret;
+
+	ret = sdhci_bind(dev, &plat->mmc, &plat->cfg);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static const struct udevice_id s5p_sdhci_ids[] = {
+	{ .compatible = "samsung,exynos4412-sdhci"},
+	{ }
+};
+
+U_BOOT_DRIVER(s5p_sdhci_drv) = {
+	.name		= "s5p_sdhci",
+	.id		= UCLASS_MMC,
+	.of_match	= s5p_sdhci_ids,
+	.bind		= s5p_sdhci_bind,
+	.ops		= &sdhci_ops,
+	.probe		= s5p_sdhci_probe,
+	.priv_auto_alloc_size = sizeof(struct sdhci_host),
+	.platdata_auto_alloc_size = sizeof(struct s5p_sdhci_plat),
+};
+#endif /* CONFIG_DM_MMC */
-- 
1.9.1

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

* [U-Boot] [PATCH] mmc: s5p_sdhci: support the Driver model for Exynos
  2016-07-21 12:30 ` [U-Boot] [PATCH] mmc: s5p_sdhci: support the Driver model for Exynos Jaehoon Chung
@ 2016-08-01  2:21   ` Simon Glass
  2016-08-04  0:38   ` Minkyu Kang
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Glass @ 2016-08-01  2:21 UTC (permalink / raw)
  To: u-boot

On 21 July 2016 at 06:30, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> This patch support the driver model for s5p_sdhci controller.
> To support the legacy model, maintained the existing code.
>
> Note: If use the Driver Model, it needs to modify the device-tree.
> In future, will update the Device-tree and enable the configuratioin.
> (CONFIG_BLK, CONFIG_DM_MMC and CONFING_DM_MMC_OPS)
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/s5p_sdhci.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 73 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH] mmc: s5p_sdhci: support the Driver model for Exynos
  2016-07-21 12:30 ` [U-Boot] [PATCH] mmc: s5p_sdhci: support the Driver model for Exynos Jaehoon Chung
  2016-08-01  2:21   ` Simon Glass
@ 2016-08-04  0:38   ` Minkyu Kang
  2016-08-04  1:00     ` Jaehoon Chung
  1 sibling, 1 reply; 4+ messages in thread
From: Minkyu Kang @ 2016-08-04  0:38 UTC (permalink / raw)
  To: u-boot

On 21/07/16 21:30, Jaehoon Chung wrote:
> This patch support the driver model for s5p_sdhci controller.
> To support the legacy model, maintained the existing code.
> 
> Note: If use the Driver Model, it needs to modify the device-tree.
> In future, will update the Device-tree and enable the configuratioin.
> (CONFIG_BLK, CONFIG_DM_MMC and CONFING_DM_MMC_OPS)
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/s5p_sdhci.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 73 insertions(+)
> 

Because this patch has dependency with your patch, I delegate this patch to you.

Acked-by: Minkyu Kang <mk7.kang@samsung.com>

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH] mmc: s5p_sdhci: support the Driver model for Exynos
  2016-08-04  0:38   ` Minkyu Kang
@ 2016-08-04  1:00     ` Jaehoon Chung
  0 siblings, 0 replies; 4+ messages in thread
From: Jaehoon Chung @ 2016-08-04  1:00 UTC (permalink / raw)
  To: u-boot

Hi, 

On 08/04/2016 09:38 AM, Minkyu Kang wrote:
> On 21/07/16 21:30, Jaehoon Chung wrote:
>> This patch support the driver model for s5p_sdhci controller.
>> To support the legacy model, maintained the existing code.
>>
>> Note: If use the Driver Model, it needs to modify the device-tree.
>> In future, will update the Device-tree and enable the configuratioin.
>> (CONFIG_BLK, CONFIG_DM_MMC and CONFING_DM_MMC_OPS)
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>>  drivers/mmc/s5p_sdhci.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 73 insertions(+)
>>
> 
> Because this patch has dependency with your patch, I delegate this patch to you.

I will rebase this patch, and send the patch v2.
At that time, i will add with your acked-by and Simon's reviewd-by tags.

Best Regards,
Jaehoon Chung

> 
> Acked-by: Minkyu Kang <mk7.kang@samsung.com>
> 
> Thanks,
> Minkyu Kang.
> 
> 
> 

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

end of thread, other threads:[~2016-08-04  1:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20160721123041epcas1p1185613fcce2efcb4296ed450b0132188@epcas1p1.samsung.com>
2016-07-21 12:30 ` [U-Boot] [PATCH] mmc: s5p_sdhci: support the Driver model for Exynos Jaehoon Chung
2016-08-01  2:21   ` Simon Glass
2016-08-04  0:38   ` Minkyu Kang
2016-08-04  1:00     ` Jaehoon Chung

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.