mmc: dw_mmc: move mci_send_cmd forward to avoid declaration
No functional change intended. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
132b3b6aa6
commit
4dba18defb
|
@ -230,7 +230,6 @@ err:
|
|||
}
|
||||
#endif /* defined(CONFIG_DEBUG_FS) */
|
||||
|
||||
static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg);
|
||||
static bool dw_mci_ctrl_reset(struct dw_mci *host, u32 reset)
|
||||
{
|
||||
u32 ctrl;
|
||||
|
@ -252,6 +251,46 @@ static bool dw_mci_ctrl_reset(struct dw_mci *host, u32 reset)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void dw_mci_wait_while_busy(struct dw_mci *host, u32 cmd_flags)
|
||||
{
|
||||
u32 status;
|
||||
|
||||
/*
|
||||
* Databook says that before issuing a new data transfer command
|
||||
* we need to check to see if the card is busy. Data transfer commands
|
||||
* all have SDMMC_CMD_PRV_DAT_WAIT set, so we'll key off that.
|
||||
*
|
||||
* ...also allow sending for SDMMC_CMD_VOLT_SWITCH where busy is
|
||||
* expected.
|
||||
*/
|
||||
if ((cmd_flags & SDMMC_CMD_PRV_DAT_WAIT) &&
|
||||
!(cmd_flags & SDMMC_CMD_VOLT_SWITCH)) {
|
||||
if (readl_poll_timeout_atomic(host->regs + SDMMC_STATUS,
|
||||
status,
|
||||
!(status & SDMMC_STATUS_BUSY),
|
||||
10, 500 * USEC_PER_MSEC))
|
||||
dev_err(host->dev, "Busy; trying anyway\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg)
|
||||
{
|
||||
struct dw_mci *host = slot->host;
|
||||
unsigned int cmd_status = 0;
|
||||
|
||||
mci_writel(host, CMDARG, arg);
|
||||
wmb(); /* drain writebuffer */
|
||||
dw_mci_wait_while_busy(host, cmd);
|
||||
mci_writel(host, CMD, SDMMC_CMD_START | cmd);
|
||||
|
||||
if (readl_poll_timeout_atomic(host->regs + SDMMC_CMD, cmd_status,
|
||||
!(cmd_status & SDMMC_CMD_START),
|
||||
1, 500 * USEC_PER_MSEC))
|
||||
dev_err(&slot->mmc->class_dev,
|
||||
"Timeout sending command (cmd %#x arg %#x status %#x)\n",
|
||||
cmd, arg, cmd_status);
|
||||
}
|
||||
|
||||
static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
|
||||
{
|
||||
struct dw_mci_slot *slot = mmc_priv(mmc);
|
||||
|
@ -359,28 +398,6 @@ static u32 dw_mci_prep_stop_abort(struct dw_mci *host, struct mmc_command *cmd)
|
|||
return cmdr;
|
||||
}
|
||||
|
||||
static void dw_mci_wait_while_busy(struct dw_mci *host, u32 cmd_flags)
|
||||
{
|
||||
u32 status;
|
||||
|
||||
/*
|
||||
* Databook says that before issuing a new data transfer command
|
||||
* we need to check to see if the card is busy. Data transfer commands
|
||||
* all have SDMMC_CMD_PRV_DAT_WAIT set, so we'll key off that.
|
||||
*
|
||||
* ...also allow sending for SDMMC_CMD_VOLT_SWITCH where busy is
|
||||
* expected.
|
||||
*/
|
||||
if ((cmd_flags & SDMMC_CMD_PRV_DAT_WAIT) &&
|
||||
!(cmd_flags & SDMMC_CMD_VOLT_SWITCH)) {
|
||||
if (readl_poll_timeout_atomic(host->regs + SDMMC_STATUS,
|
||||
status,
|
||||
!(status & SDMMC_STATUS_BUSY),
|
||||
10, 500 * USEC_PER_MSEC))
|
||||
dev_err(host->dev, "Busy; trying anyway\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void dw_mci_start_command(struct dw_mci *host,
|
||||
struct mmc_command *cmd, u32 cmd_flags)
|
||||
{
|
||||
|
@ -1185,24 +1202,6 @@ static void dw_mci_submit_data(struct dw_mci *host, struct mmc_data *data)
|
|||
}
|
||||
}
|
||||
|
||||
static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg)
|
||||
{
|
||||
struct dw_mci *host = slot->host;
|
||||
unsigned int cmd_status = 0;
|
||||
|
||||
mci_writel(host, CMDARG, arg);
|
||||
wmb(); /* drain writebuffer */
|
||||
dw_mci_wait_while_busy(host, cmd);
|
||||
mci_writel(host, CMD, SDMMC_CMD_START | cmd);
|
||||
|
||||
if (readl_poll_timeout_atomic(host->regs + SDMMC_CMD, cmd_status,
|
||||
!(cmd_status & SDMMC_CMD_START),
|
||||
1, 500 * USEC_PER_MSEC))
|
||||
dev_err(&slot->mmc->class_dev,
|
||||
"Timeout sending command (cmd %#x arg %#x status %#x)\n",
|
||||
cmd, arg, cmd_status);
|
||||
}
|
||||
|
||||
static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
|
||||
{
|
||||
struct dw_mci *host = slot->host;
|
||||
|
|
Loading…
Reference in New Issue