All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] mmc: sdhci-esdhc-imx: fix acmd23 unwork and ddr not supported on sabresd issues
@ 2013-10-21 14:27 ` Dong Aisheng
  0 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-arm-kernel, cjb, shawn.guo, s.hauer, b29396, wsa, ulf.hansson

Patch 1~3 fix acmd23 unwork issue.
Currently the eMMC chip integrated on i.MX6Q SabreSD boards does not work.
(It's easily reproduced once you enable usdhc4 on sabresd, see patch 3)
It's caused by acmd setting bits are never cleared once it's been set
which cause the next normal commands to work abnormally.

Patch 4~6 fix DDR not supported on SabreSD board.
The SabreSD board does not have 1.8v signal voltage switch support for uSDHC,
thus it can not support UHS_DDR50 mode which can only run at 1.8v signal voltage.

The issue is that current mmc DDR mode support implemented in MMC core depends
on UHS_DDR50, which then cause such controller like uSDHC on SabreSD without 1.8v
capability can not support eMMC DDR mode too.
(But the SabreSD board does support eMMC DDR mode since the eMMC DDR mode can
work on either 1.8v or 3.3v)
So this patch gets rid of this limitation to let controller not support
1.8v signal voltage can also support eMMC DDR mode.

Patch 7 add eMMC hs200 support

Dong Aisheng (7):
  mmc: sdhci: clear auto cmd setting bits for no data cmds
  mmc: sdhci-esdhc-imx: add SDHCI_TRANSFER_MODE read function
  ARM: dts: sabresd: add usdhc4 support
  mmc: sdhci-esdhc-imx: add MMC_CAP_1_8V_DDR for mx6
  mmc: sdhci-esdhc-imx: fix cpas over write issue
  mmc: core: mmc DDR mode should not depend on UHS_DDR50
  mmc: sdhci-esdhc-imx: add eMMC HS200 mode support

 arch/arm/boot/dts/imx6qdl-sabresd.dtsi |    9 +++++++++
 drivers/mmc/core/mmc.c                 |    8 ++------
 drivers/mmc/host/sdhci-esdhc-imx.c     |   21 ++++++++++++++++++++-
 drivers/mmc/host/sdhci.c               |    5 +++++
 4 files changed, 36 insertions(+), 7 deletions(-)

-- 
1.7.2.rc3



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

* [PATCH 0/7] mmc: sdhci-esdhc-imx: fix acmd23 unwork and ddr not supported on sabresd issues
@ 2013-10-21 14:27 ` Dong Aisheng
  0 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-arm-kernel

