linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Packham <Chris.Packham@alliedtelesis.co.nz>
To: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: gpio desc flags being lost
Date: Wed, 3 Jul 2019 05:35:46 +0000	[thread overview]
Message-ID: <d4724d7ec8ab4f95884ea947d9467e26@svr-chch-ex1.atlnz.lc> (raw)

Hi LinusW, Bartosz,

I was debugging something else and I noticed a problem with the gpio 
framework or the gpio-mmio driver (or both) in 5.2.0-rc6.

I have some gpio hogs in my device tree which seem to get requested at 
startup as expected

...
GPIO line 456 (sw-reset) hogged as output/low
GPIO line 459 (phy-1g-reset) hogged as output/low
GPIO line 460 (i2c-reset) hogged as output/low
GPIO line 461 (lm81-reset) hogged as output/low
GPIO line 462 (phy-led-reset) hogged as output/low
GPIO line 448 (pcie-reset) hogged as output/low
..

I wanted to see what state these lines were in

# cat /sys/kernel/debug/gpio
gpiochip4: GPIOs 448-455, parent: platform/fffa00029.dev-reset-ctl-2, 
fffa00029.dev-reset-ctl-2:

gpiochip3: GPIOs 456-463, parent: platform/fffa00020.dev-reset-ctl, 
fffa00020.dev-reset-ctl:

I expected the hogs to show up here.

# echo 448 >/sys/class/gpio/export

Now I'm pretty sure I shouldn't be allowed to do that.

# cat /sys/kernel/debug/gpio
gpiochip4: GPIOs 448-455, parent: platform/fffa00029.dev-reset-ctl-2, 
fffa00029.dev-reset-ctl-2:gpio-448 (                    |sysfs 
     ) in  lo

Doing a bit of debugging so far I see that after startup the desc->flags 
for those gpios is 0. But for the hogged ones it should be 0x800 (or 0x801).

I happen to have a 4.8.17 kernel for the board I'm using. Testing with 
that seems to be OK.

[root@linuxbox ~]# uname -a
Linux linuxbox 4.8.17-at1+ #3 SMP Wed Jul 3 05:30:55 UTC 2019 ppc GNU/Linux
[root@linuxbox ~]# cat /sys/kernel/debug/gpio
gpiochip4: GPIOs 448-455, parent: platform/fffa00029.dev-reset-ctl-2, 
fffa00029.dev-reset-ctl-2:
  gpio-448 (                    |pcie-reset          ) out lo

gpiochip3: GPIOs 456-463, parent: platform/fffa00020.dev-reset-ctl, 
fffa00020.dev-reset-ctl:
  gpio-456 (                    |sw-reset            ) out lo
  gpio-459 (                    |phy-1g-reset        ) out lo
  gpio-460 (                    |i2c-reset           ) out lo
  gpio-461 (                    |lm81-reset          ) out lo
  gpio-462 (                    |phy-led-reset       ) out lo

[root@linuxbox ~]# echo 448 >/sys/class/gpio/export
sh: write error: Device or resource busy

I'll do some proper bisecting tomorrow, but figured you might want to 
know sooner rather than later.

             reply	other threads:[~2019-07-03  5:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-03  5:35 Chris Packham [this message]
2019-07-03  6:28 ` gpio desc flags being lost Linus Walleij
2019-07-03  9:29   ` Chris Packham
2019-07-03 21:30     ` Chris Packham
2019-07-05 21:53       ` Linus Walleij

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=d4724d7ec8ab4f95884ea947d9467e26@svr-chch-ex1.atlnz.lc \
    --to=chris.packham@alliedtelesis.co.nz \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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).