All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller
@ 2016-11-17  7:40 ` Jaehoon Chung
  2016-11-17  7:40   ` [PATCHv3 1/9] mmc: dw_mmc: display the real register value on debugfs Jaehoon Chung
                     ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Jaehoon Chung @ 2016-11-17  7:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, adrian.hunter, Jaehoon Chung

This patchset is modified the some minor fixing and cleaning codes.

* Major changes
- Remove the unnecessary codes and use_stop_abort() by default.
- Remove the obsoleted property "supports-highspeed"
- Deprecated the "clock-freq-min-max" property. Instead, use "max-frequency"
- Minimum clock value is set to 100K by default.

Change in v3:
- Use the dwmmc private cookie enum.
- Add the reviewed-by and acked-by tags.

Change in v2:
- Applied patches relevant to dt files
- Use "deprecated" instead of removing about "clock-freq-min-max"
- Added Heiko's Tested-by tag

Jaehoon Chung (9):
  mmc: dw_mmc: display the real register value on debugfs
  mmc: dw_mmc: fix the debug message for checking card's present
  mmc: dw_mmc: change the DW_MCI_FREQ_MIN from 400K to 100K
  mmc: dw_mmc: use the hold register when send stop command
  mmc: dw_mmc: call the dw_mci_prep_stop_abort() by default
  mmc: dw_mmc: use the cookie's enum values for post/pre_req()
  mmc: dw_mmc: remove the unnecessary mmc_data structure
  mmc: dw_mmc: The "clock-freq-min-max" property was deprecated
  Documentation: synopsys-dw-mshc: remove the unused properties

 .../devicetree/bindings/mmc/synopsys-dw-mshc.txt   |  8 +-
 drivers/mmc/host/dw_mmc.c                          | 88 +++++++++++-----------
 include/linux/mmc/dw_mmc.h                         |  6 ++
 3 files changed, 50 insertions(+), 52 deletions(-)

-- 
2.10.1


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

* [PATCHv3 1/9] mmc: dw_mmc: display the real register value on debugfs
  2016-11-17  7:40 ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
@ 2016-11-17  7:40   ` Jaehoon Chung
  2016-11-17  7:40   ` [PATCHv3 2/9] mmc: dw_mmc: fix the debug message for checking card's present Jaehoon Chung
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Jaehoon Chung @ 2016-11-17  7:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, adrian.hunter, Jaehoon Chung

Developer wants to see the real register value, not register offset.
This patch fixed to display the real value of register.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
---
 drivers/mmc/host/dw_mmc.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 9341b18..7ffd57b 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -165,12 +165,14 @@ static const struct file_operations dw_mci_req_fops = {
 
 static int dw_mci_regs_show(struct seq_file *s, void *v)
 {
-	seq_printf(s, "STATUS:\t0x%08x\n", SDMMC_STATUS);
-	seq_printf(s, "RINTSTS:\t0x%08x\n", SDMMC_RINTSTS);
-	seq_printf(s, "CMD:\t0x%08x\n", SDMMC_CMD);
-	seq_printf(s, "CTRL:\t0x%08x\n", SDMMC_CTRL);
-	seq_printf(s, "INTMASK:\t0x%08x\n", SDMMC_INTMASK);
-	seq_printf(s, "CLKENA:\t0x%08x\n", SDMMC_CLKENA);
+	struct dw_mci *host = s->private;
+
+	seq_printf(s, "STATUS:\t0x%08x\n", mci_readl(host, STATUS));
+	seq_printf(s, "RINTSTS:\t0x%08x\n", mci_readl(host, RINTSTS));
+	seq_printf(s, "CMD:\t0x%08x\n", mci_readl(host, CMD));
+	seq_printf(s, "CTRL:\t0x%08x\n", mci_readl(host, CTRL));
+	seq_printf(s, "INTMASK:\t0x%08x\n", mci_readl(host, INTMASK));
+	seq_printf(s, "CLKENA:\t0x%08x\n", mci_readl(host, CLKENA));
 
 	return 0;
 }
-- 
2.10.1


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

* [PATCHv3 2/9] mmc: dw_mmc: fix the debug message for checking card's present
  2016-11-17  7:40 ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
  2016-11-17  7:40   ` [PATCHv3 1/9] mmc: dw_mmc: display the real register value on debugfs Jaehoon Chung
@ 2016-11-17  7:40   ` Jaehoon Chung
  2016-11-17  7:40   ` [PATCHv3 3/9] mmc: dw_mmc: change the DW_MCI_FREQ_MIN from 400K to 100K Jaehoon Chung
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Jaehoon Chung @ 2016-11-17  7:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, adrian.hunter, Jaehoon Chung

If display the debug message, this message should be spamming.
If flags is maintained the previous value, didn't display the debug
message.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
---
 drivers/mmc/host/dw_mmc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 7ffd57b..6adefb8 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1537,13 +1537,10 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
 			== 0 ? 1 : 0;
 
 	spin_lock_bh(&host->lock);
-	if (present) {
-		set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
+	if (present && !test_and_set_bit(DW_MMC_CARD_PRESENT, &slot->flags))
 		dev_dbg(&mmc->class_dev, "card is present\n");
-	} else {
-		clear_bit(DW_MMC_CARD_PRESENT, &slot->flags);
+	else if (!test_and_clear_bit(DW_MMC_CARD_PRESENT, &slot->flags))
 		dev_dbg(&mmc->class_dev, "card is not present\n");
-	}
 	spin_unlock_bh(&host->lock);
 
 	return present;
-- 
2.10.1


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

* [PATCHv3 3/9] mmc: dw_mmc: change the DW_MCI_FREQ_MIN from 400K to 100K
  2016-11-17  7:40 ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
  2016-11-17  7:40   ` [PATCHv3 1/9] mmc: dw_mmc: display the real register value on debugfs Jaehoon Chung
  2016-11-17  7:40   ` [PATCHv3 2/9] mmc: dw_mmc: fix the debug message for checking card's present Jaehoon Chung
@ 2016-11-17  7:40   ` Jaehoon Chung
  2016-11-17  7:40   ` [PATCHv3 4/9] mmc: dw_mmc: use the hold register when send stop command Jaehoon Chung
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Jaehoon Chung @ 2016-11-17  7:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, adrian.hunter, Jaehoon Chung

If there is no property "clock-freq-min-max", mmc->f_min should be set
to 400K by default. But Some SoC can be used 100K.
When 100K is used, MMC core will try to check from 400K to 100K.

Reported-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
---
 drivers/mmc/host/dw_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 6adefb8..d5f0384 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -54,7 +54,7 @@
 #define DW_MCI_DMA_THRESHOLD	16
 
 #define DW_MCI_FREQ_MAX	200000000	/* unit: HZ */
-#define DW_MCI_FREQ_MIN	400000		/* unit: HZ */
+#define DW_MCI_FREQ_MIN	100000		/* unit: HZ */
 
 #define IDMAC_INT_CLR		(SDMMC_IDMAC_INT_AI | SDMMC_IDMAC_INT_NI | \
 				 SDMMC_IDMAC_INT_CES | SDMMC_IDMAC_INT_DU | \
-- 
2.10.1


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

* [PATCHv3 4/9] mmc: dw_mmc: use the hold register when send stop command
  2016-11-17  7:40 ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
                     ` (2 preceding siblings ...)
  2016-11-17  7:40   ` [PATCHv3 3/9] mmc: dw_mmc: change the DW_MCI_FREQ_MIN from 400K to 100K Jaehoon Chung
@ 2016-11-17  7:40   ` Jaehoon Chung
  2016-11-17  7:40   ` [PATCHv3 5/9] mmc: dw_mmc: call the dw_mci_prep_stop_abort() by default Jaehoon Chung
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Jaehoon Chung @ 2016-11-17  7:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, adrian.hunter, Jaehoon Chung

If DW_MMC_CARD_NO_USE_HOLD isn't set, it's usesd by default.
Enve if SDMMC_CMD_USB_HOLD_REG is set in prepare_command(), but it
doesn't set in pre_stop_abort().

To maintain the consistency, add the checking condition for this.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
---
 drivers/mmc/host/dw_mmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index d5f0384..f592280 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -337,6 +337,9 @@ 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))
+		cmdr |= SDMMC_CMD_USE_HOLD_REG;
+
 	return cmdr;
 }
 
-- 
2.10.1


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

* [PATCHv3 5/9] mmc: dw_mmc: call the dw_mci_prep_stop_abort() by default
  2016-11-17  7:40 ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
                     ` (3 preceding siblings ...)
  2016-11-17  7:40   ` [PATCHv3 4/9] mmc: dw_mmc: use the hold register when send stop command Jaehoon Chung
@ 2016-11-17  7:40   ` Jaehoon Chung
  2016-11-17  7:51     ` Shawn Lin
  2016-11-17  7:40   ` [PATCHv3 6/9] mmc: dw_mmc: use the cookie's enum values for post/pre_req() Jaehoon Chung
                     ` (4 subsequent siblings)
  9 siblings, 1 reply; 12+ messages in thread
From: Jaehoon Chung @ 2016-11-17  7:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, adrian.hunter, Jaehoon Chung

stop_cmdr should be set to values relevant to stop command.
It migth be assigned to values whatever there is mrq->stop or not.
Then it doesn't need to use dw_mci_prepare_command().
It's enough to use the prep_stop_abort for preparing stop command.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/mmc/host/dw_mmc.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index f592280..f01b5ce 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -385,7 +385,7 @@ static void dw_mci_start_command(struct dw_mci *host,
 
 static inline void send_stop_abort(struct dw_mci *host, struct mmc_data *data)
 {
-	struct mmc_command *stop = data->stop ? data->stop : &host->stop_abort;
+	struct mmc_command *stop = &host->stop_abort;
 
 	dw_mci_start_command(host, stop, host->stop_cmdr);
 }
@@ -1277,10 +1277,7 @@ static void __dw_mci_start_request(struct dw_mci *host,
 		spin_unlock_irqrestore(&host->irq_lock, irqflags);
 	}
 
-	if (mrq->stop)
-		host->stop_cmdr = dw_mci_prepare_command(slot->mmc, mrq->stop);
-	else
-		host->stop_cmdr = dw_mci_prep_stop_abort(host, cmd);
+	host->stop_cmdr = dw_mci_prep_stop_abort(host, cmd);
 }
 
 static void dw_mci_start_request(struct dw_mci *host,
@@ -1890,8 +1887,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
 			if (test_and_clear_bit(EVENT_DATA_ERROR,
 					       &host->pending_events)) {
 				dw_mci_stop_dma(host);
-				if (data->stop ||
-				    !(host->data_status & (SDMMC_INT_DRTO |
+				if (!(host->data_status & (SDMMC_INT_DRTO |
 							   SDMMC_INT_EBE)))
 					send_stop_abort(host, data);
 				state = STATE_DATA_ERROR;
@@ -1927,8 +1923,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
 			if (test_and_clear_bit(EVENT_DATA_ERROR,
 					       &host->pending_events)) {
 				dw_mci_stop_dma(host);
-				if (data->stop ||
-				    !(host->data_status & (SDMMC_INT_DRTO |
+				if (!(host->data_status & (SDMMC_INT_DRTO |
 							   SDMMC_INT_EBE)))
 					send_stop_abort(host, data);
 				state = STATE_DATA_ERROR;
@@ -2004,7 +1999,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
 			host->cmd = NULL;
 			host->data = NULL;
 
-			if (mrq->stop)
+			if (!mrq->sbc && mrq->stop)
 				dw_mci_command_complete(host, mrq->stop);
 			else
 				host->cmd_status = 0;
-- 
2.10.1


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

* [PATCHv3 6/9] mmc: dw_mmc: use the cookie's enum values for post/pre_req()
  2016-11-17  7:40 ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
                     ` (4 preceding siblings ...)
  2016-11-17  7:40   ` [PATCHv3 5/9] mmc: dw_mmc: call the dw_mci_prep_stop_abort() by default Jaehoon Chung
@ 2016-11-17  7:40   ` Jaehoon Chung
  2016-11-17  7:40   ` [PATCHv3 7/9] mmc: dw_mmc: remove the unnecessary mmc_data structure Jaehoon Chung
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Jaehoon Chung @ 2016-11-17  7:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, adrian.hunter, Jaehoon Chung

This patch removed the meaningless value. Instead, use the cookie's enum
values for executing correctly.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/mmc/host/dw_mmc.c  | 39 +++++++++++++++++++--------------------
 include/linux/mmc/dw_mmc.h |  6 ++++++
 2 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index f01b5ce..d2fae00 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -414,12 +414,13 @@ static void dw_mci_dma_cleanup(struct dw_mci *host)
 {
 	struct mmc_data *data = host->data;
 
-	if (data)
-		if (!data->host_cookie)
-			dma_unmap_sg(host->dev,
-				     data->sg,
-				     data->sg_len,
-				     dw_mci_get_dma_dir(data));
+	if (data && data->host_cookie == COOKIE_MAPPED) {
+		dma_unmap_sg(host->dev,
+			     data->sg,
+			     data->sg_len,
+			     dw_mci_get_dma_dir(data));
+		data->host_cookie = COOKIE_UNMAPPED;
+	}
 }
 
 static void dw_mci_idmac_reset(struct dw_mci *host)
@@ -850,13 +851,13 @@ static const struct dw_mci_dma_ops dw_mci_edmac_ops = {
 
 static int dw_mci_pre_dma_transfer(struct dw_mci *host,
 				   struct mmc_data *data,
-				   bool next)
+				   int cookie)
 {
 	struct scatterlist *sg;
 	unsigned int i, sg_len;
 
-	if (!next && data->host_cookie)
-		return data->host_cookie;
+	if (data->host_cookie == COOKIE_PRE_MAPPED)
+		return data->sg_len;
 
 	/*
 	 * We don't do DMA on "complex" transfers, i.e. with
@@ -881,8 +882,7 @@ static int dw_mci_pre_dma_transfer(struct dw_mci *host,
 	if (sg_len == 0)
 		return -EINVAL;
 
-	if (next)
-		data->host_cookie = sg_len;
+	data->host_cookie = cookie;
 
 	return sg_len;
 }
@@ -897,13 +897,12 @@ static void dw_mci_pre_req(struct mmc_host *mmc,
 	if (!slot->host->use_dma || !data)
 		return;
 
-	if (data->host_cookie) {
-		data->host_cookie = 0;
-		return;
-	}
+	/* This data might be unmapped at this time */
+	data->host_cookie = COOKIE_UNMAPPED;
 
-	if (dw_mci_pre_dma_transfer(slot->host, mrq->data, 1) < 0)
-		data->host_cookie = 0;
+	if (dw_mci_pre_dma_transfer(slot->host, mrq->data,
+				COOKIE_PRE_MAPPED) < 0)
+		data->host_cookie = COOKIE_UNMAPPED;
 }
 
 static void dw_mci_post_req(struct mmc_host *mmc,
@@ -916,12 +915,12 @@ static void dw_mci_post_req(struct mmc_host *mmc,
 	if (!slot->host->use_dma || !data)
 		return;
 
-	if (data->host_cookie)
+	if (data->host_cookie != COOKIE_UNMAPPED)
 		dma_unmap_sg(slot->host->dev,
 			     data->sg,
 			     data->sg_len,
 			     dw_mci_get_dma_dir(data));
-	data->host_cookie = 0;
+	data->host_cookie = COOKIE_UNMAPPED;
 }
 
 static void dw_mci_adjust_fifoth(struct dw_mci *host, struct mmc_data *data)
@@ -1027,7 +1026,7 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data)
 	if (!host->use_dma)
 		return -ENODEV;
 
-	sg_len = dw_mci_pre_dma_transfer(host, data, 0);
+	sg_len = dw_mci_pre_dma_transfer(host, data, COOKIE_MAPPED);
 	if (sg_len < 0) {
 		host->dma_ops->stop(host);
 		return sg_len;
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index f5af2bd..15db6f8 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -39,6 +39,12 @@ enum {
 	EVENT_DATA_ERROR,
 };
 
+enum dw_mci_cookie {
+	COOKIE_UNMAPPED,
+	COOKIE_PRE_MAPPED,	/* mapped by pre_req() of dwmmc */
+	COOKIE_MAPPED,		/* mapped by prepare_data() of dwmmc */
+};
+
 struct mmc_data;
 
 enum {
-- 
2.10.1


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

* [PATCHv3 7/9] mmc: dw_mmc: remove the unnecessary mmc_data structure
  2016-11-17  7:40 ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
                     ` (5 preceding siblings ...)
  2016-11-17  7:40   ` [PATCHv3 6/9] mmc: dw_mmc: use the cookie's enum values for post/pre_req() Jaehoon Chung
@ 2016-11-17  7:40   ` Jaehoon Chung
  2016-11-17  7:40   ` [PATCHv3 8/9] mmc: dw_mmc: The "clock-freq-min-max" property was deprecated Jaehoon Chung
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Jaehoon Chung @ 2016-11-17  7:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, adrian.hunter, Jaehoon Chung

Remove the unnecessary mmc_data structure.
Instead, cmd->data can be used.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
---
 drivers/mmc/host/dw_mmc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index d2fae00..40afb45 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -236,7 +236,6 @@ static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg);
 
 static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
 {
-	struct mmc_data	*data;
 	struct dw_mci_slot *slot = mmc_priv(mmc);
 	struct dw_mci *host = slot->host;
 	u32 cmdr;
@@ -291,10 +290,9 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
 	if (cmd->flags & MMC_RSP_CRC)
 		cmdr |= SDMMC_CMD_RESP_CRC;
 
-	data = cmd->data;
-	if (data) {
+	if (cmd->data) {
 		cmdr |= SDMMC_CMD_DAT_EXP;
-		if (data->flags & MMC_DATA_WRITE)
+		if (cmd->data->flags & MMC_DATA_WRITE)
 			cmdr |= SDMMC_CMD_DAT_WR;
 	}
 
-- 
2.10.1


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

* [PATCHv3 8/9] mmc: dw_mmc: The "clock-freq-min-max" property was deprecated
  2016-11-17  7:40 ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
                     ` (6 preceding siblings ...)
  2016-11-17  7:40   ` [PATCHv3 7/9] mmc: dw_mmc: remove the unnecessary mmc_data structure Jaehoon Chung
@ 2016-11-17  7:40   ` Jaehoon Chung
  2016-11-17  7:40   ` [PATCHv3 9/9] Documentation: synopsys-dw-mshc: remove the unused properties Jaehoon Chung
  2016-11-18 11:17   ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
  9 siblings, 0 replies; 12+ messages in thread
From: Jaehoon Chung @ 2016-11-17  7:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, adrian.hunter, Jaehoon Chung

The "clock-freq-min-max" property was deprecated.
There is "max-frequency" property in drivers/mmc/core/host.c
"max-frequency" can be replaced with "clock-freq-min-max".
Minimum clock value might be set to 100K by default.
Then MMC core should try to find the correct value from 400K to 100K.
So it just needs to set Maximum clock value.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt | 3 ++-
 drivers/mmc/host/dw_mmc.c                                  | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
index bfa461a..1279a22 100644
--- a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
@@ -59,8 +59,9 @@ Optional properties:
   is specified and the ciu clock is specified then we'll try to set the ciu
   clock to this at probe time.
 
-* clock-freq-min-max: Minimum and Maximum clock frequency for card output
+* clock-freq-min-max (DEPRECATED): Minimum and Maximum clock frequency for card output
   clock(cclk_out). If it's not specified, max is 200MHZ and min is 400KHz by default.
+	  (Use the "max-frequency" instead of "clock-freq-min-max".)
 
 * num-slots: specifies the number of slots supported by the controller.
   The number of physical slots actually used could be equal or less than the
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 40afb45..3638364 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2608,6 +2608,8 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 		mmc->f_min = DW_MCI_FREQ_MIN;
 		mmc->f_max = DW_MCI_FREQ_MAX;
 	} else {
+		dev_info(host->dev,
+			"'clock-freq-min-max' property was deprecated.\n");
 		mmc->f_min = freq[0];
 		mmc->f_max = freq[1];
 	}
-- 
2.10.1


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

* [PATCHv3 9/9] Documentation: synopsys-dw-mshc: remove the unused properties
  2016-11-17  7:40 ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
                     ` (7 preceding siblings ...)
  2016-11-17  7:40   ` [PATCHv3 8/9] mmc: dw_mmc: The "clock-freq-min-max" property was deprecated Jaehoon Chung
@ 2016-11-17  7:40   ` Jaehoon Chung
  2016-11-18 11:17   ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
  9 siblings, 0 replies; 12+ messages in thread
From: Jaehoon Chung @ 2016-11-17  7:40 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, adrian.hunter, Jaehoon Chung

"support-highspeed" was the obsoleted property.
And "broken-cd" is not synopsys specific property.
It can be referred to mmc.txt binding Documentation.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
---
 Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
index 1279a22..7fd17c3 100644
--- a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
@@ -75,11 +75,6 @@ Optional properties:
 * card-detect-delay: Delay in milli-seconds before detecting card after card
   insert event. The default value is 0.
 
-* supports-highspeed (DEPRECATED): Enables support for high speed cards (up to 50MHz)
-			   (use "cap-mmc-highspeed" or "cap-sd-highspeed" instead)
-
-* broken-cd: as documented in mmc core bindings.
-
 * vmmc-supply: The phandle to the regulator to use for vmmc.  If this is
   specified we'll defer probe until we can find this regulator.
 
-- 
2.10.1


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

* Re: [PATCHv3 5/9] mmc: dw_mmc: call the dw_mci_prep_stop_abort() by default
  2016-11-17  7:40   ` [PATCHv3 5/9] mmc: dw_mmc: call the dw_mci_prep_stop_abort() by default Jaehoon Chung
@ 2016-11-17  7:51     ` Shawn Lin
  0 siblings, 0 replies; 12+ messages in thread
From: Shawn Lin @ 2016-11-17  7:51 UTC (permalink / raw)
  To: Jaehoon Chung, linux-mmc; +Cc: shawn.lin, ulf.hansson, adrian.hunter

在 2016/11/17 15:40, Jaehoon Chung 写道:
> stop_cmdr should be set to values relevant to stop command.
> It migth be assigned to values whatever there is mrq->stop or not.
> Then it doesn't need to use dw_mci_prepare_command().
> It's enough to use the prep_stop_abort for preparing stop command.
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> Tested-by: Heiko Stuebner <heiko@sntech.de>

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

> ---
>  drivers/mmc/host/dw_mmc.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index f592280..f01b5ce 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -385,7 +385,7 @@ static void dw_mci_start_command(struct dw_mci *host,
>
>  static inline void send_stop_abort(struct dw_mci *host, struct mmc_data *data)
>  {
> -	struct mmc_command *stop = data->stop ? data->stop : &host->stop_abort;
> +	struct mmc_command *stop = &host->stop_abort;
>
>  	dw_mci_start_command(host, stop, host->stop_cmdr);
>  }
> @@ -1277,10 +1277,7 @@ static void __dw_mci_start_request(struct dw_mci *host,
>  		spin_unlock_irqrestore(&host->irq_lock, irqflags);
>  	}
>
> -	if (mrq->stop)
> -		host->stop_cmdr = dw_mci_prepare_command(slot->mmc, mrq->stop);
> -	else
> -		host->stop_cmdr = dw_mci_prep_stop_abort(host, cmd);
> +	host->stop_cmdr = dw_mci_prep_stop_abort(host, cmd);
>  }
>
>  static void dw_mci_start_request(struct dw_mci *host,
> @@ -1890,8 +1887,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
>  			if (test_and_clear_bit(EVENT_DATA_ERROR,
>  					       &host->pending_events)) {
>  				dw_mci_stop_dma(host);
> -				if (data->stop ||
> -				    !(host->data_status & (SDMMC_INT_DRTO |
> +				if (!(host->data_status & (SDMMC_INT_DRTO |
>  							   SDMMC_INT_EBE)))
>  					send_stop_abort(host, data);
>  				state = STATE_DATA_ERROR;
> @@ -1927,8 +1923,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
>  			if (test_and_clear_bit(EVENT_DATA_ERROR,
>  					       &host->pending_events)) {
>  				dw_mci_stop_dma(host);
> -				if (data->stop ||
> -				    !(host->data_status & (SDMMC_INT_DRTO |
> +				if (!(host->data_status & (SDMMC_INT_DRTO |
>  							   SDMMC_INT_EBE)))
>  					send_stop_abort(host, data);
>  				state = STATE_DATA_ERROR;
> @@ -2004,7 +1999,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
>  			host->cmd = NULL;
>  			host->data = NULL;
>
> -			if (mrq->stop)
> +			if (!mrq->sbc && mrq->stop)
>  				dw_mci_command_complete(host, mrq->stop);
>  			else
>  				host->cmd_status = 0;
>


-- 
Best Regards
Shawn Lin


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

* Re: [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller
  2016-11-17  7:40 ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
                     ` (8 preceding siblings ...)
  2016-11-17  7:40   ` [PATCHv3 9/9] Documentation: synopsys-dw-mshc: remove the unused properties Jaehoon Chung
@ 2016-11-18 11:17   ` Jaehoon Chung
  9 siblings, 0 replies; 12+ messages in thread
From: Jaehoon Chung @ 2016-11-18 11:17 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, adrian.hunter

Hi,

On 11/17/2016 04:40 PM, Jaehoon Chung wrote:
> This patchset is modified the some minor fixing and cleaning codes.
> 
> * Major changes
> - Remove the unnecessary codes and use_stop_abort() by default.
> - Remove the obsoleted property "supports-highspeed"
> - Deprecated the "clock-freq-min-max" property. Instead, use "max-frequency"
> - Minimum clock value is set to 100K by default.

I have applied this patchset on my dwmmc repository.
If there are some issues, let me know, plz.

Best Regards,
Jaehoon Chung

> 
> Change in v3:
> - Use the dwmmc private cookie enum.
> - Add the reviewed-by and acked-by tags.
> 
> Change in v2:
> - Applied patches relevant to dt files
> - Use "deprecated" instead of removing about "clock-freq-min-max"
> - Added Heiko's Tested-by tag
> 
> Jaehoon Chung (9):
>   mmc: dw_mmc: display the real register value on debugfs
>   mmc: dw_mmc: fix the debug message for checking card's present
>   mmc: dw_mmc: change the DW_MCI_FREQ_MIN from 400K to 100K
>   mmc: dw_mmc: use the hold register when send stop command
>   mmc: dw_mmc: call the dw_mci_prep_stop_abort() by default
>   mmc: dw_mmc: use the cookie's enum values for post/pre_req()
>   mmc: dw_mmc: remove the unnecessary mmc_data structure
>   mmc: dw_mmc: The "clock-freq-min-max" property was deprecated
>   Documentation: synopsys-dw-mshc: remove the unused properties
> 
>  .../devicetree/bindings/mmc/synopsys-dw-mshc.txt   |  8 +-
>  drivers/mmc/host/dw_mmc.c                          | 88 +++++++++++-----------
>  include/linux/mmc/dw_mmc.h                         |  6 ++
>  3 files changed, 50 insertions(+), 52 deletions(-)
> 


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

end of thread, other threads:[~2016-11-18 11:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20161117074336epcas3p3e02ba42edba96bba201f26d05e80601c@epcas3p3.samsung.com>
2016-11-17  7:40 ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller Jaehoon Chung
2016-11-17  7:40   ` [PATCHv3 1/9] mmc: dw_mmc: display the real register value on debugfs Jaehoon Chung
2016-11-17  7:40   ` [PATCHv3 2/9] mmc: dw_mmc: fix the debug message for checking card's present Jaehoon Chung
2016-11-17  7:40   ` [PATCHv3 3/9] mmc: dw_mmc: change the DW_MCI_FREQ_MIN from 400K to 100K Jaehoon Chung
2016-11-17  7:40   ` [PATCHv3 4/9] mmc: dw_mmc: use the hold register when send stop command Jaehoon Chung
2016-11-17  7:40   ` [PATCHv3 5/9] mmc: dw_mmc: call the dw_mci_prep_stop_abort() by default Jaehoon Chung
2016-11-17  7:51     ` Shawn Lin
2016-11-17  7:40   ` [PATCHv3 6/9] mmc: dw_mmc: use the cookie's enum values for post/pre_req() Jaehoon Chung
2016-11-17  7:40   ` [PATCHv3 7/9] mmc: dw_mmc: remove the unnecessary mmc_data structure Jaehoon Chung
2016-11-17  7:40   ` [PATCHv3 8/9] mmc: dw_mmc: The "clock-freq-min-max" property was deprecated Jaehoon Chung
2016-11-17  7:40   ` [PATCHv3 9/9] Documentation: synopsys-dw-mshc: remove the unused properties Jaehoon Chung
2016-11-18 11:17   ` [PATCHv3 0/9] mmc: dw_mmc: clean the codes for dwmmc controller 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.