hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/mmc/host/tifm_sd.c
....@@ -1,14 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * tifm_sd.c - TI FlashMedia driver
34 *
45 * Copyright (C) 2006 Alex Dubov <oakad@yahoo.com>
56 *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
9
- *
107 * Special thanks to Brad Campbell for extensive testing of this driver.
11
- *
128 */
139
1410
....@@ -76,6 +72,8 @@
7672 #define TIFM_MMCSD_CMD_ADTC 0x3000
7773
7874 #define TIFM_MMCSD_MAX_BLOCK_SIZE 0x0800UL
75
+
76
+#define TIFM_MMCSD_REQ_TIMEOUT_MS 1000
7977
8078 enum {
8179 CMD_READY = 0x0001,
....@@ -336,7 +334,8 @@
336334 rc |= TIFM_MMCSD_RSP_R0;
337335 break;
338336 case MMC_RSP_R1B:
339
- rc |= TIFM_MMCSD_RSP_BUSY; // deliberate fall-through
337
+ rc |= TIFM_MMCSD_RSP_BUSY;
338
+ fallthrough;
340339 case MMC_RSP_R1:
341340 rc |= TIFM_MMCSD_RSP_R1;
342341 break;
....@@ -888,7 +887,6 @@
888887 struct tifm_dev *sock = host->dev;
889888
890889 writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE);
891
- mmiowb();
892890 host->clk_div = 61;
893891 host->clk_freq = 20000000;
894892 writel(TIFM_MMCSD_RESET, sock->addr + SOCK_MMCSD_SYSTEM_CONTROL);
....@@ -939,7 +937,6 @@
939937 writel(TIFM_MMCSD_CERR | TIFM_MMCSD_BRS | TIFM_MMCSD_EOC
940938 | TIFM_MMCSD_ERRMASK,
941939 sock->addr + SOCK_MMCSD_INT_ENABLE);
942
- mmiowb();
943940
944941 return 0;
945942 }
....@@ -964,7 +961,12 @@
964961 host = mmc_priv(mmc);
965962 tifm_set_drvdata(sock, mmc);
966963 host->dev = sock;
967
- host->timeout_jiffies = msecs_to_jiffies(1000);
964
+ host->timeout_jiffies = msecs_to_jiffies(TIFM_MMCSD_REQ_TIMEOUT_MS);
965
+ /*
966
+ * We use a fixed request timeout of 1s, hence inform the core about it.
967
+ * A future improvement should instead respect the cmd->busy_timeout.
968
+ */
969
+ mmc->max_busy_timeout = TIFM_MMCSD_REQ_TIMEOUT_MS;
968970
969971 tasklet_init(&host->finish_tasklet, tifm_sd_end_cmd,
970972 (unsigned long)host);
....@@ -1004,7 +1006,6 @@
10041006 spin_lock_irqsave(&sock->lock, flags);
10051007 host->eject = 1;
10061008 writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE);
1007
- mmiowb();
10081009 spin_unlock_irqrestore(&sock->lock, flags);
10091010
10101011 tasklet_kill(&host->finish_tasklet);