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

orangepi5.wip: initial OrangePi5 support; collab with @efectn #4582

Merged
merged 6 commits into from Dec 31, 2022

Conversation

rpardini
Copy link
Member

@rpardini rpardini commented Dec 18, 2022

orangepi5.wip: initial OrangePi5 support

  • everything is on top of existing rockchip-rk3588 family
    • thus the same crazy half-android rk kernel tree and ancient rk u-boot

  • OPi5's Xunlong vendor u-boot; override family in board hook
      - using original config from vendor, needs BOOT_SOC

  • OPi5's kernel patches, all extracted from Xunlong's tree
      - Only enable the DT patch and the Motorcomm PHY patch
      - Other stuff that looks might be useful is grouped in a few other disabled patches
      - Most panel/overlays/etc from Xunlong tree not included

  • OPi5: rockchip-rk3588-legacy: add patch to remove chosen > bootargs from rk3588-linux.dtsi
    • make sure this does not break the rock-5b


@rpardini
Copy link
Member Author

Test image is building (on arm64), should be up at https://github.com/rpardini/armbian-release/releases/tag/20221218b if all goes well.

config/boards/orangepi5.wip Outdated Show resolved Hide resolved
schwar3kat
schwar3kat previously approved these changes Dec 18, 2022
Copy link
Contributor

@schwar3kat schwar3kat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks okay to me. Only one synergy that I am aware of that might be of interest.
The 2002-OrangePi5-dubious-Motcomm-stuff-extracted-from-Xun.patch.disabled looks at first glance similar to the patch in rockchip64 add-driver-for-Motorcomm-YT85xx+PHYs.patch that I added for the yt8531C in the orangepi-r1-plus-lts. I remember going through a number of variants before the current one. It seems to work well for that chip. I couldn't find anyone to test any of the other chips.

@rpardini
Copy link
Member Author

The 2002-OrangePi5-dubious-Motcomm-stuff-extracted-from-Xun.patch.disabled looks at first glance similar to the patch in rockchip64 add-driver-for-Motorcomm-YT85xx+PHYs.patch that I added for the yt8531C in the orangepi-r1-plus-lts.

Thanks, I thought I saw that indeed. I wonder if the OPi5 has any Motorcomm PHY's in it; otherwise why would Xunlong add this to their tree.

@rpardini
Copy link
Member Author

@efectn
Copy link
Member

efectn commented Dec 18, 2022

@efectn
Copy link
Member

efectn commented Dec 18, 2022

The 2002-OrangePi5-dubious-Motcomm-stuff-extracted-from-Xun.patch.disabled looks at first glance similar to the patch in rockchip64 add-driver-for-Motorcomm-YT85xx+PHYs.patch that I added for the yt8531C in the orangepi-r1-plus-lts.

Thanks, I thought I saw that indeed. I wonder if the OPi5 has any Motorcomm PHY's in it; otherwise why would Xunlong add this to their tree.

You're right. Opi 5 also uses YT8531C, as you can see here https://drive.google.com/drive/u/0/mobile/folders/1Bre2q0bGgXQuQlYaYDMvwstpvtHLmcgX?usp=share_link

igorpecovnik
igorpecovnik previously approved these changes Dec 18, 2022
Copy link
Member

@igorpecovnik igorpecovnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enable test images cli and deskotp and merge when confirmed working

@efectn
Copy link
Member

efectn commented Dec 18, 2022

Can't boot. Just blinks

@rpardini
Copy link
Member Author

Can't boot. Just blinks

UART logs?

amazingfate
amazingfate previously approved these changes Dec 18, 2022
@rpardini rpardini marked this pull request as draft December 18, 2022 14:14
@rpardini
Copy link
Member Author

@efectn drafted this until we get it booting

If it really has absolutely nothing on UART with this image, we gotta get UART logs with xunlong's image to compare / eliminate obvious stuff like "bootloader in SPI intereferring".

Otherwise two directions possible, either:

  1. insist on using same u-boot, try to make the u-boot defconfig as similar as possible to rock-5b, fixing only dts; I see you have some extra stuff in there trying to enable pcie etc, that won't work and might be causing it to explode/hang
    or;
  2. give up up on using shared u-boot; just point BOOTSOURCE directly to Xunlong's and the branch, with no patches; it might just work, and we have u-boot per board (not per-family) anyway

@efectn
Copy link
Member

efectn commented Dec 18, 2022

@efectn drafted this until we get it booting

If it really has absolutely nothing on UART with this image, we gotta get UART logs with xunlong's image to compare / eliminate obvious stuff like "bootloader in SPI intereferring".

Otherwise two directions possible, either:

  1. insist on using same u-boot, try to make the u-boot defconfig as similar as possible to rock-5b, fixing only dts; I see you have some extra stuff in there trying to enable pcie etc, that won't work and might be causing it to explode/hang
    or;
  2. give up up on using shared u-boot; just point BOOTSOURCE directly to Xunlong's and the branch, with no patches; it might just work, and we have u-boot per board (not per-family) anyway

I tried to generate an image in my PC and it worked. I used uboot and kernel sources from orange pi. Also i used orange pi's kernel config. I think the problem may be related to that.

@efectn
Copy link
Member

efectn commented Dec 18, 2022

I couldn't debug UART due to my USB-TTL converter didn't work.

@rpardini
Copy link
Member Author

rpardini commented Dec 18, 2022

I couldn't debug UART due to my USB-TTL converter didn't work.

Hmm, it's 1500000 baud indeed so not all adapters work. Worth investing though.

tried to generate an image in my PC and it worked. I used uboot and kernel sources from orange pi. Also i used orange pi's kernel config. I think the problem may be related to that.

Great! I've vendor u-boot implemented, will force push.

Please push the .config?

@efectn
Copy link
Member

efectn commented Dec 18, 2022

I couldn't debug UART due to my USB-TTL converter didn't work.

Hmm, it's 1500000 baud indeed so not all adapters work. Worth investing though.

tried to generate an image in my PC and it worked. I used uboot and kernel sources from orange pi. Also i used orange pi's kernel config. I think the problem may be related to that.

Great! I've vendor u-boot implemented, will force push.

Please push the .config?

I think we should also use kernel config as same as https://github.com/orangepi-xunlong/orangepi-build/blob/next/external/config/kernel/linux-rockchip-rk3588-legacy.config. I think we can specify this in rockchip-rk3588.conf or orange pi conf

@rpardini
Copy link
Member Author

I think we should also use kernel config as same as orangepi-xunlong/orangepi-build@next/external/config/kernel/linux-rockchip-rk3588-legacy.config. I think we can specify this in rockchip-rk3588.conf

Yep, I'll try to merge .config's, let's see how it goes.

Meanwhile a image is building with full Xunlong vendor u-boot.

@efectn
Copy link
Member

efectn commented Dec 18, 2022

I think we should also use kernel config as same as orangepi-xunlong/orangepi-build@next/external/config/kernel/linux-rockchip-rk3588-legacy.config. I think we can specify this in rockchip-rk3588.conf

Yep, I'll try to merge .config's, let's see how it goes.

Meanwhile a image is building with full Xunlong vendor u-boot.

Cool. I'm generating image with xunlong vendored uboot and orange pi's kernel now. I hope it'll work.

Looks like the PR will be ready for merging after doing these stuff.

@rpardini
Copy link
Member Author

Added the config, in 3 commits

  • first update the existing config, that was abandoned at 5.10.72; no real changes
  • then merge the Xunlong config; revert a bunch to respect previous PR's
  • re-update with new configs

@efectn
Copy link
Member

efectn commented Dec 18, 2022

I think we should also use kernel config as same as orangepi-xunlong/orangepi-build@next/external/config/kernel/linux-rockchip-rk3588-legacy.config. I think we can specify this in rockchip-rk3588.conf

Yep, I'll try to merge .config's, let's see how it goes.
Meanwhile a image is building with full Xunlong vendor u-boot.

Cool. I'm generating image with xunlong vendored uboot and orange pi's kernel now. I hope it'll work.

Looks like the PR will be ready for merging after doing these stuff.

Didn't boot. I think you forgot patching something that's exists in xunlog's kernel tree and not exists in patches and radxa's kernel tree.

(Maybe in one of Makefiles)

@ChisBread
Copy link

What's sudo lshw | grep -i -B4 -A3 'usb@' output

  *-usbhost:0               
       product: EHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 ehci_hcd
       physical id: 1
       bus info: usb@1
       logical name: usb1
       version: 5.10
       capabilities: usb-2.00
--
  *-usbhost:1
       product: EHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 ehci_hcd
       physical id: 2
       bus info: usb@2
       logical name: usb2
       version: 5.10
       capabilities: usb-2.00
--
  *-usbhost:2
       product: Generic Platform OHCI controller
       vendor: Linux 5.10.110-rockchip-rk3588 ohci_hcd
       physical id: 3
       bus info: usb@3
       logical name: usb3
       version: 5.10
       capabilities: usb-1.10
--
  *-usbhost:3
       product: Generic Platform OHCI controller
       vendor: Linux 5.10.110-rockchip-rk3588 ohci_hcd
       physical id: 4
       bus info: usb@4
       logical name: usb4
       version: 5.10
       capabilities: usb-1.10
--
  *-usbhost:4
       product: xHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 xhci-hcd
       physical id: 5
       bus info: usb@5
       logical name: usb5
       version: 5.10
       capabilities: usb-2.00
--
  *-usbhost:5
       product: xHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 xhci-hcd
       physical id: 6
       bus info: usb@6
       logical name: usb6
       version: 5.10
       capabilities: usb-3.00
--
  *-usbhost:6
       product: xHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 xhci-hcd
       physical id: 7
       bus info: usb@7
       logical name: usb7
       version: 5.10
       capabilities: usb-2.00
--
  *-usbhost:7
       product: xHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 xhci-hcd
       physical id: 8
       bus info: usb@8
       logical name: usb8
       version: 5.10
       capabilities: usb-3.00

@efectn
Copy link
Member

efectn commented Dec 22, 2022

What's sudo lshw | grep -i -B4 -A3 'usb@' output

  *-usbhost:0               
       product: EHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 ehci_hcd
       physical id: 1
       bus info: usb@1
       logical name: usb1
       version: 5.10
       capabilities: usb-2.00
--
  *-usbhost:1
       product: EHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 ehci_hcd
       physical id: 2
       bus info: usb@2
       logical name: usb2
       version: 5.10
       capabilities: usb-2.00
--
  *-usbhost:2
       product: Generic Platform OHCI controller
       vendor: Linux 5.10.110-rockchip-rk3588 ohci_hcd
       physical id: 3
       bus info: usb@3
       logical name: usb3
       version: 5.10
       capabilities: usb-1.10
--
  *-usbhost:3
       product: Generic Platform OHCI controller
       vendor: Linux 5.10.110-rockchip-rk3588 ohci_hcd
       physical id: 4
       bus info: usb@4
       logical name: usb4
       version: 5.10
       capabilities: usb-1.10
--
  *-usbhost:4
       product: xHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 xhci-hcd
       physical id: 5
       bus info: usb@5
       logical name: usb5
       version: 5.10
       capabilities: usb-2.00
--
  *-usbhost:5
       product: xHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 xhci-hcd
       physical id: 6
       bus info: usb@6
       logical name: usb6
       version: 5.10
       capabilities: usb-3.00
--
  *-usbhost:6
       product: xHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 xhci-hcd
       physical id: 7
       bus info: usb@7
       logical name: usb7
       version: 5.10
       capabilities: usb-2.00
--
  *-usbhost:7
       product: xHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 xhci-hcd
       physical id: 8
       bus info: usb@8
       logical name: usb8
       version: 5.10
       capabilities: usb-3.00

Same as Orange Pi images. Can you check typec on Orange Pi image and Armbian with usb2 service? There shouldn't be any problem

@efectn
Copy link
Member

efectn commented Dec 22, 2022

@rpardini I think we should add this service into the bsp? What would you mean

@ChisBread
Copy link

ChisBread commented Dec 22, 2022

Same as Orange Pi images. Can you check typec on Orange Pi image and Armbian with usb2 service? There shouldn't be any problem

I tried to install orange-build kernel&dtb&uboot, now typec is ok!

lshw:

  *-usbhost:0               
       product: EHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 ehci_hcd
       physical id: 1
       bus info: usb@1
       logical name: usb1
       version: 5.10
       capabilities: usb-2.00
--
  *-usbhost:1
       product: EHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 ehci_hcd
       physical id: 2
       bus info: usb@2
       logical name: usb2
       version: 5.10
       capabilities: usb-2.00
--
  *-usbhost:2
       product: Generic Platform OHCI controller
       vendor: Linux 5.10.110-rockchip-rk3588 ohci_hcd
       physical id: 3
       bus info: usb@3
       logical name: usb3
       version: 5.10
       capabilities: usb-1.10
--
  *-usbhost:3
       product: Generic Platform OHCI controller
       vendor: Linux 5.10.110-rockchip-rk3588 ohci_hcd
       physical id: 4
       bus info: usb@4
       logical name: usb4
       version: 5.10
       capabilities: usb-1.10
--
  *-usbhost:4
       product: xHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 xhci-hcd
       physical id: 5
       bus info: usb@5
       logical name: usb5
       version: 5.10
       capabilities: usb-2.00
--
  *-usbhost:5
       product: xHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 xhci-hcd
       physical id: 6
       bus info: usb@6
       logical name: usb6
       version: 5.10
       capabilities: usb-3.00
--
  *-usbhost:6
       product: xHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 xhci-hcd
       physical id: 7
       bus info: usb@7
       logical name: usb7
       version: 5.10
       capabilities: usb-2.00
--
          description: Keyboard
          product: Logitech USB Receiver System Control
          vendor: Logitech
          physical id: 1
          bus info: usb@7:1
          logical name: input6
          logical name: /dev/input/event6
          logical name: input6::capslock
--
  *-usbhost:7
       product: xHCI Host Controller
       vendor: Linux 5.10.110-rockchip-rk3588 xhci-hcd
       physical id: 8
       bus info: usb@8
       logical name: usb8
       version: 5.10
       capabilities: usb-3.00

@efectn
Copy link
Member

efectn commented Dec 22, 2022

I think we should try PWM, I2C, SPI functionalities before merging the PR. I'm not much sure that they work properly due to we haven't added overlays. Orange Pi has different GPIO schema than Rock 5B

@rpardini
Copy link
Member Author

if only there were any approving reviews...

@ChisBread
Copy link

ChisBread commented Dec 22, 2022

I think we should try PWM, I2C, SPI functionalities before merging the PR. I'm not much sure that they work properly due to we haven't added overlays. Orange Pi has different GPIO schema than Rock 5B

Have you tested type-c? I'm sure this time that type-c wasn't working before installing the orangepi kernel...
I can also test functions like PWM, I2C, SPI etc. on weekends, if needed.

edit: sorry I forgot you don't have an otg cable...

@efectn
Copy link
Member

efectn commented Dec 22, 2022

I think we should try PWM, I2C, SPI functionalities before merging the PR. I'm not much sure that they work properly due to we haven't added overlays. Orange Pi has different GPIO schema than Rock 5B

Have you tested type-c? I'm sure this time that type-c wasn't working before installing the orangepi kernel... I can also test functions like PWM, I2C, SPI etc. on weekends, if needed.

edit: sorry I forgot you don't have an otg cable...

I can test pwm, i2c etc. today or tomorrow. I don't have a possibility to test type c 😓

@ChisBread
Copy link

I can test pwm, i2c etc. today or tomorrow. I don't have a possibility to test type c 😓

I think there may be a problem with the type-c power supply

image
image

@ChisBread
Copy link

type-c powered after:

sudo dpkg -i linux-u-boot-legacy-orangepi5_1.0.6_arm64.deb linux-image-legacy-rockchip-rk3588_1.0.6_arm64.deb linux-dtb-legacy-rockchip-rk3588_20221220a-rpardini_arm64.deb
sudo reboot

image

@igorpecovnik
Copy link
Member

igorpecovnik commented Dec 22, 2022

Please those testings here https://forum.armbian.com/topic/24900-orange-pi-5-support/

@ChisBread
Copy link

ok

@xlazom00
Copy link
Contributor

xlazom00 commented Dec 22, 2022

I think that you should be able to set usb to host mode also in dtb file
with something like this khadas/linux@84a75e8

@ChisBread
Copy link

I found no difference in armbian vs. orangepi's arch/arm64/boot/dts/rockchip/.rk3588s-orangepi-5.dtb.dts.tmp
So I read and enabled 2005-OrangePi5-dubious-tcpm-stuff-extracted-from-Xunlong-.patch
With orangepi5_usb2_init.service, all usb ports work normally now.
@rpardini @efectn

@efectn
Copy link
Member

efectn commented Dec 23, 2022

I think we should enable the patch and make changes in dtb file like how Khadas does

@ChisBread
Copy link

I think we should enable the patch and make changes in dtb file like how Khadas does

This is the dts of orangepi, I think it is similar to that of khadas?

&usbhost3_0 {
 dr_mode = "host";
 status = "okay";
};

&usbhost_dwc3_0 {
 status = "okay";
};

usbhost_dwc3_0 looks like Type-A USB3.0, it works fine

@efectn

This comment was marked as spam.

Copy link
Contributor

@catalinii catalinii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested rock-5b and it works...while I don't have a Orange PI 5 the code looks good

@igorpecovnik igorpecovnik merged commit 18198b1 into armbian:master Dec 31, 2022
@igorpecovnik
Copy link
Member

I made images, but no hardware around to verify. They contain all fixes that has been merged:
https://www.armbian.com/orangepi-5/

@efectn Would you like to serve as official maintainer?

@efectn
Copy link
Member

efectn commented Jan 1, 2023

I made images, but no hardware around to verify. They contain all fixes that has been merged: https://www.armbian.com/orangepi-5/

@efectn Would you like to serve as official maintainer?

Sure. I can maintain OPi 5

@igorpecovnik
Copy link
Member

Cool! Check and proceed via that document to understand expectations, provide contact details via form, ... only together we can keep devices in good shape.

Happy new year!

@SvOlli
Copy link

SvOlli commented Jan 1, 2023

Did a small test run with Armbian_23.02.0-trunk.0112_Orangepi5_jammy_legacy_5.10.110_xfce_desktop.img.xz
Works in general, here's what I found that didn't work:

  • "vertical" USB2.0 slot which is shared with "power type-c" (needed to move keyboard/mouse dongle)
  • transfer to NVMe (just doesn't boot after full transfer)
  • rather long shutdown time

Those work on the Debian-image from OrangePi.

Hope this helps and looking forward to a version that's en par with OrangePi's,
SvOlli

@royalroot
Copy link

royalroot commented Jan 2, 2023

I tested with Bullseye CLI (on the download page https://www.armbian.com/orangepi-5/) and most things are working.
Heres what I found out that didn't work:

  • Installing zfs-dkms (modules does not compile) with apt install zfs-dkms
  • Setting up a network bridge (br0 with bridge_ports eth0)

Those doesn't work in the images from OrangePI either.

Zfs

When installing zfs-dkms from backports apt -t bullseye-backports install zfs-dkms compiling works, but the modules can't be loaded into the kernel.

Bridge

When setting up the bridge in /etc/network/interfaces (with bridge-utils installed)

allow-hotplug eth0
iface eth0 inet manual

# br0
auto br0
 
# Bridge setup
iface br0 inet static
    address 192.168.1.20
    netmask 255.255.255.0
    gateway 192.168.1.1
    nameserver 192.168.1.3
    bridge_ports eth0

The IP is recognized by nmap but does not respond if I ping it or try to ssh into it. I have a headless setup so I can't see what happens "inside" the orange pi.

Earlier I tested this setup with the orangepi debian image the results were the same. But I also experienced that an external usb network interface works with this settings.

Maybe It helps you to figure out what is happening here.
You may not have noticed these problems before, since it is not a default setup.

Nico

@bbaranoff
Copy link

Hello don't know where to ask seems active here... someone knows how to deal with maskrom and recovery button got maskrom mode enabled and can't get rid of. Got maskrom mode a first time get rid of don't how have booted fine on Armbian then again in maskrom mode :/

@igorpecovnik
Copy link
Member

Hello don't know where to ask seems active here

https://forum.armbian.com/forum/206-orange-pi-5/

@armbian armbian locked as resolved and limited conversation to collaborators Jan 3, 2023
@rpardini rpardini deleted the orangepi5--collab-with-efectn branch January 3, 2023 09:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Work in progress Unfinished / work in progress
Development

Successfully merging this pull request may close these issues.

None yet