periph icon indicating copy to clipboard operation
periph copied to clipboard

host: Rock64 headers definition

Open brusan opened this issue 6 years ago • 15 comments

After reviewing the Pine64 folder I realize my Go fingers are somewhat too inexperienced to contribute to this fantastic project :) Still, I'd like to help out with any info I can provide if there are plans for supporting the Rock64. As you are certainly aware, there are a number of differences between the Pine64 and the Rock64 when it comes to ports.

br/brusan

brusan avatar Apr 11 '18 22:04 brusan

Do you have one available? If so, you could extract /proc/devicetree/model and you could start something from there. The first step is to implement Present() bool

maruel avatar Apr 11 '18 22:04 maruel

Renamed the issue since as long sysfs works, basic functionality should be there.

maruel avatar Apr 11 '18 22:04 maruel

Yes, I have one running here. Will dig into it - and probably fail miserably :)

brusan avatar Apr 12 '18 21:04 brusan

Here's a simple example for the CHIP: https://github.com/google/periph/blob/master/host/chip/chip.go#L125

maruel avatar Apr 12 '18 21:04 maruel

Ok, thank you, I'll give it a try but be warned - I may need some help...

brusan avatar Apr 12 '18 21:04 brusan

I have implemented Present() bool, had to take a different route as compared to Pine64 but it works ok now. The /proc/devicetree/model tree is not available in this distro but seems to be at /sys/firmware/devicetree/base. uname -a => Linux rock64 4.4.77-rockchip-ayufan-136 #1 SMP Thu Oct 12 09:14:48 UTC 2017 aarch64 GNU/Linux I guess my next step would be looking at the CHIP example above and go from there?

brusan avatar Apr 15 '18 22:04 brusan

Btw, I discovered some disturbing info regarding the SD-card and the GPIO on the Rock64. Seems like several of the GPIO ports can not be used unless running the system from an eMMC card.

brusan avatar Apr 15 '18 22:04 brusan

/proc/device-tree/compatible is equivalent to /sys/firmware/devicetree/base/compatible, It'd device-tree, not devicetree, sorry I typo'ed above.

It happens that not all pins can be used, for example on the Raspberry Pi there's a few unusable GPIOs since they are using by the SDCard interface, this is normal.

maruel avatar Apr 16 '18 00:04 maruel

For the bcm283x driver, I decided against exposing these (GPIO47 to 53) so apps do not play with them by accident.

maruel avatar Apr 16 '18 00:04 maruel

Ok, those pins should not be exposed. There is a special case in the Rock64 case where they are available provided you boot the device from an eMMC-card but as I can not see how to detect that in the code I leave it out for now. I started of from a copy of the Pine64 code. There are several headers on the Pine64 that are not present on the Rock64 (e.g. Euler bus and expansion bus). Is it enough if I delete those sections from the rock64.go file or should I also make changes in other files?

brusan avatar Apr 16 '18 08:04 brusan

You need to only put the relevant buses. While it's also created by the same company "pine64" as the "pine64", it's using a completely different CPU. So while you can take inspiration from the package pine64, it's definitely a different beast.

maruel avatar Apr 16 '18 20:04 maruel

Thank you. Btw I drop the rock64 directory here as it stands right now just in case someone else would like to contribute. rock64.zip

brusan avatar Apr 16 '18 23:04 brusan

The best way to contribute is to use GitHub Pull Request system:

  • Visit https://github.com/google/periph
  • Click "Fork" on the top right
  • You'll get https://github.com/brusan/periph
  • Try to run git clone [email protected]:brusan/periph
    • It will fail if you never used ssh. Try git clone https://github.com/brusan/periph
    • There's more documentation at https://help.github.com/articles/cloning-a-repository/ and https://help.github.com/articles/which-remote-url-should-i-use/.
  • Do your change
  • Run git add .
  • Run git commit and enter a description
  • Run git push to push your change to your fork.
  • Create a pull request; https://help.github.com/articles/creating-a-pull-request/

Do you want to try this?

maruel avatar Apr 16 '18 23:04 maruel

Thank you for a great description. I'll continue working "offline" for a while since I have to make sure my project is making progress before the motorcycle track riding season starts up here in Sweden. Hence I am for the moment switching over to a Pi 3B+ platform to gain momentum and will return to the drivers in a few weeks.

brusan avatar Apr 17 '18 20:04 brusan

As I don't personally have a Rock64, unless I magically receive one in the mail I'll have to wait for someone to contribute the headers.

maruel avatar Jul 17 '18 13:07 maruel

I'll close this issue since while the original Rock64 is still available at https://pine64.com/product-category/single-board-computers/, it is not competitive and I didn't get additional requests for support in 5 years. If you believe this should be done, please file a new issue at https://github.com/periph/host. Thanks.

maruel avatar Sep 20 '23 17:09 maruel