| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/drivers/mmc/host/au1xmmc.c - AU1XX0 MMC driver |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 16 | 17 | * All Rights Reserved. |
|---|
| 17 | 18 | * |
|---|
| 18 | 19 | |
|---|
| 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. |
|---|
| 22 | 20 | */ |
|---|
| 23 | 21 | |
|---|
| 24 | 22 | /* Why don't we use the SD controllers' carddetect feature? |
|---|
| .. | .. |
|---|
| 261 | 259 | au1xmmc_finish_request(host); |
|---|
| 262 | 260 | } |
|---|
| 263 | 261 | |
|---|
| 264 | | -static int au1xmmc_send_command(struct au1xmmc_host *host, int wait, |
|---|
| 262 | +static int au1xmmc_send_command(struct au1xmmc_host *host, |
|---|
| 265 | 263 | struct mmc_command *cmd, struct mmc_data *data) |
|---|
| 266 | 264 | { |
|---|
| 267 | 265 | u32 mmccmd = (cmd->opcode << SD_CMD_CI_SHIFT); |
|---|
| .. | .. |
|---|
| 304 | 302 | __raw_writel(cmd->arg, HOST_CMDARG(host)); |
|---|
| 305 | 303 | wmb(); /* drain writebuffer */ |
|---|
| 306 | 304 | |
|---|
| 307 | | - if (wait) |
|---|
| 308 | | - IRQ_OFF(host, SD_CONFIG_CR); |
|---|
| 309 | | - |
|---|
| 310 | 305 | __raw_writel((mmccmd | SD_CMD_GO), HOST_CMD(host)); |
|---|
| 311 | 306 | wmb(); /* drain writebuffer */ |
|---|
| 312 | 307 | |
|---|
| 313 | 308 | /* Wait for the command to go on the line */ |
|---|
| 314 | 309 | while (__raw_readl(HOST_CMD(host)) & SD_CMD_GO) |
|---|
| 315 | 310 | /* 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 | | - } |
|---|
| 329 | 311 | |
|---|
| 330 | 312 | return 0; |
|---|
| 331 | 313 | } |
|---|
| .. | .. |
|---|
| 713 | 695 | } |
|---|
| 714 | 696 | |
|---|
| 715 | 697 | if (!ret) |
|---|
| 716 | | - ret = au1xmmc_send_command(host, 0, mrq->cmd, mrq->data); |
|---|
| 698 | + ret = au1xmmc_send_command(host, mrq->cmd, mrq->data); |
|---|
| 717 | 699 | |
|---|
| 718 | 700 | if (ret) { |
|---|
| 719 | 701 | mrq->cmd->error = ret; |
|---|
| .. | .. |
|---|
| 986 | 968 | goto out2; |
|---|
| 987 | 969 | } |
|---|
| 988 | 970 | |
|---|
| 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) |
|---|
| 992 | 973 | goto out3; |
|---|
| 993 | | - } |
|---|
| 994 | | - host->irq = r->start; |
|---|
| 995 | 974 | |
|---|
| 996 | 975 | mmc->ops = &au1xmmc_ops; |
|---|
| 997 | 976 | |
|---|
| .. | .. |
|---|
| 1118 | 1097 | if (host->platdata && host->platdata->cd_setup && |
|---|
| 1119 | 1098 | !(mmc->caps & MMC_CAP_NEEDS_POLL)) |
|---|
| 1120 | 1099 | host->platdata->cd_setup(mmc, 0); |
|---|
| 1121 | | -out_clk: |
|---|
| 1100 | + |
|---|
| 1122 | 1101 | clk_disable_unprepare(host->clk); |
|---|
| 1102 | +out_clk: |
|---|
| 1123 | 1103 | clk_put(host->clk); |
|---|
| 1124 | 1104 | out_irq: |
|---|
| 1125 | 1105 | free_irq(host->irq, host); |
|---|