All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: linux-mmc@vger.kernel.org
Cc: chris@printf.net, ulf.hansson@linaro.org,
	ludovic.desroches@atmel.com, tgih.jun@samsung.com,
	devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	Jaehoon Chung <jh80.chung@samsung.com>
Subject: [PATCHv3 1/4] mmc: host: add slot argument to mmc_of_parse
Date: Wed, 28 May 2014 14:35:48 +0900	[thread overview]
Message-ID: <1401255351-17653-2-git-send-email-jh80.chung@samsung.com> (raw)
In-Reply-To: <1401255351-17653-1-git-send-email-jh80.chung@samsung.com>

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

Some hosts manage several slots. In these case information such as the
bus width, chip 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>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
---
Changelog V3:
	- None.
Changelog V2:
	- Fix the typo.

 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

  reply	other threads:[~2014-05-28  5:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28  5:35 [PATCHv3 0/4] mmc: fixed the mmc_of_parse for dwmmc Jaehoon Chung
2014-05-28  5:35 ` Jaehoon Chung [this message]
2014-05-28  5:35 ` [PATCHv3 2/4] mmc: dw_mmc: use the __mmc_of_parse to parse the slot node Jaehoon Chung
2014-05-30 12:53   ` Seungwon Jeon
2014-05-28  5:35 ` [PATCHv3 3/4] mmc: dw_mmc: remove the "supports-highspeed" property Jaehoon Chung
2014-05-30  8:01   ` Ulf Hansson
2014-05-30  8:12     ` Jaehoon Chung
2014-05-30 12:51       ` Seungwon Jeon
2014-06-03 13:43     ` Mark Rutland
2014-05-30 12:53   ` Seungwon Jeon
2014-05-28  5:35 ` [PATCHv3 4/4] ARM: dts: replace the slot property into slot sub-node for dwmmc Jaehoon Chung
2014-05-30 12:54   ` Seungwon Jeon
2014-05-30 18:15     ` Heiko Stübner
2014-06-02 13:08       ` Dinh Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401255351-17653-2-git-send-email-jh80.chung@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=chris@printf.net \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=ludovic.desroches@atmel.com \
    --cc=tgih.jun@samsung.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.