linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] mmc: fixed the mmc_of_parse for dwmmc
@ 2014-05-23 10:25 Jaehoon Chung
  2014-05-23 10:25 ` [PATCH 1/3] mmc: host: add slot argument to mmc_of_parse Jaehoon Chung
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jaehoon Chung @ 2014-05-23 10:25 UTC (permalink / raw)
  To: linux-mmc
  Cc: Chris Ball, Ulf Hansson, Ludovic Desroches, Seungwon Jeon,
	devicetree, linux-kernel, linux-samsung-soc, Jaehoon Chung

This patch-set is fixed the dw-mmc controller problem.
dw-mmc controller have the slot, but mmc_of_parse didn't parse the slot sub-node.
So dw-mmc controller didn't work correctly.

Jaehoon Chung (2):
  mmc: dw_mmc: use the __mmc_of_parse to parse the slot node
  ARM: dts: replace the broken-cd property into slot node for dwmmc.

Ludovic Desroches (1):
  mmc: host: add slot argument to mmc_of_parse

 arch/arm/boot/dts/exynos4412-odroidx.dts      |    2 +-
 arch/arm/boot/dts/exynos4412-origen.dts       |    2 +-
 arch/arm/boot/dts/exynos4412-trats2.dts       |    4 ++--
 arch/arm/boot/dts/exynos5250-arndale.dts      |    2 +-
 arch/arm/boot/dts/exynos5250-cros-common.dtsi |    4 ++--
 arch/arm/boot/dts/exynos5250-smdk5250.dts     |    2 +-
 arch/arm/boot/dts/exynos5420-arndale-octa.dts |    2 +-
 arch/arm/boot/dts/rk3066a-bqcurie2.dts        |    2 +-
 arch/arm/boot/dts/socfpga_arria5.dtsi         |    2 +-
 arch/arm/boot/dts/socfpga_cyclone5.dtsi       |    2 +-
 arch/arm/boot/dts/socfpga_vt.dts              |    2 +-
 drivers/mmc/core/host.c                       |   13 +++++++++----
 drivers/mmc/host/dw_mmc.c                     |   25 ++++++-------------------
 include/linux/mmc/host.h                      |   10 +++++++++-
 14 files changed, 37 insertions(+), 37 deletions(-)

-- 
1.7.9.5


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

* [PATCH 1/3] mmc: host: add slot argument to mmc_of_parse
  2014-05-23 10:25 [PATCH 0/3] mmc: fixed the mmc_of_parse for dwmmc Jaehoon Chung
@ 2014-05-23 10:25 ` Jaehoon Chung
  2014-05-23 10:44   ` Tushar Behera
  2014-05-26  8:09   ` Ludovic Desroches
  2014-05-23 10:25 ` [PATCH 2/3] mmc: dw_mmc: use the __mmc_of_parse to parse the slot node Jaehoon Chung
  2014-05-23 10:25 ` [PATCH 3/3] ARM: dts: replace the broken-cd property into slot node for dwmmc Jaehoon Chung
  2 siblings, 2 replies; 9+ messages in thread
From: Jaehoon Chung @ 2014-05-23 10:25 UTC (permalink / raw)
  To: linux-mmc
  Cc: Chris Ball, Ulf Hansson, Ludovic Desroches, Seungwon Jeon,
	devicetree, linux-kernel, linux-samsung-soc, Jaehoon Chung

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Some hosts manage several slots. In these case information such as the
bus width, chi detect and others are into the slot node. So we have to
parse child node. If not NULL, slot node will be used instead of the
device node.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/core/host.c  |   13 +++++++++----
 include/linux/mmc/host.h |   10 +++++++++-
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 95cceae..0f677b3 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -298,15 +298,17 @@ static inline void mmc_host_clk_sysfs_init(struct mmc_host *host)
 #endif
 
 /**
- *	mmc_of_parse() - parse host's device-tree node
+ *	__mmc_of_parse() - parse host's device-tree node
  *	@host: host whose node should be parsed.
+ *	@slot : some device provide several slots so the node to parse
+ *		is not the host one.
  *
  * To keep the rest of the MMC subsystem unaware of whether DT has been
  * used to to instantiate and configure this host instance or not, we
  * parse the properties and set respective generic mmc-host flags and
  * parameters.
  */
-int mmc_of_parse(struct mmc_host *host)
+int __mmc_of_parse(struct mmc_host *host, struct device_node *slot)
 {
 	struct device_node *np;
 	u32 bus_width;
@@ -317,7 +319,10 @@ int mmc_of_parse(struct mmc_host *host)
 	if (!host->parent || !host->parent->of_node)
 		return 0;
 
-	np = host->parent->of_node;
+	if (slot)
+		np = slot;
+	else
+		np = host->parent->of_node;
 
 	/* "bus-width" is translated to MMC_CAP_*_BIT_DATA flags */
 	if (of_property_read_u32(np, "bus-width", &bus_width) < 0) {
@@ -459,7 +464,7 @@ out:
 	return ret;
 }
 
-EXPORT_SYMBOL(mmc_of_parse);
+EXPORT_SYMBOL(__mmc_of_parse);
 
 /**
  *	mmc_alloc_host - initialise the per-host structure.
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 7960424..c62af91 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -372,7 +372,15 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *);
 int mmc_add_host(struct mmc_host *);
 void mmc_remove_host(struct mmc_host *);
 void mmc_free_host(struct mmc_host *);
-int mmc_of_parse(struct mmc_host *host);
+int __mmc_of_parse(struct mmc_host *host, struct device_node *slot);
+/*
+ * mmc_of_parse - parse host's device-tree node
+ *	@host: host whose node should be parsed.
+ */
+static inline int mmc_of_parse(struct mmc_host *host)
+{
+	return __mmc_of_parse(host, NULL);
+}
 
 static inline void *mmc_priv(struct mmc_host *host)
 {
-- 
1.7.9.5


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

* [PATCH 2/3] mmc: dw_mmc: use the __mmc_of_parse to parse the slot node
  2014-05-23 10:25 [PATCH 0/3] mmc: fixed the mmc_of_parse for dwmmc Jaehoon Chung
  2014-05-23 10:25 ` [PATCH 1/3] mmc: host: add slot argument to mmc_of_parse Jaehoon Chung
@ 2014-05-23 10:25 ` Jaehoon Chung
  2014-05-23 10:25 ` [PATCH 3/3] ARM: dts: replace the broken-cd property into slot node for dwmmc Jaehoon Chung
  2 siblings, 0 replies; 9+ messages in thread
From: Jaehoon Chung @ 2014-05-23 10:25 UTC (permalink / raw)
  To: linux-mmc
  Cc: Chris Ball, Ulf Hansson, Ludovic Desroches, Seungwon Jeon,
	devicetree, linux-kernel, linux-samsung-soc, Jaehoon Chung

dw-mmc controller have the multiple slot.
Then it needs to parse the property for each slot.

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

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 1ac227c..d4800f8 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1015,12 +1015,11 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
 {
 	int present;
 	struct dw_mci_slot *slot = mmc_priv(mmc);
-	struct dw_mci_board *brd = slot->host->pdata;
 	struct dw_mci *host = slot->host;
 	int gpio_cd = mmc_gpio_get_cd(mmc);
 
 	/* Use platform get_cd function, else try onboard card detect */
-	if (brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION)
+	if (slot->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION)
 		present = 1;
 	else if (!IS_ERR_VALUE(gpio_cd))
 		present = gpio_cd;
@@ -2010,6 +2009,9 @@ static struct dw_mci_of_slot_quirks {
 	{
 		.quirk	= "disable-wp",
 		.id	= DW_MCI_SLOT_QUIRK_NO_WRITE_PROTECT,
+	}, {
+		.quirk	= "broken-cd",
+		.id	= DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
 	},
 };
 
@@ -2088,7 +2090,7 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 	if (host->pdata->caps2)
 		mmc->caps2 = host->pdata->caps2;
 
-	mmc_of_parse(mmc);
+	__mmc_of_parse(mmc, dw_mci_of_find_slot_node(host->dev, slot->id));
 
 	if (host->pdata->blk_settings) {
 		mmc->max_segs = host->pdata->blk_settings->max_segs;
@@ -2231,23 +2233,13 @@ static inline bool dw_mci_ctrl_all_reset(struct dw_mci *host)
 }
 
 #ifdef CONFIG_OF
-static struct dw_mci_of_quirks {
-	char *quirk;
-	int id;
-} of_quirks[] = {
-	{
-		.quirk	= "broken-cd",
-		.id	= DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
-	},
-};
-
 static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
 {
 	struct dw_mci_board *pdata;
 	struct device *dev = host->dev;
 	struct device_node *np = dev->of_node;
 	const struct dw_mci_drv_data *drv_data = host->drv_data;
-	int idx, ret;
+	int ret;
 	u32 clock_frequency;
 
 	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
@@ -2264,11 +2256,6 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
 		pdata->num_slots = 1;
 	}
 
-	/* get quirks */
-	for (idx = 0; idx < ARRAY_SIZE(of_quirks); idx++)
-		if (of_get_property(np, of_quirks[idx].quirk, NULL))
-			pdata->quirks |= of_quirks[idx].id;
-
 	if (of_property_read_u32(np, "fifo-depth", &pdata->fifo_depth))
 		dev_info(dev, "fifo-depth property not found, using "
 				"value of FIFOTH register as default\n");
-- 
1.7.9.5


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

* [PATCH 3/3] ARM: dts: replace the broken-cd property into slot node for dwmmc.
  2014-05-23 10:25 [PATCH 0/3] mmc: fixed the mmc_of_parse for dwmmc Jaehoon Chung
  2014-05-23 10:25 ` [PATCH 1/3] mmc: host: add slot argument to mmc_of_parse Jaehoon Chung
  2014-05-23 10:25 ` [PATCH 2/3] mmc: dw_mmc: use the __mmc_of_parse to parse the slot node Jaehoon Chung
@ 2014-05-23 10:25 ` Jaehoon Chung
  2 siblings, 0 replies; 9+ messages in thread
From: Jaehoon Chung @ 2014-05-23 10:25 UTC (permalink / raw)
  To: linux-mmc
  Cc: Chris Ball, Ulf Hansson, Ludovic Desroches, Seungwon Jeon,
	devicetree, linux-kernel, linux-samsung-soc, Jaehoon Chung

dw-mmc controller can be support the multiple slot.
So each slot's property can be difference.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 arch/arm/boot/dts/exynos4412-odroidx.dts      |    2 +-
 arch/arm/boot/dts/exynos4412-origen.dts       |    2 +-
 arch/arm/boot/dts/exynos4412-trats2.dts       |    4 ++--
 arch/arm/boot/dts/exynos5250-arndale.dts      |    2 +-
 arch/arm/boot/dts/exynos5250-cros-common.dtsi |    4 ++--
 arch/arm/boot/dts/exynos5250-smdk5250.dts     |    2 +-
 arch/arm/boot/dts/exynos5420-arndale-octa.dts |    2 +-
 arch/arm/boot/dts/rk3066a-bqcurie2.dts        |    2 +-
 arch/arm/boot/dts/socfpga_arria5.dtsi         |    2 +-
 arch/arm/boot/dts/socfpga_cyclone5.dtsi       |    2 +-
 arch/arm/boot/dts/socfpga_vt.dts              |    2 +-
 11 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/arm/boot/dts/exynos4412-odroidx.dts b/arch/arm/boot/dts/exynos4412-odroidx.dts
index 31db28a..24ec351 100644
--- a/arch/arm/boot/dts/exynos4412-odroidx.dts
+++ b/arch/arm/boot/dts/exynos4412-odroidx.dts
@@ -46,7 +46,6 @@
 
 		num-slots = <1>;
 		supports-highspeed;
-		broken-cd;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <2 3>;
@@ -55,6 +54,7 @@
 		slot@0 {
 			reg = <0>;
 			bus-width = <8>;
+			broken-cd;
 		};
 	};
 
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts
index e2c0dca..ed712a6 100644
--- a/arch/arm/boot/dts/exynos4412-origen.dts
+++ b/arch/arm/boot/dts/exynos4412-origen.dts
@@ -129,7 +129,6 @@
 
 		num-slots = <1>;
 		supports-highspeed;
-		broken-cd;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <2 3>;
@@ -138,6 +137,7 @@
 		slot@0 {
 			reg = <0>;
 			bus-width = <8>;
+			broken-cd;
 		};
 	};
 
diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
index 9583563..294a586 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -460,8 +460,6 @@
 	mmc@12550000 {
 		num-slots = <1>;
 		supports-highspeed;
-		broken-cd;
-		non-removable;
 		card-detect-delay = <200>;
 		vmmc-supply = <&vemmc_reg>;
 		clock-frequency = <400000000>;
@@ -475,6 +473,8 @@
 		slot@0 {
 			reg = <0>;
 			bus-width = <8>;
+			non-removable;
+			broken-cd;
 		};
 	};
 
diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
index 090f983..0c9a7da 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -400,7 +400,6 @@
 		status = "okay";
 		num-slots = <1>;
 		supports-highspeed;
-		broken-cd;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <2 3>;
@@ -412,6 +411,7 @@
 		slot@0 {
 			reg = <0>;
 			bus-width = <8>;
+			broken-cd;
 		};
 	};
 
diff --git a/arch/arm/boot/dts/exynos5250-cros-common.dtsi b/arch/arm/boot/dts/exynos5250-cros-common.dtsi
index 2c1560d..7ab3b94 100644
--- a/arch/arm/boot/dts/exynos5250-cros-common.dtsi
+++ b/arch/arm/boot/dts/exynos5250-cros-common.dtsi
@@ -249,7 +249,6 @@
 	mmc@12200000 {
 		num-slots = <1>;
 		supports-highspeed;
-		broken-cd;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <2 3>;
@@ -260,6 +259,7 @@
 		slot@0 {
 			reg = <0>;
 			bus-width = <8>;
+			broken-cd;
 		};
 	};
 
@@ -283,7 +283,6 @@
 	mmc@12230000 {
 		num-slots = <1>;
 		supports-highspeed;
-		broken-cd;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <2 3>;
@@ -293,6 +292,7 @@
 		slot@0 {
 			reg = <0>;
 			bus-width = <4>;
+			broken-cd;
 		};
 	};
 
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index a794a70..feffe24 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -283,7 +283,6 @@
 		status = "okay";
 		num-slots = <1>;
 		supports-highspeed;
-		broken-cd;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
 		samsung,dw-mshc-sdr-timing = <2 3>;
@@ -294,6 +293,7 @@
 		slot@0 {
 			reg = <0>;
 			bus-width = <8>;
+			broken-cd;
 		};
 	};
 
diff --git a/arch/arm/boot/dts/exynos5420-arndale-octa.dts b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
index 80a3bf4..0d3b467 100644
--- a/arch/arm/boot/dts/exynos5420-arndale-octa.dts
+++ b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
@@ -39,7 +39,6 @@
 
 	mmc@12200000 {
 		status = "okay";
-		broken-cd;
 		supports-highspeed;
 		card-detect-delay = <200>;
 		samsung,dw-mshc-ciu-div = <3>;
@@ -52,6 +51,7 @@
 		slot@0 {
 			reg = <0>;
 			bus-width = <8>;
+			broken-cd;
 		};
 	};
 
diff --git a/arch/arm/boot/dts/rk3066a-bqcurie2.dts b/arch/arm/boot/dts/rk3066a-bqcurie2.dts
index 035df40..62c7484 100644
--- a/arch/arm/boot/dts/rk3066a-bqcurie2.dts
+++ b/arch/arm/boot/dts/rk3066a-bqcurie2.dts
@@ -69,7 +69,6 @@
 		dwmmc@10218000 { /* wifi */
 			num-slots = <1>;
 			status = "okay";
-			non-removable;
 
 			pinctrl-names = "default";
 			pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_bus4>;
@@ -78,6 +77,7 @@
 				reg = <0>;
 				bus-width = <4>;
 				disable-wp;
+				non-removable;
 			};
 		};
 
diff --git a/arch/arm/boot/dts/socfpga_arria5.dtsi b/arch/arm/boot/dts/socfpga_arria5.dtsi
index 6c87b70..9c2b933 100644
--- a/arch/arm/boot/dts/socfpga_arria5.dtsi
+++ b/arch/arm/boot/dts/socfpga_arria5.dtsi
@@ -30,11 +30,11 @@
 		dwmmc0@ff704000 {
 			num-slots = <1>;
 			supports-highspeed;
-			broken-cd;
 
 			slot@0 {
 				reg = <0>;
 				bus-width = <4>;
+				broken-cd;
 			};
 		};
 
diff --git a/arch/arm/boot/dts/socfpga_cyclone5.dtsi b/arch/arm/boot/dts/socfpga_cyclone5.dtsi
index ca41b0e..c5c7b5f 100644
--- a/arch/arm/boot/dts/socfpga_cyclone5.dtsi
+++ b/arch/arm/boot/dts/socfpga_cyclone5.dtsi
@@ -31,11 +31,11 @@
 		dwmmc0@ff704000 {
 			num-slots = <1>;
 			supports-highspeed;
-			broken-cd;
 
 			slot@0 {
 				reg = <0>;
 				bus-width = <4>;
+				broken-cd;
 			};
 		};
 
diff --git a/arch/arm/boot/dts/socfpga_vt.dts b/arch/arm/boot/dts/socfpga_vt.dts
index 87d6f75..ff1111e 100644
--- a/arch/arm/boot/dts/socfpga_vt.dts
+++ b/arch/arm/boot/dts/socfpga_vt.dts
@@ -44,11 +44,11 @@
 		dwmmc0@ff704000 {
 			num-slots = <1>;
 			supports-highspeed;
-			broken-cd;
 
 			slot@0 {
 				reg = <0>;
 				bus-width = <4>;
+				broken-cd;
 			};
 		};
 
-- 
1.7.9.5


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

