From patchwork Fri May 23 10:25:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 4230101 Return-Path: X-Original-To: patchwork-linux-mmc@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 851FA9F1CD for ; Fri, 23 May 2014 10:26:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B03BC2034B for ; Fri, 23 May 2014 10:26:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C34EE20204 for ; Fri, 23 May 2014 10:26:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752333AbaEWK0T (ORCPT ); Fri, 23 May 2014 06:26:19 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:17087 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751231AbaEWKZ1 (ORCPT ); Fri, 23 May 2014 06:25:27 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N60003K7VMBZJ70@mailout3.samsung.com>; Fri, 23 May 2014 19:25:24 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.114]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id B1.23.13369.3122F735; Fri, 23 May 2014 19:25:23 +0900 (KST) X-AuditID: cbfee690-b7fb56d000003439-38-537f2213e31e Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id B5.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 1/3] mmc: host: add slot argument to mmc_of_parse Date: Fri, 23 May 2014 19:25:19 +0900 Message-id: <1400840721-11050-2-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+NgFvrDLMWRmVeSWpSXmKPExsWyRsSkSFdYqT7Y4MtpQ4sJl7czWsw/co7V 4savNlaLy7vmsFkc+d/PaDHj/D4mi0Mzky0+3L/IbHF8bbgDp8eCX1tZPO5c28PmcePVQiaP vi2rGD0+b5ILYI3isklJzcksSy3St0vgyvh+w7rgpmjFw5NvWRoYnwh2MXJySAiYSOyYf50N whaTuHBvPZDNxSEksJRR4s3/+UwwRa+3zWaGSCxilDj8pYcJwmljkmi7foIFpIpNQEdi+7fj YB0iArISP/9cABvFLLCaSeLo8t9A7RwcwgKOEl23S0BqWARUJdYcv8IIEuYVcJPYvU0AxJQQ UJCYM8kGpIJTwF1i3tyLrCC2EFDFh+3zwCZKCKxjlzi0sIcZYoyAxLfJh1ggemUlNh1ghrhZ UuLgihssExiFFzAyrGIUTS1ILihOSi8y0StOzC0uzUvXS87P3cQIDPnT/55N2MF474D1IcZk oHETmaVEk/OBMZNXEm9obGZkYWpiamxkbmlGmrCSOK/ao6QgIYH0xJLU7NTUgtSi+KLSnNTi Q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rHq5bFN2ccPzFNUslluKMREMt 5qLiRACiAkRV7AIAAA== 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 From: Ludovic Desroches 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 Signed-off-by: Jaehoon Chung --- 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) {