Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allwinner: extend supported CPUS (H2, H3) #1

Closed
chenjeff622 opened this issue Jan 1, 2021 · 6 comments · Fixed by #23
Closed

allwinner: extend supported CPUS (H2, H3) #1

chenjeff622 opened this issue Jan 1, 2021 · 6 comments · Fixed by #23

Comments

@chenjeff622
Copy link

as title. how do i porting please?

@maruel
Copy link
Member

maruel commented Jan 1, 2021

Could you contribute one?

If you want the headers, you could create a directory orangepi and use https://github.com/periph/host/tree/main/pine64 as an inspiration, then send a PR.

@chenjeff622
Copy link
Author

okey. i will give a try.

@f0086
Copy link
Contributor

f0086 commented Sep 26, 2022

@chenjeff622 Any progress on this? If not, I could pick this one up.
I want to support the Orange Pi Zero (v1) with an Allwinner H2 CPU (ARMv7-A). Sadly, the allwinner package does not detect the CPU (see here the detection logic). The H2 is a 32 bit CPU with the device string allwinner,sun8i-h2-plus. Can I just extend the check for this type to support the CPU or is there more work to be done? What do you think @maruel?

@chenjeff622
Copy link
Author

https://github.com/periph/host/tree/main/allwinner
You should to create h2 inside the folder. I don't have time to test my h3 board. Maybe we make it success together.

@maruel
Copy link
Member

maruel commented Sep 26, 2022

Even if the pinout is not supported, you can still use sysfs driver as a fallback.
I'm happy to have more memory registered driver! I don't have one to develop and test on.

@maruel maruel changed the title possible porting allwinner H3 or orangepi pc? allwinner: extend supported CPUS (H2, H3) Sep 26, 2022
f0086 added a commit to f0086/host that referenced this issue Dec 13, 2022
Add support for the Allwinner H2+ and H3 CPUs, which are almost
identical. The H2+ has no GBit MAC and no 4h HDMI, but the rest is
completely identical. For this library tho, it is not relevant, so we
can combine these two CPU types into one single H3 and detect the H2+ as
a H3 CPU.

Support for detecting Orange Pi Zero boards are added, which uses the H3
SOC. The Pinouts are from the Orange Pi manual.

This resolves periph#1
@f0086
Copy link
Contributor

f0086 commented Dec 13, 2022

I've implemented support for H2+ and H3 CPUs.

maruel pushed a commit that referenced this issue Dec 16, 2022
* Support for Allwinner H2+ and H3 (OrangePiSZero)

Add support for the Allwinner H2+ and H3 CPUs, which are almost
identical. The H2+ has no GBit MAC and no 4h HDMI, but the rest is
completely identical. For this library tho, it is not relevant, so we
can combine these two CPU types into one single H3 and detect the H2+ as
a H3 CPU.

Support for detecting Orange Pi Zero boards are added, which uses the H3
SOC. The Pinouts are from the Orange Pi manual.

Fixes #1
penguinland added a commit to penguinland/host that referenced this issue Jan 11, 2023
[RSDK-1008] Support GPIO pins on the NVidia Jetson Orin board

Tried at my desk: with these changes linked into the Viam RDK, I'm able to set the GPIO pins high and low through our app!

Motivation for this is described at periph#26: on every other (non-Orin) board, if you enable a GPIO pin, it gets created in `/sys/class/gpio/gpioN` where `N` is the pin's number. but the Orin uses different names, so we need to include those names separately. 

Linking things up: this is the same PR as periph#27, but into our own fork instead of the original repo. This is a quick-and-dirty approach to get our Orin prototype up and running. This approach doesn't support muxing the pins to other locations (apologies if that's the wrong phrasing, I only half understand what it means), hence why the other version of this PR might not get accepted into the original repo in the near future. We (or they, if they get there first?) can figure that out later, when our support for the Orin is further along.

#### How the list of names was constructed ####

[Nvidia's documentation](https://developer.nvidia.com/docs/drive/drive-os/archives/6.0.3/linux/sdk/oxy_ex-1/common/topics/sys_components/CalculatingGPIOIndexinLinux32.html) describes what they should be in theory. 

In practice, there are 2 GPIO chips, and you can see their offsets and how many pins they have: 
```
viam@orindevkit2:~$ cd /sys/class/gpio
viam@orindevkit2:/sys/class/gpio$ ls
export  gpiochip316  gpiochip348  unexport
viam@orindevkit2:/sys/class/gpio$ cat gpiochip316/base
316
viam@orindevkit2:/sys/class/gpio$ cat gpiochip316/ngpio 
32
viam@orindevkit2:/sys/class/gpio$ cat gpiochip348/base
348
viam@orindevkit2:/sys/class/gpio$ cat gpiochip348/ngpio
164
```
You can see that they're contiguous with each other: one starts at 316 and has 32 pins, and the other starts at 348 and has 164 pins. You can then enumerate all the pins by running `for i in $(seq 316 511); do echo "$i: $(echo $i > export; ls|grep -v export|grep -v gpiochip3; echo $i > unexport)"; done`. A handful of pins give errors rather than being exported, but all the rest of the names match up with what they're supposed to be in theory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants