From: marex@denx.de (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 07/12] ARM: imx6q: add config-on-boot gpios
Date: Tue, 22 May 2012 05:25:39 +0200 [thread overview]
Message-ID: <201205220525.39660.marex@denx.de> (raw)
In-Reply-To: <20120522031709.GH8140@S2101-09.ap.freescale.net>
Dear Shawn Guo,
> Apart from my comments below, we really need to know Rob and Grant's
> opinion on this.
Hm ... so why don't you actually write per-board driver ? :-) That'd handle
every single board very well, you'd configure the GPIOs there, every single
additional necessary thing that has to be configured would sink there too etc.
> On Mon, May 21, 2012 at 05:23:52PM +0800, Richard Zhao wrote:
> > 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 <richard.zhao@freescale.com>
> > Cc: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Rob Herring <rob.herring@calxeda.com>
> > Cc: Grant Likely <grant.likely@secretlab.ca>
> > ---
> >
> > 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 */
> > + };
> > +
>
> So it looks like something not specific to imx board but generic to
> other boards. If so, we may need to come up with a generic binding
> document for this.
>
> Is this only used to configure output pin? Will there be any pin that
> needs to be configured as input but not owned by any driver? Hopefully
> not.
>
> > 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 <linux/irqdomain.h>
> > #include <linux/of.h>
> > #include <linux/of_address.h>
> >
> > +#include <linux/of_gpio.h>
> >
> > #include <linux/of_irq.h>
> > #include <linux/of_platform.h>
> > #include <linux/pinctrl/machine.h>
> >
> > @@ -113,6 +114,38 @@ static void __init imx6q_sabrelite_init(void)
> >
> > imx6q_sabrelite_cko1_setup();
> >
> > }
> >
> > +static void __init imx6q_config_on_boot(void)
>
> Do you intend to make this function non-gpio-config only. Otherwise,
> we may need to have "gpio" in the function name, as well as the
> "config-on-boot" node name.
>
> Also, if we define the binding as generic one, we may need to find a
> common place to implement the function.
>
> > +{
> > + 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");
>
> So all the gpios will use the same name.
>
> And doesn't the reset generally need a pulse or edge signal, e.g. pull
> down for a msec and pull up?
>
> Regards,
> Shawn
>
> > + }
> > +
> > + 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();
> >
> > }
Best regards,
Marek Vasut
next prev parent reply other threads:[~2012-05-22 3:25 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-21 9:23 [PATCH v2 00/12] add imx usb driver for mx28/6x Richard Zhao
2012-05-21 9:23 ` [PATCH v2 01/12] usb: otg: add notify_connect_change callback Richard Zhao
2012-05-21 9:26 ` Felipe Balbi
2012-05-21 9:36 ` Richard Zhao
2012-05-21 9:38 ` Felipe Balbi
2012-05-21 10:19 ` Richard Zhao
2012-05-21 13:03 ` Greg KH
2012-05-21 13:05 ` Greg KH
2012-05-21 17:36 ` Marek Vasut
2012-05-21 17:47 ` Greg KH
2012-05-21 18:32 ` Marek Vasut
2012-05-21 18:40 ` Greg KH
2012-05-21 19:27 ` Marek Vasut
2012-05-22 0:27 ` Richard Zhao
2012-05-21 9:23 ` [PATCH v2 02/12] usb: chipidea: permit driver bindings pass phy pointer Richard Zhao
2012-05-22 4:22 ` Marek Vasut
2012-05-22 9:59 ` Alexander Shishkin
2012-05-22 14:07 ` Marek Vasut
2012-05-22 15:14 ` Richard Zhao
2012-05-23 1:35 ` Chen Peter-B29397
2012-05-23 8:08 ` Alexander Shishkin
2012-05-21 9:23 ` [PATCH v2 03/12] usb: ehci-hcd: notify phy when connect change Richard Zhao
2012-05-22 4:23 ` Marek Vasut
2012-05-22 4:36 ` Richard Zhao
2012-05-21 9:23 ` [PATCH v2 04/12] usb: otg: add basic mxs phy driver support Richard Zhao
2012-05-21 9:23 ` [PATCH v2 05/12] usb: chipidea: add imx driver binding Richard Zhao
2012-05-22 4:30 ` Marek Vasut
2012-05-22 4:51 ` Richard Zhao
2012-05-22 9:56 ` Alexander Shishkin
2012-05-22 10:06 ` Felipe Balbi
2012-05-22 10:31 ` Richard Zhao
2012-05-22 10:35 ` Felipe Balbi
2012-05-22 10:41 ` Alexander Shishkin
2012-05-22 15:06 ` Richard Zhao
2012-05-23 13:02 ` Alexander Shishkin
2012-05-23 13:09 ` Felipe Balbi
2012-05-23 13:13 ` Alexander Shishkin
2012-05-22 13:52 ` Shawn Guo
2012-05-22 13:55 ` Felipe Balbi
2012-05-22 10:21 ` Alexander Shishkin
2012-05-22 10:24 ` Alexander Shishkin
2012-05-22 15:30 ` Richard Zhao
2012-05-22 15:28 ` Richard Zhao
2012-05-21 9:23 ` [PATCH v2 06/12] ARM: imx6q: correct device name of usbphy and usb controller clock export Richard Zhao
2012-05-22 4:31 ` Marek Vasut
2012-05-22 4:56 ` Richard Zhao
2012-05-21 9:23 ` [PATCH v2 07/12] ARM: imx6q: add config-on-boot gpios Richard Zhao
2012-05-22 3:17 ` Shawn Guo
2012-05-22 3:25 ` Marek Vasut [this message]
2012-05-22 3:32 ` Shawn Guo
2012-05-22 4:20 ` Marek Vasut
2012-05-22 4:42 ` Shawn Guo
2012-05-22 5:22 ` Marek Vasut
2012-05-22 5:25 ` Shawn Guo
2012-05-22 5:27 ` Marek Vasut
2012-05-22 6:07 ` Richard Zhao
2012-05-22 3:38 ` Richard Zhao
2012-05-21 9:23 ` [PATCH v2 08/12] ARM: imx6q: add usbphy clocks Richard Zhao
2012-05-22 4:32 ` Marek Vasut
2012-05-22 4:45 ` Shawn Guo
2012-05-22 5:22 ` Marek Vasut
2012-05-22 4:59 ` Richard Zhao
2012-05-22 5:37 ` Shawn Guo
2012-05-22 6:08 ` Richard Zhao
2012-05-21 9:23 ` [PATCH v2 09/12] ARM: imx6q: disable usb charger detector Richard Zhao
2012-05-22 3:48 ` Shawn Guo
2012-05-22 4:32 ` Richard Zhao
2012-05-21 9:23 ` [PATCH v2 10/12] ARM: dts: imx6q-sabrelite: add usb devices Richard Zhao
2012-05-22 5:10 ` Shawn Guo
2012-05-22 5:59 ` Richard Zhao
2012-05-22 6:08 ` Shawn Guo
2012-05-22 6:19 ` Richard Zhao
2012-05-21 9:23 ` [PATCH v2 11/12] ARM: mxs: clk_register_clkdev mx28 usb clocks Richard Zhao
2012-05-22 4:48 ` Shawn Guo
2012-05-22 5:01 ` Richard Zhao
2012-05-21 9:23 ` [PATCH v2 12/12] ARM: dts: imx28-evk: add usb devices Richard Zhao
2012-05-22 4:52 ` Shawn Guo
2012-05-22 5:03 ` Richard Zhao
2012-05-22 5:24 ` Marek Vasut
2012-05-21 19:34 ` [PATCH v2 00/12] add imx usb driver for mx28/6x Fabio Estevam
2012-05-21 19:41 ` Marek Vasut
2012-05-21 19:47 ` Subodh Nijsure
2012-05-21 20:07 ` Marek Vasut
2012-05-22 1:38 ` Chen Peter-B29397
2012-05-22 1:41 ` Richard Zhao
2012-05-22 1:44 ` Chen Peter-B29397
2012-05-22 1:51 ` Richard Zhao
2012-05-22 2:00 ` Shawn Guo
2012-05-22 5:08 ` Richard Zhao
2012-05-22 13:13 ` Dirk Behme
2012-05-24 3:38 ` Richard Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201205220525.39660.marex@denx.de \
--to=marex@denx.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).