All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Alexandre Courbot <gnurou@gmail.com>,
	chrisrfq@gmail.com, Arun Bharadwaj <arun@gumstix.com>,
	devicetree@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Johan Hovold <johan@kernel.org>,
	linux-gpio@vger.kernel.org, kernel@pengutronix.de,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 3/3] gpiolib: Add GPIO initialization
Date: Sun, 7 May 2017 11:22:01 +0100	[thread overview]
Message-ID: <20170507102201.GL22219@n2100.armlinux.org.uk> (raw)
In-Reply-To: <20170207110950.zy5pzo2hq6hrvmr5@pengutronix.de>

On Tue, Feb 07, 2017 at 12:09:50PM +0100, Uwe Kleine-König wrote:
> Now additionally I want to initialize some gpios but allow them to be
> grabbed later. IMHO there are the following new cases:
> 
> It should be possible to:
> 
>  a) change the value of a gpio initially configured as output
>  b) change the direction of a gpio initially configured as output
>  c) change the direction of a gpio initially configured as input
> 
> IMHO the dts should describe which case should be applied to a given
> gpio.

Isn't it the job of the board firmware to ensure that the hardware is
setup to a reasonably sane state for the board?

You give an example of holding GPIOs low in Linux for "ESD reasons"
later in this thread, but if you're only doing that in Linux, what if
Linux isn't running yet, and the GPIO has been left floating by the
board firmware?  Fixing this in Linux is really too late.

Floating GPIOs are also a source of higher current drain - a GPIO
sitting mid-rail turns both transistors on for a MOS input, which gives
a direct path across the power supply.  The quicker that the GPIOs can
be initialised, the less wasted power there is.  So, that's another
argument for board firmware doing the basic GPIO initialisation and not
stuffing this into DT and having the kernel do it.

We could then talk about floating GPIOs that activate higher power
devices, and the arguments for doing GPIO initialisation as early as
possible in board firmware continue to stack up.

IMHO, initial configuration of GPIOs is the job of board firmware, not
the kernel.  I see no sane reason to push that into the kernel.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

WARNING: multiple messages have this Message-ID (diff)
From: linux@armlinux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/3] gpiolib: Add GPIO initialization
Date: Sun, 7 May 2017 11:22:01 +0100	[thread overview]
Message-ID: <20170507102201.GL22219@n2100.armlinux.org.uk> (raw)
In-Reply-To: <20170207110950.zy5pzo2hq6hrvmr5@pengutronix.de>

On Tue, Feb 07, 2017 at 12:09:50PM +0100, Uwe Kleine-K?nig wrote:
> Now additionally I want to initialize some gpios but allow them to be
> grabbed later. IMHO there are the following new cases:
> 
> It should be possible to:
> 
>  a) change the value of a gpio initially configured as output
>  b) change the direction of a gpio initially configured as output
>  c) change the direction of a gpio initially configured as input
> 
> IMHO the dts should describe which case should be applied to a given
> gpio.

Isn't it the job of the board firmware to ensure that the hardware is
setup to a reasonably sane state for the board?

You give an example of holding GPIOs low in Linux for "ESD reasons"
later in this thread, but if you're only doing that in Linux, what if
Linux isn't running yet, and the GPIO has been left floating by the
board firmware?  Fixing this in Linux is really too late.

Floating GPIOs are also a source of higher current drain - a GPIO
sitting mid-rail turns both transistors on for a MOS input, which gives
a direct path across the power supply.  The quicker that the GPIOs can
be initialised, the less wasted power there is.  So, that's another
argument for board firmware doing the basic GPIO initialisation and not
stuffing this into DT and having the kernel do it.

We could then talk about floating GPIOs that activate higher power
devices, and the arguments for doing GPIO initialisation as early as
possible in board firmware continue to stack up.

IMHO, initial configuration of GPIOs is the job of board firmware, not
the kernel.  I see no sane reason to push that into the kernel.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

  parent reply	other threads:[~2017-05-07 10:22 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-30  7:44 [PATCH v2 0/3] gpiolib: Initializing GPIOs using DT property gpio-initval Markus Pargmann
2015-08-30  7:44 ` Markus Pargmann
2015-08-30  7:44 ` [PATCH v2 1/3] gpio: Use __gpiod_request directly Markus Pargmann
2015-08-30  7:44   ` Markus Pargmann
2015-09-21 21:41   ` Linus Walleij
2015-09-21 21:41     ` Linus Walleij
2015-09-23  4:25   ` Alexandre Courbot
2015-09-23  4:25     ` Alexandre Courbot
     [not found]     ` <CAAVeFuJPzjJ6td9UZ993sbfOyEOo=7WVu-Y2KnFgXewyt_8knA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-24  7:02       ` Markus Pargmann
2015-09-24  7:02         ` Markus Pargmann
2015-09-24 17:49       ` Linus Walleij
2015-09-24 17:49         ` Linus Walleij
     [not found]         ` <CACRpkdaBxAhWKnJ3vsd+K6xMgaym7D9M0zTEMu_=fmiUNpxTEA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-27 14:32           ` Markus Pargmann
2015-09-27 14:32             ` Markus Pargmann
     [not found] ` <1440920686-6892-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-08-30  7:44   ` [PATCH v2 2/3] gpiolib: gpiod_hog remove separate name argument Markus Pargmann
2015-08-30  7:44     ` Markus Pargmann
2015-09-21 23:28     ` Linus Walleij
2015-09-21 23:28       ` Linus Walleij
2015-09-24  6:39       ` Markus Pargmann
2015-09-24  6:39         ` Markus Pargmann
2015-09-24 17:52         ` Linus Walleij
2015-09-24 17:52           ` Linus Walleij
2015-09-27 14:34           ` Markus Pargmann
2015-09-27 14:34             ` Markus Pargmann
2015-08-30  7:44 ` [PATCH v2 3/3] gpiolib: Add GPIO initialization Markus Pargmann
2015-08-30  7:44   ` Markus Pargmann
2015-09-21 11:01   ` Markus Pargmann
2015-09-21 11:01     ` Markus Pargmann
2015-09-21 23:42   ` Linus Walleij
2015-09-21 23:42     ` Linus Walleij
2015-09-24  6:48     ` Markus Pargmann
2015-09-24  6:48       ` Markus Pargmann
2017-02-07 11:09   ` Uwe Kleine-König
2017-02-07 11:09     ` Uwe Kleine-König
2017-02-07 13:30     ` Lothar Waßmann
2017-02-07 13:30       ` Lothar Waßmann
2017-02-07 14:57       ` Uwe Kleine-König
2017-02-07 14:57         ` Uwe Kleine-König
     [not found]     ` <20170207110950.zy5pzo2hq6hrvmr5-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-05-06 20:32       ` Uwe Kleine-König
2017-05-06 20:32         ` Uwe Kleine-König
2017-05-07  7:30         ` Linus Walleij
2017-05-07  7:30           ` Linus Walleij
2017-05-07  9:45           ` Uwe Kleine-König
2017-05-07  9:45             ` Uwe Kleine-König
2017-05-11 14:29             ` Linus Walleij
2017-05-11 14:29               ` Linus Walleij
     [not found]               ` <CACRpkdZPwH3vPjdCgCjYW4Q5OvbE5O0RLJ4bV-QLR2nVLy4kAQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-11 20:18                 ` Uwe Kleine-König
2017-05-11 20:18                   ` Uwe Kleine-König
2017-05-07 10:22     ` Russell King - ARM Linux [this message]
2017-05-07 10:22       ` Russell King - ARM Linux
2017-05-07 12:38       ` Uwe Kleine-König
2017-05-07 12:38         ` Uwe Kleine-König

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=20170507102201.GL22219@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=arun@gumstix.com \
    --cc=chrisrfq@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gnurou@gmail.com \
    --cc=johan@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.