All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] mmc: dw_mmc: remove the multiple slot concept
       [not found] <CGME20170605044137epcas1p4e7e2b74aa17ea7d7137da7b677bfb282@epcas1p4.samsung.com>
@ 2017-06-05  4:41 ` Jaehoon Chung
       [not found]   ` <CGME20170605044137epcas1p408ff8655bcf8084e758f358ff0ed632e@epcas1p4.samsung.com>
                     ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Jaehoon Chung @ 2017-06-05  4:41 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, Jaehoon Chung

DWMMC IP is provided the multiple slot.
It's only used the one slot per an IP in mmc subsystem.
If we can consider only one slot, then dwmmc controller codes can be more simpler than now.
This patchset is the first step to remove the multiple slot.

In future work,
   - Remove the entire slot structure.
   - Move to slot's members into dwmci host.

Jaehoon Chung (6):
  mmc: dw_mmc: deprecated the "num-slots" property
  mmc: dw_mmc: remove the loop about finding slots
  mmc: dw_mmc: change the array of slots
  mmc: dw_mmc: remove the 'id' arguments about functions relevant to
    slot
  mmc: dw_mmc: use the 'slot' instead of 'cur_slot'
  mmc: dw_mmc: remove the unnecessary slot variable

 drivers/mmc/host/dw_mmc-exynos.c |   4 +-
 drivers/mmc/host/dw_mmc.c        | 165 +++++++++++++--------------------------
 drivers/mmc/host/dw_mmc.h        |   7 +-
 3 files changed, 57 insertions(+), 119 deletions(-)

-- 
2.10.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/6] mmc: dw_mmc: deprecated the "num-slots" property
       [not found]   ` <CGME20170605044137epcas1p408ff8655bcf8084e758f358ff0ed632e@epcas1p4.samsung.com>
@ 2017-06-05  4:41     ` Jaehoon Chung
  0 siblings, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2017-06-05  4:41 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, Jaehoon Chung

dwmmc controller is supporting only one slot per a IP.
Even though DWMMC IP is provided the multiple slot, but there is no
usage in real world.
In mmc subsystem, not allow the multiple slot concept.
Then "num-slots" property is deprecated.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/host/dw_mmc.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 4a0841c..a66edd0 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2973,7 +2973,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
 	}
 
 	/* find out number of slots supported */
-	device_property_read_u32(dev, "num-slots", &pdata->num_slots);
+	if (device_property_read_u32(dev, "num-slots", &pdata->num_slots))
+		dev_info(dev, "'num-slots' was deprecated.\n");
 
 	if (device_property_read_u32(dev, "fifo-depth", &pdata->fifo_depth))
 		dev_info(dev,
@@ -3203,18 +3204,12 @@ int dw_mci_probe(struct dw_mci *host)
 	if (ret)
 		goto err_dmaunmap;
 
-	if (host->pdata->num_slots)
-		host->num_slots = host->pdata->num_slots;
-	else
-		host->num_slots = 1;
-
-	if (host->num_slots < 1 ||
-	    host->num_slots > SDMMC_GET_SLOT_NUM(mci_readl(host, HCON))) {
-		dev_err(host->dev,
-			"Platform data must supply correct num_slots.\n");
-		ret = -ENODEV;
-		goto err_clk_ciu;
-	}
+	/*
+	 * 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,
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/6] mmc: dw_mmc: remove the loop about finding slots
       [not found]   ` <CGME20170605044137epcas1p47fa50e6e9a2b68eccc1f726a33e14c0e@epcas1p4.samsung.com>
@ 2017-06-05  4:41     ` Jaehoon Chung
  0 siblings, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2017-06-05  4:41 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, Jaehoon Chung

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: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/host/dw_mmc.c | 115 +++++++++++++++-------------------------------
 1 file changed, 36 insertions(+), 79 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index a66edd0..1b415da 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -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)
 {
-	int i;
-
-	for (i = 0; i < host->num_slots; i++) {
-		struct dw_mci_slot *slot = host->slot[i];
-
-		if (!slot)
-			continue;
+	int i = 0;
+	struct dw_mci_slot *slot = host->slot[i];
 
-		if (slot->mmc->ops->card_event)
-			slot->mmc->ops->card_event(slot->mmc);
-		mmc_detect_change(slot->mmc,
-			msecs_to_jiffies(host->pdata->detect_delay_ms));
-	}
+	if (slot->mmc->ops->card_event)
+		slot->mmc->ops->card_event(slot->mmc);
+	mmc_detect_change(slot->mmc,
+		msecs_to_jiffies(host->pdata->detect_delay_ms));
 }
 
 static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
 {
 	struct dw_mci *host = dev_id;
 	u32 pending;
-	int i;
+	int i = 0;
+	struct dw_mci_slot *slot = host->slot[i];
 
 	pending = mci_readl(host, MINTSTS); /* read-only mask reg */
 
@@ -2659,19 +2654,11 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
 			dw_mci_handle_cd(host);
 		}
 
-		/* Handle SDIO Interrupts */
-		for (i = 0; i < host->num_slots; i++) {
-			struct dw_mci_slot *slot = host->slot[i];
-
-			if (!slot)
-				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);
-			}
+		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)
 {
 	unsigned long irqflags;
 	u32 temp;
-	int i;
+	int i = 0;
 	struct dw_mci_slot *slot;
 
 	/*
 	 * No need for CD if all slots have a non-error GPIO
 	 * as well as broken card detection is found.
 	 */
-	for (i = 0; i < host->num_slots; i++) {
-		slot = host->slot[i];
-		if (slot->mmc->caps & MMC_CAP_NEEDS_POLL)
-			return;
-
-		if (mmc_gpio_get_cd(slot->mmc) < 0)
-			break;
-	}
-	if (i == host->num_slots)
+	slot = host->slot[i];
+	if (slot->mmc->caps & MMC_CAP_NEEDS_POLL)
 		return;
 
-	spin_lock_irqsave(&host->irq_lock, irqflags);
-	temp = mci_readl(host, INTMASK);
-	temp  |= SDMMC_INT_CD;
-	mci_writel(host, INTMASK, temp);
-	spin_unlock_irqrestore(&host->irq_lock, irqflags);
+	if (mmc_gpio_get_cd(slot->mmc) < 0) {
+		spin_lock_irqsave(&host->irq_lock, irqflags);
+		temp = mci_readl(host, INTMASK);
+		temp  |= SDMMC_INT_CD;
+		mci_writel(host, INTMASK, temp);
+		spin_unlock_irqrestore(&host->irq_lock, irqflags);
+	}
 }
 
 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;
 	int width, i, ret = 0;
 	u32 fifo_size;
-	int init_slots = 0;
 
 	if (!host->pdata) {
 		host->pdata = dw_mci_parse_dt(host);
@@ -3205,13 +3186,6 @@ int dw_mci_probe(struct dw_mci *host)
 		goto err_dmaunmap;
 
 	/*
-	 * Even though dwmmc IP is provided the multiple slots,
-	 * there is no use case in mms 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,
 	 * receive ready and error such as transmit, receive timeout, crc error
 	 */
@@ -3226,20 +3200,9 @@ int dw_mci_probe(struct dw_mci *host)
 		 host->irq, width, fifo_size);
 
 	/* We need at least one slot to succeed */
-	for (i = 0; i < host->num_slots; i++) {
-		ret = dw_mci_init_slot(host, i);
-		if (ret)
-			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);
+	ret = dw_mci_init_slot(host, 0);
+	if (ret) {
+		dev_dbg(host->dev, "slot %d init failed\n", i);
 		goto err_dmaunmap;
 	}
 
@@ -3267,13 +3230,11 @@ EXPORT_SYMBOL(dw_mci_probe);
 
 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);
-		if (host->slot[i])
-			dw_mci_cleanup_slot(host->slot[i], i);
-	}
+	dev_dbg(host->dev, "remove slot %d\n", i);
+	if (host->slot[i])
+		dw_mci_cleanup_slot(host->slot[i], i);
 
 	mci_writel(host, RINTSTS, 0xFFFFFFFF);
 	mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */
@@ -3316,8 +3277,9 @@ EXPORT_SYMBOL(dw_mci_runtime_suspend);
 
 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_slot *slot = host->slot[i];
 
 	if (host->cur_slot &&
 	    (mmc_can_gpio_cd(host->cur_slot->mmc) ||
@@ -3356,17 +3318,12 @@ int dw_mci_runtime_resume(struct device *dev)
 		   DW_MCI_ERROR_FLAGS);
 	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)
