Commit 58870241 authored by Jaehoon Chung's avatar Jaehoon Chung Committed by Ulf Hansson

mmc: dw_mmc: remove the loop about finding slots

dwmmc controller has used the only one slot.
It doesn't need to check the other slots.
Remove the loop about finding slots.
Signed-off-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: default avatarShawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent d30a8f7b
...@@ -2563,26 +2563,21 @@ static void dw_mci_cmd_interrupt(struct dw_mci *host, u32 status) ...@@ -2563,26 +2563,21 @@ static void dw_mci_cmd_interrupt(struct dw_mci *host, u32 status)
static void dw_mci_handle_cd(struct dw_mci *host) static void dw_mci_handle_cd(struct dw_mci *host)
{ {
int i; int i = 0;
struct dw_mci_slot *slot = host->slot[i];
for (i = 0; i < host->num_slots; i++) {
struct dw_mci_slot *slot = host->slot[i];
if (!slot)
continue;
if (slot->mmc->ops->card_event) if (slot->mmc->ops->card_event)
slot->mmc->ops->card_event(slot->mmc); slot->mmc->ops->card_event(slot->mmc);
mmc_detect_change(slot->mmc, mmc_detect_change(slot->mmc,
msecs_to_jiffies(host->pdata->detect_delay_ms)); msecs_to_jiffies(host->pdata->detect_delay_ms));
}
} }
static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
{ {
struct dw_mci *host = dev_id; struct dw_mci *host = dev_id;
u32 pending; u32 pending;
int i; int i = 0;
struct dw_mci_slot *slot = host->slot[i];
pending = mci_readl(host, MINTSTS); /* read-only mask reg */ pending = mci_readl(host, MINTSTS); /* read-only mask reg */
...@@ -2659,19 +2654,11 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) ...@@ -2659,19 +2654,11 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
dw_mci_handle_cd(host); dw_mci_handle_cd(host);
} }
/* Handle SDIO Interrupts */ if (pending & SDMMC_INT_SDIO(slot->sdio_id)) {
for (i = 0; i < host->num_slots; i++) { mci_writel(host, RINTSTS,
struct dw_mci_slot *slot = host->slot[i]; SDMMC_INT_SDIO(slot->sdio_id));
__dw_mci_enable_sdio_irq(slot, 0);
if (!slot) sdio_signal_irq(slot->mmc);
continue;
if (pending & SDMMC_INT_SDIO(slot->sdio_id)) {
mci_writel(host, RINTSTS,
SDMMC_INT_SDIO(slot->sdio_id));
__dw_mci_enable_sdio_irq(slot, 0);
sdio_signal_irq(slot->mmc);
}
} }
} }
...@@ -3011,29 +2998,24 @@ static void dw_mci_enable_cd(struct dw_mci *host) ...@@ -3011,29 +2998,24 @@ static void dw_mci_enable_cd(struct dw_mci *host)
{ {
unsigned long irqflags; unsigned long irqflags;
u32 temp; u32 temp;
int i; int i = 0;
struct dw_mci_slot *slot; struct dw_mci_slot *slot;
/* /*
* No need for CD if all slots have a non-error GPIO * No need for CD if all slots have a non-error GPIO
* as well as broken card detection is found. * as well as broken card detection is found.
*/ */
for (i = 0; i < host->num_slots; i++) { slot = host->slot[i];
slot = host->slot[i]; if (slot->mmc->caps & MMC_CAP_NEEDS_POLL)
if (slot->mmc->caps & MMC_CAP_NEEDS_POLL)
return;
if (mmc_gpio_get_cd(slot->mmc) < 0)
break;
}
if (i == host->num_slots)
return; return;
spin_lock_irqsave(&host->irq_lock, irqflags); if (mmc_gpio_get_cd(slot->mmc) < 0) {
temp = mci_readl(host, INTMASK); spin_lock_irqsave(&host->irq_lock, irqflags);
temp |= SDMMC_INT_CD; temp = mci_readl(host, INTMASK);
mci_writel(host, INTMASK, temp); temp |= SDMMC_INT_CD;
spin_unlock_irqrestore(&host->irq_lock, irqflags); mci_writel(host, INTMASK, temp);
spin_unlock_irqrestore(&host->irq_lock, irqflags);
}
} }
int dw_mci_probe(struct dw_mci *host) int dw_mci_probe(struct dw_mci *host)
...@@ -3041,7 +3023,6 @@ int dw_mci_probe(struct dw_mci *host) ...@@ -3041,7 +3023,6 @@ int dw_mci_probe(struct dw_mci *host)
const struct dw_mci_drv_data *drv_data = host->drv_data; const struct dw_mci_drv_data *drv_data = host->drv_data;
int width, i, ret = 0; int width, i, ret = 0;
u32 fifo_size; u32 fifo_size;
int init_slots = 0;
if (!host->pdata) { if (!host->pdata) {
host->pdata = dw_mci_parse_dt(host); host->pdata = dw_mci_parse_dt(host);
...@@ -3204,13 +3185,6 @@ int dw_mci_probe(struct dw_mci *host) ...@@ -3204,13 +3185,6 @@ int dw_mci_probe(struct dw_mci *host)
if (ret) if (ret)
goto err_dmaunmap; goto err_dmaunmap;
/*
* Even though dwmmc IP is provided the multiple slots,
* there is no use case in mmc subsystem.
* dwmmc host controller needs to initialize the one slot per an IP.
*/
host->num_slots = 1;
/* /*
* Enable interrupts for command done, data over, data empty, * Enable interrupts for command done, data over, data empty,
* receive ready and error such as transmit, receive timeout, crc error * receive ready and error such as transmit, receive timeout, crc error
...@@ -3226,20 +3200,9 @@ int dw_mci_probe(struct dw_mci *host) ...@@ -3226,20 +3200,9 @@ int dw_mci_probe(struct dw_mci *host)
host->irq, width, fifo_size); host->irq, width, fifo_size);
/* We need at least one slot to succeed */ /* We need at least one slot to succeed */
for (i = 0; i < host->num_slots; i++) { ret = dw_mci_init_slot(host, 0);
ret = dw_mci_init_slot(host, i); if (ret) {
if (ret) dev_dbg(host->dev, "slot %d init failed\n", i);
dev_dbg(host->dev, "slot %d init failed\n", i);
else
init_slots++;
}
if (init_slots) {
dev_info(host->dev, "%d slots initialized\n", init_slots);
} else {
dev_dbg(host->dev,
"attempted to initialize %d slots, but failed on all\n",
host->num_slots);
goto err_dmaunmap; goto err_dmaunmap;
} }
...@@ -3267,13 +3230,11 @@ EXPORT_SYMBOL(dw_mci_probe); ...@@ -3267,13 +3230,11 @@ EXPORT_SYMBOL(dw_mci_probe);
void dw_mci_remove(struct dw_mci *host) void dw_mci_remove(struct dw_mci *host)
{ {
int i; int i = 0;
for (i = 0; i < host->num_slots; i++) { dev_dbg(host->dev, "remove slot %d\n", i);
dev_dbg(host->dev, "remove slot %d\n", i); if (host->slot[i])
if (host->slot[i]) dw_mci_cleanup_slot(host->slot[i], i);
dw_mci_cleanup_slot(host->slot[i], i);
}
mci_writel(host, RINTSTS, 0xFFFFFFFF); mci_writel(host, RINTSTS, 0xFFFFFFFF);
mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */ mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */
...@@ -3316,8 +3277,9 @@ EXPORT_SYMBOL(dw_mci_runtime_suspend); ...@@ -3316,8 +3277,9 @@ EXPORT_SYMBOL(dw_mci_runtime_suspend);
int dw_mci_runtime_resume(struct device *dev) int dw_mci_runtime_resume(struct device *dev)
{ {
int i, ret = 0; int i = 0, ret = 0;
struct dw_mci *host = dev_get_drvdata(dev); struct dw_mci *host = dev_get_drvdata(dev);
struct dw_mci_slot *slot = host->slot[i];
if (host->cur_slot && if (host->cur_slot &&
(mmc_can_gpio_cd(host->cur_slot->mmc) || (mmc_can_gpio_cd(host->cur_slot->mmc) ||
...@@ -3356,17 +3318,12 @@ int dw_mci_runtime_resume(struct device *dev) ...@@ -3356,17 +3318,12 @@ int dw_mci_runtime_resume(struct device *dev)
DW_MCI_ERROR_FLAGS); DW_MCI_ERROR_FLAGS);
mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE); mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE);
for (i = 0; i < host->num_slots; i++) {
struct dw_mci_slot *slot = host->slot[i];
if (!slot) if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER)
continue; dw_mci_set_ios(slot->mmc, &slot->mmc->ios);
if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER)
dw_mci_set_ios(slot->mmc, &slot->mmc->ios);
/* Force setup bus to guarantee available clock output */ /* Force setup bus to guarantee available clock output */
dw_mci_setup_bus(slot, true); dw_mci_setup_bus(slot, true);
}
/* Now that slots are all setup, we can enable card detect */ /* Now that slots are all setup, we can enable card detect */
dw_mci_enable_cd(host); dw_mci_enable_cd(host);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment