From patchwork Mon Oct 29 13:28:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1663591 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 4AC1F3FDDA for ; Mon, 29 Oct 2012 13:43:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757610Ab2J2NnJ (ORCPT ); Mon, 29 Oct 2012 09:43:09 -0400 Received: from mail.df.lth.se ([194.47.250.12]:13988 "EHLO mail.df.lth.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758795Ab2J2NnI (ORCPT ); Mon, 29 Oct 2012 09:43:08 -0400 X-Greylist: delayed 359 seconds by postgrey-1.27 at vger.kernel.org; Mon, 29 Oct 2012 09:43:08 EDT Received: from mer.df.lth.se (mer.df.lth.se [194.47.250.37]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.df.lth.se (Postfix) with ESMTPS id 2209C65D89; Mon, 29 Oct 2012 14:37:07 +0100 (CET) Received: from mer.df.lth.se (triad@localhost.localdomain [127.0.0.1]) by mer.df.lth.se (8.14.3/8.14.3/Debian-9.4) with ESMTP id q9TDb6IY022482; Mon, 29 Oct 2012 14:37:06 +0100 Received: (from triad@localhost) by mer.df.lth.se (8.14.3/8.14.3/Submit) id q9TDb3At022481; Mon, 29 Oct 2012 14:37:03 +0100 From: Linus Walleij To: linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Russell King , Ulf Hansson , Linus Walleij Subject: [PATCH] MMCI: fetch pinctrl handle and set default state Date: Mon, 29 Oct 2012 14:28:39 +0100 Message-Id: <1351517319-22357-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.7.2.5 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org This fetches the pinctrl resource for the MMCI driver, and if a "default" state is found, it is activated. Acked-by: Ulf Hansson Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Change dev_err() to dev_warn() when grabbing the default pins since being unable to obtain the default state is not in any way fatal. --- drivers/mmc/host/mmci.c | 18 ++++++++++++++++++ drivers/mmc/host/mmci.h | 4 ++++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index edc3e9b..9a36226 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -1360,6 +1361,23 @@ static int __devinit mmci_probe(struct amba_device *dev, mmc->f_max = min(host->mclk, fmax); dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max); + host->pinctrl = devm_pinctrl_get(&dev->dev); + if (IS_ERR(host->pinctrl)) { + ret = PTR_ERR(host->pinctrl); + goto clk_disable; + } + + host->pins_default = pinctrl_lookup_state(host->pinctrl, + PINCTRL_STATE_DEFAULT); + + /* enable pins to be muxed in and configured */ + if (!IS_ERR(host->pins_default)) { + ret = pinctrl_select_state(host->pinctrl, host->pins_default); + if (ret) + dev_warn(&dev->dev, "could not set default pins\n"); + } else + dev_warn(&dev->dev, "could not get default pinstate\n"); + #ifdef CONFIG_REGULATOR /* If we're using the regulator framework, try to fetch a regulator */ host->vcc = regulator_get(&dev->dev, "vmmc"); diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index d437ccf..d34d8c0 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -195,6 +195,10 @@ struct mmci_host { unsigned int size; struct regulator *vcc; + /* pinctrl handles */ + struct pinctrl *pinctrl; + struct pinctrl_state *pins_default; + #ifdef CONFIG_DMA_ENGINE /* DMA stuff */ struct dma_chan *dma_current;