-			continue;
-		if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER)
-			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 */
-		dw_mci_setup_bus(slot, true);
-	}
+	/* Force setup bus to guarantee available clock output */
+	dw_mci_setup_bus(slot, true);
 
 	/* Now that slots are all setup, we can enable card detect */
 	dw_mci_enable_cd(host);
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/6] mmc: dw_mmc: change the array of slots
       [not found]   ` <CGME20170605044137epcas1p413b27e4b2f3db83c1623acf4cc2b9cdc@epcas1p4.samsung.com>
@ 2017-06-05  4:41     ` Jaehoon Chung
  0 siblings, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2017-06-05  4:41 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, Jaehoon Chung

It doesn't need to use the array of slots anymore.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/host/dw_mmc.c | 21 +++++++++------------
 drivers/mmc/host/dw_mmc.h |  4 +---
 2 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 1b415da..8ed3c87 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)
 
 static void dw_mci_handle_cd(struct dw_mci *host)
 {
-	int i = 0;
-	struct dw_mci_slot *slot = host->slot[i];
+	struct dw_mci_slot *slot = host->slot;
 
 	if (slot->mmc->ops->card_event)
 		slot->mmc->ops->card_event(slot->mmc);
@@ -2576,8 +2575,7 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
 {
 	struct dw_mci *host = dev_id;
 	u32 pending;
-	int i = 0;
-	struct dw_mci_slot *slot = host->slot[i];
+	struct dw_mci_slot *slot = host->slot;
 
 	pending = mci_readl(host, MINTSTS); /* read-only mask reg */
 
@@ -2707,7 +2705,7 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 	slot->sdio_id = host->sdio_id0 + id;
 	slot->mmc = mmc;
 	slot->host = host;
-	host->slot[id] = slot;
+	host->slot = slot;
 
 	mmc->ops = &dw_mci_ops;
 	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)
 {
 	/* Debugfs stuff is cleaned up by mmc core */
 	mmc_remove_host(slot->mmc);
-	slot->host->slot[id] = NULL;
+	slot->host->slot = NULL;
 	mmc_free_host(slot->mmc);
 }
 
@@ -2998,14 +2996,13 @@ static void dw_mci_enable_cd(struct dw_mci *host)
 {
 	unsigned long irqflags;
 	u32 temp;
-	int i = 0;
 	struct dw_mci_slot *slot;
 
 	/*
 	 * No need for CD if all slots have a non-error GPIO
 	 * as well as broken card detection is found.
 	 */
-	slot = host->slot[i];
+	slot = host->slot;
 	if (slot->mmc->caps & MMC_CAP_NEEDS_POLL)
 		return;
 
@@ -3233,8 +3230,8 @@ void dw_mci_remove(struct dw_mci *host)
 	int i = 0;
 
 	dev_dbg(host->dev, "remove slot %d\n", i);
-	if (host->slot[i])
-		dw_mci_cleanup_slot(host->slot[i], i);
+	if (host->slot)
+		dw_mci_cleanup_slot(host->slot, i);
 
 	mci_writel(host, RINTSTS, 0xFFFFFFFF);
 	mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */
@@ -3277,9 +3274,9 @@ EXPORT_SYMBOL(dw_mci_runtime_suspend);
 
 int dw_mci_runtime_resume(struct device *dev)
 {
-	int i = 0, ret = 0;
+	int ret = 0;
 	struct dw_mci *host = dev_get_drvdata(dev);
-	struct dw_mci_slot *slot = host->slot[i];
+	struct dw_mci_slot *slot = host->slot;
 
 	if (host->cur_slot &&
 	    (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 ce34736..1ec8f40 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -20,8 +20,6 @@
 #include <linux/reset.h>
 #include <linux/interrupt.h>
 
-#define MAX_MCI_SLOTS	2
-
 enum dw_mci_state {
 	STATE_IDLE = 0,
 	STATE_SENDING_CMD,
@@ -215,7 +213,7 @@ struct dw_mci {
 	void			*priv;
 	struct clk		*biu_clk;
 	struct clk		*ciu_clk;
-	struct dw_mci_slot	*slot[MAX_MCI_SLOTS];
+	struct dw_mci_slot	*slot;
 
 	/* FIFO push and pull */
 	int			fifo_depth;
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/6] mmc: dw_mmc: remove the 'id' arguments about functions relevant to slot
       [not found]   ` <CGME20170605044137epcas1p4c0df9a32c3987a0c4751900cdb439650@epcas1p4.samsung.com>
@ 2017-06-05  4:41     ` Jaehoon Chung
  0 siblings, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2017-06-05  4:41 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, Jaehoon Chung

Doesn't need to pass the id value for slot functions.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/host/dw_mmc.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 8ed3c87..8a4fa88 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2688,7 +2688,7 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
+static int dw_mci_init_slot(struct dw_mci *host)
 {
 	struct mmc_host *mmc;
 	struct dw_mci_slot *slot;
@@ -2701,8 +2701,8 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 		return -ENOMEM;
 
 	slot = mmc_priv(mmc);
-	slot->id = id;
-	slot->sdio_id = host->sdio_id0 + id;
+	slot->id = 0;
+	slot->sdio_id = host->sdio_id0 + slot->id;
 	slot->mmc = mmc;
 	slot->host = host;
 	host->slot = slot;
@@ -2801,7 +2801,7 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 	return ret;
 }
 
-static void dw_mci_cleanup_slot(struct dw_mci_slot *slot, unsigned int id)
+static void dw_mci_cleanup_slot(struct dw_mci_slot *slot)
 {
 	/* Debugfs stuff is cleaned up by mmc core */
 	mmc_remove_host(slot->mmc);
@@ -3197,7 +3197,7 @@ int dw_mci_probe(struct dw_mci *host)
 		 host->irq, width, fifo_size);
 
 	/* We need at least one slot to succeed */
-	ret = dw_mci_init_slot(host, 0);
+	ret = dw_mci_init_slot(host);
 	if (ret) {
 		dev_dbg(host->dev, "slot %d init failed\n", i);
 		goto err_dmaunmap;
@@ -3227,11 +3227,9 @@ EXPORT_SYMBOL(dw_mci_probe);
 
 void dw_mci_remove(struct dw_mci *host)
 {
-	int i = 0;
-
-	dev_dbg(host->dev, "remove slot %d\n", i);
+	dev_dbg(host->dev, "remove slot\n");
 	if (host->slot)
-		dw_mci_cleanup_slot(host->slot, i);
+		dw_mci_cleanup_slot(host->slot);
 
 	mci_writel(host, RINTSTS, 0xFFFFFFFF);
 	mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/6] mmc: dw_mmc: use the 'slot' instead of 'cur_slot'
       [not found]   ` <CGME20170605044137epcas1p44c44e94f8514d5115daaa83593d57c98@epcas1p4.samsung.com>
@ 2017-06-05  4:41     ` Jaehoon Chung
  0 siblings, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2017-06-05  4:41 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, Jaehoon Chung

Remove the 'cur_slot'. Instead, just use 'slot'.
There is no multiple slots, so we need to consider only one slot.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/host/dw_mmc-exynos.c |  4 ++--
 drivers/mmc/host/dw_mmc.c        | 33 ++++++++++++++++-----------------
 drivers/mmc/host/dw_mmc.h        |  3 ---
 3 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
index 25691cc..3502679 100644
--- a/drivers/mmc/host/dw_mmc-exynos.c
+++ b/drivers/mmc/host/dw_mmc-exynos.c
@@ -157,8 +157,8 @@ static void dw_mci_exynos_set_clksel_timing(struct dw_mci *host, u32 timing)
 	 * HOLD register should be bypassed in case there is no phase shift
 	 * applied on CMD/DATA that is sent to the card.
 	 */
-	if (!SDMMC_CLKSEL_GET_DRV_WD3(clksel) && host->cur_slot)
-		set_bit(DW_MMC_CARD_NO_USE_HOLD, &host->cur_slot->flags);
+	if (!SDMMC_CLKSEL_GET_DRV_WD3(clksel) && host->slot)
+		set_bit(DW_MMC_CARD_NO_USE_HOLD, &host->slot->flags);
 }
 
 #ifdef CONFIG_PM
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 8a4fa88..97a8b0c 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -392,7 +392,7 @@ static u32 dw_mci_prep_stop_abort(struct dw_mci *host, struct mmc_command *cmd)
 	cmdr = stop->opcode | SDMMC_CMD_STOP |
 		SDMMC_CMD_RESP_CRC | SDMMC_CMD_RESP_EXP;
 
-	if (!test_bit(DW_MMC_CARD_NO_USE_HOLD, &host->cur_slot->flags))
+	if (!test_bit(DW_MMC_CARD_NO_USE_HOLD, &host->slot->flags))
 		cmdr |= SDMMC_CMD_USE_HOLD_REG;
 
 	return cmdr;
@@ -480,7 +480,7 @@ static void dw_mci_dmac_complete_dma(void *arg)
 	if ((host->use_dma == TRANS_MODE_EDMAC) &&
 	    data && (data->flags & MMC_DATA_READ))
 		/* Invalidate cache after read */
-		dma_sync_sg_for_cpu(mmc_dev(host->cur_slot->mmc),
+		dma_sync_sg_for_cpu(mmc_dev(host->slot->mmc),
 				    data->sg,
 				    data->sg_len,
 				    DMA_FROM_DEVICE);
@@ -820,7 +820,7 @@ static int dw_mci_edmac_start_dma(struct dw_mci *host,
 
 	/* Flush cache before write */
 	if (host->data->flags & MMC_DATA_WRITE)
-		dma_sync_sg_for_device(mmc_dev(host->cur_slot->mmc), sgl,
+		dma_sync_sg_for_device(mmc_dev(host->slot->mmc), sgl,
 				       sg_elems, DMA_TO_DEVICE);
 
 	dma_async_issue_pending(host->dms->ch);
@@ -1282,7 +1282,6 @@ static void __dw_mci_start_request(struct dw_mci *host,
 
 	mrq = slot->mrq;
 
-	host->cur_slot = slot;
 	host->mrq = mrq;
 
 	host->pending_events = 0;
@@ -1763,7 +1762,7 @@ static bool dw_mci_reset(struct dw_mci *host)
 
 ciu_out:
 	/* After a CTRL reset we need to have CIU set clock registers  */
-	mci_send_cmd(host->cur_slot, SDMMC_CMD_UPD_CLK, 0);
+	mci_send_cmd(host->slot, SDMMC_CMD_UPD_CLK, 0);
 
 	return ret;
 }
@@ -1790,11 +1789,11 @@ static void dw_mci_request_end(struct dw_mci *host, struct mmc_request *mrq)
 	__acquires(&host->lock)
 {
 	struct dw_mci_slot *slot;
-	struct mmc_host	*prev_mmc = host->cur_slot->mmc;
+	struct mmc_host	*prev_mmc = host->slot->mmc;
 
 	WARN_ON(host->cmd || host->data);
 
-	host->cur_slot->mrq = NULL;
+	host->slot->mrq = NULL;
 	host->mrq = NULL;
 	if (!list_empty(&host->queue)) {
 		slot = list_entry(host->queue.next,
@@ -1944,7 +1943,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
 			err = dw_mci_command_complete(host, cmd);
 			if (cmd == mrq->sbc && !err) {
 				prev_state = state = STATE_SENDING_CMD;
-				__dw_mci_start_request(host, host->cur_slot,
+				__dw_mci_start_request(host, host->slot,
 						       mrq->cmd);
 				goto unlock;
 			}
@@ -3261,9 +3260,9 @@ int dw_mci_runtime_suspend(struct device *dev)
 
 	clk_disable_unprepare(host->ciu_clk);
 
-	if (host->cur_slot &&
-	    (mmc_can_gpio_cd(host->cur_slot->mmc) ||
-	     !mmc_card_is_removable(host->cur_slot->mmc)))
+	if (host->slot &&
+	    (mmc_can_gpio_cd(host->slot->mmc) ||
+	     !mmc_card_is_removable(host->slot->mmc)))
 		clk_disable_unprepare(host->biu_clk);
 
 	return 0;
@@ -3276,9 +3275,9 @@ int dw_mci_runtime_resume(struct device *dev)
 	struct dw_mci *host = dev_get_drvdata(dev);
 	struct dw_mci_slot *slot = host->slot;
 
-	if (host->cur_slot &&
-	    (mmc_can_gpio_cd(host->cur_slot->mmc) ||
-	     !mmc_card_is_removable(host->cur_slot->mmc))) {
+	if (host->slot &&
+	    (mmc_can_gpio_cd(host->slot->mmc) ||
+	     !mmc_card_is_removable(host->slot->mmc))) {
 		ret = clk_prepare_enable(host->biu_clk);
 		if (ret)
 			return ret;
@@ -3326,9 +3325,9 @@ int dw_mci_runtime_resume(struct device *dev)
 	return 0;
 
 err:
-	if (host->cur_slot &&
-	    (mmc_can_gpio_cd(host->cur_slot->mmc) ||
-	     !mmc_card_is_removable(host->cur_slot->mmc)))
+	if (host->slot &&
+	    (mmc_can_gpio_cd(host->slot->mmc) ||
+	     !mmc_card_is_removable(host->slot->mmc)))
 		clk_disable_unprepare(host->biu_clk);
 
 	return ret;
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 1ec8f40..75da375 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -132,7 +132,6 @@ struct dw_mci_dma_slave {
  * =======
  *
  * @lock is a softirq-safe spinlock protecting @queue as well as
- * @cur_slot, @mrq and @state. These must always be updated
  * at the same time while holding @lock.
  *
  * @irq_lock is an irq-safe spinlock protecting the INTMASK register
@@ -168,7 +167,6 @@ struct dw_mci {
 	struct scatterlist	*sg;
 	struct sg_mapping_iter	sg_miter;
 
-	struct dw_mci_slot	*cur_slot;
 	struct mmc_request	*mrq;
 	struct mmc_command	*cmd;
 	struct mmc_data		*data;
@@ -204,7 +202,6 @@ struct dw_mci {
 
 	u32			bus_hz;
 	u32			current_speed;
-	u32			num_slots;
 	u32			fifoth_val;
 	u16			verid;
 	struct device		*dev;
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/6] mmc: dw_mmc: remove the unnecessary slot variable
       [not found]   ` <CGME20170605044137epcas1p4e618a41342719da1ba318627baff7098@epcas1p4.samsung.com>
@ 2017-06-05  4:41     ` Jaehoon Chung
  0 siblings, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2017-06-05  4:41 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, Jaehoon Chung

Remove the unnecessary slot variable.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/host/dw_mmc.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 97a8b0c..a9dfb26 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2995,17 +2995,15 @@ static void dw_mci_enable_cd(struct dw_mci *host)
 {
 	unsigned long irqflags;
 	u32 temp;
-	struct dw_mci_slot *slot;
 
 	/*
 	 * No need for CD if all slots have a non-error GPIO
 	 * as well as broken card detection is found.
 	 */
-	slot = host->slot;
-	if (slot->mmc->caps & MMC_CAP_NEEDS_POLL)
+	if (host->slot->mmc->caps & MMC_CAP_NEEDS_POLL)
 		return;
 
-	if (mmc_gpio_get_cd(slot->mmc) < 0) {
+	if (mmc_gpio_get_cd(host->slot->mmc) < 0) {
 		spin_lock_irqsave(&host->irq_lock, irqflags);
 		temp = mci_readl(host, INTMASK);
 		temp  |= SDMMC_INT_CD;
@@ -3273,7 +3271,6 @@ int dw_mci_runtime_resume(struct device *dev)
 {
 	int ret = 0;
 	struct dw_mci *host = dev_get_drvdata(dev);
-	struct dw_mci_slot *slot = host->slot;
 
 	if (host->slot &&
 	    (mmc_can_gpio_cd(host->slot->mmc) ||
@@ -3313,11 +3310,11 @@ int dw_mci_runtime_resume(struct device *dev)
 	mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE);
 
 
-	if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER)
-		dw_mci_set_ios(slot->mmc, &slot->mmc->ios);
+	if (host->slot->mmc->pm_flags & MMC_PM_KEEP_POWER)
+		dw_mci_set_ios(host->slot->mmc, &host->slot->mmc->ios);
 
 	/* Force setup bus to guarantee available clock output */
-	dw_mci_setup_bus(slot, true);
+	dw_mci_setup_bus(host->slot, true);
 
 	/* Now that slots are all setup, we can enable card detect */
 	dw_mci_enable_cd(host);
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/6] mmc: dw_mmc: remove the multiple slot concept
  2017-06-05  4:41 ` [PATCH 0/6] mmc: dw_mmc: remove the multiple slot concept Jaehoon Chung
                     ` (5 preceding siblings ...)
       [not found]   ` <CGME20170605044137epcas1p4e618a41342719da1ba318627baff7098@epcas1p4.samsung.com>
@ 2017-06-08 13:52   ` Ulf Hansson
  2017-06-12 22:13     ` Jaehoon Chung
  2017-06-09  1:38   ` Shawn Lin
  2017-06-29 10:56   ` Jaehoon Chung
  8 siblings, 1 reply; 11+ messages in thread
From: Ulf Hansson @ 2017-06-08 13:52 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc, Shawn Lin

On 5 June 2017 at 06:41, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> DWMMC IP is provided the multiple slot.
> It's only used the one slot per an IP in mmc subsystem.
> If we can consider only one slot, then dwmmc controller codes can be more simpler than now.
> This patchset is the first step to remove the multiple slot.
>
> In future work,
>    - Remove the entire slot structure.
>    - Move to slot's members into dwmci host.
>
> Jaehoon Chung (6):
>   mmc: dw_mmc: deprecated the "num-slots" property
>   mmc: dw_mmc: remove the loop about finding slots
>   mmc: dw_mmc: change the array of slots
>   mmc: dw_mmc: remove the 'id' arguments about functions relevant to
>     slot
>   mmc: dw_mmc: use the 'slot' instead of 'cur_slot'
>   mmc: dw_mmc: remove the unnecessary slot variable
>
>  drivers/mmc/host/dw_mmc-exynos.c |   4 +-
>  drivers/mmc/host/dw_mmc.c        | 165 +++++++++++++--------------------------
>  drivers/mmc/host/dw_mmc.h        |   7 +-
>  3 files changed, 57 insertions(+), 119 deletions(-)
>
> --
> 2.10.2
>

This looks good to me, however I couldn't apply them cleanly on my next branch.

Perhaps you have something additional for dw_mmc in you local tree?
Then never mind, I can pick these via your regular pull request.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/6] mmc: dw_mmc: remove the multiple slot concept
  2017-06-05  4:41 ` [PATCH 0/6] mmc: dw_mmc: remove the multiple slot concept Jaehoon Chung
                     ` (6 preceding siblings ...)
  2017-06-08 13:52   ` [PATCH 0/6] mmc: dw_mmc: remove the multiple slot concept Ulf Hansson
@ 2017-06-09  1:38   ` Shawn Lin
  2017-06-29 10:56   ` Jaehoon Chung
  8 siblings, 0 replies; 11+ messages in thread
From: Shawn Lin @ 2017-06-09  1:38 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc, shawn.lin, ulf.hansson

Hi Jaehoon,

On 2017/6/5 12:41, Jaehoon Chung wrote:
> DWMMC IP is provided the multiple slot.
> It's only used the one slot per an IP in mmc subsystem.
> If we can consider only one slot, then dwmmc controller codes can be more simpler than now.
> This patchset is the first step to remove the multiple slot.
> 
> In future work,
>     - Remove the entire slot structure.
>     - Move to slot's members into dwmci host.
> 

The whole series looks good to me.

Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>

> Jaehoon Chung (6):
>    mmc: dw_mmc: deprecated the "num-slots" property
>    mmc: dw_mmc: remove the loop about finding slots
>    mmc: dw_mmc: change the array of slots
>    mmc: dw_mmc: remove the 'id' arguments about functions relevant to
>      slot
>    mmc: dw_mmc: use the 'slot' instead of 'cur_slot'
>    mmc: dw_mmc: remove the unnecessary slot variable
> 
>   drivers/mmc/host/dw_mmc-exynos.c |   4 +-
>   drivers/mmc/host/dw_mmc.c        | 165 +++++++++++++--------------------------
>   drivers/mmc/host/dw_mmc.h        |   7 +-
>   3 files changed, 57 insertions(+), 119 deletions(-)
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/6] mmc: dw_mmc: remove the multiple slot concept
  2017-06-08 13:52   ` [PATCH 0/6] mmc: dw_mmc: remove the multiple slot concept Ulf Hansson
@ 2017-06-12 22:13     ` Jaehoon Chung
  0 siblings, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2017-06-12 22:13 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Shawn Lin

On 06/08/2017 10:52 PM, Ulf Hansson wrote:
> On 5 June 2017 at 06:41, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> DWMMC IP is provided the multiple slot.
>> It's only used the one slot per an IP in mmc subsystem.
>> If we can consider only one slot, then dwmmc controller codes can be more simpler than now.
>> This patchset is the first step to remove the multiple slot.
>>
>> In future work,
>>    - Remove the entire slot structure.
>>    - Move to slot's members into dwmci host.
>>
>> Jaehoon Chung (6):
>>   mmc: dw_mmc: deprecated the "num-slots" property
>>   mmc: dw_mmc: remove the loop about finding slots
>>   mmc: dw_mmc: change the array of slots
>>   mmc: dw_mmc: remove the 'id' arguments about functions relevant to
>>     slot
>>   mmc: dw_mmc: use the 'slot' instead of 'cur_slot'
>>   mmc: dw_mmc: remove the unnecessary slot variable
>>
>>  drivers/mmc/host/dw_mmc-exynos.c |   4 +-
>>  drivers/mmc/host/dw_mmc.c        | 165 +++++++++++++--------------------------
>>  drivers/mmc/host/dw_mmc.h        |   7 +-
>>  3 files changed, 57 insertions(+), 119 deletions(-)
>>
>> --
>> 2.10.2
>>
> 
> This looks good to me, however I couldn't apply them cleanly on my next branch.
> 
> Perhaps you have something additional for dw_mmc in you local tree?
> Then never mind, I can pick these via your regular pull request.

Will send PR..Thanks!

Best Regards,
Jaehoon Chung

> 
> Kind regards
> Uffe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/6] mmc: dw_mmc: remove the multiple slot concept
  2017-06-05  4:41 ` [PATCH 0/6] mmc: dw_mmc: remove the multiple slot concept Jaehoon Chung
                     ` (7 preceding siblings ...)
  2017-06-09  1:38   ` Shawn Lin
@ 2017-06-29 10:56   ` Jaehoon Chung
  8 siblings, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2017-06-29 10:56 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin

On 06/05/2017 01:41 PM, Jaehoon Chung wrote:
> DWMMC IP is provided the multiple slot.
> It's only used the one slot per an IP in mmc subsystem.
> If we can consider only one slot, then dwmmc controller codes can be more simpler than now.
> This patchset is the first step to remove the multiple slot.
> 
> In future work,
>    - Remove the entire slot structure.
>    - Move to slot's members into dwmci host.

Applied to my dwmmc repository.

Best Regards,
Jaehoon Chung

> 
> Jaehoon Chung (6):
>   mmc: dw_mmc: deprecated the "num-slots" property
>   mmc: dw_mmc: remove the loop about finding slots
>   mmc: dw_mmc: change the array of slots
>   mmc: dw_mmc: remove the 'id' arguments about functions relevant to
>     slot
>   mmc: dw_mmc: use the 'slot' instead of 'cur_slot'
>   mmc: dw_mmc: remove the unnecessary slot variable
> 
>  drivers/mmc/host/dw_mmc-exynos.c |   4 +-
>  drivers/mmc/host/dw_mmc.c        | 165 +++++++++++++--------------------------
>  drivers/mmc/host/dw_mmc.h        |   7 +-
>  3 files changed, 57 insertions(+), 119 deletions(-)
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-06-29 10:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170605044137epcas1p4e7e2b74aa17ea7d7137da7b677bfb282@epcas1p4.samsung.com>
2017-06-05  4:41 ` [PATCH 0/6] mmc: dw_mmc: remove the multiple slot concept Jaehoon Chung
     [not found]   ` <CGME20170605044137epcas1p408ff8655bcf8084e758f358ff0ed632e@epcas1p4.samsung.com>
2017-06-05  4:41     ` [PATCH 1/6] mmc: dw_mmc: deprecated the "num-slots" property Jaehoon Chung
     [not found]   ` <CGME20170605044137epcas1p47fa50e6e9a2b68eccc1f726a33e14c0e@epcas1p4.samsung.com>
2017-06-05  4:41     ` [PATCH 2/6] mmc: dw_mmc: remove the loop about finding slots Jaehoon Chung
     [not found]   ` <CGME20170605044137epcas1p413b27e4b2f3db83c1623acf4cc2b9cdc@epcas1p4.samsung.com>
2017-06-05  4:41     ` [PATCH 3/6] mmc: dw_mmc: change the array of slots Jaehoon Chung
     [not found]   ` <CGME20170605044137epcas1p4c0df9a32c3987a0c4751900cdb439650@epcas1p4.samsung.com>
2017-06-05  4:41     ` [PATCH 4/6] mmc: dw_mmc: remove the 'id' arguments about functions relevant to slot Jaehoon Chung
     [not found]   ` <CGME20170605044137epcas1p44c44e94f8514d5115daaa83593d57c98@epcas1p4.samsung.com>
2017-06-05  4:41     ` [PATCH 5/6] mmc: dw_mmc: use the 'slot' instead of 'cur_slot' Jaehoon Chung
     [not found]   ` <CGME20170605044137epcas1p4e618a41342719da1ba318627baff7098@epcas1p4.samsung.com>
2017-06-05  4:41     ` [PATCH 6/6] mmc: dw_mmc: remove the unnecessary slot variable Jaehoon Chung
2017-06-08 13:52   ` [PATCH 0/6] mmc: dw_mmc: remove the multiple slot concept Ulf Hansson
2017-06-12 22:13     ` Jaehoon Chung
2017-06-09  1:38   ` Shawn Lin
2017-06-29 10:56   ` Jaehoon Chung

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.