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: [PATCHv2 2/3] mmc: dw_mmc: use the __mmc_of_parse to parse the slot node
Date: Mon, 26 May 2014 20:35:06 +0900	[thread overview]
Message-ID: <1401104107-17651-3-git-send-email-jh80.chung@samsung.com> (raw)
In-Reply-To: <1401104107-17651-1-git-send-email-jh80.chung@samsung.com>

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>
---
Changelog V2:
	- None

 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


  parent reply	other threads:[~2014-05-26 11:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26 11:35 [PATCHv2 0/3] mmc: fixed the mmc_of_parse for dwmmc Jaehoon Chung
2014-05-26 11:35 ` [PATCHv2 1/3] mmc: host: add slot argument to mmc_of_parse Jaehoon Chung
2014-05-26 14:37   ` Ulf Hansson
2014-05-27  9:48   ` Seungwon Jeon
2014-05-26 11:35 ` Jaehoon Chung [this message]
2014-05-27  9:49   ` [PATCHv2 2/3] mmc: dw_mmc: use the __mmc_of_parse to parse the slot node Seungwon Jeon
2014-05-27 10:07     ` Jaehoon Chung
2014-05-26 11:35 ` [PATCHv2 3/3] ARM: dts: replace the broken-cd property into slot node for dwmmc Jaehoon Chung
2014-05-27  9:49   ` Seungwon Jeon
2014-05-27 10:08     ` Jaehoon Chung
2014-05-27 10:38     ` Ulf Hansson

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=1401104107-17651-3-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.