Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Orange Pi Zero U-Boot GPIO access

Featured Replies

I'm working with an Orange Pi Zero board powered by OpenWRT with U-Boot (2018.11) and kernel (4.14.93).

 

I'm trying to implement a recovery mode by inspecting a state of some button during an u-boot phase. This button is connected to a PL4 GPIO line. When Linux gets loaded it's possible to read a state of this GPIO line, but during an u-boot phase result is the same ( 0 ) regardless of a real state of the button (`gpio input pl4`).

As I got from H2+ datasheet, L port is a dedicated port (bank) with all GPIO lines disabled by default, when I try to change value of a configuration register for this port nothing changes - I read it and see that it's the same.

I used both direct memory access (writel and pointer dereferencing) and indirect access - sunxi_gpio_set_cfgpin(). Also I see, indirectly,  that the GPIO line is disabled by inspection result of a `gpio st` command.

 

. How can I turn on any GPIO line on an L port?

. Do I have to change something to *dts / board.c file(s) to make `gpio input pl4` work properly?

 

Thanks in advance for any help.

Indeed by default R_PIO-based GPIOs aren't accessible in u-boot.  I made an Armbian patch last year to enable R_PIO access in the PRCM so that I could read the board revision GPIO PL3 on the NEO2 v1.1 (H5-based).  You can take a look at the change here:  https://github.com/armbian/build/blob/master/patch/u-boot/u-boot-sunxi/enable-r_pio-gpio-access-h3-h5.patch.  I would imagine that you should be able to add the "prcm_apb0_enable(PRCM_APB0_GATE_PIO)" call to your OpenWRT u-boot; after you do this the GPIO commands/function access for PL4 should work (hopefully!).  What's awesome about all of this is how it is basically not documented anywhere :)

 

1 hour ago, 5kft said:

I made an Armbian patch last year to enable R_PIO access in the PRCM

Maybe that could becomes use as default for Armbian U-Boot ...

Would you mind doing a PR for that ?

1 hour ago, 5kft said:

What's awesome about all of this is how it is basically not documented anywhere :)

Right ! U-Boot in general is not well documented ...

  • Author
12 hours ago, 5kft said:

Indeed by default R_PIO-based GPIOs aren't accessible in u-boot.  I made an Armbian patch last year to enable R_PIO access in the PRCM so that I could read the board revision GPIO PL3 on the NEO2 v1.1 (H5-based).  You can take a look at the change here:  https://github.com/armbian/build/blob/master/patch/u-boot/u-boot-sunxi/enable-r_pio-gpio-access-h3-h5.patch.  I would imagine that you should be able to add the "prcm_apb0_enable(PRCM_APB0_GATE_PIO)" call to your OpenWRT u-boot; after you do this the GPIO commands/function access for PL4 should work (hopefully!).  What's awesome about all of this is how it is basically not documented anywhere :)

 

Thanks a lot, it works!

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.