mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Cannot set GPIOs in barebox
@ 2018-07-19  9:05 Mihaita Ivascu
  2018-07-19 10:30 ` Mihaita Ivascu
  0 siblings, 1 reply; 5+ messages in thread
From: Mihaita Ivascu @ 2018-07-19  9:05 UTC (permalink / raw)
  To: barebox

Hello,

    I would like to set gpio direction and values from barebox. I use:

gpio_direction_output(133, 1);
        mdelay(2);
        gpio_set_value(133, 1);
        mdelay(2);
        gpio_direction_output(137, 1);
        mdelay(2);
        gpio_set_value(137, 1);

from my board.c or using commands in the barebox shell. Setting
direction is working but setting value it not performed.

GPIOs 128-159, chip 20ac000.gpio:
             dir val requested  label
  GPIO  128:  in  lo        false
  GPIO  129:  in  lo        false
  GPIO  130:  in  lo        false
  GPIO  131:  in  lo        false
  GPIO  132:  in  lo        false
  GPIO  133: out  lo         true  gpio
  GPIO  134:  in  lo        false
  GPIO  135:  in  lo        false
  GPIO  136:  in  lo        false
  GPIO  137: out  lo         true  gpio
  GPIO  138:  in  lo        false


    What could be the issue? And what could be the workaround? I would
really need to set some GPIOs high from the barebox.

Thanks,
      Mihaita

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cannot set GPIOs in barebox
  2018-07-19  9:05 Cannot set GPIOs in barebox Mihaita Ivascu
@ 2018-07-19 10:30 ` Mihaita Ivascu
  2018-07-30 19:27   ` Aleksander Morgado
  0 siblings, 1 reply; 5+ messages in thread
From: Mihaita Ivascu @ 2018-07-19 10:30 UTC (permalink / raw)
  To: barebox

Hello,

    This topic could be ignored. GPIO set/get value functions from
barebox are working fine BUT gpioinfo function has some bug it reports
unchanged status for gpios value.

Best regards,
         Mihaita Ivascu

On Thu, Jul 19, 2018 at 11:05 AM Mihaita Ivascu
<mihaita_ivascu@trimble.com> wrote:
>
> Hello,
>
>     I would like to set gpio direction and values from barebox. I use:
>
> gpio_direction_output(133, 1);
>         mdelay(2);
>         gpio_set_value(133, 1);
>         mdelay(2);
>         gpio_direction_output(137, 1);
>         mdelay(2);
>         gpio_set_value(137, 1);
>
> from my board.c or using commands in the barebox shell. Setting
> direction is working but setting value it not performed.
>
> GPIOs 128-159, chip 20ac000.gpio:
>              dir val requested  label
>   GPIO  128:  in  lo        false
>   GPIO  129:  in  lo        false
>   GPIO  130:  in  lo        false
>   GPIO  131:  in  lo        false
>   GPIO  132:  in  lo        false
>   GPIO  133: out  lo         true  gpio
>   GPIO  134:  in  lo        false
>   GPIO  135:  in  lo        false
>   GPIO  136:  in  lo        false
>   GPIO  137: out  lo         true  gpio
>   GPIO  138:  in  lo        false
>
>
>     What could be the issue? And what could be the workaround? I would
> really need to set some GPIOs high from the barebox.
>
> Thanks,
>       Mihaita

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cannot set GPIOs in barebox
  2018-07-19 10:30 ` Mihaita Ivascu
@ 2018-07-30 19:27   ` Aleksander Morgado
  2018-07-30 20:40     ` Andrey Smirnov
  0 siblings, 1 reply; 5+ messages in thread
From: Aleksander Morgado @ 2018-07-30 19:27 UTC (permalink / raw)
  To: Mihaita Ivascu; +Cc: barebox

Hey,

>
>     This topic could be ignored. GPIO set/get value functions from
> barebox are working fine BUT gpioinfo function has some bug it reports
> unchanged status for gpios value.
>

