From patchwork Fri May 23 10:25:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 4230071 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EE567BF90B for ; Fri, 23 May 2014 10:26:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A1852021A for ; Fri, 23 May 2014 10:26:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 26D0C20204 for ; Fri, 23 May 2014 10:26:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752121AbaEWKZu (ORCPT ); Fri, 23 May 2014 06:25:50 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:28806 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbaEWKZq (ORCPT ); Fri, 23 May 2014 06:25:46 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N6000GDBVMB4C30@mailout1.samsung.com>; Fri, 23 May 2014 19:25:23 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.115]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 20.B9.14704.3122F735; Fri, 23 May 2014 19:25:23 +0900 (KST) X-AuditID: cbfee68f-b7fef6d000003970-6f-537f22139d65 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 66.8C.08203.3122F735; Fri, 23 May 2014 19:25:23 +0900 (KST) Received: from localhost.localdomain ([10.252.81.186]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N60007VWVMBNF80@mmp1.samsung.com>; Fri, 23 May 2014 19:25:23 +0900 (KST) From: Jaehoon Chung To: linux-mmc@vger.kernel.org Cc: Chris Ball , Ulf Hansson , Ludovic Desroches , Seungwon Jeon , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Jaehoon Chung Subject: [PATCH 2/3] mmc: dw_mmc: use the __mmc_of_parse to parse the slot node Date: Fri, 23 May 2014 19:25:20 +0900 Message-id: <1400840721-11050-3-git-send-email-jh80.chung@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1400840721-11050-1-git-send-email-jh80.chung@samsung.com> References: <1400840721-11050-1-git-send-email-jh80.chung@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPLMWRmVeSWpSXmKPExsWyRsSkWFdYqT7YYEmbmcWEy9sZLeYfOcdq ceNXG6vF5V1z2CyO/O9ntJhxfh+TxaGZyRYf7l9ktji+NtyB02PBr60sHneu7WHzuPFqIZNH 35ZVjB6fN8kFsEZx2aSk5mSWpRbp2yVwZey53s5W8Fykou/vDqYGxibBLkZODgkBE4m2LW9Z IGwxiQv31rN1MXJxCAksZZQ4ev4EC0zRxW/NTBCJRYwSnWfmsUI4bUwSbdchqtgEdCS2fzvO BGKLCMhK/PxzAWwUs8BqJomjy38zgySEBfwl2u5tZwexWQRUJZa2gezj5OAVcJNo650FNJUD aJ2CxJxJNiBhTgF3iXlzL7KC2EJAJR+2zwObKSGwjl3i86PjrBBzBCS+TT7EAtErK7HpADPE 1ZISB1fcYJnAKLyAkWEVo2hqQXJBcVJ6kbFecWJucWleul5yfu4mRmDgn/73rH8H490D1ocY k4HGTWSWEk3OB0ZOXkm8obGZkYWpiamxkbmlGWnCSuK89x8mBQkJpCeWpGanphak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OSDTU Yi4qTgQA4hSboO8CAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@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 --- 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");