Difference between revisions of "Quartz64 Development"

From PINE64
Jump to navigation Jump to search
(→‎Upstreaming Status: Add dsi-dphy patch series, update rk817-charger series to v10, update csi-dphy status)
(→‎Upstreaming Status: Add TRNG to upstreaming table)
 
(10 intermediate revisions by 3 users not shown)
Line 51: Line 51:
|-
|-
! scope="row" rowspan="5" | [[Mainline Hardware Encoding|Video Encode]]  
! scope="row" rowspan="5" | [[Mainline Hardware Encoding|Video Encode]]  
| style="background:LightYellow; text-align:center;"|In review<sup>[https://patchwork.kernel.org/project/linux-rockchip/list/?series=649611]</sup>
| style="background:PaleGreen; text-align:center;"|Linux Mainline
| style="text-align:center; background:LightYellow;"|GStreamer only
| style="text-align:center; background:LightYellow;"|GStreamer only
| JPEG on VEPU121
| JPEG on VEPU121
| Hantro-based
| Hantro-based. Mainline as of 6.1<sup>[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6f1ae821a6c4aa9d5b8f437b27ec86fb569219fd]</sup>
|
|
|-
|-
Line 95: Line 95:
| Quartz64 Model A/B
| Quartz64 Model A/B
|-
|-
! scope="row" | u-boot
! scope="row" rowspan="3" | Bootloader
| colspan="2" style="background:#F99; text-align:center;"|Waiting on ATF sources
| colspan="2" style="background:LightYellow; text-align:center;"|In review<sup>[https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/16952]</sup>
| <code>TF-A</code>
|
|-
| colspan="2" style="background:LightYellow; text-align:center;"|In progress
| <code>U-Boot</code>
| [[Quartz64_Development#Mainline_U-Boot_Work|See below]]
|
|
|-
| colspan="2" style="background:LightYellow; text-align:center;"|In progress<sup>[https://github.com/jaredmcneill/quartz64_uefi]</sup>
| <code>Tianocore EDK II</code>
|
|
|-
|-
Line 171: Line 180:
|-
|-
! scope="row" | Battery
! scope="row" | Battery
| colspan="2" style="background:LightYellow; text-align:center;"|In review<sup>[https://patchwork.kernel.org/project/linux-rockchip/list/?series=671676&archive=both]</sup>
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rk817-charger</code>
| <code>rk817-charger</code>
| In the BSP tree this is handled by [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/blob/quartz64/drivers/power/supply/rk817_battery.c rk817_battery.c] and [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/blob/quartz64/drivers/power/supply/rk817_charger.c rk817_charger.c].
| As of 6.1<sup>[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/power/supply/rk817_charger.c?id=11cb8da0189b417392e2334ae967b0ba1f0d1be8]</sup>
| Quartz64 Model A, Pinenote
| Quartz64 Model A, Pinenote
|-
|-
Line 213: Line 222:
|
|
|-
|-
| colspan="2" style="background:PaleGreen; text-align:center;"|linux-next<sup>[https://patchwork.kernel.org/project/linux-rockchip/list/?series=661385]</sup>
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rockchip-inno-csidphy</code>
| <code>rockchip-inno-csidphy</code>
|
| As of 6.1<sup>[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=29c99fb085ad53e6d5504d1f8d32e6673b9b3a2c]</sup>
|
|
|-
|-
Line 228: Line 237:
| <code>rk-crypto</code> v2
| <code>rk-crypto</code> v2
| Downstream driver [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/tree/quartz64/drivers/crypto/rockchip] doesn't include a rk3568 compatible either, but the TRM shows that it seemingly matches.
| Downstream driver [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/tree/quartz64/drivers/crypto/rockchip] doesn't include a rk3568 compatible either, but the TRM shows that it seemingly matches.
|
|-
! scope="row" | TRNG
| colspan="2" style="background:LightYellow; text-align:center;"|In review<sup>[https://patchwork.kernel.org/project/linux-rockchip/list/?series=694733&archive=both]</sup>
| <code>rockchip-rng</code>
|
|
|
|}
|}
Line 251: Line 266:
* Video Decode
* Video Decode
** VP8
** VP8
** H.264
* Video Encode
** JPEG (it's pretty bad)
* Battery
* Battery
* GPU
* GPU
Line 270: Line 288:
=== Confirmed Broken ===
=== Confirmed Broken ===


* USB 3.0 &mdash; only works with very short cables and depends on the device. This is due to a hardware design issue relating to the coupling capacitors needed for SATA, which shares the same lines as USB 3.0.
* USB 3.0 (applies to Model A only) &mdash; only works with very short cables and depends on the device. This is due to a hardware design issue relating to the coupling capacitors needed for SATA, which shares the same lines as USB 3.0.
** Hardware design changes have been suggested to engineers, it's in their hands now.
** Hardware design changes have been suggested to engineers, it's in their hands now.
* Module autoloading for the Ethernet PHY. The Motorcomm PHY does not have a vendor ID written into the appropriate hardware block, so there is no canonical way to identify the device.


=== Needs Testing ===
=== Needs Testing ===


* E-Paper &mdash; needs EBC driver
* E-Paper
* Microphone Input
* Microphone Input
* CSI &mdash; needs CIF driver
* CSI &mdash; needs CIF driver
* eDP &mdash; needs PHY driver and controller driver
* eDP &mdash; needs PHY driver and controller driver
* DSI &mdash; needs driver
* DSI


== TODO ==
== TODO ==
Line 325: Line 342:


[[User:CounterPillow]] has experimentally ported stuff, but it's currently not working.
[[User:CounterPillow]] has experimentally ported stuff, but it's currently not working.
=== OS Images ===
We need a '''Debian-based''' OS image with a packaged '''mainline kernel''' that's updated through a repository for SOQuartz and Quartz64 Model B. Other distribution userlands are welcome as well, but a lot of users are looking for Debian or Ubuntu. Do keep in mind that it'll probably have to be Bookworm due to the mesa GPU support stuff.


== Linux Kernel Config Options ==
== Linux Kernel Config Options ==
Line 354: Line 375:
* <code>CONFIG_ROCKCHIP_DW_HDMI</code>
* <code>CONFIG_ROCKCHIP_DW_HDMI</code>
** HDMI PHY
** HDMI PHY
* <code>CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY</code>
** MIPI DSI DPHY (note: requires in-review patches linked in status table)
* <code>CONFIG_ROCKCHIP_VOP2</code>
* <code>CONFIG_ROCKCHIP_VOP2</code>
** Video output
** Video output
Line 368: Line 391:
* <code>CONFIG_MFD_RK808</code>
* <code>CONFIG_MFD_RK808</code>
** Various things relating to the RK817 chip
** Various things relating to the RK817 chip
* <code>CONFIG_CHARGER_RK817</code>
** RK817 charger (note: requires in-review patches linked in status table)
* <code>CONFIG_REGULATOR_RK808</code>
* <code>CONFIG_REGULATOR_RK808</code>
** Voltage regulators
** Voltage regulators
Line 394: Line 419:
* <code>CONFIG_COMMON_CLK_ROCKCHIP</code>
* <code>CONFIG_COMMON_CLK_ROCKCHIP</code>
** Common clock support
** Common clock support
* <code>CONFIG_PHY_ROCKCHIP_INNO_CSIDPHY</code>
** MIPI CSI DPHY


== Resources ==
== Resources ==

Latest revision as of 18:22, 12 November 2022

This page documents the current status of software support for the Quartz64 single-board computer, and provides links to resources to help prospective contributors get started. Information is kept current on a best-effort basis as various patches get accepted into the kernel.

Overview

Upstreaming Status

Function Status Component Notes Applies To
Video Output Linux Mainline rockchipdrm/VOP2

As of 5.19-rc1[1], Also featured in Phoronix Article[2]

Needs porting rockchip-edpphy-naneng Downstream: [3] and [4] Coordinate any porting with Rockchip first
In review[5] dw-mipi-dsi-rockchip Downstream: [6]
3D Acceleration Linux Mainline Upstream Mesa panfrost As of 5.18[7]
Video Decode Linux Mainline GStreamer only, no ffmpeg[8] hantro using v4l2-requests VDPU121 handling 1080p H.263, MPEG-1, MPEG-2, VP8 and H.264. Mainline as of 5.19[9]
Needs writing rkvdec2 using v4l2-requests VDPU346 handling 4K H.265, H.264 and VP9
Needs writing rkdjpeg using v4l2-requests VDPU720 handling JPEG, User:CounterPillow is working on this
Video Encode Linux Mainline GStreamer only JPEG on VEPU121 Hantro-based. Mainline as of 6.1[10]
Needs writing ? H.264 on VEPU121 Hantro-based
Needs writing ? VP8 on VEPU121 Hantro-based
Needs writing ? H.264 on VEPU540 rkvenc-based
Needs writing ? H.265 on VEPU540 rkvenc-based
Audio Linux Mainline rockchip-i2s-tdm As of 5.16[11]
Linux Mainline rockchip-spdif As of 5.15[12]
Linux Mainline rk817-codec As of 5.14[13]. Quartz64 Model A/B
Bootloader In review[14] TF-A
In progress U-Boot See below
In progress[15] Tianocore EDK II
Device Tree Linux Mainline Quartz64 Model A As of 5.16[16] Quartz64 Model A
Linux Mainline Quartz64 Model B As of 5.19[17] Quartz64 Model B
Linux Mainline SOQuartz As of 5.19[18] SOQuartz
Linux Mainline PineNote As of 5.18[19] PineNote
Gigabit Ethernet Linux Mainline rk3566-gmac As of 5.14[20]
Linux Mainline yt8511-phy As of 5.14[21]
IOMMU Linux Mainline rockchip-iommu As of 5.14[22]
GPIO Linux Mainline gpio-rockchip As of 5.15[23]
pinctrl Linux Mainline
Thermal Regulation Linux Mainline rockchip-thermal As of 5.14[24]
PCIe Linux Mainline pcie-dw-rockchip As of 5.15[25]
Power Management Linux Mainline rockchip-pm-domains As of 5.14[26]
Voltage Control Linux Mainline rk3568-pmu-io-voltage-domain As of 5.15[27]
SPI Linux Mainline spi-rockchip As of 5.14[28]. Necessary device tree changes in review.
Battery Linux Mainline rk817-charger As of 6.1[29] Quartz64 Model A, Pinenote
Microphone Linux Mainline rockchip-saradc As of 5.15[30]. Headphone jack mic seems to connect to SARADC_VIN2_HP_HOOK, so I'm pretty sure that the dtsi and driver changes are needed for that mic to work
USB 2.0 Linux Mainline rockchip-usb2phy As of 5.17[31]
e-Ink In review (RFC)[32] rockchip-ebc A DRM driver is available here; also see RK3566 EBC Reverse-Engineering
Combo PHY Linux Mainline naneng-combphy As of 5.18[33]. Still requires DTS changes
RGA Needs fixing rockchip-rga User:CounterPillow experimentally enabled it[34] in the device tree and ran gstreamer's v4l2convert through it to test, resulting in a completely garbled output.
Fan Controller Needs porting emc2301 Previous attempts at mainlining: [35] and [36]. Latest iteration: [37] SOQuartz Blade
CSI Camera Needs porting rkisp Downstream: [38]
Linux Mainline rockchip-inno-csidphy As of 6.1[39]
NPU Needs writing Downstream version is a closed source SDK. Major undertaking to reimplement this as Linux does not (yet) appear to have a generic architecture for neural accelerators.
Crypto Needs porting rk-crypto v2 Downstream driver [40] doesn't include a rk3568 compatible either, but the TRM shows that it seemingly matches.
TRNG In review[41] rockchip-rng

Current Status

The following sections give an overview over the current status of different parts of the board. Some parts are waiting on a driver to be written or ported, others only need various adjustments.

According to pgwipeout, I/O device performance is within expected ranges now.

Working

  • eMMC
  • SDMMC0 (SD cards)
  • GMAC (Gigabit Ethernet)
  • USB 2.0
  • SATA 2
  • SATA 3
  • UART
    • UART 0 (Pi-bus)
    • UART 1 (Bluetooth)
    • UART 2 (Pi-bus, debug)
  • Video Decode
    • VP8
    • H.264
  • Video Encode
    • JPEG (it's pretty bad)
  • Battery
  • GPU
  • Audio
    • Analog audio works
    • SPDIF works
    • HDMI works
  • SPI — works, user needs to modify device tree to add devices
  • I2C — works, user needs to modify device tree to add devices

Partially Working

  • PCI-Express Controller — everything but devices that need cache coherency (e.g. dGPUs) should work
    • User:CounterPillow noticed some weirdness with NVMe devices disconnecting during heavy write operations, likely down due to power draw on one of the rails as the same sustained bandwidth could be achieved with a different PCIe device with no issue.
  • SDMMC1 (Wi-Fi) — AP6256 working, BL602 needs some work to make it flash firmware
  • GIC — needs errata published by Rockchip to get upstream to add device-specific workarounds[42]
  • Video Output — only at 1920x1080p60 and nothing else, very buggy and rough around more than just the edges

Confirmed Broken

  • USB 3.0 (applies to Model A only) — only works with very short cables and depends on the device. This is due to a hardware design issue relating to the coupling capacitors needed for SATA, which shares the same lines as USB 3.0.
    • Hardware design changes have been suggested to engineers, it's in their hands now.

Needs Testing

  • E-Paper
  • Microphone Input
  • CSI — needs CIF driver
  • eDP — needs PHY driver and controller driver
  • DSI

TODO

ebc-dev Reverse Engineering and Development

The driver for the eInk panel needs to both be reverse engineered and then rewritten as C. In its current form, it is mostly an assembly dump produced by gcc with debug symbols. See RK3566 EBC Reverse-Engineering for details.

Investigate MCU

The RK3566 comes with an integrated RISC-V microcontroller (MCU). It communicates with the A55 host through the Mailbox system driven by the rockchip-mailbox driver. Since this MCU would be quite useful for things such as low power standby mode, investigating how it can be turned on and have firmware flashed to it should greatly enhance the power saving features of the PineNote.

Mainline U-Boot Work

Currently, mainline U-Boot does not have support for the RK3566 SoC used on the Quartz64. That's why we currently use the "downstream" Rockchip U-Boot, which is based on an old version of U-Boot and contains vendor specific patches that have not undergone the same level of code review as they'd have done had they been submitted upstream.

While the lack of ATF sources means that using mainline U-Boot would still require the use of Rockchip provided binaries for the firmware, the mainline U-Boot works needs to be done eventually anyway, and even with Rockchip blobs, a more modern version of U-Boot will be much nicer to use.

Someone needs to get on the task of investigating what minimally needs to be ported to get the board booting with mainline U-Boot, port those changes, and submit them for review.

Things that need to be done

This list is non-exhaustive as we don't exactly know how much is missing

  • Do the rk3568.dtsi refactoring into rk356x.dtsi/rk3568.dtsi/rk3566.dtsi that the kernel did, probably just port the kernel dtsi files for this
  • Bring the kernel's Quartz64 DTS into the tree
  • Write a quartz64-rk3566_defconfig based on evb-rk3568_defconfig

Stretch Goals:

  • Port the Naneng Combo PHY driver to u-boot so we can SATA, USB 3 and PCIe boot
  • Look into SPI
  • Port the Motorcomm PHY driver to u-boot for networking?
  • Port a basic VOP2 driver to get a framebuffer from u-boot

List of Useful Resources for this Task

eDP Driver Porting

The eDP PHY driver and controller driver needs to be ported, brought into shape and submitted with proper commit attribution to the Rockchip authors.

User:CounterPillow has experimentally ported stuff, but it's currently not working.

OS Images

We need a Debian-based OS image with a packaged mainline kernel that's updated through a repository for SOQuartz and Quartz64 Model B. Other distribution userlands are welcome as well, but a lot of users are looking for Debian or Ubuntu. Do keep in mind that it'll probably have to be Bookworm due to the mesa GPU support stuff.

Linux Kernel Config Options

  • CONFIG_SND_SOC_ROCKCHIP_I2S_TDM
    • for Analog and HDMI audio
  • CONFIG_SND_SOC_RK817
    • for Analog audio on the Model A
  • CONFIG_STMMAC_ETH
    • Ethernet
  • CONFIG_DWMAC_ROCKCHIP
    • Ethernet
  • CONFIG_MOTORCOMM_PHY
    • Ethernet, set this one to Y, m won't work out of the box if the generic PHY driver is y and binds first. Alternatively tell users in board-specific setup instructions to force including the motorcomm module in initramfs if you set it to m.
  • CONFIG_MMC_DW
    • MMC/SD
  • CONFIG_MMC_DW_ROCKCHIP
    • MMC/SD
  • CONFIG_MMC_SDHCI_OF_DWCMSHC
    • MMC/SD
  • CONFIG_PCIE_ROCKCHIP_DW_HOST
    • PCIe
  • CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY
    • PHY for PCIe/SATA/USB3
  • CONFIG_DRM_PANFROST
    • GPU
  • CONFIG_SND_SOC_ROCKCHIP_SPDIF
    • SPDIF audio
  • CONFIG_ROCKCHIP_DW_HDMI
    • HDMI PHY
  • CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY
    • MIPI DSI DPHY (note: requires in-review patches linked in status table)
  • CONFIG_ROCKCHIP_VOP2
    • Video output
  • CONFIG_ARCH_ROCKCHIP
    • General SoC support
  • CONFIG_ROCKCHIP_PHY
    • General SoC support
  • CONFIG_PHY_ROCKCHIP_INNO_USB2
    • USB 2
  • CONFIG_RTC_DRV_RK808
    • Real-time Clock
  • CONFIG_COMMON_CLK_RK808
    • Real-time Clock
  • CONFIG_MFD_RK808
    • Various things relating to the RK817 chip
  • CONFIG_CHARGER_RK817
    • RK817 charger (note: requires in-review patches linked in status table)
  • CONFIG_REGULATOR_RK808
    • Voltage regulators
  • CONFIG_ROCKCHIP_PM_DOMAINS
    • Power management domains
  • CONFIG_GPIO_ROCKCHIP
    • GPIO support
  • CONFIG_PINCTRL_ROCKCHIP
    • GPIO and general SoC support
  • CONFIG_PWM_ROCKCHIP
    • PWM support
  • CONFIG_ROCKCHIP_IOMMU
    • IOMMU support
  • CONFIG_ROCKCHIP_MBOX
    • Mailbox support (for communication with MCU)
  • CONFIG_ROCKCHIP_SARADC
    • Analog-to-digital conversion support, for e.g. microphones
  • CONFIG_ROCKCHIP_THERMAL
    • Temperature sensor and thermal throttling support
  • CONFIG_SPI_ROCKCHIP
    • SPI support
  • CONFIG_VIDEO_HANTRO_ROCKCHIP
    • Hardware video decoder support
  • CONFIG_ROCKCHIP_IODOMAIN
    • General SoC support so your I/O pins have the right voltage
  • CONFIG_COMMON_CLK_ROCKCHIP
    • Common clock support
  • CONFIG_PHY_ROCKCHIP_INNO_CSIDPHY
    • MIPI CSI DPHY

Resources

Repositories

Other

Board/SoC Documentation

Booting

Boot Order

The RK3566 boot ROM will search for a valid ID BLOCK in the following order on the support boot media:

  • SPI NOR flash
  • SPI NAND flash
  • SD-Card
  • eMMC

... if this fails, the boot ROM will initialize the USB0 port and wait for a connection from the Rockchip flash/boot tools.

Bootloader Flashing

As per pgwipeout's commit message:

  • Make a partition named uboot as partition number 1 at 8 MiB to 16 MiB
  • dd if=idblock.bin of=/dev/<mmc/sd> seek=64
  • dd if=uboot.img of=/dev/<mmc/sd>1

BSP Image Layout