From patchwork Mon Oct 22 07:52:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12389 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E855F23EF8 for ; Mon, 22 Oct 2012 07:52:37 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 8494AA18482 for ; Mon, 22 Oct 2012 07:52:37 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so3051151iej.11 for ; Mon, 22 Oct 2012 00:52:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=BAH85YSmlGpMWbBLb8dttAgRCKTY0iRnhzp58llV7q4=; b=SKnIDqlQA2sRJxb4Qtn7sG8h5b9C3FplxN/9+vaTZ7AUhcsjRDuNpIVPAmvjNXkLu3 X91yZF5W+b5zi01ynOU3pA0GWNmvfZyE70MzKIut2n5rFmxMSChK5E10xwxbpr1dT+/K ew02r7onRuKzdFJc3xUuC0U8C948JBkserlEL43gx7JQgR/fJA78RDPY6rrh2/CFnX+d PSmkobGVUqoHPCRNfwhYUeeGfwhOO2Klp56oQIOxqKhPiZ/QYYL2AxhrX6RcMwNF5FjJ ++w0et5ve/Tx7xfdTGZqhhvzRJlaLBonU1o1bS2XoXbGtZX3s/MEt2csWZaxqozkJAbe nocA== Received: by 10.50.88.233 with SMTP id bj9mr8182553igb.70.1350892356901; Mon, 22 Oct 2012 00:52:36 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp187048igt; Mon, 22 Oct 2012 00:52:36 -0700 (PDT) Received: by 10.14.178.195 with SMTP id f43mr10918120eem.44.1350892355937; Mon, 22 Oct 2012 00:52:35 -0700 (PDT) Received: from eu1sys200aog102.obsmtp.com (eu1sys200aog102.obsmtp.com [207.126.144.113]) by mx.google.com with SMTP id f7si428200eeo.94.2012.10.22.00.52.29 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Oct 2012 00:52:35 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.113 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.113; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.113 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob102.postini.com ([207.126.147.11]) with SMTP ID DSNKUIT7OQ+0evFtUSiB8nZUtnCFiaqBMChq@postini.com; Mon, 22 Oct 2012 07:52:35 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 504DB191; Mon, 22 Oct 2012 07:52:16 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id AB03D276C; Mon, 22 Oct 2012 07:52:15 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 8354AA8065; Mon, 22 Oct 2012 09:52:11 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 22 Oct 2012 09:52:14 +0200 From: Linus Walleij To: , Cc: Russell King , Ulf Hansson , Anmar Oueja , Linus Walleij Subject: [PATCH] MMCI: fetch pinctrl handle and set default state Date: Mon, 22 Oct 2012 09:52:06 +0200 Message-ID: <1350892326-5125-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQn7MyncoQvaAND5bhFFFawcYPrcFn35BQKAOyJYrZvp4dJAnSGkWAIJ2ZMbF14iT1om2ASO From: Linus Walleij This fetches the pinctrl resource for the MMCI driver, and if a "default" state is found, it is activated. Signed-off-by: Linus Walleij --- drivers/mmc/host/mmci.c | 18 ++++++++++++++++++ drivers/mmc/host/mmci.h | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index edc3e9b..269566d 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_err(&dev->dev, "could not set default pins\n"); + } else + dev_err(&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;