hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/mmc/host/au1xmmc.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/drivers/mmc/host/au1xmmc.c - AU1XX0 MMC driver
34 *
....@@ -16,9 +17,6 @@
1617 * All Rights Reserved.
1718 *
1819
19
- * This program is free software; you can redistribute it and/or modify
20
- * it under the terms of the GNU General Public License version 2 as
21
- * published by the Free Software Foundation.
2220 */
2321
2422 /* Why don't we use the SD controllers' carddetect feature?
....@@ -261,7 +259,7 @@
261259 au1xmmc_finish_request(host);
262260 }
263261
264
-static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,
262
+static int au1xmmc_send_command(struct au1xmmc_host *host,
265263 struct mmc_command *cmd, struct mmc_data *data)
266264 {
267265 u32 mmccmd = (cmd->opcode << SD_CMD_CI_SHIFT);
....@@ -304,28 +302,12 @@
304302 __raw_writel(cmd->arg, HOST_CMDARG(host));
305303 wmb(); /* drain writebuffer */
306304
307
- if (wait)
308
- IRQ_OFF(host, SD_CONFIG_CR);
309
-
310305 __raw_writel((mmccmd | SD_CMD_GO), HOST_CMD(host));
311306 wmb(); /* drain writebuffer */
312307
313308 /* Wait for the command to go on the line */
314309 while (__raw_readl(HOST_CMD(host)) & SD_CMD_GO)
315310 /* nop */;
316
-
317
- /* Wait for the command to come back */
318
- if (wait) {
319
- u32 status = __raw_readl(HOST_STATUS(host));
320
-
321
- while (!(status & SD_STATUS_CR))
322
- status = __raw_readl(HOST_STATUS(host));
323
-
324
- /* Clear the CR status */
325
- __raw_writel(SD_STATUS_CR, HOST_STATUS(host));
326
-
327
- IRQ_ON(host, SD_CONFIG_CR);
328
- }
329311
330312 return 0;
331313 }
....@@ -713,7 +695,7 @@
713695 }
714696
715697 if (!ret)
716
- ret = au1xmmc_send_command(host, 0, mrq->cmd, mrq->data);
698
+ ret = au1xmmc_send_command(host, mrq->cmd, mrq->data);
717699
718700 if (ret) {
719701 mrq->cmd->error = ret;
....@@ -986,12 +968,9 @@
986968 goto out2;
987969 }
988970
989
- r = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
990
- if (!r) {
991
- dev_err(&pdev->dev, "no IRQ defined\n");
971
+ host->irq = platform_get_irq(pdev, 0);
972
+ if (host->irq < 0)
992973 goto out3;
993
- }
994
- host->irq = r->start;
995974
996975 mmc->ops = &au1xmmc_ops;
997976
....@@ -1118,8 +1097,9 @@
11181097 if (host->platdata && host->platdata->cd_setup &&
11191098 !(mmc->caps & MMC_CAP_NEEDS_POLL))
11201099 host->platdata->cd_setup(mmc, 0);
1121
-out_clk:
1100
+
11221101 clk_disable_unprepare(host->clk);
1102
+out_clk:
11231103 clk_put(host->clk);
11241104 out_irq:
11251105 free_irq(host->irq, host);
....@@ -1210,6 +1190,7 @@
12101190 .resume = au1xmmc_resume,
12111191 .driver = {
12121192 .name = DRIVER_NAME,
1193
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
12131194 },
12141195 };
12151196