From patchwork Wed May 7 10:06:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ludovic Desroches X-Patchwork-Id: 4126861 Return-Path: X-Original-To: patchwork-linux-arm@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 DA19EBFF02 for ; Wed, 7 May 2014 10:09:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0992220222 for ; Wed, 7 May 2014 10:09:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 38550201FB for ; Wed, 7 May 2014 10:09:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Whyl5-0003ox-R1; Wed, 07 May 2014 10:07:27 +0000 Received: from eusmtp01.atmel.com ([212.144.249.243]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Whyl2-0003h4-9B for linux-arm-kernel@lists.infradead.org; Wed, 07 May 2014 10:07:25 +0000 Received: from ibiza.corp.atmel.com (10.161.101.13) by eusmtp01.atmel.com (10.161.101.31) with Microsoft SMTP Server id 14.2.347.0; Wed, 7 May 2014 12:06:58 +0200 From: Ludovic Desroches To: , , Subject: [PATCH RFC] mmc: add slot argument to mmc_of_parse Date: Wed, 7 May 2014 12:06:57 +0200 Message-ID: <1399457217-22846-1-git-send-email-ludovic.desroches@atmel.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140507_030724_649513_9413F07D X-CRM114-Status: GOOD ( 13.44 ) X-Spam-Score: -0.7 (/) Cc: ulf.hansson@linaro.org, Ludovic Desroches , chris@printf.net X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,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 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 nodes. If not NULL, slot node will be used instead of the device node. Signed-off-by: Ludovic Desroches --- Hi, Since this patch is only a RFC, I have not yet updated drivers using this function. I would like to use mmc_of_parse to reduce code duplication. My issue is that atmel mci is a bit different from others mci host since it can provide several slots, so it allocates several mmc hosts. By the way, it is not the only one. When calling mmc_alloc_host, host->parent is set to &pdev->dev. mmc_of_parse uses host->parent->of_node but in my case settings are in the slot nodes so in the child nodes. That's why I would like to have a way to tell which node I want to use. Regards Ludovic drivers/mmc/core/host.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index fdea825..ed6cea5 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -300,13 +300,15 @@ static inline void mmc_host_clk_sysfs_init(struct mmc_host *host) /** * mmc_of_parse() - parse host's device-tree node * @host: host whose node should be parsed. + * @slot: some devices 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) {