Commit 122537e1f37db0710e6d35514975bf883a64154f
Committed by
Tom Rini
1 parent
c62c7ef779
Exists in
smarc_8mq_lf_v2020.04
and in
9 other branches
mmc: Add support for HI3660 SoC reusing hi6220_dw_mmc driver
This commit adds MMC driver support for HI3660 SoC reusing hi6220_dw_mmc driver. Since HI3660 operates at different clock rate and uses fifo mode now, let's introduce the platform data and utilize it for different SoCs supported by this driver. Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Showing 1 changed file with 26 additions and 3 deletions Side-by-side Diff
drivers/mmc/hi6220_dw_mmc.c
... | ... | @@ -22,6 +22,11 @@ |
22 | 22 | struct dwmci_host host; |
23 | 23 | }; |
24 | 24 | |
25 | +struct hisi_mmc_data { | |
26 | + unsigned int clock; | |
27 | + bool use_fifo; | |
28 | +}; | |
29 | + | |
25 | 30 | static int hi6220_dwmmc_ofdata_to_platdata(struct udevice *dev) |
26 | 31 | { |
27 | 32 | struct hi6220_dwmmc_priv_data *priv = dev_get_priv(dev); |
28 | 33 | |
29 | 34 | |
30 | 35 | |
... | ... | @@ -49,13 +54,17 @@ |
49 | 54 | struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); |
50 | 55 | struct hi6220_dwmmc_priv_data *priv = dev_get_priv(dev); |
51 | 56 | struct dwmci_host *host = &priv->host; |
57 | + struct hisi_mmc_data *mmc_data; | |
52 | 58 | |
59 | + mmc_data = (struct hisi_mmc_data *)dev_get_driver_data(dev); | |
60 | + | |
53 | 61 | /* Use default bus speed due to absence of clk driver */ |
54 | - host->bus_hz = 50000000; | |
62 | + host->bus_hz = mmc_data->clock; | |
55 | 63 | |
56 | 64 | dwmci_setup_cfg(&plat->cfg, host, host->bus_hz, 400000); |
57 | 65 | host->mmc = &plat->mmc; |
58 | 66 | |
67 | + host->fifo_mode = mmc_data->use_fifo; | |
59 | 68 | host->mmc->priv = &priv->host; |
60 | 69 | upriv->mmc = host->mmc; |
61 | 70 | host->mmc->dev = dev; |
62 | 71 | |
... | ... | @@ -75,9 +84,23 @@ |
75 | 84 | return 0; |
76 | 85 | } |
77 | 86 | |
87 | +static const struct hisi_mmc_data hi3660_mmc_data = { | |
88 | + .clock = 3200000, | |
89 | + .use_fifo = true, | |
90 | +}; | |
91 | + | |
92 | +static const struct hisi_mmc_data hi6220_mmc_data = { | |
93 | + .clock = 50000000, | |
94 | + .use_fifo = false, | |
95 | +}; | |
96 | + | |
78 | 97 | static const struct udevice_id hi6220_dwmmc_ids[] = { |
79 | - { .compatible = "hisilicon,hi6220-dw-mshc" }, | |
80 | - { .compatible = "hisilicon,hi3798cv200-dw-mshc" }, | |
98 | + { .compatible = "hisilicon,hi6220-dw-mshc", | |
99 | + .data = (ulong)&hi6220_mmc_data }, | |
100 | + { .compatible = "hisilicon,hi3798cv200-dw-mshc", | |
101 | + .data = (ulong)&hi6220_mmc_data }, | |
102 | + { .compatible = "hisilicon,hi3660-dw-mshc", | |
103 | + .data = (ulong)&hi3660_mmc_data }, | |
81 | 104 | { } |
82 | 105 | }; |
83 | 106 |