From patchwork Wed May 28 05:35:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 4252691 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 8348EBF90B for ; Wed, 28 May 2014 05:36:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B51E020138 for ; Wed, 28 May 2014 05:36:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C82B120172 for ; Wed, 28 May 2014 05:36:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752768AbaE1FgC (ORCPT ); Wed, 28 May 2014 01:36:02 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:43438 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbaE1Ff7 (ORCPT ); Wed, 28 May 2014 01:35:59 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N6900J7MRJTVJ00@mailout4.samsung.com>; Wed, 28 May 2014 14:35:53 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.116]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id B6.43.13369.9B575835; Wed, 28 May 2014 14:35:53 +0900 (KST) X-AuditID: cbfee690-b7fb56d000003439-61-538575b9e303 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id D1.2A.07139.8B575835; Wed, 28 May 2014 14:35:53 +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 <0N6900AUBRJSSIB0@mmp2.samsung.com>; Wed, 28 May 2014 14:35:52 +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: [PATCHv3 1/4] mmc: host: add slot argument to mmc_of_parse Date: Wed, 28 May 2014 14:35:48 +0900 Message-id: <1401255351-17653-2-git-send-email-jh80.chung@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1401255351-17653-1-git-send-email-jh80.chung@samsung.com> References: <1401255351-17653-1-git-send-email-jh80.chung@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJLMWRmVeSWpSXmKPExsWyRsSkRHdnaWuwwdm7fBYTLm9ntJh/5Byr xY1fbawWR/73M1rMOL+PyeLQzGSLD/cvMlscXxvuwOGx4NdWFo871/awedx4tZDJo2/LKkaP z5vkAlijuGxSUnMyy1KL9O0SuDI6dy1hLfgtVnF/2RamBsZXQl2MnBwSAiYSzT3bmCBsMYkL 99azdTFycQgJLGWUWPDhPSNM0fn+T+wQiemMEisP32aCcNqYJFZMWcgKUsUmoCOx/dtxsFEi ArISP/9cABvFLHCKUaK3owusSFjAWeLixudANgcHi4CqxN0eU5Awr4CbxJRfc9hBwhICChJz JtmAhDkF3CXWT5vMDGILAZUcvXEUbKSEwDJ2iQVN+8B2sQgISHybfIgFoldWYtMBZoijJSUO rrjBMoFReAEjwypG0dSC5ILipPQiE73ixNzi0rx0veT83E2MwGA//e/ZhB2M9w5YH2JMBho3 kVlKNDkfGC15JfGGxmZGFqYmpsZG5pZmpAkrifOqPUoKEhJITyxJzU5NLUgtii8qzUktPsTI xMEp1cC4xs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ArsRRnJBpqMRcVJwIA dmfQPOkCAAA= 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 From: Ludovic Desroches 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 Signed-off-by: Jaehoon Chung Signed-off-by: Ulf Hansson Acked-by: Seungwon Jeon --- 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) {