From patchwork Mon May 21 09:23:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhao X-Patchwork-Id: 160342 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 871B1B6FB9 for ; Mon, 21 May 2012 19:29:52 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SWOt7-0004Ku-T1; Mon, 21 May 2012 09:26:52 +0000 Received: from ch1ehsobe003.messaging.microsoft.com ([216.32.181.183] helo=ch1outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SWOrU-0003Sx-AN for linux-arm-kernel@lists.infradead.org; Mon, 21 May 2012 09:25:09 +0000 Received: from mail68-ch1-R.bigfish.com (10.43.68.253) by CH1EHSOBE008.bigfish.com (10.43.70.58) with Microsoft SMTP Server id 14.1.225.23; Mon, 21 May 2012 09:24:55 +0000 Received: from mail68-ch1 (localhost [127.0.0.1]) by mail68-ch1-R.bigfish.com (Postfix) with ESMTP id 28EB04000C2; Mon, 21 May 2012 09:24:55 +0000 (UTC) X-SpamScore: 3 X-BigFish: VS3(zcb8kzzz1202hzz8275bh8275dhz2dh2a8h668h839hd24he5bhf0ah) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail68-ch1 (localhost.localdomain [127.0.0.1]) by mail68-ch1 (MessageSwitch) id 1337592292817316_17295; Mon, 21 May 2012 09:24:52 +0000 (UTC) Received: from CH1EHSMHS007.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.246]) by mail68-ch1.bigfish.com (Postfix) with ESMTP id B740646007F; Mon, 21 May 2012 09:24:52 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS007.bigfish.com (10.43.70.7) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 21 May 2012 09:24:52 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.2.298.5; Mon, 21 May 2012 04:25:03 -0500 Received: from b20223-02.ap.freescale.net (b20223-02.ap.freescale.net [10.192.242.124]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id q4L9Nwfg004395; Mon, 21 May 2012 04:24:58 -0500 (CDT) From: Richard Zhao To: , , Subject: [PATCH v2 07/12] ARM: imx6q: add config-on-boot gpios Date: Mon, 21 May 2012 17:23:52 +0800 Message-ID: <1337592237-5090-8-git-send-email-richard.zhao@freescale.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1337592237-5090-1-git-send-email-richard.zhao@freescale.com> References: <1337592237-5090-1-git-send-email-richard.zhao@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.32.181.183 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: marex@denx.de, B20596@freescale.com, linuxzsc@gmaill.com, dong.aisheng@linaro.org, fabio.estevam@freescale.com, alexander.shishkin@linux.intel.com, B29397@freescale.com, Rob Herring , Grant Likely , stern@rowland.harvard.edu, kernel@pengutronix.de, gregkh@linuxfoundation.org, richard.zhao@freescale.com, shawn.guo@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Sometimes, boards have gpios that don't own by any driver or owner by a generic driver that don't like hacks. Such gpios is normally output and need setup once on boot. So I introduce the config-on-boot gpios. Signed-off-by: Richard Zhao Cc: Shawn Guo Cc: Rob Herring Cc: Grant Likely --- arch/arm/boot/dts/imx6q-sabrelite.dts | 7 ++++++ arch/arm/mach-imx/mach-imx6q.c | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/imx6q-sabrelite.dts b/arch/arm/boot/dts/imx6q-sabrelite.dts index e0ec929..1dd2261 100644 --- a/arch/arm/boot/dts/imx6q-sabrelite.dts +++ b/arch/arm/boot/dts/imx6q-sabrelite.dts @@ -17,6 +17,13 @@ model = "Freescale i.MX6 Quad SABRE Lite Board"; compatible = "fsl,imx6q-sabrelite", "fsl,imx6q"; + config-on-boot { + output-gpios = < + &gpio3 22 0>; /* vbus reset */ + output-gpio-values = < + 1>; /* vbus reset */ + }; + memory { reg = <0x10000000 0x40000000>; }; diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index b47e98b..577cf19 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -113,6 +114,38 @@ static void __init imx6q_sabrelite_init(void) imx6q_sabrelite_cko1_setup(); } +static void __init imx6q_config_on_boot(void) +{ + struct device_node *np; + struct property *pp; + int cnt, len, i; + int gpio; + + np = of_find_node_by_path("/config-on-boot"); + if (!np) + return; + cnt = of_gpio_named_count(np, "output-gpios"); + pp = of_find_property(np, "output-gpio-values", &len); + if (!pp || cnt != len / sizeof(u32)) { + pr_err("Invalid config-on-boot gpios!\n"); + of_node_put(np); + return; + } + for (i = 0; i < cnt; i++) { + gpio = of_get_named_gpio(np, "output-gpios", i); + if (gpio_is_valid(gpio)) + gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, + "config-on-boot"); + } + + of_node_put(np); +} + +static void __init imx6q_post_populate(void) +{ + imx6q_config_on_boot(); +} + static void __init imx6q_init_machine(void) { /* @@ -126,6 +159,8 @@ static void __init imx6q_init_machine(void) of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + imx6q_post_populate(); + imx6q_pm_init(); }