From patchwork Mon May 26 11:35:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 4241611 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1878B9F1E7 for ; Mon, 26 May 2014 11:35:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3E3D7201CE for ; Mon, 26 May 2014 11:35:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 52F0520160 for ; Mon, 26 May 2014 11:35:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752439AbaEZLfY (ORCPT ); Mon, 26 May 2014 07:35:24 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:45987 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752083AbaEZLfR (ORCPT ); Mon, 26 May 2014 07:35:17 -0400 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N6600DXQIUPRC20@mailout4.samsung.com>; Mon, 26 May 2014 20:35:13 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.114]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id D2.C9.19452.1F623835; Mon, 26 May 2014 20:35:13 +0900 (KST) X-AuditID: cbfee68e-b7fb96d000004bfc-8e-538326f1cd38 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 71.47.08203.1F623835; Mon, 26 May 2014 20:35:13 +0900 (KST) Received: from localhost.localdomain ([10.252.81.186]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N66006CJIUPY670@mmp2.samsung.com>; Mon, 26 May 2014 20:35:13 +0900 (KST) From: Jaehoon Chung 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 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 Message-id: <1401104107-17651-3-git-send-email-jh80.chung@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1401104107-17651-1-git-send-email-jh80.chung@samsung.com> References: <1401104107-17651-1-git-send-email-jh80.chung@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJLMWRmVeSWpSXmKPExsWyRsSkSPejWnOwQeNWZYsJl7czWsw/co7V 4savNlaLI//7GS1mnN/HZHFoZrLFh/sXmS2Orw134PBY8Gsri8eda3vYPG68Wsjk0bdlFaPH 501yAaxRXDYpqTmZZalF+nYJXBm9F66yFjSKVvTcnsLcwDhZsIuRk0NCwETi6/PJTBC2mMSF e+vZuhi5OIQEljJK3Ju+mwWmaP6hZ4wQiemMEk2/j0JVtTFJ7H1ynh2kik1AR2L7t+Ngo0QE ZCV+/rkAVsQscIpRorejixUkISwQLLHxzUtmEJtFQFXi5Y8esBW8Am4SsycsBmrgAFqnIDFn kg1ImFPAXWL5mpfsIGEhoJKTjY4gIyUEFrFLrF89iQlijIDEt8mHWCBaZSU2HWCGOFpS4uCK GywTGIUXMDKsYhRNLUguKE5KLzLSK07MLS7NS9dLzs/dxAgM9tP/nvXtYLx5wPoQYzLQuInM UqLJ+cBoySuJNzQ2M7IwNTE1NjK3NCNNWEmcd9HDpCAhgfTEktTs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1q5jNJrDYncnw3/7eNBXntUosxRmJhlrMRcWJABGO Ro7pAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP dw-mmc controller have the multiple slot. Then it needs to parse the property for each slot. Signed-off-by: Jaehoon Chung --- 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");