* Re: [PATCH 1/3] mmc: host: add slot argument to mmc_of_parse
  2014-05-23 10:25 ` [PATCH 1/3] mmc: host: add slot argument to mmc_of_parse Jaehoon Chung
@ 2014-05-23 10:44   ` Tushar Behera
  2014-05-26  8:09   ` Ludovic Desroches
  1 sibling, 0 replies; 9+ messages in thread
From: Tushar Behera @ 2014-05-23 10:44 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: linux-mmc, Chris Ball, Ulf Hansson, Ludovic Desroches,
	Seungwon Jeon, devicetree, lkml, linux-samsung-soc

On 23 May 2014 15:55, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>
> Some hosts manage several slots. In these case information such as the
> bus width, chi detect and others are into the slot node. So we have to
> parse child node. If not NULL, slot node will be used instead of the
> device node.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/core/host.c  |   13 +++++++++----
>  include/linux/mmc/host.h |   10 +++++++++-
>  2 files changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 95cceae..0f677b3 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -298,15 +298,17 @@ static inline void mmc_host_clk_sysfs_init(struct mmc_host *host)
>  #endif
>
>  /**
> - *     mmc_of_parse() - parse host's device-tree node
> + *     __mmc_of_parse() - parse host's device-tree node

IMO it would be better to rename this function, something like
mmc_of_parse_slot().

-- 
Tushar Behera

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

* Re: [PATCH 1/3] mmc: host: add slot argument to mmc_of_parse
  2014-05-23 10:25 ` [PATCH 1/3] mmc: host: add slot argument to mmc_of_parse Jaehoon Chung
  2014-05-23 10:44   ` Tushar Behera
@ 2014-05-26  8:09   ` Ludovic Desroches
  2014-05-26  8:38     ` Jaehoon Chung
  1 sibling, 1 reply; 9+ messages in thread
From: Ludovic Desroches @ 2014-05-26  8:09 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: linux-mmc, Chris Ball, Ulf Hansson, Ludovic Desroches,
	Seungwon Jeon, devicetree, linux-kernel, linux-samsung-soc

On Fri, May 23, 2014 at 07:25:19PM +0900, Jaehoon Chung wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Some hosts manage several slots. In these case information such as the
> bus width, chi detect and others are into the slot node. So we have to

/s/chi detect/chip detect

> parse child node. If not NULL, slot node will be used instead of the
> device node.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/core/host.c  |   13 +++++++++----
>  include/linux/mmc/host.h |   10 +++++++++-
>  2 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 95cceae..0f677b3 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -298,15 +298,17 @@ static inline void mmc_host_clk_sysfs_init(struct mmc_host *host)
>  #endif
>  
>  /**
> - *	mmc_of_parse() - parse host's device-tree node
> + *	__mmc_of_parse() - parse host's device-tree node
>   *	@host: host whose node should be parsed.
> + *	@slot : some device provide several slots so the node to parse
> + *		is not the host one.
>   *
>   * To keep the rest of the MMC subsystem unaware of whether DT has been
>   * used to to instantiate and configure this host instance or not, we
>   * parse the properties and set respective generic mmc-host flags and
>   * parameters.
>   */
> -int mmc_of_parse(struct mmc_host *host)
> +int __mmc_of_parse(struct mmc_host *host, struct device_node *slot)
>  {
>  	struct device_node *np;
>  	u32 bus_width;
> @@ -317,7 +319,10 @@ int mmc_of_parse(struct mmc_host *host)
>  	if (!host->parent || !host->parent->of_node)
>  		return 0;
>  
> -	np = host->parent->of_node;
> +	if (slot)
> +		np = slot;
> +	else
> +		np = host->parent->of_node;
>  
>  	/* "bus-width" is translated to MMC_CAP_*_BIT_DATA flags */
>  	if (of_property_read_u32(np, "bus-width", &bus_width) < 0) {
> @@ -459,7 +464,7 @@ out:
>  	return ret;
>  }
>  
> -EXPORT_SYMBOL(mmc_of_parse);
> +EXPORT_SYMBOL(__mmc_of_parse);
>  
>  /**
>   *	mmc_alloc_host - initialise the per-host structure.
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 7960424..c62af91 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -372,7 +372,15 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *);
>  int mmc_add_host(struct mmc_host *);
>  void mmc_remove_host(struct mmc_host *);
>  void mmc_free_host(struct mmc_host *);
> -int mmc_of_parse(struct mmc_host *host);
> +int __mmc_of_parse(struct mmc_host *host, struct device_node *slot);
> +/*
> + * mmc_of_parse - parse host's device-tree node
> + *	@host: host whose node should be parsed.
> + */
> +static inline int mmc_of_parse(struct mmc_host *host)
> +{
> +	return __mmc_of_parse(host, NULL);
> +}
>  
>  static inline void *mmc_priv(struct mmc_host *host)
>  {
> -- 
> 1.7.9.5
> 

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

* Re: [PATCH 1/3] mmc: host: add slot argument to mmc_of_parse
  2014-05-26  8:09   ` Ludovic Desroches
@ 2014-05-26  8:38     ` Jaehoon Chung
  2014-05-26  8:44       ` Ulf Hansson
  0 siblings, 1 reply; 9+ messages in thread
From: Jaehoon Chung @ 2014-05-26  8:38 UTC (permalink / raw)
  To: Jaehoon Chung, linux-mmc, Chris Ball, Ulf Hansson, Seungwon Jeon,
	devicetree, linux-kernel, linux-samsung-soc, Tushar Behera

Hi,

On 05/26/2014 05:09 PM, Ludovic Desroches wrote:
> On Fri, May 23, 2014 at 07:25:19PM +0900, Jaehoon Chung wrote:
>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>
>> Some hosts manage several slots. In these case information such as the
>> bus width, chi detect and others are into the slot node. So we have to
> 
> /s/chi detect/chip detect
Will fix.

Tushar have suggested the rename mmc_of_parse_slot() instead of __mmc_of_parse().
I'm not sure which name is better. How about?

If never mind, i will change to mmc_of_parse_slot(), then send patch-v2.

Best Regards,
Jaehoon Chung
> 
>> parse child node. If not NULL, slot node will be used instead of the
>> device node.
>>
>> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>>  drivers/mmc/core/host.c  |   13 +++++++++----
>>  include/linux/mmc/host.h |   10 +++++++++-
>>  2 files changed, 18 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
>> index 95cceae..0f677b3 100644
>> --- a/drivers/mmc/core/host.c
>> +++ b/drivers/mmc/core/host.c
>> @@ -298,15 +298,17 @@ static inline void mmc_host_clk_sysfs_init(struct mmc_host *host)
>>  #endif
>>  
>>  /**
>> - *	mmc_of_parse() - parse host's device-tree node
>> + *	__mmc_of_parse() - parse host's device-tree node
>>   *	@host: host whose node should be parsed.
>> + *	@slot : some device provide several slots so the node to parse
>> + *		is not the host one.
>>   *
>>   * To keep the rest of the MMC subsystem unaware of whether DT has been
>>   * used to to instantiate and configure this host instance or not, we
>>   * parse the properties and set respective generic mmc-host flags and
>>   * parameters.
>>   */
>> -int mmc_of_parse(struct mmc_host *host)
>> +int __mmc_of_parse(struct mmc_host *host, struct device_node *slot)
>>  {
>>  	struct device_node *np;
>>  	u32 bus_width;
>> @@ -317,7 +319,10 @@ int mmc_of_parse(struct mmc_host *host)
>>  	if (!host->parent || !host->parent->of_node)
>>  		return 0;
>>  
>> -	np = host->parent->of_node;
>> +	if (slot)
>> +		np = slot;
>> +	else
>> +		np = host->parent->of_node;
>>  
>>  	/* "bus-width" is translated to MMC_CAP_*_BIT_DATA flags */
>>  	if (of_property_read_u32(np, "bus-width", &bus_width) < 0) {
>> @@ -459,7 +464,7 @@ out:
>>  	return ret;
>>  }
>>  
>> -EXPORT_SYMBOL(mmc_of_parse);
>> +EXPORT_SYMBOL(__mmc_of_parse);
>>  
>>  /**
>>   *	mmc_alloc_host - initialise the per-host structure.
>> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
>> index 7960424..c62af91 100644
>> --- a/include/linux/mmc/host.h
>> +++ b/include/linux/mmc/host.h
>> @@ -372,7 +372,15 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *);
>>  int mmc_add_host(struct mmc_host *);
>>  void mmc_remove_host(struct mmc_host *);
>>  void mmc_free_host(struct mmc_host *);
>> -int mmc_of_parse(struct mmc_host *host);
>> +int __mmc_of_parse(struct mmc_host *host, struct device_node *slot);
>> +/*
>> + * mmc_of_parse - parse host's device-tree node
>> + *	@host: host whose node should be parsed.
>> + */
>> +static inline int mmc_of_parse(struct mmc_host *host)
>> +{
>> +	return __mmc_of_parse(host, NULL);
>> +}
>>  
>>  static inline void *mmc_priv(struct mmc_host *host)
>>  {
>> -- 
>> 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] 9+ messages in thread

* Re: [PATCH 1/3] mmc: host: add slot argument to mmc_of_parse
  2014-05-26  8:38     ` Jaehoon Chung
@ 2014-05-26  8:44       ` Ulf Hansson
  2014-05-26  9:11         ` Jaehoon Chung
  0 siblings, 1 reply; 9+ messages in thread
From: Ulf Hansson @ 2014-05-26  8:44 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: Jaehoon Chung, linux-mmc, Chris Ball, Seungwon Jeon, devicetree,
	linux-kernel, linux-samsung-soc, Tushar Behera

On 26 May 2014 10:38, Jaehoon Chung <jh80.chung@gmail.com> wrote:
> Hi,
>
> On 05/26/2014 05:09 PM, Ludovic Desroches wrote:
>> On Fri, May 23, 2014 at 07:25:19PM +0900, Jaehoon Chung wrote:
>>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>>
>>> Some hosts manage several slots. In these case information such as the
>>> bus width, chi detect and others are into the slot node. So we have to
>>
>> /s/chi detect/chip detect
> Will fix.
>
> Tushar have suggested the rename mmc_of_parse_slot() instead of __mmc_of_parse().
> I'm not sure which name is better. How about?
>
> If never mind, i will change to mmc_of_parse_slot(), then send patch-v2.

I would prefer to keep it as is, but just because that's my taste. :-)

Kind regards
Ulf Hansson

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

* Re: [PATCH 1/3] mmc: host: add slot argument to mmc_of_parse
  2014-05-26  8:44       ` Ulf Hansson
@ 2014-05-26  9:11         ` Jaehoon Chung
  0 siblings, 0 replies; 9+ messages in thread
From: Jaehoon Chung @ 2014-05-26  9:11 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Jaehoon Chung, linux-mmc, Chris Ball, Seungwon Jeon, devicetree,
	linux-kernel, linux-samsung-soc, Tushar Behera

Hi, Ulf.

On 05/26/2014 05:44 PM, Ulf Hansson wrote:
> On 26 May 2014 10:38, Jaehoon Chung <jh80.chung@gmail.com> wrote:
>> Hi,
>>
>> On 05/26/2014 05:09 PM, Ludovic Desroches wrote:
>>> On Fri, May 23, 2014 at 07:25:19PM +0900, Jaehoon Chung wrote:
>>>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>>>
>>>> Some hosts manage several slots. In these case information such as the
>>>> bus width, chi detect and others are into the slot node. So we have to
>>>
>>> /s/chi detect/chip detect
>> Will fix.
>>
>> Tushar have suggested the rename mmc_of_parse_slot() instead of __mmc_of_parse().
>> I'm not sure which name is better. How about?
>>
>> If never mind, i will change to mmc_of_parse_slot(), then send patch-v2.
> 
> I would prefer to keep it as is, but just because that's my taste. :-)
Ok. I think so.
I want to merge this patch-set for fixing the dw-mmc problem, before release the 3.16.

dw-mmc controller also used the slot concept, so some property didn't parse with mmc_of_parse().

Best Regards,
Jaehoon Chung
 
> 
> Kind regards
> Ulf Hansson
> 


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

end of thread, other threads:[~2014-05-26  9:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-23 10:25 [PATCH 0/3] mmc: fixed the mmc_of_parse for dwmmc Jaehoon Chung
2014-05-23 10:25 ` [PATCH 1/3] mmc: host: add slot argument to mmc_of_parse Jaehoon Chung
2014-05-23 10:44   ` Tushar Behera
2014-05-26  8:09   ` Ludovic Desroches
2014-05-26  8:38     ` Jaehoon Chung
2014-05-26  8:44       ` Ulf Hansson
2014-05-26  9:11         ` Jaehoon Chung
2014-05-23 10:25 ` [PATCH 2/3] mmc: dw_mmc: use the __mmc_of_parse to parse the slot node Jaehoon Chung
2014-05-23 10:25 ` [PATCH 3/3] ARM: dts: replace the broken-cd property into slot node for dwmmc Jaehoon Chung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).