Not that I got into much detail, but when I saw that same issue (I
have some WIP patches to manage GPIOs via RATP) I just assumed that we
can reliably gpio_get_value() on input GPIOs, and gpio_set_value() on
output GPIOs. Trying to "read" the output GPIO value with
gpio_get_value() may not be reliable or even supported at all. Is that
assumption correct?

-- 
Aleksander
https://aleksander.es

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cannot set GPIOs in barebox
  2018-07-30 19:27   ` Aleksander Morgado
@ 2018-07-30 20:40     ` Andrey Smirnov
  2018-08-03  8:22       ` Mihaita Ivascu
  0 siblings, 1 reply; 5+ messages in thread
From: Andrey Smirnov @ 2018-07-30 20:40 UTC (permalink / raw)
  To: Aleksander Morgado; +Cc: mihaita_ivascu, Barebox List

On Mon, Jul 30, 2018 at 12:28 PM Aleksander Morgado
<aleksander@aleksander.es> wrote:
>
> Hey,
>
> >
> >     This topic could be ignored. GPIO set/get value functions from
> > barebox are working fine BUT gpioinfo function has some bug it reports
> > unchanged status for gpios value.
> >
>
> Not that I got into much detail, but when I saw that same issue (I
> have some WIP patches to manage GPIOs via RATP) I just assumed that we
> can reliably gpio_get_value() on input GPIOs, and gpio_set_value() on
> output GPIOs. Trying to "read" the output GPIO value with
> gpio_get_value() may not be reliable or even supported at all. Is that
> assumption correct?

AFAIK/IMHO this would really depend on the hardware platform. On
i.MX(also depending on IOMUX IP used as well) appropriate IOMUX
configuration is necessary in order to be able to "sense" the actual
logical level of a GPIO configured as . If I recall things correctly,
i.MX51/6/8, would require a SION bit set and i.MX7/VF610 would require
input buffer to be enabled, otherwise output GPIOs would always report
the same value via gpio_get_value().

Thanks,
Andrey Smirnov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cannot set GPIOs in barebox
  2018-07-30 20:40     ` Andrey Smirnov
@ 2018-08-03  8:22       ` Mihaita Ivascu
  0 siblings, 0 replies; 5+ messages in thread
From: Mihaita Ivascu @ 2018-08-03  8:22 UTC (permalink / raw)
  To: andrew.smirnov; +Cc: barebox, aleksander

Ok, thanks for the clarification.
On Mon, Jul 30, 2018 at 10:40 PM Andrey Smirnov
<andrew.smirnov@gmail.com> wrote:
>
> On Mon, Jul 30, 2018 at 12:28 PM Aleksander Morgado
> <aleksander@aleksander.es> wrote:
> >
> > Hey,
> >
> > >
> > >     This topic could be ignored. GPIO set/get value functions from
> > > barebox are working fine BUT gpioinfo function has some bug it reports
> > > unchanged status for gpios value.
> > >
> >
> > Not that I got into much detail, but when I saw that same issue (I
> > have some WIP patches to manage GPIOs via RATP) I just assumed that we
> > can reliably gpio_get_value() on input GPIOs, and gpio_set_value() on
> > output GPIOs. Trying to "read" the output GPIO value with
> > gpio_get_value() may not be reliable or even supported at all. Is that
> > assumption correct?
>
> AFAIK/IMHO this would really depend on the hardware platform. On
> i.MX(also depending on IOMUX IP used as well) appropriate IOMUX
> configuration is necessary in order to be able to "sense" the actual
> logical level of a GPIO configured as . If I recall things correctly,
> i.MX51/6/8, would require a SION bit set and i.MX7/VF610 would require
> input buffer to be enabled, otherwise output GPIOs would always report
> the same value via gpio_get_value().
>
> Thanks,
> Andrey Smirnov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-03  8:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19  9:05 Cannot set GPIOs in barebox Mihaita Ivascu
2018-07-19 10:30 ` Mihaita Ivascu
2018-07-30 19:27   ` Aleksander Morgado
2018-07-30 20:40     ` Andrey Smirnov
2018-08-03  8:22       ` Mihaita Ivascu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox