diff options
author | Zhangfei Gao <zhangfei.gao@linaro.org> | 2014-01-13 04:14:29 -0500 |
---|---|---|
committer | Chris Ball <chris@printf.net> | 2014-01-17 17:59:17 -0500 |
commit | 0e662440e9658163128b71a925dbf6a30d4db625 (patch) | |
tree | a456a2ca1f2b57f2be57b394c425a3995e84abdf /drivers/mmc | |
parent | 7cf347bd20ec8169add381ad23f9fb25c6c076f0 (diff) |
mmc: dw_mmc: k3: remove clk_table
Remove clk_table and directly use ios->clock as clock source rate.
Abstract init clock rate and max clock limitation in clk.c
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
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/dw_mmc-k3.c | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/drivers/mmc/host/dw_mmc-k3.c b/drivers/mmc/host/dw_mmc-k3.c index 3542a03e9f99..f567c219cff4 100644 --- a/drivers/mmc/host/dw_mmc-k3.c +++ b/drivers/mmc/host/dw_mmc-k3.c | |||
@@ -18,56 +18,19 @@ | |||
18 | #include "dw_mmc.h" | 18 | #include "dw_mmc.h" |
19 | #include "dw_mmc-pltfm.h" | 19 | #include "dw_mmc-pltfm.h" |
20 | 20 | ||
21 | #define MAX_NUMS 10 | ||
22 | struct dw_mci_k3_priv_data { | ||
23 | u32 clk_table[MAX_NUMS]; | ||
24 | }; | ||
25 | |||
26 | static void dw_mci_k3_set_ios(struct dw_mci *host, struct mmc_ios *ios) | 21 | static void dw_mci_k3_set_ios(struct dw_mci *host, struct mmc_ios *ios) |
27 | { | 22 | { |
28 | struct dw_mci_k3_priv_data *priv = host->priv; | ||
29 | u32 rate = priv->clk_table[ios->timing]; | ||
30 | int ret; | 23 | int ret; |
31 | 24 | ||
32 | if (!rate) { | 25 | ret = clk_set_rate(host->ciu_clk, ios->clock); |
33 | dev_warn(host->dev, | ||
34 | "no specified rate in timing %u\n", ios->timing); | ||
35 | return; | ||
36 | } | ||
37 | |||
38 | ret = clk_set_rate(host->ciu_clk, rate); | ||
39 | if (ret) | 26 | if (ret) |
40 | dev_warn(host->dev, "failed to set clock rate %uHz\n", rate); | 27 | dev_warn(host->dev, "failed to set rate %uHz\n", ios->clock); |
41 | 28 | ||
42 | host->bus_hz = clk_get_rate(host->ciu_clk); | 29 | host->bus_hz = clk_get_rate(host->ciu_clk); |
43 | } | 30 | } |
44 | 31 | ||
45 | static int dw_mci_k3_parse_dt(struct dw_mci *host) | ||
46 | { | ||
47 | struct dw_mci_k3_priv_data *priv; | ||
48 | struct device_node *node = host->dev->of_node; | ||
49 | struct property *prop; | ||
50 | const __be32 *cur; | ||
51 | u32 val, num = 0; | ||
52 | |||
53 | priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL); | ||
54 | if (!priv) { | ||
55 | dev_err(host->dev, "mem alloc failed for private data\n"); | ||
56 | return -ENOMEM; | ||
57 | } | ||
58 | host->priv = priv; | ||
59 | |||
60 | of_property_for_each_u32(node, "clock-freq-table", prop, cur, val) { | ||
61 | if (num >= MAX_NUMS) | ||
62 | break; | ||
63 | priv->clk_table[num++] = val; | ||
64 | } | ||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | static const struct dw_mci_drv_data k3_drv_data = { | 32 | static const struct dw_mci_drv_data k3_drv_data = { |
69 | .set_ios = dw_mci_k3_set_ios, | 33 | .set_ios = dw_mci_k3_set_ios, |
70 | .parse_dt = dw_mci_k3_parse_dt, | ||
71 | }; | 34 | }; |
72 | 35 | ||
73 | static const struct of_device_id dw_mci_k3_match[] = { | 36 | static const struct of_device_id dw_mci_k3_match[] = { |