public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH RFT] gpio: vybrid: Fix up setting output value in vybrid_gpio_direction_output
Date: Tue, 9 Jun 2015 19:23:21 +0530	[thread overview]
Message-ID: <5576EFD1.50504@toradex.com> (raw)
In-Reply-To: <CAFRkauCV4ThvrHUNZOJ=tJK4sBrMC1wwjr+TGpBtjtLYy-wy2Q@mail.gmail.com>

On 06/09/2015 06:49 PM, Axel Lin wrote:
> 2015-06-09 20:58 GMT+08:00 Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>:
>> Hello Axel,
>>
>> On 06/09/2015 02:45 PM, Axel Lin wrote:
>>>
>>> Pass correct gpio argument to gpio_set_value().
>>> The calcualation of gpio = gpio + (gpios->chip * VYBRID_GPIO_COUNT);
>>> is required for calling imx_iomux_gpio_* functions so move them close to
>>> improve readability.
>>>
>>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>>> ---
>>> Hi Bhuvanchandra,
>>> I think current code does not pass correct gpio argument to
>>> gpio_set_value()
>>> in vybrid_gpio_direction_output(). It only works if gpios->chip is 0.
>>> I don't have the h/w to test, can you double check this?
>>
>> gpio_set_value() needs the actual gpio number to be passed not the gpio
>> offset of gpio chip.
>
> Are you sure?
> Please take a look at gpio_get_value()/gpio_set_value() implement in
> drivers/gpio/gpio-uclass.c.
Yes,

Toggling GPIO_34 => GPIO_01 2nd instance, with debug prints:

Colibri VFxx # gpio toggle 34
DEBUG: gpio_to_device: gpio: 34
DEBUG: gpio_to_device: desc_offset: 2
DEBUG: gpio_to_device: gpio: 34
DEBUG: gpio_to_device: desc_offset: 2
DEBUG: gpio_to_device: gpio: 34
DEBUG: gpio_to_device: desc_offset: 2
DEBUG: vybrid_gpio_direction_output: gpio(before calculation): 2
DEBUG: vybrid_gpio_direction_output: gpio(after calculation): 34
DEBUG: gpio_set_value: gpio: 34
DEBUG: gpio_to_device: gpio: 34
DEBUG: gpio_to_device: desc_offset: 2
DEBUG: dm_gpio_set_value: gpio_offset: 2
gpio: pin 34 (gpio 34) value is 0
DEBUG: gpio_to_device: gpio: 34
DEBUG: gpio_to_device: desc_offset: 2
Colibri VFxx # gpio toggle 34
DEBUG: gpio_to_device: gpio: 34
DEBUG: gpio_to_device: desc_offset: 2
DEBUG: gpio_to_device: gpio: 34
DEBUG: gpio_to_device: desc_offset: 2
DEBUG: gpio_to_device: gpio: 34
DEBUG: gpio_to_device: desc_offset: 2
DEBUG: vybrid_gpio_direction_output: gpio(before calculation): 2
DEBUG: vybrid_gpio_direction_output: gpio(after calculation): 34
DEBUG: gpio_set_value: gpio: 34
DEBUG: gpio_to_device: gpio: 34
DEBUG: gpio_to_device: desc_offset: 2
DEBUG: dm_gpio_set_value: desc_offset: 2
gpio: pin 34 (gpio 34) value is 1
DEBUG: gpio_to_device: gpio: 34
DEBUG: gpio_to_device: desc_offset: 2
>

Best regards,
Bhuvan

  reply	other threads:[~2015-06-09 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09  9:15 [U-Boot] [PATCH RFT] gpio: vybrid: Fix up setting output value in vybrid_gpio_direction_output Axel Lin
2015-06-09 12:58 ` Bhuvanchandra DV
2015-06-09 13:19   ` Axel Lin
2015-06-09 13:53     ` Bhuvanchandra DV [this message]
2015-06-09 14:03       ` Axel Lin

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=5576EFD1.50504@toradex.com \
    --to=bhuvanchandra.dv@toradex.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