From patchwork Mon May 26 11:35:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 4241561 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 1677FBF90B for ; Mon, 26 May 2014 11:35:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43C65201F5 for ; Mon, 26 May 2014 11:35:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F9EB20204 for ; Mon, 26 May 2014 11:35:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752428AbaEZLfT (ORCPT ); Mon, 26 May 2014 07:35:19 -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 S1752080AbaEZLfP (ORCPT ); Mon, 26 May 2014 07:35:15 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N6600GBQIUP0P10@mailout4.samsung.com>; Mon, 26 May 2014 20:35:13 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.114]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id FE.60.16580.1F623835; Mon, 26 May 2014 20:35:13 +0900 (KST) X-AuditID: cbfee691-b7f2f6d0000040c4-0f-538326f17dae Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id E0.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 1/3] mmc: host: add slot argument to mmc_of_parse Date: Mon, 26 May 2014 20:35:05 +0900 Message-id: <1401104107-17651-2-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+NgFvrJLMWRmVeSWpSXmKPExsWyRsSkSPejWnOwwY7dMhYTLm9ntJh/5Byr xY1fbawWR/73M1rMOL+PyeLQzGSLD/cvMlscXxvuwOGx4NdWFo871/awedx4tZDJo2/LKkaP z5vkAlijuGxSUnMyy1KL9O0SuDLu7D/BVPBXtGLvzt+MDYx/BbsYOTkkBEwkFk26zAJhi0lc uLeerYuRi0NIYCmjxL/VW9hgiqYeaWeGSExnlJizfz0LhNPGJLH3yXl2kCo2AR2J7d+OM4HY IgKyEj//XAAbxSxwilGit6OLFSQhLOAs8Xr7BLAiFgFVidPTnoKt4BVwk+if+xloBQfQOgWJ OZNsQMKcAu4Sy9e8ZAcJCwGVnGx0BBkpIbCMXWL25hZ2iDECEt8mH2KBaJWV2HSAGeJoSYmD K26wTGAUXsDIsIpRNLUguaA4Kb3IVK84Mbe4NC9dLzk/dxMjMNhP/3s2cQfj/QPWhxiTgcZN ZJYSTc4HRkteSbyhsZmRhamJqbGRuaUZacJK4rzpj5KChATSE0tSs1NTC1KL4otKc1KL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v4pLPL7bzUGIpzkg01GIuKk4E AAm453HpAgAA 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, 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 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) {