Patch 1~3 fix acmd23 unwork issue.
Currently the eMMC chip integrated on i.MX6Q SabreSD boards does not work.
(It's easily reproduced once you enable usdhc4 on sabresd, see patch 3)
It's caused by acmd setting bits are never cleared once it's been set
which cause the next normal commands to work abnormally.

Patch 4~6 fix DDR not supported on SabreSD board.
The SabreSD board does not have 1.8v signal voltage switch support for uSDHC,
thus it can not support UHS_DDR50 mode which can only run at 1.8v signal voltage.

The issue is that current mmc DDR mode support implemented in MMC core depends
on UHS_DDR50, which then cause such controller like uSDHC on SabreSD without 1.8v
capability can not support eMMC DDR mode too.
(But the SabreSD board does support eMMC DDR mode since the eMMC DDR mode can
work on either 1.8v or 3.3v)
So this patch gets rid of this limitation to let controller not support
1.8v signal voltage can also support eMMC DDR mode.

Patch 7 add eMMC hs200 support

Dong Aisheng (7):
  mmc: sdhci: clear auto cmd setting bits for no data cmds
  mmc: sdhci-esdhc-imx: add SDHCI_TRANSFER_MODE read function
  ARM: dts: sabresd: add usdhc4 support
  mmc: sdhci-esdhc-imx: add MMC_CAP_1_8V_DDR for mx6
  mmc: sdhci-esdhc-imx: fix cpas over write issue
  mmc: core: mmc DDR mode should not depend on UHS_DDR50
  mmc: sdhci-esdhc-imx: add eMMC HS200 mode support

 arch/arm/boot/dts/imx6qdl-sabresd.dtsi |    9 +++++++++
 drivers/mmc/core/mmc.c                 |    8 ++------
 drivers/mmc/host/sdhci-esdhc-imx.c     |   21 ++++++++++++++++++++-
 drivers/mmc/host/sdhci.c               |    5 +++++
 4 files changed, 36 insertions(+), 7 deletions(-)

-- 
1.7.2.rc3

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

* [PATCH 1/7] mmc: sdhci: clear auto cmd setting bits for no data cmds
  2013-10-21 14:27 ` Dong Aisheng
@ 2013-10-21 14:27   ` Dong Aisheng
  -1 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-arm-kernel, cjb, shawn.guo, s.hauer, b29396, wsa, ulf.hansson

The auto cmd settings bits should be cleared before sending new commands
or we may receive command timeout error for normal commands due to wrongly
pre-sent auto cmd.

e.g. we receive CMD13 timeout error due to ACMD23 is wrongly enabled
by former data commands.

mmc2: new high speed DDR MMC card at address 0001
mmcblk1: mmc2:0001 SEM08G 7.39 GiB
mmcblk1boot0: mmc2:0001 SEM08G partition 1 2.00 MiB
mmcblk1boot1: mmc2:0001 SEM08G partition 2 2.00 MiB
mmcblk1rpmb: mmc2:0001 SEM08G partition 3 128 KiB
 mmcblk1: p1 p2 p3 p4 < p5 p6 p7 >
mmc2: Timeout waiting for hardware interrupt.
 mmcblk1boot1: unknown partition table
mmc2: Timeout waiting for hardware interrupt.
 mmcblk1boot0: unknown partition table

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index a21a710..f868e9b 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -898,6 +898,11 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
 	u16 mode;
 	struct mmc_data *data = cmd->data;
 
+	/* clear Auto CMD settings for no data CMDs */
+	mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
+	sdhci_writew(host, mode & ~(SDHCI_TRNS_AUTO_CMD12 |
+			SDHCI_TRNS_AUTO_CMD23), SDHCI_TRANSFER_MODE);
+
 	if (data == NULL)
 		return;
 
-- 
1.7.2.rc3



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

* [PATCH 1/7] mmc: sdhci: clear auto cmd setting bits for no data cmds
@ 2013-10-21 14:27   ` Dong Aisheng
  0 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-arm-kernel

The auto cmd settings bits should be cleared before sending new commands
or we may receive command timeout error for normal commands due to wrongly
pre-sent auto cmd.

e.g. we receive CMD13 timeout error due to ACMD23 is wrongly enabled
by former data commands.

mmc2: new high speed DDR MMC card at address 0001
mmcblk1: mmc2:0001 SEM08G 7.39 GiB
mmcblk1boot0: mmc2:0001 SEM08G partition 1 2.00 MiB
mmcblk1boot1: mmc2:0001 SEM08G partition 2 2.00 MiB
mmcblk1rpmb: mmc2:0001 SEM08G partition 3 128 KiB
 mmcblk1: p1 p2 p3 p4 < p5 p6 p7 >
mmc2: Timeout waiting for hardware interrupt.
 mmcblk1boot1: unknown partition table
mmc2: Timeout waiting for hardware interrupt.
 mmcblk1boot0: unknown partition table

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index a21a710..f868e9b 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -898,6 +898,11 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
 	u16 mode;
 	struct mmc_data *data = cmd->data;
 
+	/* clear Auto CMD settings for no data CMDs */
+	mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
+	sdhci_writew(host, mode & ~(SDHCI_TRNS_AUTO_CMD12 |
+			SDHCI_TRNS_AUTO_CMD23), SDHCI_TRANSFER_MODE);
+
 	if (data == NULL)
 		return;
 
-- 
1.7.2.rc3

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

* [PATCH 2/7] mmc: sdhci-esdhc-imx: add SDHCI_TRANSFER_MODE read function
  2013-10-21 14:27 ` Dong Aisheng
@ 2013-10-21 14:27   ` Dong Aisheng
  -1 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-arm-kernel, cjb, shawn.guo, s.hauer, b29396, wsa, ulf.hansson

Used to read out the correct value of SDHCI_TRANSFER_MODE register
for upper layer.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 461a4c3..2be77e0 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -385,6 +385,22 @@ static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
 		return ret;
 	}
 
+	if (unlikely(reg == SDHCI_TRANSFER_MODE)) {
+		if (esdhc_is_usdhc(imx_data)) {
+			u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
+			ret = m & ESDHC_MIX_CTRL_SDHCI_MASK;
+			/* Swap AC23 bit */
+			if (m & ESDHC_MIX_CTRL_AC23EN) {
+				ret &= ~ESDHC_MIX_CTRL_AC23EN;
+				ret |= SDHCI_TRNS_AUTO_CMD23;
+			}
+		} else {
+			ret = readw(host->ioaddr + SDHCI_TRANSFER_MODE);
+		}
+
+		return ret;
+	}
+
 	return readw(host->ioaddr + reg);
 }
 
-- 
1.7.2.rc3



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

* [PATCH 2/7] mmc: sdhci-esdhc-imx: add SDHCI_TRANSFER_MODE read function
@ 2013-10-21 14:27   ` Dong Aisheng
  0 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-arm-kernel

Used to read out the correct value of SDHCI_TRANSFER_MODE register
for upper layer.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 461a4c3..2be77e0 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -385,6 +385,22 @@ static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
 		return ret;
 	}
 
+	if (unlikely(reg == SDHCI_TRANSFER_MODE)) {
+		if (esdhc_is_usdhc(imx_data)) {
+			u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
+			ret = m & ESDHC_MIX_CTRL_SDHCI_MASK;
+			/* Swap AC23 bit */
+			if (m & ESDHC_MIX_CTRL_AC23EN) {
+				ret &= ~ESDHC_MIX_CTRL_AC23EN;
+				ret |= SDHCI_TRNS_AUTO_CMD23;
+			}
+		} else {
+			ret = readw(host->ioaddr + SDHCI_TRANSFER_MODE);
+		}
+
+		return ret;
+	}
+
 	return readw(host->ioaddr + reg);
 }
 
-- 
1.7.2.rc3

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

* [PATCH 3/7] ARM: dts: sabresd: add usdhc4 support
  2013-10-21 14:27 ` Dong Aisheng
@ 2013-10-21 14:27   ` Dong Aisheng
  -1 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-arm-kernel, cjb, shawn.guo, s.hauer, b29396, wsa, ulf.hansson

Add usdhc4 support which has an eMMC card mounted on board.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 arch/arm/boot/dts/imx6qdl-sabresd.dtsi |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index 39eafc2..76762a3 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -241,3 +241,12 @@
 	wp-gpios = <&gpio2 1 0>;
 	status = "okay";
 };
+
+&usdhc4 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usdhc4_1>;
+	bus-width = <8>;
+	non-removable;
+	no-1-8-v;
+	status = "okay";
+};
-- 
1.7.2.rc3



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

* [PATCH 3/7] ARM: dts: sabresd: add usdhc4 support
@ 2013-10-21 14:27   ` Dong Aisheng
  0 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-arm-kernel

Add usdhc4 support which has an eMMC card mounted on board.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 arch/arm/boot/dts/imx6qdl-sabresd.dtsi |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index 39eafc2..76762a3 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -241,3 +241,12 @@
 	wp-gpios = <&gpio2 1 0>;
 	status = "okay";
 };
+
+&usdhc4 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usdhc4_1>;
+	bus-width = <8>;
+	non-removable;
+	no-1-8-v;
+	status = "okay";
+};
-- 
1.7.2.rc3

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

* [PATCH 4/7] mmc: sdhci-esdhc-imx: add MMC_CAP_1_8V_DDR for mx6
  2013-10-21 14:27 ` Dong Aisheng
@ 2013-10-21 14:27   ` Dong Aisheng
  -1 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-arm-kernel, cjb, shawn.guo, s.hauer, b29396, wsa, ulf.hansson

The i.MX6 supports 1.8v/3.3v eMMC DDR mode, so add this flag.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 2be77e0..5fe484f 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1025,6 +1025,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 	if (esdhc_is_usdhc(imx_data)) {
 		writel(0x08100810, host->ioaddr + ESDHC_WTMK_LVL);
 		host->quirks2 |= SDHCI_QUIRK2_PRESET_VALUE_BROKEN;
+		host->mmc->caps |= MMC_CAP_1_8V_DDR;
 	}
 
 	if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING)
-- 
1.7.2.rc3



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

* [PATCH 4/7] mmc: sdhci-esdhc-imx: add MMC_CAP_1_8V_DDR for mx6
@ 2013-10-21 14:27   ` Dong Aisheng
  0 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-arm-kernel

The i.MX6 supports 1.8v/3.3v eMMC DDR mode, so add this flag.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 2be77e0..5fe484f 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1025,6 +1025,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 	if (esdhc_is_usdhc(imx_data)) {
 		writel(0x08100810, host->ioaddr + ESDHC_WTMK_LVL);
 		host->quirks2 |= SDHCI_QUIRK2_PRESET_VALUE_BROKEN;
+		host->mmc->caps |= MMC_CAP_1_8V_DDR;
 	}
 
 	if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING)
-- 
1.7.2.rc3

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

* [PATCH 5/7] mmc: sdhci-esdhc-imx: fix cpas over write issue
  2013-10-21 14:27 ` Dong Aisheng
@ 2013-10-21 14:27   ` Dong Aisheng
  -1 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-arm-kernel, cjb, shawn.guo, s.hauer, b29396, wsa, ulf.hansson

We should use '|=' instead '=', or it may over write
the original caps assigned before this line.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 5fe484f..baa27c7 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1070,7 +1070,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 		break;
 
 	case ESDHC_CD_PERMANENT:
-		host->mmc->caps = MMC_CAP_NONREMOVABLE;
+		host->mmc->caps |= MMC_CAP_NONREMOVABLE;
 		break;
 
 	case ESDHC_CD_NONE:
-- 
1.7.2.rc3



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

* [PATCH 5/7] mmc: sdhci-esdhc-imx: fix cpas over write issue
@ 2013-10-21 14:27   ` Dong Aisheng
  0 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-arm-kernel

We should use '|=' instead '=', or it may over write
the original caps assigned before this line.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 5fe484f..baa27c7 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1070,7 +1070,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 		break;
 
 	case ESDHC_CD_PERMANENT:
-		host->mmc->caps = MMC_CAP_NONREMOVABLE;
+		host->mmc->caps |= MMC_CAP_NONREMOVABLE;
 		break;
 
 	case ESDHC_CD_NONE:
-- 
1.7.2.rc3

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

* [PATCH 6/7] mmc: core: mmc DDR mode should not depend on UHS_DDR50
  2013-10-21 14:27 ` Dong Aisheng
@ 2013-10-21 14:27   ` Dong Aisheng
  -1 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-arm-kernel, cjb, shawn.guo, s.hauer, b29396, wsa, ulf.hansson

The MMC_CAP_UHS_DDR50 must work on 1.8v.
However, the eMMC DDR mode can work on either 1.8v or 3.3v and
should not depend on UHS_DDR50.
So get rid of this limitation to let controller without 1.8v
signal voltage support can also work for eMMC DDR mode if it claims.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/core/mmc.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 6d02012..215ba38 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1117,14 +1117,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	 */
 	if (mmc_card_highspeed(card)) {
 		if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_8V)
-			&& ((host->caps & (MMC_CAP_1_8V_DDR |
-			     MMC_CAP_UHS_DDR50))
-				== (MMC_CAP_1_8V_DDR | MMC_CAP_UHS_DDR50)))
+			&& (host->caps & MMC_CAP_1_8V_DDR))
 				ddr = MMC_1_8V_DDR_MODE;
 		else if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_2V)
-			&& ((host->caps & (MMC_CAP_1_2V_DDR |
-			     MMC_CAP_UHS_DDR50))
-				== (MMC_CAP_1_2V_DDR | MMC_CAP_UHS_DDR50)))
+			&& (host->caps & MMC_CAP_1_2V_DDR))
 				ddr = MMC_1_2V_DDR_MODE;
 	}
 
-- 
1.7.2.rc3



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

* [PATCH 6/7] mmc: core: mmc DDR mode should not depend on UHS_DDR50
@ 2013-10-21 14:27   ` Dong Aisheng
  0 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-arm-kernel

The MMC_CAP_UHS_DDR50 must work on 1.8v.
However, the eMMC DDR mode can work on either 1.8v or 3.3v and
should not depend on UHS_DDR50.
So get rid of this limitation to let controller without 1.8v
signal voltage support can also work for eMMC DDR mode if it claims.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/core/mmc.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 6d02012..215ba38 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1117,14 +1117,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	 */
 	if (mmc_card_highspeed(card)) {
 		if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_8V)
-			&& ((host->caps & (MMC_CAP_1_8V_DDR |
-			     MMC_CAP_UHS_DDR50))
-				== (MMC_CAP_1_8V_DDR | MMC_CAP_UHS_DDR50)))
+			&& (host->caps & MMC_CAP_1_8V_DDR))
 				ddr = MMC_1_8V_DDR_MODE;
 		else if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_2V)
-			&& ((host->caps & (MMC_CAP_1_2V_DDR |
-			     MMC_CAP_UHS_DDR50))
-				== (MMC_CAP_1_2V_DDR | MMC_CAP_UHS_DDR50)))
+			&& (host->caps & MMC_CAP_1_2V_DDR))
 				ddr = MMC_1_2V_DDR_MODE;
 	}
 
-- 
1.7.2.rc3

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

* [PATCH 7/7] mmc: sdhci-esdhc-imx: add eMMC HS200 mode support
  2013-10-21 14:27 ` Dong Aisheng
@ 2013-10-21 14:27   ` Dong Aisheng
  -1 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-arm-kernel, cjb, shawn.guo, s.hauer, b29396, wsa, ulf.hansson

Add support for eMMC 4.5 cards to work on hs200 mode.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index baa27c7..d4ba277 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -825,6 +825,7 @@ static int esdhc_change_pinstate(struct sdhci_host *host,
 		pinctrl = imx_data->pins_100mhz;
 		break;
 	case MMC_TIMING_UHS_SDR104:
+	case MMC_TIMING_MMC_HS200:
 		pinctrl = imx_data->pins_200mhz;
 		break;
 	default:
@@ -852,6 +853,7 @@ static int esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs)
 		imx_data->uhs_mode = SDHCI_CTRL_UHS_SDR50;
 		break;
 	case MMC_TIMING_UHS_SDR104:
+	case MMC_TIMING_MMC_HS200:
 		imx_data->uhs_mode = SDHCI_CTRL_UHS_SDR104;
 		break;
 	case MMC_TIMING_UHS_DDR50:
-- 
1.7.2.rc3



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

* [PATCH 7/7] mmc: sdhci-esdhc-imx: add eMMC HS200 mode support
@ 2013-10-21 14:27   ` Dong Aisheng
  0 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 14:27 UTC (permalink / raw)
  To: linux-arm-kernel

Add support for eMMC 4.5 cards to work on hs200 mode.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index baa27c7..d4ba277 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -825,6 +825,7 @@ static int esdhc_change_pinstate(struct sdhci_host *host,
 		pinctrl = imx_data->pins_100mhz;
 		break;
 	case MMC_TIMING_UHS_SDR104:
+	case MMC_TIMING_MMC_HS200:
 		pinctrl = imx_data->pins_200mhz;
 		break;
 	default:
@@ -852,6 +853,7 @@ static int esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs)
 		imx_data->uhs_mode = SDHCI_CTRL_UHS_SDR50;
 		break;
 	case MMC_TIMING_UHS_SDR104:
+	case MMC_TIMING_MMC_HS200:
 		imx_data->uhs_mode = SDHCI_CTRL_UHS_SDR104;
 		break;
 	case MMC_TIMING_UHS_DDR50:
-- 
1.7.2.rc3

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

* Re: [PATCH 2/7] mmc: sdhci-esdhc-imx: add SDHCI_TRANSFER_MODE read function
  2013-10-21 14:27   ` Dong Aisheng
@ 2013-10-21 16:01     ` John Tobias
  -1 siblings, 0 replies; 28+ messages in thread
From: John Tobias @ 2013-10-21 16:01 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: linux-mmc, linux-arm-kernel, cjb, Shawn Guo, s.hauer, wsa, ulf.hansson

Hi Dong,

I compiled my kernel after applying your patch but it didn't compile
it correctly due to esdhc_is_usdhc function. It should be
is_imx6_usdhc?

Regards,

john

On Mon, Oct 21, 2013 at 7:27 AM, Dong Aisheng <b29396@freescale.com> wrote:
> Used to read out the correct value of SDHCI_TRANSFER_MODE register
> for upper layer.
>
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 461a4c3..2be77e0 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -385,6 +385,22 @@ static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
>                 return ret;
>         }
>
> +       if (unlikely(reg == SDHCI_TRANSFER_MODE)) {
> +               if (esdhc_is_usdhc(imx_data)) {
> +                       u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
> +                       ret = m & ESDHC_MIX_CTRL_SDHCI_MASK;
> +                       /* Swap AC23 bit */
> +                       if (m & ESDHC_MIX_CTRL_AC23EN) {
> +                               ret &= ~ESDHC_MIX_CTRL_AC23EN;
> +                               ret |= SDHCI_TRNS_AUTO_CMD23;
> +                       }
> +               } else {
> +                       ret = readw(host->ioaddr + SDHCI_TRANSFER_MODE);
> +               }
> +
> +               return ret;
> +       }
> +
>         return readw(host->ioaddr + reg);
>  }
>
> --
> 1.7.2.rc3
>
>
> --
> 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] 28+ messages in thread

* [PATCH 2/7] mmc: sdhci-esdhc-imx: add SDHCI_TRANSFER_MODE read function
@ 2013-10-21 16:01     ` John Tobias
  0 siblings, 0 replies; 28+ messages in thread
From: John Tobias @ 2013-10-21 16:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Dong,

I compiled my kernel after applying your patch but it didn't compile
it correctly due to esdhc_is_usdhc function. It should be
is_imx6_usdhc?

Regards,

john

On Mon, Oct 21, 2013 at 7:27 AM, Dong Aisheng <b29396@freescale.com> wrote:
> Used to read out the correct value of SDHCI_TRANSFER_MODE register
> for upper layer.
>
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 461a4c3..2be77e0 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -385,6 +385,22 @@ static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
>                 return ret;
>         }
>
> +       if (unlikely(reg == SDHCI_TRANSFER_MODE)) {
> +               if (esdhc_is_usdhc(imx_data)) {
> +                       u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
> +                       ret = m & ESDHC_MIX_CTRL_SDHCI_MASK;
> +                       /* Swap AC23 bit */
> +                       if (m & ESDHC_MIX_CTRL_AC23EN) {
> +                               ret &= ~ESDHC_MIX_CTRL_AC23EN;
> +                               ret |= SDHCI_TRNS_AUTO_CMD23;
> +                       }
> +               } else {
> +                       ret = readw(host->ioaddr + SDHCI_TRANSFER_MODE);
> +               }
> +
> +               return ret;
> +       }
> +
>         return readw(host->ioaddr + reg);
>  }
>
> --
> 1.7.2.rc3
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/7] mmc: sdhci-esdhc-imx: add SDHCI_TRANSFER_MODE read function
  2013-10-21 16:01     ` John Tobias
@ 2013-10-21 16:29       ` Dong Aisheng
  -1 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 16:29 UTC (permalink / raw)
  To: John Tobias
  Cc: Dong Aisheng, Ulf Hansson, Shawn Guo, wsa, Sascha Hauer,
	linux-mmc, Chris Ball, linux-arm-kernel

Hi John,

You need apply this patch series first which introduced esdhc_is_usdhc.
http://permalink.gmane.org/gmane.linux.kernel.mmc/23074

Please refer to Chris tree:
https://git.kernel.org/cgit/linux/kernel/git/cjb/mmc.git/log/?h=mmc-next

Regards
Dong Aisheng

On Tue, Oct 22, 2013 at 12:01 AM, John Tobias <john.tobias.ph@gmail.com> wrote:
> Hi Dong,
>
> I compiled my kernel after applying your patch but it didn't compile
> it correctly due to esdhc_is_usdhc function. It should be
> is_imx6_usdhc?
>
> Regards,
>
> john
>
> On Mon, Oct 21, 2013 at 7:27 AM, Dong Aisheng <b29396@freescale.com> wrote:
>> Used to read out the correct value of SDHCI_TRANSFER_MODE register
>> for upper layer.
>>
>> Signed-off-by: Dong Aisheng <b29396@freescale.com>
>> ---
>>  drivers/mmc/host/sdhci-esdhc-imx.c |   16 ++++++++++++++++
>>  1 files changed, 16 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
>> index 461a4c3..2be77e0 100644
>> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
>> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
>> @@ -385,6 +385,22 @@ static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
>>                 return ret;
>>         }
>>
>> +       if (unlikely(reg == SDHCI_TRANSFER_MODE)) {
>> +               if (esdhc_is_usdhc(imx_data)) {
>> +                       u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
>> +                       ret = m & ESDHC_MIX_CTRL_SDHCI_MASK;
>> +                       /* Swap AC23 bit */
>> +                       if (m & ESDHC_MIX_CTRL_AC23EN) {
>> +                               ret &= ~ESDHC_MIX_CTRL_AC23EN;
>> +                               ret |= SDHCI_TRNS_AUTO_CMD23;
>> +                       }
>> +               } else {
>> +                       ret = readw(host->ioaddr + SDHCI_TRANSFER_MODE);
>> +               }
>> +
>> +               return ret;
>> +       }
>> +
>>         return readw(host->ioaddr + reg);
>>  }
>>
>> --
>> 1.7.2.rc3
>>
>>
>> --
>> 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
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/7] mmc: sdhci-esdhc-imx: add SDHCI_TRANSFER_MODE read function
@ 2013-10-21 16:29       ` Dong Aisheng
  0 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-21 16:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi John,

You need apply this patch series first which introduced esdhc_is_usdhc.
http://permalink.gmane.org/gmane.linux.kernel.mmc/23074

Please refer to Chris tree:
https://git.kernel.org/cgit/linux/kernel/git/cjb/mmc.git/log/?h=mmc-next

Regards
Dong Aisheng

On Tue, Oct 22, 2013 at 12:01 AM, John Tobias <john.tobias.ph@gmail.com> wrote:
> Hi Dong,
>
> I compiled my kernel after applying your patch but it didn't compile
> it correctly due to esdhc_is_usdhc function. It should be
> is_imx6_usdhc?
>
> Regards,
>
> john
>
> On Mon, Oct 21, 2013 at 7:27 AM, Dong Aisheng <b29396@freescale.com> wrote:
>> Used to read out the correct value of SDHCI_TRANSFER_MODE register
>> for upper layer.
>>
>> Signed-off-by: Dong Aisheng <b29396@freescale.com>
>> ---
>>  drivers/mmc/host/sdhci-esdhc-imx.c |   16 ++++++++++++++++
>>  1 files changed, 16 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
>> index 461a4c3..2be77e0 100644
>> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
>> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
>> @@ -385,6 +385,22 @@ static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
>>                 return ret;
>>         }
>>
>> +       if (unlikely(reg == SDHCI_TRANSFER_MODE)) {
>> +               if (esdhc_is_usdhc(imx_data)) {
>> +                       u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
>> +                       ret = m & ESDHC_MIX_CTRL_SDHCI_MASK;
>> +                       /* Swap AC23 bit */
>> +                       if (m & ESDHC_MIX_CTRL_AC23EN) {
>> +                               ret &= ~ESDHC_MIX_CTRL_AC23EN;
>> +                               ret |= SDHCI_TRNS_AUTO_CMD23;
>> +                       }
>> +               } else {
>> +                       ret = readw(host->ioaddr + SDHCI_TRANSFER_MODE);
>> +               }
>> +
>> +               return ret;
>> +       }
>> +
>>         return readw(host->ioaddr + reg);
>>  }
>>
>> --
>> 1.7.2.rc3
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>> the body of a message to majordomo at vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/7] mmc: sdhci: clear auto cmd setting bits for no data cmds
  2013-10-21 14:27   ` Dong Aisheng
@ 2013-10-23  2:33     ` Shawn Guo
  -1 siblings, 0 replies; 28+ messages in thread
From: Shawn Guo @ 2013-10-23  2:33 UTC (permalink / raw)
  To: Dong Aisheng; +Cc: linux-mmc, linux-arm-kernel, cjb, s.hauer, wsa, ulf.hansson

On Mon, Oct 21, 2013 at 10:27:01PM +0800, Dong Aisheng wrote:
> The auto cmd settings bits should be cleared before sending new commands
> or we may receive command timeout error for normal commands due to wrongly
> pre-sent auto cmd.
> 
> e.g. we receive CMD13 timeout error due to ACMD23 is wrongly enabled
> by former data commands.
> 
> mmc2: new high speed DDR MMC card at address 0001
> mmcblk1: mmc2:0001 SEM08G 7.39 GiB
> mmcblk1boot0: mmc2:0001 SEM08G partition 1 2.00 MiB
> mmcblk1boot1: mmc2:0001 SEM08G partition 2 2.00 MiB
> mmcblk1rpmb: mmc2:0001 SEM08G partition 3 128 KiB
>  mmcblk1: p1 p2 p3 p4 < p5 p6 p7 >
> mmc2: Timeout waiting for hardware interrupt.
>  mmcblk1boot1: unknown partition table
> mmc2: Timeout waiting for hardware interrupt.
>  mmcblk1boot0: unknown partition table
> 
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index a21a710..f868e9b 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -898,6 +898,11 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
>  	u16 mode;
>  	struct mmc_data *data = cmd->data;
>  
> +	/* clear Auto CMD settings for no data CMDs */
> +	mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
> +	sdhci_writew(host, mode & ~(SDHCI_TRNS_AUTO_CMD12 |
> +			SDHCI_TRNS_AUTO_CMD23), SDHCI_TRANSFER_MODE);
> +

IMO, it will be more readable if we move the code into the if-clause
of (data == NULL), something like:

	if (data == NULL) {
		/* clear Auto CMD settings for no data CMDs */
		mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
		mode &= SDHCI_TRNS_AUTO_CMD12 | SDHCI_TRNS_AUTO_CMD23;
		sdhci_writew(host, mode, SDHCI_TRANSFER_MODE);
	}

Shawn

>  	if (data == NULL)
>  		return;
>  
> -- 
> 1.7.2.rc3
> 
> 


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

* [PATCH 1/7] mmc: sdhci: clear auto cmd setting bits for no data cmds
@ 2013-10-23  2:33     ` Shawn Guo
  0 siblings, 0 replies; 28+ messages in thread
From: Shawn Guo @ 2013-10-23  2:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 21, 2013 at 10:27:01PM +0800, Dong Aisheng wrote:
> The auto cmd settings bits should be cleared before sending new commands
> or we may receive command timeout error for normal commands due to wrongly
> pre-sent auto cmd.
> 
> e.g. we receive CMD13 timeout error due to ACMD23 is wrongly enabled
> by former data commands.
> 
> mmc2: new high speed DDR MMC card at address 0001
> mmcblk1: mmc2:0001 SEM08G 7.39 GiB
> mmcblk1boot0: mmc2:0001 SEM08G partition 1 2.00 MiB
> mmcblk1boot1: mmc2:0001 SEM08G partition 2 2.00 MiB
> mmcblk1rpmb: mmc2:0001 SEM08G partition 3 128 KiB
>  mmcblk1: p1 p2 p3 p4 < p5 p6 p7 >
> mmc2: Timeout waiting for hardware interrupt.
>  mmcblk1boot1: unknown partition table
> mmc2: Timeout waiting for hardware interrupt.
>  mmcblk1boot0: unknown partition table
> 
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index a21a710..f868e9b 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -898,6 +898,11 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
>  	u16 mode;
>  	struct mmc_data *data = cmd->data;
>  
> +	/* clear Auto CMD settings for no data CMDs */
> +	mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
> +	sdhci_writew(host, mode & ~(SDHCI_TRNS_AUTO_CMD12 |
> +			SDHCI_TRNS_AUTO_CMD23), SDHCI_TRANSFER_MODE);
> +

IMO, it will be more readable if we move the code into the if-clause
of (data == NULL), something like:

	if (data == NULL) {
		/* clear Auto CMD settings for no data CMDs */
		mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
		mode &= SDHCI_TRNS_AUTO_CMD12 | SDHCI_TRNS_AUTO_CMD23;
		sdhci_writew(host, mode, SDHCI_TRANSFER_MODE);
	}

Shawn

>  	if (data == NULL)
>  		return;
>  
> -- 
> 1.7.2.rc3
> 
> 

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

* Re: [PATCH 5/7] mmc: sdhci-esdhc-imx: fix cpas over write issue
  2013-10-21 14:27   ` Dong Aisheng
@ 2013-10-23  2:51     ` Shawn Guo
  -1 siblings, 0 replies; 28+ messages in thread
From: Shawn Guo @ 2013-10-23  2:51 UTC (permalink / raw)
  To: Dong Aisheng; +Cc: linux-mmc, linux-arm-kernel, cjb, s.hauer, wsa, ulf.hansson

On Mon, Oct 21, 2013 at 10:27:05PM +0800, Dong Aisheng wrote:
> We should use '|=' instead '=', or it may over write
> the original caps assigned before this line.
> 
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 5fe484f..baa27c7 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1070,7 +1070,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
>  		break;
>  
>  	case ESDHC_CD_PERMANENT:
> -		host->mmc->caps = MMC_CAP_NONREMOVABLE;
> +		host->mmc->caps |= MMC_CAP_NONREMOVABLE;

I think it will be more logical if you switch the order of this patch
and the previous one.

Shawn

>  		break;
>  
>  	case ESDHC_CD_NONE:
> -- 
> 1.7.2.rc3
> 
> 


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

* [PATCH 5/7] mmc: sdhci-esdhc-imx: fix cpas over write issue
@ 2013-10-23  2:51     ` Shawn Guo
  0 siblings, 0 replies; 28+ messages in thread
From: Shawn Guo @ 2013-10-23  2:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 21, 2013 at 10:27:05PM +0800, Dong Aisheng wrote:
> We should use '|=' instead '=', or it may over write
> the original caps assigned before this line.
> 
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 5fe484f..baa27c7 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1070,7 +1070,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
>  		break;
>  
>  	case ESDHC_CD_PERMANENT:
> -		host->mmc->caps = MMC_CAP_NONREMOVABLE;
> +		host->mmc->caps |= MMC_CAP_NONREMOVABLE;

I think it will be more logical if you switch the order of this patch
and the previous one.

Shawn

>  		break;
>  
>  	case ESDHC_CD_NONE:
> -- 
> 1.7.2.rc3
> 
> 

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

* Re: [PATCH 1/7] mmc: sdhci: clear auto cmd setting bits for no data cmds
  2013-10-23  2:33     ` Shawn Guo
@ 2013-10-23  5:54       ` Dong Aisheng
  -1 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-23  5:54 UTC (permalink / raw)
  To: Shawn Guo; +Cc: linux-mmc, linux-arm-kernel, cjb, s.hauer, wsa, ulf.hansson

On Wed, Oct 23, 2013 at 10:33:28AM +0800, Shawn Guo wrote:
> On Mon, Oct 21, 2013 at 10:27:01PM +0800, Dong Aisheng wrote:
> > The auto cmd settings bits should be cleared before sending new commands
> > or we may receive command timeout error for normal commands due to wrongly
> > pre-sent auto cmd.
> > 
> > e.g. we receive CMD13 timeout error due to ACMD23 is wrongly enabled
> > by former data commands.
> > 
> > mmc2: new high speed DDR MMC card at address 0001
> > mmcblk1: mmc2:0001 SEM08G 7.39 GiB
> > mmcblk1boot0: mmc2:0001 SEM08G partition 1 2.00 MiB
> > mmcblk1boot1: mmc2:0001 SEM08G partition 2 2.00 MiB
> > mmcblk1rpmb: mmc2:0001 SEM08G partition 3 128 KiB
> >  mmcblk1: p1 p2 p3 p4 < p5 p6 p7 >
> > mmc2: Timeout waiting for hardware interrupt.
> >  mmcblk1boot1: unknown partition table
> > mmc2: Timeout waiting for hardware interrupt.
> >  mmcblk1boot0: unknown partition table
> > 
> > Signed-off-by: Dong Aisheng <b29396@freescale.com>
> > ---
> >  drivers/mmc/host/sdhci.c |    5 +++++
> >  1 files changed, 5 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > index a21a710..f868e9b 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -898,6 +898,11 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
> >  	u16 mode;
> >  	struct mmc_data *data = cmd->data;
> >  
> > +	/* clear Auto CMD settings for no data CMDs */
> > +	mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
> > +	sdhci_writew(host, mode & ~(SDHCI_TRNS_AUTO_CMD12 |
> > +			SDHCI_TRNS_AUTO_CMD23), SDHCI_TRANSFER_MODE);
> > +
> 
> IMO, it will be more readable if we move the code into the if-clause
> of (data == NULL), something like:
> 
> 	if (data == NULL) {
> 		/* clear Auto CMD settings for no data CMDs */
> 		mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
> 		mode &= SDHCI_TRNS_AUTO_CMD12 | SDHCI_TRNS_AUTO_CMD23;
> 		sdhci_writew(host, mode, SDHCI_TRANSFER_MODE);
> 	}
> 

I'm fine with it.
Will change to:

if (data == NULL) {
	/* clear Auto CMD settings for no data CMDs */
	mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
	mode &= ~(SDHCI_TRNS_AUTO_CMD12 | SDHCI_TRNS_AUTO_CMD23);
	sdhci_writew(host, mode, SDHCI_TRANSFER_MODE);
	return;
}

Regards
Dong Aisheng

> Shawn
> 
> >  	if (data == NULL)
> >  		return;
> >  
> > -- 
> > 1.7.2.rc3
> > 
> > 


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

* [PATCH 1/7] mmc: sdhci: clear auto cmd setting bits for no data cmds
@ 2013-10-23  5:54       ` Dong Aisheng
  0 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-23  5:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 23, 2013 at 10:33:28AM +0800, Shawn Guo wrote:
> On Mon, Oct 21, 2013 at 10:27:01PM +0800, Dong Aisheng wrote:
> > The auto cmd settings bits should be cleared before sending new commands
> > or we may receive command timeout error for normal commands due to wrongly
> > pre-sent auto cmd.
> > 
> > e.g. we receive CMD13 timeout error due to ACMD23 is wrongly enabled
> > by former data commands.
> > 
> > mmc2: new high speed DDR MMC card at address 0001
> > mmcblk1: mmc2:0001 SEM08G 7.39 GiB
> > mmcblk1boot0: mmc2:0001 SEM08G partition 1 2.00 MiB
> > mmcblk1boot1: mmc2:0001 SEM08G partition 2 2.00 MiB
> > mmcblk1rpmb: mmc2:0001 SEM08G partition 3 128 KiB
> >  mmcblk1: p1 p2 p3 p4 < p5 p6 p7 >
> > mmc2: Timeout waiting for hardware interrupt.
> >  mmcblk1boot1: unknown partition table
> > mmc2: Timeout waiting for hardware interrupt.
> >  mmcblk1boot0: unknown partition table
> > 
> > Signed-off-by: Dong Aisheng <b29396@freescale.com>
> > ---
> >  drivers/mmc/host/sdhci.c |    5 +++++
> >  1 files changed, 5 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > index a21a710..f868e9b 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -898,6 +898,11 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
> >  	u16 mode;
> >  	struct mmc_data *data = cmd->data;
> >  
> > +	/* clear Auto CMD settings for no data CMDs */
> > +	mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
> > +	sdhci_writew(host, mode & ~(SDHCI_TRNS_AUTO_CMD12 |
> > +			SDHCI_TRNS_AUTO_CMD23), SDHCI_TRANSFER_MODE);
> > +
> 
> IMO, it will be more readable if we move the code into the if-clause
> of (data == NULL), something like:
> 
> 	if (data == NULL) {
> 		/* clear Auto CMD settings for no data CMDs */
> 		mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
> 		mode &= SDHCI_TRNS_AUTO_CMD12 | SDHCI_TRNS_AUTO_CMD23;
> 		sdhci_writew(host, mode, SDHCI_TRANSFER_MODE);
> 	}
> 

I'm fine with it.
Will change to:

if (data == NULL) {
	/* clear Auto CMD settings for no data CMDs */
	mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
	mode &= ~(SDHCI_TRNS_AUTO_CMD12 | SDHCI_TRNS_AUTO_CMD23);
	sdhci_writew(host, mode, SDHCI_TRANSFER_MODE);
	return;
}

Regards
Dong Aisheng

> Shawn
> 
> >  	if (data == NULL)
> >  		return;
> >  
> > -- 
> > 1.7.2.rc3
> > 
> > 

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

* Re: [PATCH 5/7] mmc: sdhci-esdhc-imx: fix cpas over write issue
  2013-10-23  2:51     ` Shawn Guo
@ 2013-10-23  5:56       ` Dong Aisheng
  -1 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-23  5:56 UTC (permalink / raw)
  To: Shawn Guo; +Cc: linux-mmc, linux-arm-kernel, cjb, s.hauer, wsa, ulf.hansson

On Wed, Oct 23, 2013 at 10:51:48AM +0800, Shawn Guo wrote:
> On Mon, Oct 21, 2013 at 10:27:05PM +0800, Dong Aisheng wrote:
> > We should use '|=' instead '=', or it may over write
> > the original caps assigned before this line.
> > 
> > Signed-off-by: Dong Aisheng <b29396@freescale.com>
> > ---
> >  drivers/mmc/host/sdhci-esdhc-imx.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> > index 5fe484f..baa27c7 100644
> > --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> > +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> > @@ -1070,7 +1070,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
> >  		break;
> >  
> >  	case ESDHC_CD_PERMANENT:
> > -		host->mmc->caps = MMC_CAP_NONREMOVABLE;
> > +		host->mmc->caps |= MMC_CAP_NONREMOVABLE;
> 
> I think it will be more logical if you switch the order of this patch
> and the previous one.
> 

Sounds good to me.
Will switch it.

Regards
Dong Aisheng

> Shawn
> 
> >  		break;
> >  
> >  	case ESDHC_CD_NONE:
> > -- 
> > 1.7.2.rc3
> > 
> > 


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

* [PATCH 5/7] mmc: sdhci-esdhc-imx: fix cpas over write issue
@ 2013-10-23  5:56       ` Dong Aisheng
  0 siblings, 0 replies; 28+ messages in thread
From: Dong Aisheng @ 2013-10-23  5:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 23, 2013 at 10:51:48AM +0800, Shawn Guo wrote:
> On Mon, Oct 21, 2013 at 10:27:05PM +0800, Dong Aisheng wrote:
> > We should use '|=' instead '=', or it may over write
> > the original caps assigned before this line.
> > 
> > Signed-off-by: Dong Aisheng <b29396@freescale.com>
> > ---
> >  drivers/mmc/host/sdhci-esdhc-imx.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> > index 5fe484f..baa27c7 100644
> > --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> > +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> > @@ -1070,7 +1070,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
> >  		break;
> >  
> >  	case ESDHC_CD_PERMANENT:
> > -		host->mmc->caps = MMC_CAP_NONREMOVABLE;
> > +		host->mmc->caps |= MMC_CAP_NONREMOVABLE;
> 
> I think it will be more logical if you switch the order of this patch
> and the previous one.
> 

Sounds good to me.
Will switch it.

Regards
Dong Aisheng

> Shawn
> 
> >  		break;
> >  
> >  	case ESDHC_CD_NONE:
> > -- 
> > 1.7.2.rc3
> > 
> > 

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

end of thread, other threads:[~2013-10-23  6:14 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-21 14:27 [PATCH 0/7] mmc: sdhci-esdhc-imx: fix acmd23 unwork and ddr not supported on sabresd issues Dong Aisheng
2013-10-21 14:27 ` Dong Aisheng
2013-10-21 14:27 ` [PATCH 1/7] mmc: sdhci: clear auto cmd setting bits for no data cmds Dong Aisheng
2013-10-21 14:27   ` Dong Aisheng
2013-10-23  2:33   ` Shawn Guo
2013-10-23  2:33     ` Shawn Guo
2013-10-23  5:54     ` Dong Aisheng
2013-10-23  5:54       ` Dong Aisheng
2013-10-21 14:27 ` [PATCH 2/7] mmc: sdhci-esdhc-imx: add SDHCI_TRANSFER_MODE read function Dong Aisheng
2013-10-21 14:27   ` Dong Aisheng
2013-10-21 16:01   ` John Tobias
2013-10-21 16:01     ` John Tobias
2013-10-21 16:29     ` Dong Aisheng
2013-10-21 16:29       ` Dong Aisheng
2013-10-21 14:27 ` [PATCH 3/7] ARM: dts: sabresd: add usdhc4 support Dong Aisheng
2013-10-21 14:27   ` Dong Aisheng
2013-10-21 14:27 ` [PATCH 4/7] mmc: sdhci-esdhc-imx: add MMC_CAP_1_8V_DDR for mx6 Dong Aisheng
2013-10-21 14:27   ` Dong Aisheng
2013-10-21 14:27 ` [PATCH 5/7] mmc: sdhci-esdhc-imx: fix cpas over write issue Dong Aisheng
2013-10-21 14:27   ` Dong Aisheng
2013-10-23  2:51   ` Shawn Guo
2013-10-23  2:51     ` Shawn Guo
2013-10-23  5:56     ` Dong Aisheng
2013-10-23  5:56       ` Dong Aisheng
2013-10-21 14:27 ` [PATCH 6/7] mmc: core: mmc DDR mode should not depend on UHS_DDR50 Dong Aisheng
2013-10-21 14:27   ` Dong Aisheng
2013-10-21 14:27 ` [PATCH 7/7] mmc: sdhci-esdhc-imx: add eMMC HS200 mode support Dong Aisheng
2013-10-21 14:27   ` Dong Aisheng

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.