Quartz64: Development

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

FunctionStatusComponentNotesApplies To
Video OutputLinux Mainlinerockchipdrm/VOP2As of 5.19-rc1Source,Also featured in Phoronix ArticleSource, 4k@30 support and other improvements in 6.4-rc1Source
Needs portingrockchip-edpphy-nanengDownstream: Source and Source Coordinate any porting with Rockchip first
Linux Mainlinedw-mipi-dsi-rockchipAs of 6.1Source
3D AccelerationLinux MainlineUpstream MesapanfrostAs of 5.18Source
Video DecodeLinux MainlineGStreamer only, no ffmpegSourcehantro using v4l2-requestsVDPU121 handling 1080p MPEG-2, VP8 and H.264. Mainline as of 5.19Source
Needs writingrkvdec2 using v4l2-requestsVDPU346 handling 4K H.265, H.264 and VP9
Needs writingrkdjpeg using v4l2-requestsVDPU720 handling JPEG, User:CounterPillow is working on this
Video EncodeLinux MainlineGStreamer onlyJPEG on VEPU121Hantro-based. Mainline as of 6.1Source
Needs writing?H.264 on VEPU121Hantro-based
Needs writing?VP8 on VEPU121Hantro-based
Needs writing?H.264 on VEPU540rkvenc-based
Needs writing?H.265 on VEPU540rkvenc-based
AudioLinux Mainlinerockchip-i2s-tdmAs of 5.16Source
Linux Mainlinerockchip-spdifAs of 5.15Source
Linux Mainlinerk817-codecAs of 5.14Source.Quartz64 Model A/B
BootloaderIn reviewSourceTF-A
MergedU-Boot#mainline_u_boot_work[See below]. Quartz64 and SOQuartz as of v2023.10-rc2Source
In progressSourceTianocore EDK II
Device TreeLinux MainlineQuartz64 Model AAs of 5.16SourceQuartz64 Model A
Linux MainlineQuartz64 Model BAs of 5.19SourceQuartz64 Model B
Linux MainlineSOQuartzAs of 5.19SourceSOQuartz
Linux MainlinePineNoteAs of 5.18SourcePineNote
Gigabit EthernetLinux Mainlinerk3566-gmacAs of 5.14Source
Linux Mainlineyt8511-phyAs of 5.14Source
IOMMULinux Mainlinerockchip-iommuAs of 5.14Source
GPIOLinux Mainlinegpio-rockchipAs of 5.15Source
pinctrlLinux Mainline
Thermal RegulationLinux Mainlinerockchip-thermalAs of 5.14Source
PCIeLinux Mainlinepcie-dw-rockchipAs of 5.15Source
Power ManagementLinux Mainlinerockchip-pm-domainsAs of 5.14Source
Voltage ControlLinux Mainlinerk3568-pmu-io-voltage-domainAs of 5.15Source
SPILinux Mainlinespi-rockchipAs of 5.14Source.Necessary device tree changes in review.
BatteryLinux Mainlinerk817-chargerAs of 6.1SourceQuartz64 Model A, PineNote
MicrophoneLinux Mainlinerockchip-saradcAs of 5.15Source. 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.0Linux Mainlinerockchip-usb2phyAs of 5.17Source
e-InkIn review (RFC)Sourcerockchip-ebcA DRM driver is available here; See also RK3566 EBC Reverse-Engineering
Combo PHYLinux Mainlinenaneng-combphyAs of 5.18Source. Still requires DTS changes
RGALinux Mainline; Could be improvedrockchip-rgaAs of 6.5Source. Note that there’s still a ‘4GB’ problem and it’s implementations has room for improvements (to put it midly Source and Source)
Fan ControllerNeeds writinggp7101Someone should write a pwm driver for it so we can then use pwm-fanSOQuartz Blade
CSI CameraNeeds portingrkispDownstream: Source
Linux Mainlinerockchip-inno-csidphyAs of 6.1Source
NPUNeeds writingDownstream version is a closed source SDK and open source kernel module rknpu. Major undertaking to reimplement this as Linux does not (yet) appear to have a generic architecture for neural accelerators.
CryptoNeeds portingrk-crypto v2Downstream driver (link) doesn’t include a rk3568 compatible either, but the TRM shows that it seemingly matches.
TRNGIn reviewSourcerockchip-rng
Wi-FiNeeds portingbes2600A downstream driver is available but it makes use of some custom Rockchip interfaces and is designed for older kernels, plans are being made to port it to DKMS.PineTab 2
Linux MainlinebrcmfmacQuartz64 Model B

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
  • Video Output
    • HDMI
    • DSI
  • Audio
    • Analog audio works
    • SPDIF works
    • HDMI works
  • SPI — works, user needs to modify device tree to add devices
  • I^2^C — 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 ^link:https://lore.kernel.org/linux-rockchip/CAMdYzYrQ5f-mv_VmTq_CRf9tR=\j3mwRpKHNLmPFgCF9whsGFRw@mail.gmail.com/[link]^

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.
    • Fixed in newer revisions by leaving SATA unpopulated
  • RGA — only works with memory ≤ 4 GiB, because Rockchip didn’t make the address registers larger. Oopsie.

Needs Testing

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

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.

The user liamur did some investigation into the MCU and found that it is disabled by TF-A on suspend, and doesn’t reside in a low-power part of the RK3566 anyway. It does however have access to most of the chip and could be used as (for example) a real-time coprocessor.

Mainline U-Boot Work

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, even with Rockchip blobs, a more modern version of U-Boot will be much nicer to use.

Mainline U-Boot contains good enough support for the RK3566 SoC used on the Quartz64 as of v2023.07 and have support for Quartz64 and SOQuartz as of v2023.10-rc2. Drivers for ethernet GMAC and Motorcomm PHY are supported as of v2024.01-rc1.

Things that could be done

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

  • 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.

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 PHY for Model A, 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_REALTEK_PHY
    • Ethernet PHY for Model B
  • 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
  • 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
  • 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
  • CONFIG_I2C_RK3X
    • I2C support

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
  • eMMC
  • SD-Card

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