forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/mmc/host/tmio_mmc_core.c
....@@ -1,18 +1,15 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Driver for the MMC / SD / SDIO IP found in:
34 *
45 * TC6393XB, TC6391XB, TC6387XB, T7L66XB, ASIC3, SH-Mobile SoCs
56 *
6
- * Copyright (C) 2015-17 Renesas Electronics Corporation
7
- * Copyright (C) 2016-17 Sang Engineering, Wolfram Sang
7
+ * Copyright (C) 2015-19 Renesas Electronics Corporation
8
+ * Copyright (C) 2016-19 Sang Engineering, Wolfram Sang
89 * Copyright (C) 2017 Horms Solutions, Simon Horman
910 * Copyright (C) 2011 Guennadi Liakhovetski
1011 * Copyright (C) 2007 Ian Molton
1112 * Copyright (C) 2004 Ian Molton
12
- *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License version 2 as
15
- * published by the Free Software Foundation.
1613 *
1714 * This driver draws mainly on scattered spec sheets, Reverse engineering
1815 * of the toshiba e800 SD driver and some parts of the 2.4 ASIC3 driver (4 bit
....@@ -29,6 +26,7 @@
2926
3027 #include <linux/delay.h>
3128 #include <linux/device.h>
29
+#include <linux/dma-mapping.h>
3230 #include <linux/highmem.h>
3331 #include <linux/interrupt.h>
3432 #include <linux/io.h>
....@@ -48,7 +46,6 @@
4846 #include <linux/scatterlist.h>
4947 #include <linux/sizes.h>
5048 #include <linux/spinlock.h>
51
-#include <linux/swiotlb.h>
5249 #include <linux/workqueue.h>
5350
5451 #include "tmio_mmc.h"
....@@ -58,6 +55,12 @@
5855 {
5956 if (host->dma_ops)
6057 host->dma_ops->start(host, data);
58
+}
59
+
60
+static inline void tmio_mmc_end_dma(struct tmio_mmc_host *host)
61
+{
62
+ if (host->dma_ops && host->dma_ops->end)
63
+ host->dma_ops->end(host);
6164 }
6265
6366 static inline void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
....@@ -161,100 +164,23 @@
161164 }
162165 }
163166
164
-static void tmio_mmc_clk_start(struct tmio_mmc_host *host)
165
-{
166
- sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, CLK_CTL_SCLKEN |
167
- sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
168
-
169
- /* HW engineers overrode docs: no sleep needed on R-Car2+ */
170
- if (!(host->pdata->flags & TMIO_MMC_MIN_RCAR2))
171
- usleep_range(10000, 11000);
172
-
173
- if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) {
174
- sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100);
175
- usleep_range(10000, 11000);
176
- }
177
-}
178
-
179
-static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
180
-{
181
- if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) {
182
- sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000);
183
- usleep_range(10000, 11000);
184
- }
185
-
186
- sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~CLK_CTL_SCLKEN &
187
- sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
188
-
189
- /* HW engineers overrode docs: no sleep needed on R-Car2+ */
190
- if (!(host->pdata->flags & TMIO_MMC_MIN_RCAR2))
191
- usleep_range(10000, 11000);
192
-}
193
-
194
-static void tmio_mmc_set_clock(struct tmio_mmc_host *host,
195
- unsigned int new_clock)
196
-{
197
- u32 clk = 0, clock;
198
-
199
- if (new_clock == 0) {
200
- tmio_mmc_clk_stop(host);
201
- return;
202
- }
203
- /*
204
- * Both HS400 and HS200/SD104 set 200MHz, but some devices need to
205
- * set 400MHz to distinguish the CPG settings in HS400.
206
- */
207
- if (host->mmc->ios.timing == MMC_TIMING_MMC_HS400 &&
208
- host->pdata->flags & TMIO_MMC_HAVE_4TAP_HS400 &&
209
- new_clock == 200000000)
210
- new_clock = 400000000;
211
-
212
- if (host->clk_update)
213
- clock = host->clk_update(host, new_clock) / 512;
214
- else
215
- clock = host->mmc->f_min;
216
-
217
- for (clk = 0x80000080; new_clock >= (clock << 1); clk >>= 1)
218
- clock <<= 1;
219
-
220
- /* 1/1 clock is option */
221
- if ((host->pdata->flags & TMIO_MMC_CLK_ACTUAL) &&
222
- ((clk >> 22) & 0x1)) {
223
- if (!(host->mmc->ios.timing == MMC_TIMING_MMC_HS400))
224
- clk |= 0xff;
225
- else
226
- clk &= ~0xff;
227
- }
228
-
229
- if (host->set_clk_div)
230
- host->set_clk_div(host->pdev, (clk >> 22) & 1);
231
-
232
- sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~CLK_CTL_SCLKEN &
233
- sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
234
- sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & CLK_CTL_DIV_MASK);
235
- if (!(host->pdata->flags & TMIO_MMC_MIN_RCAR2))
236
- usleep_range(10000, 11000);
237
-
238
- tmio_mmc_clk_start(host);
239
-}
240
-
241167 static void tmio_mmc_reset(struct tmio_mmc_host *host)
242168 {
243169 /* FIXME - should we set stop clock reg here */
244170 sd_ctrl_write16(host, CTL_RESET_SD, 0x0000);
245
- if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
246
- sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000);
247171 usleep_range(10000, 11000);
248172 sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
249
- if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
250
- sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
251173 usleep_range(10000, 11000);
174
+
175
+ if (host->reset)
176
+ host->reset(host);
177
+
178
+ tmio_mmc_abort_dma(host);
252179
253180 if (host->pdata->flags & TMIO_MMC_SDIO_IRQ) {
254181 sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask);
255182 sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001);
256183 }
257
-
258184 }
259185
260186 static void tmio_mmc_reset_work(struct work_struct *work)
....@@ -299,8 +225,6 @@
299225
300226 /* Ready for new calls */
301227 host->mrq = NULL;
302
-
303
- tmio_mmc_abort_dma(host);
304228 mmc_request_done(host->mmc, mrq);
305229 }
306230
....@@ -447,7 +371,7 @@
447371 unsigned int count;
448372 unsigned long flags;
449373
450
- if ((host->chan_tx || host->chan_rx) && !host->force_pio) {
374
+ if (host->dma_on) {
451375 pr_err("PIO IRQ in DMA mode!\n");
452376 return;
453377 } else if (!data) {
....@@ -519,7 +443,7 @@
519443 */
520444
521445 if (data->flags & MMC_DATA_READ) {
522
- if (host->chan_rx && !host->force_pio)
446
+ if (host->dma_on)
523447 tmio_mmc_check_bounce_buffer(host);
524448 dev_dbg(&host->pdev->dev, "Complete Rx request %p\n",
525449 host->mrq);
....@@ -556,7 +480,7 @@
556480 if (stat & TMIO_STAT_CRCFAIL || stat & TMIO_STAT_STOPBIT_ERR ||
557481 stat & TMIO_STAT_TXUNDERRUN)
558482 data->error = -EILSEQ;
559
- if (host->chan_tx && (data->flags & MMC_DATA_WRITE) && !host->force_pio) {
483
+ if (host->dma_on && (data->flags & MMC_DATA_WRITE)) {
560484 u32 status = sd_ctrl_read16_and_16_as_32(host, CTL_STATUS);
561485 bool done = false;
562486
....@@ -580,7 +504,7 @@
580504 tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND);
581505 tmio_mmc_dataend_dma(host);
582506 }
583
- } else if (host->chan_rx && (data->flags & MMC_DATA_READ) && !host->force_pio) {
507
+ } else if (host->dma_on && (data->flags & MMC_DATA_READ)) {
584508 tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND);
585509 tmio_mmc_dataend_dma(host);
586510 } else {
....@@ -633,7 +557,7 @@
633557 */
634558 if (host->data && (!cmd->error || cmd->error == -EILSEQ)) {
635559 if (host->data->flags & MMC_DATA_READ) {
636
- if (host->force_pio || !host->chan_rx) {
560
+ if (!host->dma_on) {
637561 tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_READOP);
638562 } else {
639563 tmio_mmc_disable_mmc_irqs(host,
....@@ -641,7 +565,7 @@
641565 tasklet_schedule(&host->dma_issue);
642566 }
643567 } else {
644
- if (host->force_pio || !host->chan_tx) {
568
+ if (!host->dma_on) {
645569 tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_WRITEOP);
646570 } else {
647571 tmio_mmc_disable_mmc_irqs(host,
....@@ -774,7 +698,7 @@
774698
775699 tmio_mmc_init_sg(host, data);
776700 host->data = data;
777
- host->force_pio = false;
701
+ host->dma_on = false;
778702
779703 /* Set transfer length / blocksize */
780704 sd_ctrl_write16(host, CTL_SD_XFER_LEN, data->blksz);
....@@ -786,59 +710,6 @@
786710 tmio_mmc_start_dma(host, data);
787711
788712 return 0;
789
-}
790
-
791
-static void tmio_mmc_hw_reset(struct mmc_host *mmc)
792
-{
793
- struct tmio_mmc_host *host = mmc_priv(mmc);
794
-
795
- if (host->hw_reset)
796
- host->hw_reset(host);
797
-}
798
-
799
-static int tmio_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
800
-{
801
- struct tmio_mmc_host *host = mmc_priv(mmc);
802
- int i, ret = 0;
803
-
804
- if (!host->init_tuning || !host->select_tuning)
805
- /* Tuning is not supported */
806
- goto out;
807
-
808
- host->tap_num = host->init_tuning(host);
809
- if (!host->tap_num)
810
- /* Tuning is not supported */
811
- goto out;
812
-
813
- if (host->tap_num * 2 >= sizeof(host->taps) * BITS_PER_BYTE) {
814
- dev_warn_once(&host->pdev->dev,
815
- "Too many taps, skipping tuning. Please consider updating size of taps field of tmio_mmc_host\n");
816
- goto out;
817
- }
818
-
819
- bitmap_zero(host->taps, host->tap_num * 2);
820
-
821
- /* Issue CMD19 twice for each tap */
822
- for (i = 0; i < 2 * host->tap_num; i++) {
823
- if (host->prepare_tuning)
824
- host->prepare_tuning(host, i % host->tap_num);
825
-
826
- ret = mmc_send_tuning(mmc, opcode, NULL);
827
- if (ret == 0)
828
- set_bit(i, host->taps);
829
-
830
- usleep_range(1000, 1200);
831
- }
832
-
833
- ret = host->select_tuning(host);
834
-
835
-out:
836
- if (ret < 0) {
837
- dev_warn(&host->pdev->dev, "Tuning procedure failed\n");
838
- tmio_mmc_hw_reset(mmc);
839
- }
840
-
841
- return ret;
842713 }
843714
844715 static void tmio_process_mrq(struct tmio_mmc_host *host,
....@@ -906,6 +777,8 @@
906777
907778 spin_lock_irqsave(&host->lock, flags);
908779
780
+ tmio_mmc_end_dma(host);
781
+
909782 mrq = host->mrq;
910783 if (IS_ERR_OR_NULL(mrq)) {
911784 spin_unlock_irqrestore(&host->lock, flags);
....@@ -926,8 +799,8 @@
926799 if (mrq->cmd->error || (mrq->data && mrq->data->error))
927800 tmio_mmc_abort_dma(host);
928801
929
- /* SCC error means retune, but executed command was still successful */
930
- if (host->check_scc_error && host->check_scc_error(host))
802
+ /* Error means retune, but executed command was still successful */
803
+ if (host->check_retune && host->check_retune(host))
931804 mmc_retune_needed(host->mmc);
932805
933806 /* If SET_BLOCK_COUNT, continue with main command */
....@@ -935,6 +808,9 @@
935808 tmio_process_mrq(host, mrq);
936809 return;
937810 }
811
+
812
+ if (host->fixup_request)
813
+ host->fixup_request(host, mrq);
938814
939815 mmc_request_done(host->mmc, mrq);
940816 }
....@@ -1051,15 +927,18 @@
1051927 switch (ios->power_mode) {
1052928 case MMC_POWER_OFF:
1053929 tmio_mmc_power_off(host);
1054
- tmio_mmc_clk_stop(host);
930
+ /* For R-Car Gen2+, we need to reset SDHI specific SCC */
931
+ if (host->pdata->flags & TMIO_MMC_MIN_RCAR2)
932
+ host->reset(host);
933
+ host->set_clock(host, 0);
1055934 break;
1056935 case MMC_POWER_UP:
1057936 tmio_mmc_power_on(host, ios->vdd);
1058
- tmio_mmc_set_clock(host, ios->clock);
937
+ host->set_clock(host, ios->clock);
1059938 tmio_mmc_set_bus_width(host, ios->bus_width);
1060939 break;
1061940 case MMC_POWER_ON:
1062
- tmio_mmc_set_clock(host, ios->clock);
941
+ host->set_clock(host, ios->clock);
1063942 tmio_mmc_set_bus_width(host, ios->bus_width);
1064943 break;
1065944 }
....@@ -1105,45 +984,13 @@
1105984 return blk_size;
1106985 }
1107986
1108
-static int tmio_mmc_prepare_hs400_tuning(struct mmc_host *mmc,
1109
- struct mmc_ios *ios)
1110
-{
1111
- struct tmio_mmc_host *host = mmc_priv(mmc);
1112
-
1113
- if (host->prepare_hs400_tuning)
1114
- host->prepare_hs400_tuning(host);
1115
-
1116
- return 0;
1117
-}
1118
-
1119
-static void tmio_mmc_hs400_downgrade(struct mmc_host *mmc)
1120
-{
1121
- struct tmio_mmc_host *host = mmc_priv(mmc);
1122
-
1123
- if (host->hs400_downgrade)
1124
- host->hs400_downgrade(host);
1125
-}
1126
-
1127
-static void tmio_mmc_hs400_complete(struct mmc_host *mmc)
1128
-{
1129
- struct tmio_mmc_host *host = mmc_priv(mmc);
1130
-
1131
- if (host->hs400_complete)
1132
- host->hs400_complete(host);
1133
-}
1134
-
1135
-static const struct mmc_host_ops tmio_mmc_ops = {
987
+static struct mmc_host_ops tmio_mmc_ops = {
1136988 .request = tmio_mmc_request,
1137989 .set_ios = tmio_mmc_set_ios,
1138990 .get_ro = tmio_mmc_get_ro,
1139991 .get_cd = tmio_mmc_get_cd,
1140992 .enable_sdio_irq = tmio_mmc_enable_sdio_irq,
1141993 .multi_io_quirk = tmio_multi_io_quirk,
1142
- .hw_reset = tmio_mmc_hw_reset,
1143
- .execute_tuning = tmio_mmc_execute_tuning,
1144
- .prepare_hs400_tuning = tmio_mmc_prepare_hs400_tuning,
1145
- .hs400_downgrade = tmio_mmc_hs400_downgrade,
1146
- .hs400_complete = tmio_mmc_hs400_complete,
1147994 };
1148995
1149996 static int tmio_mmc_init_ocr(struct tmio_mmc_host *host)
....@@ -1158,7 +1005,7 @@
11581005
11591006 /* use ocr_mask if no regulator */
11601007 if (!mmc->ocr_avail)
1161
- mmc->ocr_avail = pdata->ocr_mask;
1008
+ mmc->ocr_avail = pdata->ocr_mask;
11621009
11631010 /*
11641011 * try again.
....@@ -1192,12 +1039,10 @@
11921039 {
11931040 struct tmio_mmc_host *host;
11941041 struct mmc_host *mmc;
1195
- struct resource *res;
11961042 void __iomem *ctl;
11971043 int ret;
11981044
1199
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1200
- ctl = devm_ioremap_resource(&pdev->dev, res);
1045
+ ctl = devm_platform_ioremap_resource(pdev, 0);
12011046 if (IS_ERR(ctl))
12021047 return ERR_CAST(ctl);
12031048
....@@ -1245,7 +1090,7 @@
12451090 int ret;
12461091
12471092 /*
1248
- * Check the sanity of mmc->f_min to prevent tmio_mmc_set_clock() from
1093
+ * Check the sanity of mmc->f_min to prevent host->set_clock() from
12491094 * looping forever...
12501095 */
12511096 if (mmc->f_min == 0)
....@@ -1255,37 +1100,28 @@
12551100 _host->write16_hook = NULL;
12561101
12571102 _host->set_pwr = pdata->set_pwr;
1258
- _host->set_clk_div = pdata->set_clk_div;
12591103
12601104 ret = tmio_mmc_init_ocr(_host);
12611105 if (ret < 0)
12621106 return ret;
12631107
1264
- if (pdata->flags & TMIO_MMC_USE_GPIO_CD) {
1265
- ret = mmc_gpio_request_cd(mmc, pdata->cd_gpio, 0);
1266
- if (ret)
1267
- return ret;
1268
- }
1108
+ /*
1109
+ * Look for a card detect GPIO, if it fails with anything
1110
+ * else than a probe deferral, just live without it.
1111
+ */
1112
+ ret = mmc_gpiod_request_cd(mmc, "cd", 0, false, 0);
1113
+ if (ret == -EPROBE_DEFER)
1114
+ return ret;
12691115
1270
- mmc->caps |= MMC_CAP_ERASE | MMC_CAP_4_BIT_DATA | pdata->capabilities;
1116
+ mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities;
12711117 mmc->caps2 |= pdata->capabilities2;
12721118 mmc->max_segs = pdata->max_segs ? : 32;
1273
- mmc->max_blk_size = 512;
1119
+ mmc->max_blk_size = TMIO_MAX_BLK_SIZE;
12741120 mmc->max_blk_count = pdata->max_blk_count ? :
12751121 (PAGE_SIZE / mmc->max_blk_size) * mmc->max_segs;
1276
- mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
1277
- /*
1278
- * Since swiotlb has memory size limitation, this will calculate
1279
- * the maximum size locally (because we don't have any APIs for it now)
1280
- * and check the current max_req_size. And then, this will update
1281
- * the max_req_size if needed as a workaround.
1282
- */
1283
- if (swiotlb_max_segment()) {
1284
- unsigned int max_size = (1 << IO_TLB_SHIFT) * IO_TLB_SEGSIZE;
1285
-
1286
- if (mmc->max_req_size > max_size)
1287
- mmc->max_req_size = max_size;
1288
- }
1122
+ mmc->max_req_size = min_t(size_t,
1123
+ mmc->max_blk_size * mmc->max_blk_count,
1124
+ dma_max_mapping_size(&pdev->dev));
12891125 mmc->max_seg_size = mmc->max_req_size;
12901126
12911127 if (mmc_can_gpio_ro(mmc))
....@@ -1318,11 +1154,13 @@
13181154 if (pdata->flags & TMIO_MMC_SDIO_IRQ)
13191155 _host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
13201156
1321
- tmio_mmc_clk_stop(_host);
1157
+ _host->set_clock(_host, 0);
13221158 tmio_mmc_reset(_host);
13231159
13241160 _host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK);
1325
- tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL);
1161
+ if (!_host->sdcard_irq_mask_all)
1162
+ _host->sdcard_irq_mask_all = TMIO_MASK_ALL;
1163
+ tmio_mmc_disable_mmc_irqs(_host, _host->sdcard_irq_mask_all);
13261164
13271165 if (_host->native_hotplug)
13281166 tmio_mmc_enable_mmc_irqs(_host,
....@@ -1338,6 +1176,7 @@
13381176 /* See if we also get DMA */
13391177 tmio_mmc_request_dma(_host, pdata);
13401178
1179
+ pm_runtime_get_noresume(&pdev->dev);
13411180 pm_runtime_set_active(&pdev->dev);
13421181 pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
13431182 pm_runtime_use_autosuspend(&pdev->dev);
....@@ -1348,10 +1187,12 @@
13481187 goto remove_host;
13491188
13501189 dev_pm_qos_expose_latency_limit(&pdev->dev, 100);
1190
+ pm_runtime_put(&pdev->dev);
13511191
13521192 return 0;
13531193
13541194 remove_host:
1195
+ pm_runtime_put_noidle(&pdev->dev);
13551196 tmio_mmc_host_remove(_host);
13561197 return ret;
13571198 }
....@@ -1362,11 +1203,10 @@
13621203 struct platform_device *pdev = host->pdev;
13631204 struct mmc_host *mmc = host->mmc;
13641205
1206
+ pm_runtime_get_sync(&pdev->dev);
1207
+
13651208 if (host->pdata->flags & TMIO_MMC_SDIO_IRQ)
13661209 sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0000);
1367
-
1368
- if (!host->native_hotplug)
1369
- pm_runtime_get_sync(&pdev->dev);
13701210
13711211 dev_pm_qos_hide_latency_limit(&pdev->dev);
13721212
....@@ -1374,9 +1214,14 @@
13741214 cancel_work_sync(&host->done);
13751215 cancel_delayed_work_sync(&host->delayed_reset_work);
13761216 tmio_mmc_release_dma(host);
1217
+ tmio_mmc_disable_mmc_irqs(host, host->sdcard_irq_mask_all);
13771218
1378
- pm_runtime_put_sync(&pdev->dev);
1219
+ if (host->native_hotplug)
1220
+ pm_runtime_put_noidle(&pdev->dev);
1221
+
13791222 pm_runtime_disable(&pdev->dev);
1223
+ pm_runtime_dont_use_autosuspend(&pdev->dev);
1224
+ pm_runtime_put_noidle(&pdev->dev);
13801225 }
13811226 EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);
13821227
....@@ -1399,10 +1244,10 @@
13991244 {
14001245 struct tmio_mmc_host *host = dev_get_drvdata(dev);
14011246
1402
- tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_ALL);
1247
+ tmio_mmc_disable_mmc_irqs(host, host->sdcard_irq_mask_all);
14031248
14041249 if (host->clk_cache)
1405
- tmio_mmc_clk_stop(host);
1250
+ host->set_clock(host, 0);
14061251
14071252 tmio_mmc_clk_disable(host);
14081253
....@@ -1410,20 +1255,15 @@
14101255 }
14111256 EXPORT_SYMBOL_GPL(tmio_mmc_host_runtime_suspend);
14121257
1413
-static bool tmio_mmc_can_retune(struct tmio_mmc_host *host)
1414
-{
1415
- return host->tap_num && mmc_can_retune(host->mmc);
1416
-}
1417
-
14181258 int tmio_mmc_host_runtime_resume(struct device *dev)
14191259 {
14201260 struct tmio_mmc_host *host = dev_get_drvdata(dev);
14211261
1422
- tmio_mmc_reset(host);
14231262 tmio_mmc_clk_enable(host);
1263
+ tmio_mmc_reset(host);
14241264
14251265 if (host->clk_cache)
1426
- tmio_mmc_set_clock(host, host->clk_cache);
1266
+ host->set_clock(host, host->clk_cache);
14271267
14281268 if (host->native_hotplug)
14291269 tmio_mmc_enable_mmc_irqs(host,
....@@ -1431,8 +1271,7 @@
14311271
14321272 tmio_mmc_enable_dma(host, true);
14331273
1434
- if (tmio_mmc_can_retune(host) && host->select_tuning(host))
1435
- dev_warn(&host->pdev->dev, "Tuning selection failed\n");
1274
+ mmc_retune_needed(host->mmc);
14361275
14371276 return 0;
14381277 }