Difference between revisions of "Quartz64 Development"

From PINE64
Jump to navigation Jump to search
m (Update U-Boot ethernet GMAC and Motorcomm PHY driver status)
 
(240 intermediate revisions by 15 users not shown)
Line 1: Line 1:
Under Construction!
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 ==
== Overview ==
Line 10: Line 10:
! scope="col" | Component
! scope="col" | Component
! scope="col" | Notes
! scope="col" | Notes
! scope="col" | Applies To
|-
! scope="row" rowspan="3" | Video Output
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rockchipdrm/VOP2</code>
|
As of 5.19-rc1<sup>[https://git.kernel.org/linus/604be85547ce4d61b89292d2f9a78c721b778c16]</sup>, Also featured in Phoronix Article<sup>[https://www.phoronix.com/scan.php?page=news_item&px=Rockchip-VOP2-Linux-5.19]</sup>, 4k@30 support and other improvements in 6.4-rc1<sup>[https://git.kernel.org/linus/83b61f817f43ed67572d1e241c9f552e0a8bfff4]</sup>
|-
|-
! scope="row" | Video Output
| colspan="2" style="background:#F99; text-align:center;"|Needs porting
| colspan="2" style="background:#F99; text-align:center;"|Needs porting
| <code>rockchipdrm/VOP-v2</code>
| <code>rockchip-edpphy-naneng</code>
|  
| Downstream: [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/blob/quartz64/drivers/phy/rockchip/phy-rockchip-naneng-edp.c] and [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/commit/d7ad116fb30d11d110aeb880754cf27f34c45c40#7e8e2ef87e479c54539dc519c0b92d6b31727f8d_671_681] Coordinate any porting with Rockchip first
|
|-
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>dw-mipi-dsi-rockchip</code>
| As of 6.1<sup>[https://git.kernel.org/linus/e18d9b093006d8abd53e1ce13c0d5a8d0fcd5f64]</sup>
|
|-
|-
! scope="row" | 3D Acceleration  
! scope="row" | 3D Acceleration  
Line 20: Line 32:
| style="background:PaleGreen; text-align:center;"|Upstream Mesa
| style="background:PaleGreen; text-align:center;"|Upstream Mesa
| <code>panfrost</code>
| <code>panfrost</code>
| As of 5.18<sup>[https://git.kernel.org/linus/810028668c6d9da25664195d6b906c98a8169f72]</sup>
|-
! scope="row" rowspan="3" | Video Decode
| style="background:PaleGreen; text-align:center;"|Linux Mainline
| style="background:LightYellow; text-align:center;" rowspan="3"|GStreamer only, no ffmpeg<sup>[https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=2898]</sup>
| <code>hantro</code> using <code>v4l2-requests</code>
| VDPU121 handling 1080p MPEG-2, VP8 and H.264. Mainline as of 5.19<sup>[https://git.kernel.org/linus/5f6bfab6da6531238e899fdf29efd6d0185adc3e]</sup>
|
|-
| style="background:#F99; text-align:center;"|Needs writing
| <code>rkvdec2</code> using <code>v4l2-requests</code>
| VDPU346 handling 4K H.265, H.264 and VP9
|
|-
| style="background:#F99; text-align:center;"|Needs writing
| <code>rkdjpeg</code> using <code>v4l2-requests</code>
| VDPU720 handling JPEG, [[User:CounterPillow]] is working on this
|-
! scope="row" rowspan="5" | [[Mainline Hardware Encoding|Video Encode]]
| style="background:PaleGreen; text-align:center;"|Linux Mainline
| style="text-align:center; background:LightYellow;"|GStreamer only
| JPEG on VEPU121
| Hantro-based. Mainline as of 6.1<sup>[https://git.kernel.org/linus/6f1ae821a6c4aa9d5b8f437b27ec86fb569219fd]</sup>
|
|-
| style="background:#F99; text-align:center;"|Needs writing
| style="text-align:center;"|?
| H.264 on VEPU121
| Hantro-based
|  
|  
|-
|-
! scope="row" | Video Decode
| style="background:#F99; text-align:center;"|Needs writing
| style="background:PaleGreen; text-align:center;"|Linux Mainline?
| style="text-align:center;"|?
| style="background:LightYellow; text-align:center;"|Not in ffmpeg
| VP8 on VEPU121
| <code>hantro-vpu</code>, using <code>v4l2m2m</code>
| Hantro-based
| Speculative status on this also being hantro
|  
|-
|-
! scope="row" rowspan="2" | Audio  
| style="background:#F99; text-align:center;"|Needs writing
| colspan="2"  style="background:#F99; text-align:center;"|Needs porting
| style="text-align:center;"|?
| <code>snd-soc-rockchip-i2s?</code>
| H.264 on VEPU540
| rkvenc-based
|
|-
| style="background:#F99; text-align:center;"|Needs writing
| style="text-align:center;"|?
| H.265 on VEPU540
| rkvenc-based
|
|-
! scope="row" rowspan="3" | Audio  
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rockchip-i2s-tdm</code>
| As of 5.16<sup>[https://git.kernel.org/linus/43b058698f723e3c2087af7069c0da082a3ecbe1]</sup>
|-
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rockchip-spdif</code>
| As of 5.15<sup>[https://git.kernel.org/linus/dac825b6a6bdca41347e25f07354ad94fdc97445]</sup>
|-
|-
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rk817-codec</code>
| <code>rk817-codec</code>
| As of 5.14<sup>[https://git.kernel.org/linus/0d6a04da9b25b9a7cf2cac5f5079e3296d3bee0f]</sup>.
| Quartz64 Model A/B
|-
! scope="row" rowspan="3" | Bootloader
| 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>
|
|-
|-
! scope="row" | u-boot
| colspan="2" style="background:LightYellow; text-align:center;"|Merged
| colspan="2" style="background:LightYellow; text-align:center;"|Waiting on ATF sources
| <code>U-Boot</code>
| [[#Mainline_U-Boot_Work|See below]]. Quartz64 and SOQuartz as of v2023.10-rc2<sup>[https://source.denx.de/u-boot/u-boot/-/commit/4e619e8d4fd68095bc665a78f2651d8e478a4534]</sup>
|
|
|-
|-
! scope="row" | Device Tree
| colspan="2" style="background:LightYellow; text-align:center;"|In progress<sup>[https://github.com/jaredmcneill/quartz64_uefi]</sup>
| colspan="2"  style="background:LightYellow; text-align:center;"|In review
| <code>Tianocore EDK II</code>
|  
|
|-
! scope="row" rowspan="4" | Device Tree
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| Quartz64 Model A
| As of 5.16<sup>[https://git.kernel.org/linus/b33a22a1e7c4248608e533fc4fa524258b3fae84]</sup>
| Quartz64 Model A
|-
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| Quartz64 Model B
| As of 5.19<sup>[https://git.kernel.org/linus/c37415f55bdadffe5b4c0e7981e9fc7e8b96beea]</sup>
| Quartz64 Model B
|-
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| SOQuartz
| As of 5.19<sup>[https://git.kernel.org/linus/c466828fb3ba8cb7f5c3bf28766da9b70bf9745e]</sup>
| SOQuartz
|-
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| PineNote
| As of 5.18<sup>[https://git.kernel.org/linus/d449121e5e8addcee654250cec298c887ecafb32]</sup>
| PineNote
|-
|-
! scope="row" | Gigabit Ethernet
! scope="row" rowspan="2"| Gigabit Ethernet
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rk3566-gmac</code>
| <code>rk3566-gmac</code>
| As of 5.14<sup>[https://git.kernel.org/linus/3bb3d6b1c1957e88bfc5e77a4557f7e6ba761fe3]</sup>
|-
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>yt8511-phy</code>
| As of 5.14<sup>[https://git.kernel.org/linus/48e8c6f1612b3d2dccaea2285231def830cc5b8e]</sup>
|-
|-
! scope="row" | IOMMU
! scope="row" | IOMMU
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rockchip-iommu</code>
| <code>rockchip-iommu</code>
| As of 5.14<sup>[https://git.kernel.org/linus/c55356c534aa651ccc3053ef2d5d8d810adacf5f]</sup>
|-
|-
! scope="row" | GPIO
! scope="row" | GPIO
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
|
| <code>gpio-rockchip</code>
| As of 5.15<sup>[https://git.kernel.org/linus/936ee2675eee1faca0dcdfa79165c7990422e0fc]</sup>
|-
|-
! scope="row" | pinctrl
! scope="row" | pinctrl
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
|
|
|
|-
|-
Line 62: Line 157:
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rockchip-thermal</code>
| <code>rockchip-thermal</code>
| As of 5.14<sup>[https://git.kernel.org/linus/4b14c055a6f644cbeb1156ba24647e92fe51ec69]</sup>
|-
|-
! scope="row" | PCIe
! scope="row" | PCIe
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>pcie-dw-rockchip</code>
| <code>pcie-dw-rockchip</code>
| As of 5.15<sup>[https://git.kernel.org/linus/0e898eb8df4e34c7b129452444eb7cef68a11f43]</sup>
|-
|-
! scope="row" | Power Management
! scope="row" | Power Management
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rockchip-pm-domain</code>
| <code>rockchip-pm-domains</code>
| As of 5.14<sup>[https://git.kernel.org/linus/1782c87b44a0b1a527f01a6a184677c58ccbf9c7]</sup>
|-
! scope="row" | Voltage Control
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rk3568-pmu-io-voltage-domain</code>
| As of 5.15<sup>[https://git.kernel.org/linus/28b05a64e47cbceebb8a5f3f643033148d5c06c3]</sup>
|-
! scope="row" | SPI
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>spi-rockchip</code>
| As of 5.14<sup>[https://git.kernel.org/linus/d74d99229f4d48f42d674f7a8a1137179efd67ac]</sup>. Necessary device tree changes [https://patchwork.kernel.org/project/linux-rockchip/list/?series=586691 in review].
|-
! scope="row" | Battery
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rk817-charger</code>
| 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
|-
! scope="row" | Microphone
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rockchip-saradc</code>
| As of 5.15<sup>[https://git.kernel.org/linus/7786da3b5ae167c17f35e22ba35e06006338c2f6]</sup>. Headphone jack mic seems to connect to <code>SARADC_VIN2_HP_HOOK</code>, so I'm pretty sure that the dtsi and driver changes are needed for that mic to work
|-
! scope="row" | USB 2.0
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rockchip-usb2phy</code>
| As of 5.17<sup>[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/phy/rockchip?h=v5.17-rc1&id=42b559727a45d79c811f493515eb9b7e56016421]</sup>
|-
! scope="row" | e-Ink
| colspan="2" style="background:LightYellow; text-align:center;"|In review (RFC)<sup>[https://lore.kernel.org/linux-rockchip/20220413221916.50995-1-samuel@sholland.org/T/]</sup>
| <code>rockchip-ebc</code>
| A DRM driver is available [https://github.com/smaeul/linux/commits/rk35/ebc-drm-v5 here]; also see [[RK3566 EBC Reverse-Engineering]]
|-
! scope="row" | Combo PHY
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>naneng-combphy</code>
| As of 5.18<sup>[https://git.kernel.org/linus/7160820d742a16313f7802e33c2956c19548e488]</sup>. Still requires DTS changes
|-
! scope="row" | RGA
| colspan="2" style="background:LightYellow; text-align:center;"|Linux Mainline; Could be improved
| <code>rockchip-rga</code>
| As of 6.5[https://git.kernel.org/linus/0c3391f8bb06b744df521651534cd99e3d77e0a8]</sup>. Note that there's still a '4GB' problem and it's implementations has room for improvements (to put it midly  <sup>[https://lore.kernel.org/all/20230522102953.GB23678@pengutronix.de/]</sup> and <sup>[https://lore.kernel.org/all/b404dc20-c460-ac3f-6659-8be7a7d32bfe@arm.com/]</sup>)
|-
! scope="row" | Fan Controller
| colspan="2" style="background:#F99; text-align:center;"|Needs writing
| <code>gp7101</code>
| Someone should write a pwm driver for it so we can then use pwm-fan
| SOQuartz Blade
|-
! scope="row" rowspan="2" | CSI Camera
| colspan="2" style="background:#F99; text-align:center;"|Needs porting
| <code>rkisp</code>
| Downstream: [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/tree/quartz64/drivers/media/platform/rockchip/isp]
|
|-
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rockchip-inno-csidphy</code>
| As of 6.1<sup>[https://git.kernel.org/linus/29c99fb085ad53e6d5504d1f8d32e6673b9b3a2c]</sup>
|
|-
! scope="row" | NPU
| colspan="2" style="background:#F99; text-align:center;"|Needs writing
|
| Downstream version is a closed source SDK and [https://github.com/dieselnutjob/kernel-rk3566/tree/linux-4.19.210/drivers/rknpu open source kernel module rknpu]. Major undertaking to reimplement this as Linux does not (yet) appear to have a generic architecture for neural accelerators.
|
|-
! scope="row" | Crypto
| colspan="2" style="background:#F99; text-align:center;"|Needs porting
| <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.
|
|-
! scope="row" | TRNG
| colspan="2" style="background:LightYellow; text-align:center;"|In review<sup>[https://patchwork.kernel.org/project/linux-rockchip/list/?series=699813&archive=both]</sup>
| <code>rockchip-rng</code>
|
|
|-
! scope="row" rowspan="2" | Wi-Fi
| colspan="2" style="background:#F99; text-align:center;"|Needs porting
| <code>bes2600</code>
| A 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
|-
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>brcmfmac</code>
|
| Quartz64 Model B
|}
|}


== Ressources ==
== 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 &mdash; works, user needs to modify device tree to add devices
* I<sup>2</sup>C &mdash; works, user needs to modify device tree to add devices
 
=== Partially Working ===
 
* PCI-Express Controller &mdash; 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) &mdash; AP6256 working, BL602 needs some work to make it flash firmware
* [https://developer.arm.com/architectures/system-architectures/system-components/arm-generic-interrupt-controller GIC] &mdash; needs errata published by Rockchip to get upstream to add device-specific workarounds<sup>[https://lore.kernel.org/linux-rockchip/CAMdYzYrQ5f-mv_VmTq_CRf9tR=j3mwRpKHNLmPFgCF9whsGFRw@mail.gmail.com/]</sup>
 
=== Confirmed Broken ===
 
* <s>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.</s>
** Fixed in newer revisions by leaving SATA unpopulated
* RGA &mdash; only works with memory &le; 4 GiB, because Rockchip didn't make the address registers larger. Oopsie.
 
=== Needs Testing ===
 
* E-Paper
* Microphone Input
* CSI &mdash; needs CIF driver
* eDP &mdash; needs PHY driver and controller driver
 
== TODO ==
 
=== ebc-dev Reverse Engineering and Development ===
 
The [https://gitlab.com/pine64-org/quartz-bsp/linux-next/-/tree/rk356x-ebc-dev 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.
 
I (liamur) [https://github.com/liamhays/rk3566-mcu 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 [https://patchwork.ozlabs.org/cover/1841800/ ethernet GMAC] and [https://patchwork.ozlabs.org/patch/1817295/ 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 ====
* Downstream Rockchip U-Boot repository with Quartz64 specific patches: https://gitlab.com/pgwipeout/u-boot-rockchip/-/tree/quartz64
* Mainline Rockchip custodian U-Boot repository: https://source.denx.de/u-boot/custodians/u-boot-rockchip
* U-Boot Mailing List: https://lists.denx.de/listinfo/u-boot
 
=== 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 ==
 
* <code>CONFIG_SND_SOC_ROCKCHIP_I2S_TDM</code>
** for Analog and HDMI audio
* <code>CONFIG_SND_SOC_RK817</code>
** for Analog audio on the Model A
* <code>CONFIG_STMMAC_ETH</code>
** Ethernet
* <code>CONFIG_DWMAC_ROCKCHIP</code>
** Ethernet
* <code>CONFIG_MOTORCOMM_PHY</code>
** 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 <code>motorcomm</code> module in initramfs if you set it to m.
* <code>CONFIG_REALTEK_PHY</code>
** Ethernet PHY for Model B
* <code>CONFIG_MMC_DW</code>
** MMC/SD
* <code>CONFIG_MMC_DW_ROCKCHIP</code>
** MMC/SD
* <code>CONFIG_MMC_SDHCI_OF_DWCMSHC</code>
** MMC/SD
* <code>CONFIG_PCIE_ROCKCHIP_DW_HOST</code>
** PCIe
* <code>CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY</code>
** PHY for PCIe/SATA/USB3
* <code>CONFIG_DRM_PANFROST</code>
** GPU
* <code>CONFIG_SND_SOC_ROCKCHIP_SPDIF</code>
** SPDIF audio
* <code>CONFIG_ROCKCHIP_DW_HDMI</code>
** HDMI PHY
* <code>CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY</code>
** MIPI DSI DPHY
* <code>CONFIG_ROCKCHIP_VOP2</code>
** Video output
* <code>CONFIG_ARCH_ROCKCHIP</code>
** General SoC support
* <code>CONFIG_ROCKCHIP_PHY</code>
** General SoC support
* <code>CONFIG_PHY_ROCKCHIP_INNO_USB2</code>
** USB 2
* <code>CONFIG_RTC_DRV_RK808</code>
** Real-time Clock
* <code>CONFIG_COMMON_CLK_RK808</code>
** Real-time Clock
* <code>CONFIG_MFD_RK808</code>
** Various things relating to the RK817 chip
* <code>CONFIG_CHARGER_RK817</code>
** RK817 charger
* <code>CONFIG_REGULATOR_RK808</code>
** Voltage regulators
* <code>CONFIG_ROCKCHIP_PM_DOMAINS</code>
** Power management domains
* <code>CONFIG_GPIO_ROCKCHIP</code>
** GPIO support
* <code>CONFIG_PINCTRL_ROCKCHIP</code>
** GPIO and general SoC support
* <code>CONFIG_PWM_ROCKCHIP</code>
** PWM support
* <code>CONFIG_ROCKCHIP_IOMMU</code>
** IOMMU support
* <code>CONFIG_ROCKCHIP_MBOX</code>
** Mailbox support (for communication with MCU)
* <code>CONFIG_ROCKCHIP_SARADC</code>
** Analog-to-digital conversion support, for e.g. microphones
* <code>CONFIG_ROCKCHIP_THERMAL</code>
** Temperature sensor and thermal throttling support
* <code>CONFIG_SPI_ROCKCHIP</code>
** SPI support
* <code>CONFIG_VIDEO_HANTRO_ROCKCHIP</code>
** Hardware video decoder support
* <code>CONFIG_ROCKCHIP_IODOMAIN</code>
** General SoC support so your I/O pins have the right voltage
* <code>CONFIG_COMMON_CLK_ROCKCHIP</code>
** Common clock support
* <code>CONFIG_PHY_ROCKCHIP_INNO_CSIDPHY</code>
** MIPI CSI DPHY
* <code>CONFIG_I2C_RK3X</code>
** I2C support
 
== Resources ==
=== Repositories ===
=== Repositories ===


* pgwipeout's kernel tree
** https://gitlab.com/pgwipeout/linux-next/-/tree/quartz64-v5.15-rc1
* BSP based development effort for SPL/U-Boot and Linux
* BSP based development effort for SPL/U-Boot and Linux
** https://gitlab.com/pine64-org/quartz-bsp
** https://gitlab.com/pine64-org/quartz-bsp
* Image CI pipeline aimed at developers
** https://gitlab.com/pgwipeout/quartz64_ci/
* Rockchip U-Boot
** https://github.com/rockchip-linux/u-boot
* Downstream rockchip-linux kernel tree
** https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux
* Tianocore EDK II port for UEFI on Quartz64
** https://github.com/jaredmcneill/quartz64_uefi
* Mainline U-Boot Port by pgwipeout
** https://gitlab.com/pgwipeout/u-boot-quartz64
=== Other ===
* Rockchip-SoC Patchwork Page
** https://patchwork.kernel.org/project/linux-rockchip/list/
* Rockchip Kernel Mailing List Archive
** https://lore.kernel.org/linux-rockchip/


== Board/SoC Documentation ==
== Board/SoC Documentation ==
Line 90: Line 466:
... if this fails, the boot ROM will initialize the USB0 port and wait for a connection from the Rockchip
... if this fails, the boot ROM will initialize the USB0 port and wait for a connection from the Rockchip
flash/boot tools.
flash/boot tools.
==== Bootloader Flashing ====
As per pgwipeout's [https://gitlab.com/pine64-org/quartz-bsp/u-boot/-/commit/12d102b86813378af08b086f3b9c13ed8010754c commit message]:
* Make a partition named <code>uboot</code> as partition number 1 at 8 MiB to 16 MiB
* <code>dd if=idblock.bin of=/dev/''<mmc/sd>'' seek=64</code>
* <code>dd if=uboot.img of=/dev/''<mmc/sd>''1</code>


==== BSP Image Layout ====
==== BSP Image Layout ====
[[Category:Quartz64]][[Category:Rockchip RK3566]]

Latest revision as of 14:48, 8 October 2023

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], 4k@30 support and other improvements in 6.4-rc1[3]

Needs porting rockchip-edpphy-naneng Downstream: [4] and [5] Coordinate any porting with Rockchip first
Linux Mainline dw-mipi-dsi-rockchip As of 6.1[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 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
Merged U-Boot See below. Quartz64 and SOQuartz as of v2023.10-rc2[15]
In progress[16] Tianocore EDK II
Device Tree Linux Mainline Quartz64 Model A As of 5.16[17] Quartz64 Model A
Linux Mainline Quartz64 Model B As of 5.19[18] Quartz64 Model B
Linux Mainline SOQuartz As of 5.19[19] SOQuartz
Linux Mainline PineNote As of 5.18[20] PineNote
Gigabit Ethernet Linux Mainline rk3566-gmac As of 5.14[21]
Linux Mainline yt8511-phy As of 5.14[22]
IOMMU Linux Mainline rockchip-iommu As of 5.14[23]
GPIO Linux Mainline gpio-rockchip As of 5.15[24]
pinctrl Linux Mainline
Thermal Regulation Linux Mainline rockchip-thermal As of 5.14[25]
PCIe Linux Mainline pcie-dw-rockchip As of 5.15[26]
Power Management Linux Mainline rockchip-pm-domains As of 5.14[27]
Voltage Control Linux Mainline rk3568-pmu-io-voltage-domain As of 5.15[28]
SPI Linux Mainline spi-rockchip As of 5.14[29]. Necessary device tree changes in review.
Battery Linux Mainline rk817-charger As of 6.1[30] Quartz64 Model A, Pinenote
Microphone Linux Mainline rockchip-saradc As of 5.15[31]. 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[32]
e-Ink In review (RFC)[33] rockchip-ebc A DRM driver is available here; also see RK3566 EBC Reverse-Engineering
Combo PHY Linux Mainline naneng-combphy As of 5.18[34]. Still requires DTS changes
RGA Linux Mainline; Could be improved rockchip-rga As of 6.5[35]. Note that there's still a '4GB' problem and it's implementations has room for improvements (to put it midly [36] and [37])
Fan Controller Needs writing gp7101 Someone should write a pwm driver for it so we can then use pwm-fan 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 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.
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
Wi-Fi Needs porting bes2600 A 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 Mainline brcmfmac Quartz64 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
  • 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]

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.

I (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

BSP Image Layout