aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaehoon Chung <jh80.chung@samsung.com>2017-06-05 00:41:32 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2017-06-29 11:14:17 -0400
commitb23475faed77f6a9016013c8db6b4707466e74a8 (patch)
treeea5ab6146410dcaa8a1ddc17fd75e18bf2d763e6
parent58870241a67453be7dc9ab368d5a0cdc9c404616 (diff)
mmc: dw_mmc: change the array of slots
It doesn't need to use the array of slots anymore. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/dw_mmc.c21
-rw-r--r--drivers/mmc/host/dw_mmc.h4
2 files changed, 10 insertions, 15 deletions
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 1b415da82754..8ed3c87f6a80 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2563,8 +2563,7 @@ static void dw_mci_cmd_interrupt(struct dw_mci *host, u32 status)
2563 2563
2564static void dw_mci_handle_cd(struct dw_mci *host) 2564static void dw_mci_handle_cd(struct dw_mci *host)
2565{ 2565{
2566 int i = 0; 2566 struct dw_mci_slot *slot = host->slot;
2567 struct dw_mci_slot *slot = host->slot[i];
2568 2567
2569 if (slot->mmc->ops->card_event) 2568 if (slot->mmc->ops->card_event)
2570 slot->mmc->ops->card_event(slot->mmc); 2569 slot->mmc->ops->card_event(slot->mmc);
@@ -2576,8 +2575,7 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
2576{ 2575{
2577 struct dw_mci *host = dev_id; 2576 struct dw_mci *host = dev_id;
2578 u32 pending; 2577 u32 pending;
2579 int i = 0; 2578 struct dw_mci_slot *slot = host->slot;
2580 struct dw_mci_slot *slot = host->slot[i];
2581 2579
2582 pending = mci_readl(host, MINTSTS); /* read-only mask reg */ 2580 pending = mci_readl(host, MINTSTS); /* read-only mask reg */
2583 2581
@@ -2707,7 +2705,7 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
2707 slot->sdio_id = host->sdio_id0 + id; 2705 slot->sdio_id = host->sdio_id0 + id;
2708 slot->mmc = mmc; 2706 slot->mmc = mmc;
2709 slot->host = host; 2707 slot->host = host;
2710 host->slot[id] = slot; 2708 host->slot = slot;
2711 2709
2712 mmc->ops = &dw_mci_ops; 2710 mmc->ops = &dw_mci_ops;
2713 if (device_property_read_u32_array(host->dev, "clock-freq-min-max", 2711 if (device_property_read_u32_array(host->dev, "clock-freq-min-max",
@@ -2807,7 +2805,7 @@ static void dw_mci_cleanup_slot(struct dw_mci_slot *slot, unsigned int id)
2807{ 2805{
2808 /* Debugfs stuff is cleaned up by mmc core */ 2806 /* Debugfs stuff is cleaned up by mmc core */
2809 mmc_remove_host(slot->mmc); 2807 mmc_remove_host(slot->mmc);
2810 slot->host->slot[id] = NULL; 2808 slot->host->slot = NULL;
2811 mmc_free_host(slot->mmc); 2809 mmc_free_host(slot->mmc);
2812} 2810}
2813 2811
@@ -2998,14 +2996,13 @@ static void dw_mci_enable_cd(struct dw_mci *host)
2998{ 2996{
2999 unsigned long irqflags; 2997 unsigned long irqflags;
3000 u32 temp; 2998 u32 temp;
3001 int i = 0;
3002 struct dw_mci_slot *slot; 2999 struct dw_mci_slot *slot;
3003 3000
3004 /* 3001 /*
3005 * No need for CD if all slots have a non-error GPIO 3002 * No need for CD if all slots have a non-error GPIO
3006 * as well as broken card detection is found. 3003 * as well as broken card detection is found.
3007 */ 3004 */
3008 slot = host->slot[i]; 3005 slot = host->slot;
3009 if (slot->mmc->caps & MMC_CAP_NEEDS_POLL) 3006 if (slot->mmc->caps & MMC_CAP_NEEDS_POLL)
3010 return; 3007 return;
3011 3008
@@ -3233,8 +3230,8 @@ void dw_mci_remove(struct dw_mci *host)
3233 int i = 0; 3230 int i = 0;
3234 3231
3235 dev_dbg(host->dev, "remove slot %d\n", i); 3232 dev_dbg(host->dev, "remove slot %d\n", i);
3236 if (host->slot[i]) 3233 if (host->slot)
3237 dw_mci_cleanup_slot(host->slot[i], i); 3234 dw_mci_cleanup_slot(host->slot, i);
3238 3235
3239 mci_writel(host, RINTSTS, 0xFFFFFFFF); 3236 mci_writel(host, RINTSTS, 0xFFFFFFFF);
3240 mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */ 3237 mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */
@@ -3277,9 +3274,9 @@ EXPORT_SYMBOL(dw_mci_runtime_suspend);
3277 3274
3278int dw_mci_runtime_resume(struct device *dev) 3275int dw_mci_runtime_resume(struct device *dev)
3279{ 3276{
3280 int i = 0, ret = 0; 3277 int ret = 0;
3281 struct dw_mci *host = dev_get_drvdata(dev); 3278 struct dw_mci *host = dev_get_drvdata(dev);
3282 struct dw_mci_slot *slot = host->slot[i]; 3279 struct dw_mci_slot *slot = host->slot;
3283 3280
3284 if (host->cur_slot && 3281 if (host->cur_slot &&
3285 (mmc_can_gpio_cd(host->cur_slot->mmc) || 3282 (mmc_can_gpio_cd(host->cur_slot->mmc) ||
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index ce347361f3dc..1ec8f4092fab 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -20,8 +20,6 @@
20#include <linux/reset.h> 20#include <linux/reset.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22 22
23#define MAX_MCI_SLOTS 2
24
25enum dw_mci_state { 23enum dw_mci_state {
26 STATE_IDLE = 0, 24 STATE_IDLE = 0,
27 STATE_SENDING_CMD, 25 STATE_SENDING_CMD,
@@ -215,7 +213,7 @@ struct dw_mci {
215 void *priv; 213 void *priv;
216 struct clk *biu_clk; 214 struct clk *biu_clk;
217 struct clk *ciu_clk; 215 struct clk *ciu_clk;
218 struct dw_mci_slot *slot[MAX_MCI_SLOTS]; 216 struct dw_mci_slot *slot;
219 217
220 /* FIFO push and pull */ 218 /* FIFO push and pull */
221 int fifo_depth; 219 int fifo_depth;