public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Peng Fan <van.freenix@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] dm: gpio: mxc: fix mxc_gpio_bank_get_value
Date: Thu, 17 Mar 2016 09:44:33 +0800	[thread overview]
Message-ID: <20160317014430.GA27643@linux-7smt.suse> (raw)
In-Reply-To: <CAOMZO5CP6Qm8-Lt+f46o1QLxcJCNx=iDdBLBpskEK7eqzqoX-w@mail.gmail.com>

On Wed, Mar 16, 2016 at 09:48:24AM -0300, Fabio Estevam wrote:
>Hi Peng,
>
>On Tue, Mar 15, 2016 at 10:27 PM, Peng Fan <van.freenix@gmail.com> wrote:
>
>> If set the SION bit, we need to change the pinmux settings in device tree,
>> however device tree are introduced from linux kernel. I would not like
>> to change the pinmux setting value.
>>
>> So I choose to use data register but not PSR register.
>
>Haven't checked the kernel driver, but just curious: how does the
>kernel handle this?

bgc->gc.get = bgpio_get;

The get method:
* @get: returns value for signal "offset"; for output signals this
*      returns either the value actually sensed, or zero

138 static int bgpio_get(struct gpio_chip *gc, unsigned int gpio)
139 {
140         struct bgpio_chip *bgc = to_bgpio_chip(gc);
141
142         return !!(bgc->read_reg(bgc->reg_dat) & bgc->pin2mask(bgc, gpio));
143 }

The gpio subsystem use reg_data. The reg_data is GPIO_PSR for gpio-mxc.c:

450         err = bgpio_init(&port->bgc, &pdev->dev, 4,
451                          port->base + GPIO_PSR,
452                          port->base + GPIO_DR, NULL,
453                          port->base + GPIO_GDIR, NULL, 0);

So we know that kernel gpio-mxc use GPIO_PSR for reading data, but
as the comments for get method "for output signals this returns
either the value actually sensed, or zero", if no SION bit set, reading
PSR will return 0 with direction output.

But in U-Boot, the regulator driver needs to get the value when direction is
configured as output, we can use data register here or configure SION in pinmux.
But I prefer using data register here.

Thanks,
Peng.

  reply	other threads:[~2016-03-17  1:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15  5:48 [U-Boot] [PATCH 1/2] dm: gpio: mxc: fix mxc_gpio_bank_get_value Peng Fan
2016-03-15  5:48 ` [U-Boot] [PATCH 2/2] dm: gpio: mxc: implement xlate function Peng Fan
2016-03-16  3:32   ` Simon Glass
2016-04-11  5:28     ` Peng Fan
2016-04-11 14:56       ` Eric Nelson
2016-03-15 12:53 ` [U-Boot] [PATCH 1/2] dm: gpio: mxc: fix mxc_gpio_bank_get_value Fabio Estevam
2016-03-16  1:27   ` Peng Fan
2016-03-16 12:48     ` Fabio Estevam
2016-03-17  1:44       ` Peng Fan [this message]
2016-04-03 18:09         ` Stefano Babic
2016-04-05  5:04           ` Peng Fan
2016-04-09 18:35             ` Simon Glass

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=20160317014430.GA27643@linux-7smt.suse \
    --to=van.freenix@gmail.com \
    --cc=u-boot@lists.denx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox