aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorDinh Nguyen <dinguyen@altera.com>2014-02-17 21:31:00 -0500
committerChris Ball <chris@printf.net>2014-02-26 21:29:57 -0500
commit47a1f522d7ff5105c7efa56fe7fd41d46202f8cc (patch)
tree0ed6f219df4fd9774952abd97965e77dafb04bab /drivers/mmc
parent17c8bc85f27227e073ed8e59da39ff32f1bee873 (diff)
mmc: dw_mmc-socfpga: Remove the SOCFPGA specific platform for dw_mmc
It turns now that the only really platform specific code that is needed for SOCFPGA is using the SDMMC_CMD_USE_HOLD_REG in the prepare_command function. Since the Rockchip already has this functionality, re-use the code that is already in dw_mmc-pltfm.c. Signed-off-by: Dinh Nguyen <dinguyen@altera.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Tested-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Acked-by: Seungwon Jeon <tgih.jun@samsung.com> Signed-off-by: Chris Ball <chris@printf.net>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/Kconfig8
-rw-r--r--drivers/mmc/host/Makefile1
-rw-r--r--drivers/mmc/host/dw_mmc-socfpga.c138
3 files changed, 0 insertions, 147 deletions
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 1384f67abe21..82cc34df1af7 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -580,14 +580,6 @@ config MMC_DW_EXYNOS
580 Synopsys DesignWare Memory Card Interface driver. Select this option 580 Synopsys DesignWare Memory Card Interface driver. Select this option
581 for platforms based on Exynos4 and Exynos5 SoC's. 581 for platforms based on Exynos4 and Exynos5 SoC's.
582 582
583config MMC_DW_SOCFPGA
584 tristate "SOCFPGA specific extensions for Synopsys DW Memory Card Interface"
585 depends on MMC_DW && MFD_SYSCON
586 select MMC_DW_PLTFM
587 help
588 This selects support for Altera SoCFPGA specific extensions to the
589 Synopsys DesignWare Memory Card Interface driver.
590
591config MMC_DW_K3 583config MMC_DW_K3
592 tristate "K3 specific extensions for Synopsys DW Memory Card Interface" 584 tristate "K3 specific extensions for Synopsys DW Memory Card Interface"
593 depends on MMC_DW 585 depends on MMC_DW
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 3483b6b6b880..f162f87a049c 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -43,7 +43,6 @@ obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o
43obj-$(CONFIG_MMC_DW) += dw_mmc.o 43obj-$(CONFIG_MMC_DW) += dw_mmc.o
44obj-$(CONFIG_MMC_DW_PLTFM) += dw_mmc-pltfm.o 44obj-$(CONFIG_MMC_DW_PLTFM) += dw_mmc-pltfm.o
45obj-$(CONFIG_MMC_DW_EXYNOS) += dw_mmc-exynos.o 45obj-$(CONFIG_MMC_DW_EXYNOS) += dw_mmc-exynos.o
46obj-$(CONFIG_MMC_DW_SOCFPGA) += dw_mmc-socfpga.o
47obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o 46obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o
48obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o 47obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
49obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o 48obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
diff --git a/drivers/mmc/host/dw_mmc-socfpga.c b/drivers/mmc/host/dw_mmc-socfpga.c
deleted file mode 100644
index 3e8e53ae3302..000000000000
--- a/drivers/mmc/host/dw_mmc-socfpga.c
+++ /dev/null
@@ -1,138 +0,0 @@
1/*
2 * Altera SoCFPGA Specific Extensions for Synopsys DW Multimedia Card Interface
3 * driver
4 *
5 * Copyright (C) 2012, Samsung Electronics Co., Ltd.
6 * Copyright (C) 2013 Altera Corporation
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * Taken from dw_mmc-exynos.c
14 */
15#include <linux/clk.h>
16#include <linux/mfd/syscon.h>
17#include <linux/mmc/host.h>
18#include <linux/mmc/dw_mmc.h>
19#include <linux/module.h>
20#include <linux/of.h>
21#include <linux/platform_device.h>
22#include <linux/regmap.h>
23
24#include "dw_mmc.h"
25#include "dw_mmc-pltfm.h"
26
27#define SYSMGR_SDMMCGRP_CTRL_OFFSET 0x108
28#define DRV_CLK_PHASE_SHIFT_SEL_MASK 0x7
29#define SYSMGR_SDMMC_CTRL_SET(smplsel, drvsel) \
30 ((((smplsel) & 0x7) << 3) | (((drvsel) & 0x7) << 0))
31
32/* SOCFPGA implementation specific driver private data */
33struct dw_mci_socfpga_priv_data {
34 u8 ciu_div; /* card interface unit divisor */
35 u32 hs_timing; /* bitmask for CIU clock phase shift */
36 struct regmap *sysreg; /* regmap for system manager register */
37};
38
39static int dw_mci_socfpga_priv_init(struct dw_mci *host)
40{
41 return 0;
42}
43
44static int dw_mci_socfpga_setup_clock(struct dw_mci *host)
45{
46 struct dw_mci_socfpga_priv_data *priv = host->priv;
47
48 clk_disable_unprepare(host->ciu_clk);
49 regmap_write(priv->sysreg, SYSMGR_SDMMCGRP_CTRL_OFFSET,
50 priv->hs_timing);
51 clk_prepare_enable(host->ciu_clk);
52
53 host->bus_hz /= (priv->ciu_div + 1);
54 return 0;
55}
56
57static void dw_mci_socfpga_prepare_command(struct dw_mci *host, u32 *cmdr)
58{
59 struct dw_mci_socfpga_priv_data *priv = host->priv;
60
61 if (priv->hs_timing & DRV_CLK_PHASE_SHIFT_SEL_MASK)
62 *cmdr |= SDMMC_CMD_USE_HOLD_REG;
63}
64
65static int dw_mci_socfpga_parse_dt(struct dw_mci *host)
66{
67 struct dw_mci_socfpga_priv_data *priv;
68 struct device_node *np = host->dev->of_node;
69 u32 timing[2];
70 u32 div = 0;
71 int ret;
72
73 priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
74 if (!priv) {
75 dev_err(host->dev, "mem alloc failed for private data\n");
76 return -ENOMEM;
77 }
78
79 priv->sysreg = syscon_regmap_lookup_by_compatible("altr,sys-mgr");
80 if (IS_ERR(priv->sysreg)) {
81 dev_err(host->dev, "regmap for altr,sys-mgr lookup failed.\n");
82 return PTR_ERR(priv->sysreg);
83 }
84
85 ret = of_property_read_u32(np, "altr,dw-mshc-ciu-div", &div);
86 if (ret)
87 dev_info(host->dev, "No dw-mshc-ciu-div specified, assuming 1");
88 priv->ciu_div = div;
89
90 ret = of_property_read_u32_array(np,
91 "altr,dw-mshc-sdr-timing", timing, 2);
92 if (ret)
93 return ret;
94
95 priv->hs_timing = SYSMGR_SDMMC_CTRL_SET(timing[0], timing[1]);
96 host->priv = priv;
97 return 0;
98}
99
100static const struct dw_mci_drv_data socfpga_drv_data = {
101 .init = dw_mci_socfpga_priv_init,
102 .setup_clock = dw_mci_socfpga_setup_clock,
103 .prepare_command = dw_mci_socfpga_prepare_command,
104 .parse_dt = dw_mci_socfpga_parse_dt,
105};
106
107static const struct of_device_id dw_mci_socfpga_match[] = {
108 { .compatible = "altr,socfpga-dw-mshc",
109 .data = &socfpga_drv_data, },
110 {},
111};
112MODULE_DEVICE_TABLE(of, dw_mci_socfpga_match);
113
114static int dw_mci_socfpga_probe(struct platform_device *pdev)
115{
116 const struct dw_mci_drv_data *drv_data;
117 const struct of_device_id *match;
118
119 match = of_match_node(dw_mci_socfpga_match, pdev->dev.of_node);
120 drv_data = match->data;
121 return dw_mci_pltfm_register(pdev, drv_data);
122}
123
124static struct platform_driver dw_mci_socfpga_pltfm_driver = {
125 .probe = dw_mci_socfpga_probe,
126 .remove = __exit_p(dw_mci_pltfm_remove),
127 .driver = {
128 .name = "dwmmc_socfpga",
129 .of_match_table = dw_mci_socfpga_match,
130 .pm = &dw_mci_pltfm_pmops,
131 },
132};
133
134module_platform_driver(dw_mci_socfpga_pltfm_driver);
135
136MODULE_DESCRIPTION("Altera SOCFPGA Specific DW-MSHC Driver Extension");
137MODULE_LICENSE("GPL v2");
138MODULE_ALIAS("platform:dwmmc-socfpga");