A20 mainline kernel 5.8.0 - some GPIO ports does not works

93 views
Skip to first unread message

Milos Ladni

unread,
Jul 9, 2020, 12:51:51 PM7/9/20
to linux-sunxi
Hi,

I am using mainline kernel on my A20 board and can not get GPIO working for some ports.
I tested them through standard sysfs and for pin number id i used next : (position of letter in alphabet - 1) * 32 + pin number
I tried with PE0, PE1, PE2, and PE4, i think that whole PE port does not work. Pin is exported in /sys/class/gpioX and direction is set to 'out' but when i write 1 or 0 to value nothing happens (actually it changed value for 0.2~0.4V between logical 0 and 1). Pin numbers for that port was (5-1)*32+pinNumber => 128 + pinNumber.
In dtsi for A20 port E is by default intendent for CSI0 but CSI0 is not enabled in my case and i also tried to completly remove SCI0 from linux kernel and comment pin confiruration for CSI0 in dtsi file but it still does not works.
I noticed this issue because i use LVDS display and my display standby pin is connected to PE2.
After system is started i can login normally. After ~10 seconds i can see only this message in dmesg:

[   27.180481] random: crng init done
[   31.896048] vcc3v0: disabling
[   31.899038] vcc5v0: disabling
[   31.902015] ldo3: disabling
[   31.905150] ldo4: disabling
[   31.908346] ahci-5v: disabling
[   31.911416] usb0-vbus: disabling
[   31.914644] usb1-vbus: disabling

After this message PE2 goes to LOW and never come back to HIGH level.
I also tried to completelly remove my LVDS display and i got the same behavior for all pins on PE port.
I also tried to connect PE2 to pull-up 3V3 through 10k resistor but without success. After ~30 seconds after i turn on device PE2 goes LOW forever.
Interesting part is that when it is HIGH it is 2.8, not 3.3V. Maybe i missed some configuration in dts file.

Also tried PG1 and does not works.
Tried PH18, PH21 and it works.
Tried PB14 and it works.
Another ports i did not tried.

Interesting part is that because i enegled gpio debug in kernel setup i always get message "gpio gpiochip0: Persistence not supported for GPIO XXX" does not matter if if it is PE port which does not work or PH port which works.

Can someone check this issue or check my dts files?

Thank you,
Milos Ladicorbic
axp209.dtsi.txt
sun7i-a20.dtsi.txt
sun7i-a20-tcs.dts.txt
sun7i-a20-tcs-7zoll.dts.txt
sunxi-common-regulators.dtsi.txt
dmesg.txt

Chen-Yu Tsai

unread,
Jul 9, 2020, 1:06:05 PM7/9/20
to milosla...@gmail.com, linux-sunxi
Hi,

On Fri, Jul 10, 2020 at 12:51 AM Milos Ladni <milosla...@gmail.com> wrote:
>
> Hi,
>
> I am using mainline kernel on my A20 board and can not get GPIO working for some ports.
> I tested them through standard sysfs and for pin number id i used next : (position of letter in alphabet - 1) * 32 + pin number
> I tried with PE0, PE1, PE2, and PE4, i think that whole PE port does not work. Pin is exported in /sys/class/gpioX and direction is set to 'out' but when i write 1 or 0 to value nothing happens (actually it changed value for 0.2~0.4V between logical 0 and 1). Pin numbers for that port was (5-1)*32+pinNumber => 128 + pinNumber.
> In dtsi for A20 port E is by default intendent for CSI0 but CSI0 is not enabled in my case and i also tried to completly remove SCI0 from linux kernel and comment pin confiruration for CSI0 in dtsi file but it still does not works.
> I noticed this issue because i use LVDS display and my display standby pin is connected to PE2.
> After system is started i can login normally. After ~10 seconds i can see only this message in dmesg:
>
> [ 27.180481] random: crng init done
> [ 31.896048] vcc3v0: disabling
> [ 31.899038] vcc5v0: disabling
> [ 31.902015] ldo3: disabling
> [ 31.905150] ldo4: disabling
> [ 31.908346] ahci-5v: disabling
> [ 31.911416] usb0-vbus: disabling
> [ 31.914644] usb1-vbus: disabling
>
> After this message PE2 goes to LOW and never come back to HIGH level.
> I also tried to completelly remove my LVDS display and i got the same behavior for all pins on PE port.
> I also tried to connect PE2 to pull-up 3V3 through 10k resistor but without success. After ~30 seconds after i turn on device PE2 goes LOW forever.
> Interesting part is that when it is HIGH it is 2.8, not 3.3V. Maybe i missed some configuration in dts file.

What board are you using?

Any board based on Allwinner's reference design will use one of the
LDOs at 2.8V to power the
PE and PG pin groups. This is because the two pingroups are almost
exclusively used for camera
sensors, which a lot of use 2.8V I/O levels. Now if you don't have
power for the pingroups,
i.e. the LDOs are off, then of course the pins don't work.

First check your schematics to see if that's the case. Then you need
to properly wire up
pin power supplies using the vcc-pX-supply properties in the pinctrl
node. See other newer
boards for how that works.

ChenYu

> Also tried PG1 and does not works.
> Tried PH18, PH21 and it works.
> Tried PB14 and it works.
> Another ports i did not tried.
>
> Interesting part is that because i enegled gpio debug in kernel setup i always get message "gpio gpiochip0: Persistence not supported for GPIO XXX" does not matter if if it is PE port which does not work or PH port which works.
>
> Can someone check this issue or check my dts files?
>
> Thank you,
> Milos Ladicorbic
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/3526d3a3-64ae-403c-9fa1-8507bfd693f1o%40googlegroups.com.

Milos Ladni

unread,
Jul 9, 2020, 5:38:17 PM7/9/20
to linux-sunxi
Hi, thank you very much!

It works now. I totally forgot to enable ldo3 and ldo4:)
I am using my custom board and i want to migrate from legacy 3.4 to mainline.

Thanks,
Milos
> To unsubscribe from this group and stop receiving emails from it, send an email to linux...@googlegroups.com.

Priit Laes

unread,
Jul 10, 2020, 2:06:46 AM7/10/20
to Milos Ladni, linux-sunxi
On Thu, Jul 09, 2020 at 02:38:17PM -0700, Milos Ladni wrote:
> Hi, thank you very much!
>
> It works now. I totally forgot to enable ldo3 and ldo4:)
> I am using my custom board and i want to migrate from legacy 3.4 to
> mainline.

Sample patch for Olimex Lime2:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cd42ca0515d3952fc78a591618d57dd54f881d1f
> > an email to linux...@googlegroups.com <javascript:>.
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/da353c0a-2623-401e-816d-d1956b866aa5o%40googlegroups.com.

Milos Ladni

unread,
Jul 10, 2020, 9:49:58 AM7/10/20
to linux-sunxi
Thanks, i saw this in officialy kernel and dts for Lime2. It works perfect now:)
> To unsubscribe from this group and stop receiving emails from it, send an email to linux...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages