public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] mmc: dw_mmc: minor code cleanup.
@ 2014-05-12 11:14 Jaehoon Chung
  2014-05-12 11:14 ` [PATCH 1/5] mmc: dw_mmc: fix the wrong condition checking Jaehoon Chung
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Jaehoon Chung @ 2014-05-12 11:14 UTC (permalink / raw)
  To: linux-mmc
  Cc: chris, ulf.hansson, tgih.jun, zhangfei.gao, dinguyen,
	Jaehoon Chung

Jaehoon Chung (5):
  mmc: dw_mmc: fix the wrong condition checking
  mmc: dw_mmc: remove the "supports-highspeed" property.
  mmc: dw_mmc-exynos: add the MMC_CAP_ERASE by default.
  mmc: dw_mmc: add the specified capbilities2 of controller.
  mmc: dw_mmc: use the mmc regulator API into core.c

 .../devicetree/bindings/mmc/exynos-dw-mshc.txt     |    1 -
 .../devicetree/bindings/mmc/k3-dw-mshc.txt         |    1 -
 .../devicetree/bindings/mmc/synopsys-dw-mshc.txt   |    3 -
 arch/arm/boot/dts/exynos4412-odroidx.dts           |    2 +-
 arch/arm/boot/dts/exynos4412-origen.dts            |    2 +-
 arch/arm/boot/dts/exynos4412-trats2.dts            |    2 +-
 arch/arm/boot/dts/exynos5250-arndale.dts           |    4 +-
 arch/arm/boot/dts/exynos5250-cros-common.dtsi      |    6 +-
 arch/arm/boot/dts/exynos5250-smdk5250.dts          |    4 +-
 arch/arm/boot/dts/exynos5420-arndale-octa.dts      |    4 +-
 arch/arm/boot/dts/exynos5420-smdk5420.dts          |    4 +-
 arch/arm/boot/dts/socfpga_arria5.dtsi              |    3 +-
 arch/arm/boot/dts/socfpga_cyclone5.dtsi            |    3 +-
 arch/arm/boot/dts/socfpga_vt.dts                   |    3 +-
 drivers/mmc/host/dw_mmc-exynos.c                   |    9 +--
 drivers/mmc/host/dw_mmc.c                          |   69 ++++++++------------
 drivers/mmc/host/dw_mmc.h                          |    2 +
 17 files changed, 55 insertions(+), 67 deletions(-)

-- 
1.7.9.5


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

* [PATCH 1/5] mmc: dw_mmc: fix the wrong condition checking
  2014-05-12 11:14 [PATCH 0/5] mmc: dw_mmc: minor code cleanup Jaehoon Chung
@ 2014-05-12 11:14 ` Jaehoon Chung
  2014-05-12 11:14 ` [PATCH 2/5] mmc: dw_mmc: remove the "supports-highspeed" property Jaehoon Chung
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: Jaehoon Chung @ 2014-05-12 11:14 UTC (permalink / raw)
  To: linux-mmc
  Cc: chris, ulf.hansson, tgih.jun, zhangfei.gao, dinguyen,
	Jaehoon Chung

num-slot cab be greater than 1.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.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 d409912..7d4d9ea 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2312,7 +2312,7 @@ int dw_mci_probe(struct dw_mci *host)
 		}
 	}
 
-	if (host->pdata->num_slots > 1) {
+	if (host->pdata->num_slots < 1) {
 		dev_err(host->dev,
 			"Platform data must supply num_slots.\n");
 		return -ENODEV;
-- 
1.7.9.5


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

* [PATCH 2/5] mmc: dw_mmc: remove the "supports-highspeed" property.
  2014-05-12 11:14 [PATCH 0/5] mmc: dw_mmc: minor code cleanup Jaehoon Chung
  2014-05-12 11:14 ` [PATCH 1/5] mmc: dw_mmc: fix the wrong condition checking Jaehoon Chung
@ 2014-05-12 11:14 ` Jaehoon Chung
  2014-05-12 15:48   ` Dinh Nguyen
  2014-05-12 17:43   ` Dinh Nguyen
  2014-05-12 11:14 ` [PATCH 3/5] mmc: dw_mmc-exynos: add the MMC_CAP_ERASE by default Jaehoon Chung
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 16+ messages in thread
From: Jaehoon Chung @ 2014-05-12 11:14 UTC (permalink / raw)
  To: linux-mmc
  Cc: chris, ulf.hansson, tgih.jun, zhangfei.gao, dinguyen,
	Jaehoon Chung

Remove the "support-highspeed" property in dw-mmc.
"support-highspeed" property can be replaced to "cap-sd/mmc-highspeed".

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 .../devicetree/bindings/mmc/exynos-dw-mshc.txt     |    1 -
 .../devicetree/bindings/mmc/k3-dw-mshc.txt         |    1 -
 .../devicetree/bindings/mmc/synopsys-dw-mshc.txt   |    3 ---
 arch/arm/boot/dts/exynos4412-odroidx.dts           |    2 +-
 arch/arm/boot/dts/exynos4412-origen.dts            |    2 +-
 arch/arm/boot/dts/exynos4412-trats2.dts            |    2 +-
 arch/arm/boot/dts/exynos5250-arndale.dts           |    4 ++--
 arch/arm/boot/dts/exynos5250-cros-common.dtsi      |    6 +++---
 arch/arm/boot/dts/exynos5250-smdk5250.dts          |    4 ++--
 arch/arm/boot/dts/exynos5420-arndale-octa.dts      |    4 ++--
 arch/arm/boot/dts/exynos5420-smdk5420.dts          |    4 ++--
 arch/arm/boot/dts/socfpga_arria5.dtsi              |    3 ++-
 arch/arm/boot/dts/socfpga_cyclone5.dtsi            |    3 ++-
 arch/arm/boot/dts/socfpga_vt.dts                   |    3 ++-
 drivers/mmc/host/dw_mmc.c                          |    3 ---
 15 files changed, 20 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt
index 532b1d4..fdab6e7 100644
--- a/Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt
@@ -69,7 +69,6 @@ Example:
 
 	dwmmc0@12200000 {
 		num-slots = <1>;
-		supports-highspeed;
 		broken-cd;
 		fifo-depth = <0x80>;
 		card-detect-delay = <200>;
diff --git a/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt
index b8653ea..7674026 100644
--- a/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt
@@ -34,7 +34,6 @@ Example:
 		num-slots = <1>;
 		vmmc-supply = <&ldo12>;
 		fifo-depth = <0x100>;
-		supports-highspeed;
 		pinctrl-names = "default";
 		pinctrl-0 = <&sd_pmx_pins &sd_cfg_func1 &sd_cfg_func2>;
 		slot@0 {
diff --git a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
index 2d4a725..a8b24d7 100644
--- a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
@@ -67,8 +67,6 @@ Optional properties:
 * card-detect-delay: Delay in milli-seconds before detecting card after card
   insert event. The default value is 0.
 
-* supports-highspeed: Enables support for high speed cards (up to 50MHz)
-
 * broken-cd: as documented in mmc core bindings.
 
 * vmmc-supply: The phandle to the regulator to use for vmmc.  If this is
@@ -98,7 +96,6 @@ board specific portions as listed below.
 		clock-frequency = <400000000>;
 		clock-freq-min-max = <400000 200000000>;
 		num-slots = <1>;
-		supports-highspeed;
 		broken-cd;
 		fifo-depth = <0x80>;
 		card-detect-delay = <200>;
diff --git a/arch/arm/boot/dts/exynos4412-odroidx.dts b/arch/arm/boot/dts/exynos4412-odroidx.dts
index 31db28a..77f69d2 100644
--- a/arch/arm/boot/dts/exynos4412-odroidx.dts
+++ b/arch/arm/boot/dts/exynos4412-odroidx.dts
@@ -45,7 +45,7 @@
 		status = "okay";
 
 		num-slots = <1>;
-		supports-highspeed;
+		cap-mmc-highspeed;
 		broken-cd;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts
index e2c0dca..a0806ce 100644
--- a/arch/arm/boot/dts/exynos4412-origen.dts
+++ b/arch/arm/boot/dts/exynos4412-origen.dts
@@ -128,7 +128,7 @@
 		status = "okay";
 
 		num-slots = <1>;
-		supports-highspeed;
+		cap-mmc-highspeed;
 		broken-cd;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
index 9583563..cfcd4a3 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -459,7 +459,7 @@
 
 	mmc@12550000 {
 		num-slots = <1>;
-		supports-highspeed;
+		cap-mmc-highspeed;
 		broken-cd;
 		non-removable;
 		card-detect-delay = <200>;
diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
index 090f983..c023e3c 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -399,7 +399,7 @@
 	mmc_0: mmc@12200000 {
 		status = "okay";
 		num-slots = <1>;
-		supports-highspeed;
+		cap-mmc-highspeed;
 		broken-cd;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
@@ -418,7 +418,7 @@
 	mmc_2: mmc@12220000 {
 		status = "okay";
 		num-slots = <1>;
-		supports-highspeed;
+		cap-sd-highspeed;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <2 3>;
diff --git a/arch/arm/boot/dts/exynos5250-cros-common.dtsi b/arch/arm/boot/dts/exynos5250-cros-common.dtsi
index 2c1560d..0efa33b 100644
--- a/arch/arm/boot/dts/exynos5250-cros-common.dtsi
+++ b/arch/arm/boot/dts/exynos5250-cros-common.dtsi
@@ -248,7 +248,7 @@
 
 	mmc@12200000 {
 		num-slots = <1>;
-		supports-highspeed;
+		cap-mmc-highspeed;
 		broken-cd;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
@@ -265,7 +265,7 @@
 
 	mmc@12220000 {
 		num-slots = <1>;
-		supports-highspeed;
+		cap-sd-highspeed;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <2 3>;
@@ -282,7 +282,7 @@
 
 	mmc@12230000 {
 		num-slots = <1>;
-		supports-highspeed;
+		cap-sd-highspeed;
 		broken-cd;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index a794a70..9c1a2e6 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -282,7 +282,7 @@
 	mmc@12200000 {
 		status = "okay";
 		num-slots = <1>;
-		supports-highspeed;
+		cap-mmc-highspeed;
 		broken-cd;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
@@ -300,7 +300,7 @@
 	mmc@12220000 {
 		status = "okay";
 		num-slots = <1>;
-		supports-highspeed;
+		cap-sd-highspeed;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <2 3>;
diff --git a/arch/arm/boot/dts/exynos5420-arndale-octa.dts b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
index 80a3bf4..6b4bb5e 100644
--- a/arch/arm/boot/dts/exynos5420-arndale-octa.dts
+++ b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
@@ -40,7 +40,7 @@
 	mmc@12200000 {
 		status = "okay";
 		broken-cd;
-		supports-highspeed;
+		cap-mmc-highspeed;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <0 4>;
@@ -57,7 +57,7 @@
 
 	mmc@12220000 {
 		status = "okay";
-		supports-highspeed;
+		cap-sd-highspeed;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <2 3>;
diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts
index 6910485..b336590 100644
--- a/arch/arm/boot/dts/exynos5420-smdk5420.dts
+++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts
@@ -71,7 +71,7 @@
 	mmc@12200000 {
 		status = "okay";
 		broken-cd;
-		supports-highspeed;
+		cap-mmc-highspped;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <0 4>;
@@ -87,7 +87,7 @@
 
 	mmc@12220000 {
 		status = "okay";
-		supports-highspeed;
+		cap-sd-highspeed;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <2 3>;
diff --git a/arch/arm/boot/dts/socfpga_arria5.dtsi b/arch/arm/boot/dts/socfpga_arria5.dtsi
index 6c87b70..0c6080e 100644
--- a/arch/arm/boot/dts/socfpga_arria5.dtsi
+++ b/arch/arm/boot/dts/socfpga_arria5.dtsi
@@ -29,7 +29,8 @@
 
 		dwmmc0@ff704000 {
 			num-slots = <1>;
-			supports-highspeed;
+			cap-mmc-highspeed;
+			cap-sd-highspeed;
 			broken-cd;
 
 			slot@0 {
diff --git a/arch/arm/boot/dts/socfpga_cyclone5.dtsi b/arch/arm/boot/dts/socfpga_cyclone5.dtsi
index ca41b0e..10a1c13 100644
--- a/arch/arm/boot/dts/socfpga_cyclone5.dtsi
+++ b/arch/arm/boot/dts/socfpga_cyclone5.dtsi
@@ -30,7 +30,8 @@
 
 		dwmmc0@ff704000 {
 			num-slots = <1>;
-			supports-highspeed;
+			cap-mmc-highspeed;
+			cap-sd-highspeed;
 			broken-cd;
 
 			slot@0 {
diff --git a/arch/arm/boot/dts/socfpga_vt.dts b/arch/arm/boot/dts/socfpga_vt.dts
index 87d6f75..66b2aa1 100644
--- a/arch/arm/boot/dts/socfpga_vt.dts
+++ b/arch/arm/boot/dts/socfpga_vt.dts
@@ -43,7 +43,8 @@
 
 		dwmmc0@ff704000 {
 			num-slots = <1>;
-			supports-highspeed;
+			cap-mmc-highspeed;
+			cap-sd-highspeed;
 			broken-cd;
 
 			slot@0 {
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 7d4d9ea..75d7d4e 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2284,9 +2284,6 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
 			return ERR_PTR(ret);
 	}
 
-	if (of_find_property(np, "supports-highspeed", NULL))
-		pdata->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
-
 	return pdata;
 }
 
-- 
1.7.9.5


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

* [PATCH 3/5] mmc: dw_mmc-exynos: add the MMC_CAP_ERASE by default.
  2014-05-12 11:14 [PATCH 0/5] mmc: dw_mmc: minor code cleanup Jaehoon Chung
  2014-05-12 11:14 ` [PATCH 1/5] mmc: dw_mmc: fix the wrong condition checking Jaehoon Chung
  2014-05-12 11:14 ` [PATCH 2/5] mmc: dw_mmc: remove the "supports-highspeed" property Jaehoon Chung
@ 2014-05-12 11:14 ` Jaehoon Chung
  2014-05-13 11:15   ` Seungwon Jeon
  2014-05-12 11:14 ` [PATCH 4/5] mmc: dw_mmc: add the specified capbilities2 of controller Jaehoon Chung
  2014-05-12 11:14 ` [PATCH 5/5] mmc: dw_mmc: use the mmc regulator API into core.c Jaehoon Chung
  4 siblings, 1 reply; 16+ messages in thread
From: Jaehoon Chung @ 2014-05-12 11:14 UTC (permalink / raw)
  To: linux-mmc
  Cc: chris, ulf.hansson, tgih.jun, zhangfei.gao, dinguyen,
	Jaehoon Chung

To use the erase command, add the MMC_CAP_ERASE capability by default.

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

diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
index 0fbc53a..46fafd8 100644
--- a/drivers/mmc/host/dw_mmc-exynos.c
+++ b/drivers/mmc/host/dw_mmc-exynos.c
@@ -386,10 +386,11 @@ static int dw_mci_exynos_execute_tuning(struct dw_mci_slot *slot, u32 opcode,
 
 /* Common capabilities of Exynos4/Exynos5 SoC */
 static unsigned long exynos_dwmmc_caps[4] = {
-	MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA | MMC_CAP_CMD23,
-	MMC_CAP_CMD23,
-	MMC_CAP_CMD23,
-	MMC_CAP_CMD23,
+	MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA | MMC_CAP_CMD23 |
+		MMC_CAP_ERASE,
+	MMC_CAP_CMD23 | MMC_CAP_ERASE,
+	MMC_CAP_CMD23 | MMC_CAP_ERASE,
+	MMC_CAP_CMD23 | MMC_CAP_ERASE,
 };
 
 static const struct dw_mci_drv_data exynos_drv_data = {
-- 
1.7.9.5


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

* [PATCH 4/5] mmc: dw_mmc: add the specified capbilities2 of controller.
  2014-05-12 11:14 [PATCH 0/5] mmc: dw_mmc: minor code cleanup Jaehoon Chung
                   ` (2 preceding siblings ...)
  2014-05-12 11:14 ` [PATCH 3/5] mmc: dw_mmc-exynos: add the MMC_CAP_ERASE by default Jaehoon Chung
@ 2014-05-12 11:14 ` Jaehoon Chung
  2014-05-12 11:14 ` [PATCH 5/5] mmc: dw_mmc: use the mmc regulator API into core.c Jaehoon Chung
  4 siblings, 0 replies; 16+ messages in thread
From: Jaehoon Chung @ 2014-05-12 11:14 UTC (permalink / raw)
  To: linux-mmc
  Cc: chris, ulf.hansson, tgih.jun, zhangfei.gao, dinguyen,
	Jaehoon Chung

To use capabilities2, add the caps2 into dw_mci_drv_data.

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

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 75d7d4e..e0e933d 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2088,6 +2088,9 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 	if (host->pdata->caps2)
 		mmc->caps2 = host->pdata->caps2;
 
+	if (drv_data && drv_data->caps2)
+		mmc->caps2 |= drv_data->caps2[ctrl_id];
+
 	mmc_of_parse(mmc);
 
 	if (host->pdata->blk_settings) {
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 738fa24..5541946c 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -237,6 +237,7 @@ struct dw_mci_tuning_data {
 /**
  * dw_mci driver data - dw-mshc implementation specific driver data.
  * @caps: mmc subsystem specified capabilities of the controller(s).
+ * @caps2: mmc subsystem specified capabilities2 of the controller(s).
  * @init: early implementation specific initialization.
  * @setup_clock: implementation specific clock configuration.
  * @prepare_command: handle CMD register extensions.
@@ -250,6 +251,7 @@ struct dw_mci_tuning_data {
  */
 struct dw_mci_drv_data {
 	unsigned long	*caps;
+	unsigned long	*caps2;
 	int		(*init)(struct dw_mci *host);
 	int		(*setup_clock)(struct dw_mci *host);
 	void		(*prepare_command)(struct dw_mci *host, u32 *cmdr);
-- 
1.7.9.5


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

* [PATCH 5/5] mmc: dw_mmc: use the mmc regulator API into core.c
  2014-05-12 11:14 [PATCH 0/5] mmc: dw_mmc: minor code cleanup Jaehoon Chung
                   ` (3 preceding siblings ...)
  2014-05-12 11:14 ` [PATCH 4/5] mmc: dw_mmc: add the specified capbilities2 of controller Jaehoon Chung
@ 2014-05-12 11:14 ` Jaehoon Chung
  2014-05-12 17:41   ` Dinh Nguyen
  2014-05-14  9:48   ` Yuvaraj Cd
  4 siblings, 2 replies; 16+ messages in thread
From: Jaehoon Chung @ 2014-05-12 11:14 UTC (permalink / raw)
  To: linux-mmc
  Cc: chris, ulf.hansson, tgih.jun, zhangfei.gao, dinguyen,
	Jaehoon Chung

Use the mmc regulator API into core.c instead of enabling locally.
It can use the "vmmc", and optional "vqmmc".

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

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index e0e933d..3ab7231 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -937,6 +937,7 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	struct dw_mci_slot *slot = mmc_priv(mmc);
 	const struct dw_mci_drv_data *drv_data = slot->host->drv_data;
 	u32 regs;
+	int ret;
 
 	switch (ios->bus_width) {
 	case MMC_BUS_WIDTH_4:
@@ -975,16 +976,36 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 
 	switch (ios->power_mode) {
 	case MMC_POWER_UP:
+		if (!IS_ERR(mmc->supply.vmmc))
+			mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
+
 		set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags);
 		regs = mci_readl(slot->host, PWREN);
 		regs |= (1 << slot->id);
 		mci_writel(slot->host, PWREN, regs);
+
 		break;
 	case MMC_POWER_OFF:
+		if (!IS_ERR(mmc->supply.vmmc))
+			mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
+
+		if (!IS_ERR(mmc->supply.vqmmc) &&
+				regulator_is_enabled(mmc->supply.vqmmc))
+			regulator_disable(mmc->supply.vqmmc);
+
 		regs = mci_readl(slot->host, PWREN);
 		regs &= ~(1 << slot->id);
 		mci_writel(slot->host, PWREN, regs);
 		break;
+	case MMC_POWER_ON:
+		if (!IS_ERR(mmc->supply.vqmmc) &&
+				!regulator_is_enabled(mmc->supply.vqmmc)) {
+			ret = regulator_enable(mmc->supply.vqmmc);
+			if (ret < 0)
+				dev_err(&slot->mmc->class_dev,
+						"failed to enable vqmmc\n");
+		}
+		break;
 	default:
 		break;
 	}
@@ -2067,7 +2088,9 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 		mmc->f_max = freq[1];
 	}
 
-	mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
+	mmc_regulator_get_supply(mmc);
+	if (!mmc->ocr_avail)
+		mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
 
 	if (host->pdata->caps)
 		mmc->caps = host->pdata->caps;
@@ -2375,24 +2398,6 @@ int dw_mci_probe(struct dw_mci *host)
 		}
 	}
 
-	host->vmmc = devm_regulator_get_optional(host->dev, "vmmc");
-	if (IS_ERR(host->vmmc)) {
-		ret = PTR_ERR(host->vmmc);
-		if (ret == -EPROBE_DEFER)
-			goto err_clk_ciu;
-
-		dev_info(host->dev, "no vmmc regulator found: %d\n", ret);
-		host->vmmc = NULL;
-	} else {
-		ret = regulator_enable(host->vmmc);
-		if (ret) {
-			if (ret != -EPROBE_DEFER)
-				dev_err(host->dev,
-					"regulator_enable fail: %d\n", ret);
-			goto err_clk_ciu;
-		}
-	}
-
 	host->quirks = host->pdata->quirks;
 
 	spin_lock_init(&host->lock);
@@ -2536,9 +2541,6 @@ err_workqueue:
 err_dmaunmap:
 	if (host->use_dma && host->dma_ops->exit)
 		host->dma_ops->exit(host);
-	if (host->vmmc)
-		regulator_disable(host->vmmc);
-
 err_clk_ciu:
 	if (!IS_ERR(host->ciu_clk))
 		clk_disable_unprepare(host->ciu_clk);
@@ -2573,9 +2575,6 @@ void dw_mci_remove(struct dw_mci *host)
 	if (host->use_dma && host->dma_ops->exit)
 		host->dma_ops->exit(host);
 
-	if (host->vmmc)
-		regulator_disable(host->vmmc);
-
 	if (!IS_ERR(host->ciu_clk))
 		clk_disable_unprepare(host->ciu_clk);
 
@@ -2592,9 +2591,6 @@ EXPORT_SYMBOL(dw_mci_remove);
  */
 int dw_mci_suspend(struct dw_mci *host)
 {
-	if (host->vmmc)
-		regulator_disable(host->vmmc);
-
 	return 0;
 }
 EXPORT_SYMBOL(dw_mci_suspend);
@@ -2603,15 +2599,6 @@ int dw_mci_resume(struct dw_mci *host)
 {
 	int i, ret;
 
-	if (host->vmmc) {
-		ret = regulator_enable(host->vmmc);
-		if (ret) {
-			dev_err(host->dev,
-				"failed to enable regulator: %d\n", ret);
-			return ret;
-		}
-	}
-
 	if (!dw_mci_ctrl_all_reset(host)) {
 		ret = -ENODEV;
 		return ret;
-- 
1.7.9.5


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

* Re: [PATCH 2/5] mmc: dw_mmc: remove the "supports-highspeed" property.
  2014-05-12 11:14 ` [PATCH 2/5] mmc: dw_mmc: remove the "supports-highspeed" property Jaehoon Chung
@ 2014-05-12 15:48   ` Dinh Nguyen
  2014-05-14  4:55     ` Jaehoon Chung
  2014-05-12 17:43   ` Dinh Nguyen
  1 sibling, 1 reply; 16+ messages in thread
From: Dinh Nguyen @ 2014-05-12 15:48 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc, chris, ulf.hansson, tgih.jun, zhangfei.gao

On Mon, 2014-05-12 at 20:14 +0900, Jaehoon Chung wrote:
> Remove the "support-highspeed" property in dw-mmc.
> "support-highspeed" property can be replaced to "cap-sd/mmc-highspeed".
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  .../devicetree/bindings/mmc/exynos-dw-mshc.txt     |    1 -
>  .../devicetree/bindings/mmc/k3-dw-mshc.txt         |    1 -
>  .../devicetree/bindings/mmc/synopsys-dw-mshc.txt   |    3 ---
>  arch/arm/boot/dts/exynos4412-odroidx.dts           |    2 +-
>  arch/arm/boot/dts/exynos4412-origen.dts            |    2 +-
>  arch/arm/boot/dts/exynos4412-trats2.dts            |    2 +-
>  arch/arm/boot/dts/exynos5250-arndale.dts           |    4 ++--
>  arch/arm/boot/dts/exynos5250-cros-common.dtsi      |    6 +++---
>  arch/arm/boot/dts/exynos5250-smdk5250.dts          |    4 ++--
>  arch/arm/boot/dts/exynos5420-arndale-octa.dts      |    4 ++--
>  arch/arm/boot/dts/exynos5420-smdk5420.dts          |    4 ++--
>  arch/arm/boot/dts/socfpga_arria5.dtsi              |    3 ++-
>  arch/arm/boot/dts/socfpga_cyclone5.dtsi            |    3 ++-
>  arch/arm/boot/dts/socfpga_vt.dts                   |    3 ++-
>  drivers/mmc/host/dw_mmc.c                          |    3 ---
>  15 files changed, 20 insertions(+), 25 deletions(-)
> 

Should exynos5260-xyref5260.dts and exynos5420-peach-pit.dts also get
updated?

Dinh


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

* Re: [PATCH 5/5] mmc: dw_mmc: use the mmc regulator API into core.c
  2014-05-12 11:14 ` [PATCH 5/5] mmc: dw_mmc: use the mmc regulator API into core.c Jaehoon Chung
@ 2014-05-12 17:41   ` Dinh Nguyen
  2014-05-14  4:55     ` Jaehoon Chung
  2014-05-14  9:48   ` Yuvaraj Cd
  1 sibling, 1 reply; 16+ messages in thread
From: Dinh Nguyen @ 2014-05-12 17:41 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc, chris, ulf.hansson, tgih.jun, zhangfei.gao

On Mon, 2014-05-12 at 20:14 +0900, Jaehoon Chung wrote:
> Use the mmc regulator API into core.c instead of enabling locally.
> It can use the "vmmc", and optional "vqmmc".
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc.c |   61 ++++++++++++++++++---------------------------
>  1 file changed, 24 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index e0e933d..3ab7231 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -937,6 +937,7 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>  	struct dw_mci_slot *slot = mmc_priv(mmc);
>  	const struct dw_mci_drv_data *drv_data = slot->host->drv_data;
>  	u32 regs;
> +	int ret;
>  
>  	switch (ios->bus_width) {
>  	case MMC_BUS_WIDTH_4:
> @@ -975,16 +976,36 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>  
>  	switch (ios->power_mode) {
>  	case MMC_POWER_UP:
> +		if (!IS_ERR(mmc->supply.vmmc))
> +			mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
> +
>  		set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags);
>  		regs = mci_readl(slot->host, PWREN);
>  		regs |= (1 << slot->id);
>  		mci_writel(slot->host, PWREN, regs);
> +

Looks like stray newline here?

Dinh



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

* Re: [PATCH 2/5] mmc: dw_mmc: remove the "supports-highspeed" property.
  2014-05-12 11:14 ` [PATCH 2/5] mmc: dw_mmc: remove the "supports-highspeed" property Jaehoon Chung
  2014-05-12 15:48   ` Dinh Nguyen
@ 2014-05-12 17:43   ` Dinh Nguyen
  2014-05-14  4:55     ` Jaehoon Chung
  1 sibling, 1 reply; 16+ messages in thread
From: Dinh Nguyen @ 2014-05-12 17:43 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc, chris, ulf.hansson, tgih.jun, zhangfei.gao

On Mon, 2014-05-12 at 20:14 +0900, Jaehoon Chung wrote:
> Remove the "support-highspeed" property in dw-mmc.
> "support-highspeed" property can be replaced to "cap-sd/mmc-highspeed".
> 

s/support-highspeed/supports-highspeed

Dinh


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

* RE: [PATCH 3/5] mmc: dw_mmc-exynos: add the MMC_CAP_ERASE by default.
  2014-05-12 11:14 ` [PATCH 3/5] mmc: dw_mmc-exynos: add the MMC_CAP_ERASE by default Jaehoon Chung
@ 2014-05-13 11:15   ` Seungwon Jeon
  2014-05-13 12:27     ` Jaehoon Chung
  0 siblings, 1 reply; 16+ messages in thread
From: Seungwon Jeon @ 2014-05-13 11:15 UTC (permalink / raw)
  To: 'Jaehoon Chung', linux-mmc
  Cc: chris, ulf.hansson, zhangfei.gao, dinguyen

Hi Jaehoon,

I think we can remove MMC_CAP_ERASE from host's cap.

Can you check below patch?
[PATCH v4] mmc: remove MMC_CAP_ERASE to enable trim in eMMC/SD Device

Thanks,
Seungwon Jeon

On Mon, May 12, 2014, Jaehoon Chung wrote:
> To use the erase command, add the MMC_CAP_ERASE capability by default.
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc-exynos.c |    9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
> index 0fbc53a..46fafd8 100644
> --- a/drivers/mmc/host/dw_mmc-exynos.c
> +++ b/drivers/mmc/host/dw_mmc-exynos.c
> @@ -386,10 +386,11 @@ static int dw_mci_exynos_execute_tuning(struct dw_mci_slot *slot, u32 opcode,
> 
>  /* Common capabilities of Exynos4/Exynos5 SoC */
>  static unsigned long exynos_dwmmc_caps[4] = {
> -	MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA | MMC_CAP_CMD23,
> -	MMC_CAP_CMD23,
> -	MMC_CAP_CMD23,
> -	MMC_CAP_CMD23,
> +	MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA | MMC_CAP_CMD23 |
> +		MMC_CAP_ERASE,
> +	MMC_CAP_CMD23 | MMC_CAP_ERASE,
> +	MMC_CAP_CMD23 | MMC_CAP_ERASE,
> +	MMC_CAP_CMD23 | MMC_CAP_ERASE,
>  };
> 
>  static const struct dw_mci_drv_data exynos_drv_data = {
> --
> 1.7.9.5
> 
> --
> 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] 16+ messages in thread

* Re: [PATCH 3/5] mmc: dw_mmc-exynos: add the MMC_CAP_ERASE by default.
  2014-05-13 11:15   ` Seungwon Jeon
@ 2014-05-13 12:27     ` Jaehoon Chung
  0 siblings, 0 replies; 16+ messages in thread
From: Jaehoon Chung @ 2014-05-13 12:27 UTC (permalink / raw)
  To: Seungwon Jeon, linux-mmc; +Cc: chris, ulf.hansson, zhangfei.gao, dinguyen

Hi, Seungwon.

On 05/13/2014 08:15 PM, Seungwon Jeon wrote:
> Hi Jaehoon,
> 
> I think we can remove MMC_CAP_ERASE from host's cap.
Thanks for reminding. :) 
It's my mistake..Confused with linux-3.10.

Best Regards,
Jaehoon Chung
 
> 
> Can you check below patch?
> [PATCH v4] mmc: remove MMC_CAP_ERASE to enable trim in eMMC/SD Device
> 
> Thanks,
> Seungwon Jeon
> 
> On Mon, May 12, 2014, Jaehoon Chung wrote:
>> To use the erase command, add the MMC_CAP_ERASE capability by default.
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>>  drivers/mmc/host/dw_mmc-exynos.c |    9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
>> index 0fbc53a..46fafd8 100644
>> --- a/drivers/mmc/host/dw_mmc-exynos.c
>> +++ b/drivers/mmc/host/dw_mmc-exynos.c
>> @@ -386,10 +386,11 @@ static int dw_mci_exynos_execute_tuning(struct dw_mci_slot *slot, u32 opcode,
>>
>>  /* Common capabilities of Exynos4/Exynos5 SoC */
>>  static unsigned long exynos_dwmmc_caps[4] = {
>> -	MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA | MMC_CAP_CMD23,
>> -	MMC_CAP_CMD23,
>> -	MMC_CAP_CMD23,
>> -	MMC_CAP_CMD23,
>> +	MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA | MMC_CAP_CMD23 |
>> +		MMC_CAP_ERASE,
>> +	MMC_CAP_CMD23 | MMC_CAP_ERASE,
>> +	MMC_CAP_CMD23 | MMC_CAP_ERASE,
>> +	MMC_CAP_CMD23 | MMC_CAP_ERASE,
>>  };
>>
>>  static const struct dw_mci_drv_data exynos_drv_data = {
>> --
>> 1.7.9.5
>>
>> --
>> 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] 16+ messages in thread

* Re: [PATCH 2/5] mmc: dw_mmc: remove the "supports-highspeed" property.
  2014-05-12 15:48   ` Dinh Nguyen
@ 2014-05-14  4:55     ` Jaehoon Chung
  2014-05-14 20:17       ` Dinh Nguyen
  0 siblings, 1 reply; 16+ messages in thread
From: Jaehoon Chung @ 2014-05-14  4:55 UTC (permalink / raw)
  To: Dinh Nguyen; +Cc: linux-mmc, chris, ulf.hansson, tgih.jun, zhangfei.gao

Hi, Dinh.

On 05/13/2014 12:48 AM, Dinh Nguyen wrote:
> On Mon, 2014-05-12 at 20:14 +0900, Jaehoon Chung wrote:
>> Remove the "support-highspeed" property in dw-mmc.
>> "support-highspeed" property can be replaced to "cap-sd/mmc-highspeed".
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>>  .../devicetree/bindings/mmc/exynos-dw-mshc.txt     |    1 -
>>  .../devicetree/bindings/mmc/k3-dw-mshc.txt         |    1 -
>>  .../devicetree/bindings/mmc/synopsys-dw-mshc.txt   |    3 ---
>>  arch/arm/boot/dts/exynos4412-odroidx.dts           |    2 +-
>>  arch/arm/boot/dts/exynos4412-origen.dts            |    2 +-
>>  arch/arm/boot/dts/exynos4412-trats2.dts            |    2 +-
>>  arch/arm/boot/dts/exynos5250-arndale.dts           |    4 ++--
>>  arch/arm/boot/dts/exynos5250-cros-common.dtsi      |    6 +++---
>>  arch/arm/boot/dts/exynos5250-smdk5250.dts          |    4 ++--
>>  arch/arm/boot/dts/exynos5420-arndale-octa.dts      |    4 ++--
>>  arch/arm/boot/dts/exynos5420-smdk5420.dts          |    4 ++--
>>  arch/arm/boot/dts/socfpga_arria5.dtsi              |    3 ++-
>>  arch/arm/boot/dts/socfpga_cyclone5.dtsi            |    3 ++-
>>  arch/arm/boot/dts/socfpga_vt.dts                   |    3 ++-
>>  drivers/mmc/host/dw_mmc.c                          |    3 ---
>>  15 files changed, 20 insertions(+), 25 deletions(-)
>>
> 
> Should exynos5260-xyref5260.dts and exynos5420-peach-pit.dts also get
> updated?

I didn't find them..? Is it included into dts folder.

Best Regards,
Jaehoon Chung
> 
> Dinh
> 
> 


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

* Re: [PATCH 5/5] mmc: dw_mmc: use the mmc regulator API into core.c
  2014-05-12 17:41   ` Dinh Nguyen
@ 2014-05-14  4:55     ` Jaehoon Chung
  0 siblings, 0 replies; 16+ messages in thread
From: Jaehoon Chung @ 2014-05-14  4:55 UTC (permalink / raw)
  To: Dinh Nguyen; +Cc: linux-mmc, chris, ulf.hansson, tgih.jun, zhangfei.gao

On 05/13/2014 02:41 AM, Dinh Nguyen wrote:
> On Mon, 2014-05-12 at 20:14 +0900, Jaehoon Chung wrote:
>> Use the mmc regulator API into core.c instead of enabling locally.
>> It can use the "vmmc", and optional "vqmmc".
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>>  drivers/mmc/host/dw_mmc.c |   61 ++++++++++++++++++---------------------------
>>  1 file changed, 24 insertions(+), 37 deletions(-)
>>
>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
>> index e0e933d..3ab7231 100644
>> --- a/drivers/mmc/host/dw_mmc.c
>> +++ b/drivers/mmc/host/dw_mmc.c
>> @@ -937,6 +937,7 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>>  	struct dw_mci_slot *slot = mmc_priv(mmc);
>>  	const struct dw_mci_drv_data *drv_data = slot->host->drv_data;
>>  	u32 regs;
>> +	int ret;
>>  
>>  	switch (ios->bus_width) {
>>  	case MMC_BUS_WIDTH_4:
>> @@ -975,16 +976,36 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>>  
>>  	switch (ios->power_mode) {
>>  	case MMC_POWER_UP:
>> +		if (!IS_ERR(mmc->supply.vmmc))
>> +			mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
>> +
>>  		set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags);
>>  		regs = mci_readl(slot->host, PWREN);
>>  		regs |= (1 << slot->id);
>>  		mci_writel(slot->host, PWREN, regs);
>> +
> 
> Looks like stray newline here?

Will Remove?

> 
> Dinh
> 
> 
> 


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

* Re: [PATCH 2/5] mmc: dw_mmc: remove the "supports-highspeed" property.
  2014-05-12 17:43   ` Dinh Nguyen
@ 2014-05-14  4:55     ` Jaehoon Chung
  0 siblings, 0 replies; 16+ messages in thread
From: Jaehoon Chung @ 2014-05-14  4:55 UTC (permalink / raw)
  To: Dinh Nguyen; +Cc: linux-mmc, chris, ulf.hansson, tgih.jun, zhangfei.gao

On 05/13/2014 02:43 AM, Dinh Nguyen wrote:
> On Mon, 2014-05-12 at 20:14 +0900, Jaehoon Chung wrote:
>> Remove the "support-highspeed" property in dw-mmc.
>> "support-highspeed" property can be replaced to "cap-sd/mmc-highspeed".
>>
> 
> s/support-highspeed/supports-highspeed

Will fix.
> 
> Dinh
> 
> 


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

* Re: [PATCH 5/5] mmc: dw_mmc: use the mmc regulator API into core.c
  2014-05-12 11:14 ` [PATCH 5/5] mmc: dw_mmc: use the mmc regulator API into core.c Jaehoon Chung
  2014-05-12 17:41   ` Dinh Nguyen
@ 2014-05-14  9:48   ` Yuvaraj Cd
  1 sibling, 0 replies; 16+ messages in thread
From: Yuvaraj Cd @ 2014-05-14  9:48 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: linux-mmc@vger.kernel.org, chris, ulf.hansson, Seungwon Jeon,
	zhangfei.gao, dinguyen

On Mon, May 12, 2014 at 4:44 PM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> Use the mmc regulator API into core.c instead of enabling locally.
> It can use the "vmmc", and optional "vqmmc".
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc.c |   61 ++++++++++++++++++---------------------------
>  1 file changed, 24 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index e0e933d..3ab7231 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -937,6 +937,7 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>         struct dw_mci_slot *slot = mmc_priv(mmc);
>         const struct dw_mci_drv_data *drv_data = slot->host->drv_data;
>         u32 regs;
> +       int ret;
>
>         switch (ios->bus_width) {
>         case MMC_BUS_WIDTH_4:
> @@ -975,16 +976,36 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>
>         switch (ios->power_mode) {
>         case MMC_POWER_UP:
> +               if (!IS_ERR(mmc->supply.vmmc))
> +                       mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
> +
>                 set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags);
>                 regs = mci_readl(slot->host, PWREN);
>                 regs |= (1 << slot->id);
>                 mci_writel(slot->host, PWREN, regs);
> +
>                 break;
>         case MMC_POWER_OFF:
> +               if (!IS_ERR(mmc->supply.vmmc))
> +                       mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
> +
> +               if (!IS_ERR(mmc->supply.vqmmc) &&
> +                               regulator_is_enabled(mmc->supply.vqmmc))
> +                       regulator_disable(mmc->supply.vqmmc);
if the built-in card detection is used(CDETECT),turning off the
regulator will break the card detection
as CD# is also on vqmmc voltage rail.do you consider that case?
> +
>                 regs = mci_readl(slot->host, PWREN);
>                 regs &= ~(1 << slot->id);
>                 mci_writel(slot->host, PWREN, regs);
>                 break;
> +       case MMC_POWER_ON:
> +               if (!IS_ERR(mmc->supply.vqmmc) &&
> +                               !regulator_is_enabled(mmc->supply.vqmmc)) {
> +                       ret = regulator_enable(mmc->supply.vqmmc);
Any specific reason why do we turn on vqmmc during MMC_POWER_ON not
when MMC_POWER_UP?
> +                       if (ret < 0)
> +                               dev_err(&slot->mmc->class_dev,
> +                                               "failed to enable vqmmc\n");
> +               }
> +               break;
>         default:
>                 break;
>         }
> @@ -2067,7 +2088,9 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
>                 mmc->f_max = freq[1];
>         }
>
> -       mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
> +       mmc_regulator_get_supply(mmc);
how about using the  deferred regulators case also
https://lkml.org/lkml/2014/5/6/700
> +       if (!mmc->ocr_avail)
> +               mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
>
>         if (host->pdata->caps)
>                 mmc->caps = host->pdata->caps;
> @@ -2375,24 +2398,6 @@ int dw_mci_probe(struct dw_mci *host)
>                 }
>         }
>
> -       host->vmmc = devm_regulator_get_optional(host->dev, "vmmc");
> -       if (IS_ERR(host->vmmc)) {
> -               ret = PTR_ERR(host->vmmc);
> -               if (ret == -EPROBE_DEFER)
> -                       goto err_clk_ciu;
> -
> -               dev_info(host->dev, "no vmmc regulator found: %d\n", ret);
> -               host->vmmc = NULL;
> -       } else {
> -               ret = regulator_enable(host->vmmc);
> -               if (ret) {
> -                       if (ret != -EPROBE_DEFER)
> -                               dev_err(host->dev,
> -                                       "regulator_enable fail: %d\n", ret);
> -                       goto err_clk_ciu;
> -               }
> -       }
> -
>         host->quirks = host->pdata->quirks;
>
>         spin_lock_init(&host->lock);
> @@ -2536,9 +2541,6 @@ err_workqueue:
>  err_dmaunmap:
>         if (host->use_dma && host->dma_ops->exit)
>                 host->dma_ops->exit(host);
> -       if (host->vmmc)
> -               regulator_disable(host->vmmc);
> -
>  err_clk_ciu:
>         if (!IS_ERR(host->ciu_clk))
>                 clk_disable_unprepare(host->ciu_clk);
> @@ -2573,9 +2575,6 @@ void dw_mci_remove(struct dw_mci *host)
>         if (host->use_dma && host->dma_ops->exit)
>                 host->dma_ops->exit(host);
>
> -       if (host->vmmc)
> -               regulator_disable(host->vmmc);
> -
>         if (!IS_ERR(host->ciu_clk))
>                 clk_disable_unprepare(host->ciu_clk);
>
> @@ -2592,9 +2591,6 @@ EXPORT_SYMBOL(dw_mci_remove);
>   */
>  int dw_mci_suspend(struct dw_mci *host)
>  {
> -       if (host->vmmc)
> -               regulator_disable(host->vmmc);
> -
>         return 0;
>  }
>  EXPORT_SYMBOL(dw_mci_suspend);
> @@ -2603,15 +2599,6 @@ int dw_mci_resume(struct dw_mci *host)
>  {
>         int i, ret;
>
> -       if (host->vmmc) {
> -               ret = regulator_enable(host->vmmc);
> -               if (ret) {
> -                       dev_err(host->dev,
> -                               "failed to enable regulator: %d\n", ret);
> -                       return ret;
> -               }
> -       }
> -
>         if (!dw_mci_ctrl_all_reset(host)) {
>                 ret = -ENODEV;
>                 return ret;
> --
> 1.7.9.5
>
> --
> 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] 16+ messages in thread

* Re: [PATCH 2/5] mmc: dw_mmc: remove the "supports-highspeed" property.
  2014-05-14  4:55     ` Jaehoon Chung
@ 2014-05-14 20:17       ` Dinh Nguyen
  0 siblings, 0 replies; 16+ messages in thread
From: Dinh Nguyen @ 2014-05-14 20:17 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc, chris, ulf.hansson, tgih.jun, zhangfei.gao

On Wed, 2014-05-14 at 13:55 +0900, Jaehoon Chung wrote:
> Hi, Dinh.
> 
> On 05/13/2014 12:48 AM, Dinh Nguyen wrote:
> > On Mon, 2014-05-12 at 20:14 +0900, Jaehoon Chung wrote:
> >> Remove the "support-highspeed" property in dw-mmc.
> >> "support-highspeed" property can be replaced to "cap-sd/mmc-highspeed".
> >>
> >> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> >> ---
> >>  .../devicetree/bindings/mmc/exynos-dw-mshc.txt     |    1 -
> >>  .../devicetree/bindings/mmc/k3-dw-mshc.txt         |    1 -
> >>  .../devicetree/bindings/mmc/synopsys-dw-mshc.txt   |    3 ---
> >>  arch/arm/boot/dts/exynos4412-odroidx.dts           |    2 +-
> >>  arch/arm/boot/dts/exynos4412-origen.dts            |    2 +-
> >>  arch/arm/boot/dts/exynos4412-trats2.dts            |    2 +-
> >>  arch/arm/boot/dts/exynos5250-arndale.dts           |    4 ++--
> >>  arch/arm/boot/dts/exynos5250-cros-common.dtsi      |    6 +++---
> >>  arch/arm/boot/dts/exynos5250-smdk5250.dts          |    4 ++--
> >>  arch/arm/boot/dts/exynos5420-arndale-octa.dts      |    4 ++--
> >>  arch/arm/boot/dts/exynos5420-smdk5420.dts          |    4 ++--
> >>  arch/arm/boot/dts/socfpga_arria5.dtsi              |    3 ++-
> >>  arch/arm/boot/dts/socfpga_cyclone5.dtsi            |    3 ++-
> >>  arch/arm/boot/dts/socfpga_vt.dts                   |    3 ++-
> >>  drivers/mmc/host/dw_mmc.c                          |    3 ---
> >>  15 files changed, 20 insertions(+), 25 deletions(-)
> >>
> > 
> > Should exynos5260-xyref5260.dts and exynos5420-peach-pit.dts also get
> > updated?
> 
> I didn't find them..? Is it included into dts folder.

Ah sorry, I tested this patch series against linux-next, which has these
2 patches.


81141a027c5d ARM: dts: add dts files for exynos5260-xyref5260 board
3528dd34b2d3 ARM: dts: Add exynos5420 peach-pit board support

Not sure if you want to fix those two boards up too, but just thought I
point them out to you.

Dinh

> 
> Best Regards,
> Jaehoon Chung
> > 
> > Dinh
> > 
> > 
> 



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

end of thread, other threads:[~2014-05-14 20:19 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-12 11:14 [PATCH 0/5] mmc: dw_mmc: minor code cleanup Jaehoon Chung
2014-05-12 11:14 ` [PATCH 1/5] mmc: dw_mmc: fix the wrong condition checking Jaehoon Chung
2014-05-12 11:14 ` [PATCH 2/5] mmc: dw_mmc: remove the "supports-highspeed" property Jaehoon Chung
2014-05-12 15:48   ` Dinh Nguyen
2014-05-14  4:55     ` Jaehoon Chung
2014-05-14 20:17       ` Dinh Nguyen
2014-05-12 17:43   ` Dinh Nguyen
2014-05-14  4:55     ` Jaehoon Chung
2014-05-12 11:14 ` [PATCH 3/5] mmc: dw_mmc-exynos: add the MMC_CAP_ERASE by default Jaehoon Chung
2014-05-13 11:15   ` Seungwon Jeon
2014-05-13 12:27     ` Jaehoon Chung
2014-05-12 11:14 ` [PATCH 4/5] mmc: dw_mmc: add the specified capbilities2 of controller Jaehoon Chung
2014-05-12 11:14 ` [PATCH 5/5] mmc: dw_mmc: use the mmc regulator API into core.c Jaehoon Chung
2014-05-12 17:41   ` Dinh Nguyen
2014-05-14  4:55     ` Jaehoon Chung
2014-05-14  9:48   ` Yuvaraj Cd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox