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

Rockchip: add initial support for RK356x and RK3588 #7864

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Kwiboo
Copy link
Member

@Kwiboo Kwiboo commented May 21, 2023

This PR introduces initial support for Rockchip RK356x devices.

U-Boot 2023.07, scheduled for 03 July 2023, will be the first version with decent support for RK356x/RK3588.
The PR currently include and depends on #7365 and will be kept in draft state until u-boot package has been updated to 2023.07.

Main focus of this PR is:

  • Adding initial RK3568 device support to the build system
  • Update rkbin to latest version and add support for using ROCKCHIP_TPL when building U-Boot
  • Boot RK356x devices using mainline U-Boot 2023.07

There are two variants of the SoC supported using the same device, RK3566 and RK3568, they are very similar but unfortunately require unique ddr init blobs.
A new soc value is defined for the added devices in scripts/uboot_helper, this value is used when building a bootable u-boot for the targeted device.

PR will be updated with related u-boot and minimal linux patches until U-Boot 2023.07 has been released.

Future PRs will focus on improving Linux display and media stack.

@MarkusTeufelberger
Copy link

I have a https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R5C here that eventually is planned to run LibreELEC, if there is anything I can do to help/test please just comment here. Support for the device itself has ended up in Linux fairly recently (torvalds/linux@0562003), but at least it is already there. :-)

@Kwiboo Kwiboo force-pushed the rk3568-part1 branch 2 times, most recently from 170a08c to 17fe9cc Compare May 27, 2023 20:05
@Kwiboo
Copy link
Member Author

Kwiboo commented May 27, 2023

@MarkusTeufelberger thanks, I have imported the r5c/r5s device tree into my local u-boot repo and will push patches and build images that can be tested in next few days. Still some rk356x u-boot patches to finalize and submit upstream before that.

@Kwiboo Kwiboo force-pushed the rk3568-part1 branch 3 times, most recently from fd78fa9 to 99e9f0b Compare June 1, 2023 22:07
@diederikdehaas
Copy link

I have a Pine64 Quartz64 Model A and B and if there's an image to download, I'd happily test it.

@Kwiboo Kwiboo force-pushed the rk3568-part1 branch 2 times, most recently from 7bb13af to be77d9a Compare November 18, 2023 22:09
@zhangn1985
Copy link
Contributor

I tested U-boot part, success build, flash, boot.

@zhangn1985
Copy link
Contributor

is there any effort on rkvdec-v2 which used on RK3568

@MarkusTeufelberger
Copy link

u-boot is already at 2024.04 in this repo, is there still something missing to go forward with RK356x support?

@Kwiboo
Copy link
Member Author

Kwiboo commented May 7, 2024

@MarkusTeufelberger not that I know, will try to update re-test this PR later this weekend.

Both mainline U-Boot and Linux kernel should be in a good enough state for most 1080p usage last time I checked.

@catalinii
Copy link
Contributor

@Kwiboo I rebased this PR on the latest master, removed both u-boot and kernel patches and built an image for rock 3a.

The image works with hw acceleration using EGL rendering.

I think it would be very valuable to get this PR merged

@catalinii
Copy link
Contributor

Here is the sha I used: catalinii@7c4d316

@andyshrk
Copy link

@Kwiboo
Hi Jonas, do you have a plane to get this merged?

@Kwiboo
Copy link
Member Author

Kwiboo commented Jul 24, 2024

@catalinii @andyshrk I will try to take a new look next week or two

@catalinii
Copy link
Contributor

@Kwiboo It would mean a lot for the users of rk3568 if this would be merged :)

@Kwiboo
Copy link
Member Author

Kwiboo commented Sep 7, 2024

@Kwiboo It would mean a lot for the users of rk3568 if this would be merged :)

I am running local test on RK356x boards again and have pushed an update, also included a initial RK3588 target without display/HDMI support.

Hoping to have a final PR and drop from draft later this month, we may also want to wait on final Linux v6.11 to add support for a few more boards that have landed upstream.

@Kwiboo Kwiboo force-pushed the rk3568-part1 branch 2 times, most recently from 0a7e266 to 106d5cc Compare September 7, 2024 21:10
@catalinii
Copy link
Contributor

I can test both rock-3a or rock-5b if needed

@gonciarz
Copy link

gonciarz commented Nov 2, 2024

Hi, I've just ordered a FriendlyElec's NanoPC-T6 based on RK3588.
Btw. there are two versions: T6 and T6-LTS without LTE modem and with few upgrades)
https://wiki.friendlyelec.com/wiki/index.php/NanoPC-T6#NanoPC-T6-LTS
As soon it arrives, I can help with testing.

@catalinii
Copy link
Contributor

@gonciarz I think PR still misses some critical patches such as the HDMI support (which will be part of 6.13) for rk3588 to work. Then there is the lack of support for HDMI audio and CEC.
rk3568 is pretty much supported by the mainline but my experience on rock-3a is that is a bit slow

@Kwiboo Kwiboo force-pushed the rk3568-part1 branch 3 times, most recently from 5178b56 to 6843881 Compare November 17, 2024 22:44
GRAPHIC_DRIVERS="panfrost"

# kernel serial console
EXTRA_CMDLINE="console=uart8250,mmio32,0xfe660000 console=tty0 coherent_pool=2M cec.debounce_ms=5000 mem=3838M"
Copy link
Contributor

Choose a reason for hiding this comment

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

The first console should get earlycon=uart8250,mmio32,0xfe660000 - besides of being more correct this will also prevent double printing lines in case systemd.debug_shell is the same uart port.
Would good if other devices would be updated accordingly.

Copy link
Member Author

@Kwiboo Kwiboo Nov 19, 2024

Choose a reason for hiding this comment

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

Because most/all supported boards has a proper /chosen/stdout-path prop, we could just add earlycon without any options and Linux should pick up correct configuration.

Having the console=uart8250,mmio32,0xfe660000 ensure uart2 get full kernel startup logs when quiet is dropped.

prevent double printing lines in case systemd.debug_shell is the same uart port

Do you have a simple way to reproduce this?

I have mostly seen double logs when I incorrectly had a second uart2 console added, i.e. console=ttyS2, something that is not needed with the first console=uart8250 already added.

My serial debug cmdline for these boards is typically:

earlycon console=uart8250,mmio32,0xfe660000 systemd.debug-shell=ttyS2 textmode ssh

Seem to correctly configure the early bootconsole and later hand of to a console at ttyS2 and once kernel is running a debug shell is attached to ttyS2.

I would have preferred to add console=ttyS2 instead of console=uart8250,mmio32,0xfe660000, however then we would need to include the baudrate, i.e. console=ttyS2,1500000n8, with use of console=uart8250 the 8250 serial driver picks up the baudrate already configured by bootloader and/or earlycon.

Copy link
Contributor

Choose a reason for hiding this comment

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

Having the console=uart8250,mmio32,0xfe660000 ensure uart2 get full kernel startup logs when quiet is dropped.

Without having this tested recently: This was always the case with only console=mmio... and the second console arg set to console=tty0 for me, but that might have changed. I've always needed to change the second to console=ttySX to get a full bootlog. I really wonder if we are doing the right thing here, as having two console args looks just wrong. To my understanding console=tty0is needed for the frambuffer console used by plymouth - maybe it's time to switch to non-lite version of plymouth which supports drm and doesn't rely on ancient fb console 😆

That being said you should probably pull in HDMI-patches for RK3588 which have been merged 6.13, as I'd expect LE to stay on expected-LTS 6.12 kernel for a while and then is PR should be GTG, as the remaining issues (iommu issue with DRAM addresses > 4 GB, no rkvdec2 driver) are not expected to be resolved soonish.

@gonciarz
Copy link

@Kwiboo Hi, is there a chance you may rename PR's title. It also covers RK3588 SoC.

@Kwiboo Kwiboo changed the title Rockchip: add initial support for RK356x Rockchip: add initial support for RK356x and RK3588 Nov 19, 2024
@Kwiboo
Copy link
Member Author

Kwiboo commented Nov 19, 2024

is there a chance you may rename PR's title. It also covers RK3588 SoC.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants