aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuvaraj Kumar C D <yuvaraj.cd@gmail.com>2013-08-30 11:11:57 -0400
committerChris Ball <cjb@laptop.org>2013-09-25 21:32:20 -0400
commite6c784eded7b39caeaf2e9206336fa1daeccfd09 (patch)
tree88143d65ec2d85fc40f44d706c583993e12b6ee7
parent2eb2944fa7d14703898063eaee34d41524fb46ad (diff)
mmc: dw_mmc: exynos: move the exynos private init
Currently platform specific private data initialization 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 initialization of SMU and etc. Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com> Tested-by: Alim Akhtar <alim.akhtar@samsung.com> Tested-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by: Seungwon Jeon <tgih.jun@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/host/dw_mmc-exynos.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
index 2f28dd8098f9..37bad61a1754 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 {
72 72
73static int dw_mci_exynos_priv_init(struct dw_mci *host) 73static int dw_mci_exynos_priv_init(struct dw_mci *host)
74{ 74{
75 struct dw_mci_exynos_priv_data *priv; 75 struct dw_mci_exynos_priv_data *priv = host->priv;
76 int idx;
77
78 priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
79 if (!priv) {
80 dev_err(host->dev, "mem alloc failed for private data\n");
81 return -ENOMEM;
82 }
83
84 for (idx = 0; idx < ARRAY_SIZE(exynos_compat); idx++) {
85 if (of_device_is_compatible(host->dev->of_node,
86 exynos_compat[idx].compatible))
87 priv->ctrl_type = exynos_compat[idx].ctrl_type;
88 }
89 76
90 host->priv = priv;
91 return 0; 77 return 0;
92} 78}
93 79
@@ -174,12 +160,24 @@ static void dw_mci_exynos_set_ios(struct dw_mci *host, struct mmc_ios *ios)
174 160
175static int dw_mci_exynos_parse_dt(struct dw_mci *host) 161static int dw_mci_exynos_parse_dt(struct dw_mci *host)
176{ 162{
177 struct dw_mci_exynos_priv_data *priv = host->priv; 163 struct dw_mci_exynos_priv_data *priv;
178 struct device_node *np = host->dev->of_node; 164 struct device_node *np = host->dev->of_node;
179 u32 timing[2]; 165 u32 timing[2];
180 u32 div = 0; 166 u32 div = 0;
167 int idx;
181 int ret; 168 int ret;
182 169
170 priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL);
171 if (!priv) {
172 dev_err(host->dev, "mem alloc failed for private data\n");
173 return -ENOMEM;
174 }
175
176 for (idx = 0; idx < ARRAY_SIZE(exynos_compat); idx++) {
177 if (of_device_is_compatible(np, exynos_compat[idx].compatible))
178 priv->ctrl_type = exynos_compat[idx].ctrl_type;
179 }
180
183 of_property_read_u32(np, "samsung,dw-mshc-ciu-div", &div); 181 of_property_read_u32(np, "samsung,dw-mshc-ciu-div", &div);
184 priv->ciu_div = div; 182 priv->ciu_div = div;
185 183
@@ -188,14 +186,14 @@ static int dw_mci_exynos_parse_dt(struct dw_mci *host)
188 if (ret) 186 if (ret)
189 return ret; 187 return ret;
190 188
191 priv->sdr_timing = SDMMC_CLKSEL_TIMING(timing[0], timing[1], div);
192
193 ret = of_property_read_u32_array(np, 189 ret = of_property_read_u32_array(np,
194 "samsung,dw-mshc-ddr-timing", timing, 2); 190 "samsung,dw-mshc-ddr-timing", timing, 2);
195 if (ret) 191 if (ret)
196 return ret; 192 return ret;
197 193
194 priv->sdr_timing = SDMMC_CLKSEL_TIMING(timing[0], timing[1], div);
198 priv->ddr_timing = SDMMC_CLKSEL_TIMING(timing[0], timing[1], div); 195 priv->ddr_timing = SDMMC_CLKSEL_TIMING(timing[0], timing[1], div);
196 host->priv = priv;
199 return 0; 197 return 0;
200} 198}
201 199