Difference between revisions of "Quartz64 Development"

From PINE64
Jump to navigation Jump to search
(→‎Upstreaming Status: Change color of u-boot status)
(→‎Repositories: Update kernel tree link to 5.15-rc1)
(25 intermediate revisions by 2 users not shown)
Line 28: Line 28:
| Necessary device tree changes [https://patchwork.kernel.org/project/linux-rockchip/patch/20210719225806.26680-1-ezequiel@collabora.com/ in review]
| Necessary device tree changes [https://patchwork.kernel.org/project/linux-rockchip/patch/20210719225806.26680-1-ezequiel@collabora.com/ in review]
|-
|-
! scope="row" rowspan="2" | Audio  
! scope="row" rowspan="3" | Audio  
| colspan="2"  style="background:#F99; text-align:center;"|Needs porting
| colspan="2"  style="background:LightYellow; text-align:center;"|In review<sup>[https://patchwork.kernel.org/project/linux-rockchip/list/?series=541937]</sup>
| <code>rockchip-i2s-tdm</code>
| <code>rockchip-i2s-tdm</code>
| [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/commit/c66ee6a77083475afce9039b30d81c6265fbbb81 i2s] [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/commit/a02f20c268bb8672596e24ee1ffa84e0a26ebb57 i2s fix] [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/commit/df340d70a0b9c0bda00a8025594a65aa899d84a7 vad] [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/commit/b08d29a90fd5aaf705743ac332fab99e621bbfaf pdm] [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/commit/051faf3a861f84347ef8e76c16bbb093d86e93b1 spdif] A [https://github.com/CounterPillow/linux/compare/quartz64-5.14...CounterPillow:quartz-audio port of the i2s-tdm driver for mainline exists], but the code quality isn't good enough for submitting it upstream.
| Downstream: [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/commit/c66ee6a77083475afce9039b30d81c6265fbbb81 i2s] [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/commit/a02f20c268bb8672596e24ee1ffa84e0a26ebb57 i2s fix] [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/commit/df340d70a0b9c0bda00a8025594a65aa899d84a7 vad] [https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/-/commit/b08d29a90fd5aaf705743ac332fab99e621bbfaf pdm]
|-
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rockchip-spdif</code>
| As of 5.15<sup>[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dac825b6a6bdca41347e25f07354ad94fdc97445]</sup>
|-
|-
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
Line 62: Line 66:
|-
|-
! scope="row" | GPIO
! scope="row" | GPIO
| colspan="2"  style="background:LightYellow; text-align:center;"|In review<sup>[https://patchwork.kernel.org/project/linux-rockchip/patch/20210726013529.1634738-1-jay.xu@rock-chips.com/]</sup>
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>gpio-rockchip</code>
| <code>gpio-rockchip</code>
|
| As of 5.15<sup>[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=936ee2675eee1faca0dcdfa79165c7990422e0fc]</sup>
|-
|-
! scope="row" | pinctrl
! scope="row" | pinctrl
Line 77: Line 81:
|-
|-
! scope="row" | PCIe
! scope="row" | PCIe
| colspan="2"  style="background:LightYellow; text-align:center;"|In review<sup>[https://patchwork.kernel.org/project/linux-rockchip/patch/20210624021548.447301-1-xxm@rock-chips.com/]</sup>
| 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/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0e898eb8df4e34c7b129452444eb7cef68a11f43]</sup>
|-
|-
! scope="row" | Power Management
! scope="row" | Power Management
Line 87: Line 91:
|-
|-
! scope="row" | Voltage Control
! scope="row" | Voltage Control
| colspan="2"  style="background:LightYellow; text-align:center;"|In review<sup>[https://patchwork.kernel.org/project/linux-rockchip/patch/20210527082453.1447484-3-jay.xu@rock-chips.com/]</sup>
| colspan="2"  style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rk3568-pmu-io-voltage-domain</code>
| <code>rk3568-pmu-io-voltage-domain</code>
|
| As of 5.15<sup>[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=28b05a64e47cbceebb8a5f3f643033148d5c06c3]</sup>
|-
|-
! scope="row" | SPI  
! scope="row" | SPI  
Line 97: Line 101:
|-
|-
! 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=528837]</sup>
| colspan="2" style="background:LightYellow; text-align:center;"|In review<sup>[https://patchwork.kernel.org/project/linux-rockchip/list/?series=536233]</sup>
| <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]
| 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]
|-
|-
! scope="row" | Microphone
! scope="row" | Microphone
| colspan="2" style="background:LightYellow; text-align:center;"|linux-next<sup>[https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/iio/adc/rockchip_saradc.c?h=next-20210730&id=7786da3b5ae167c17f35e22ba35e06006338c2f6]</sup>
| colspan="2" style="background:PaleGreen; text-align:center;"|Linux Mainline
| <code>rockchip-saradc</code>
| <code>rockchip-saradc</code>
| 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
| As of 5.15<sup>[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=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
! scope="row" | USB 2.0
| colspan="2" style="background:LightYellow; text-align:center;"|In review<sup>[https://patchwork.kernel.org/project/linux-rockchip/list/?series=522639]</sup>
| colspan="2" style="background:LightYellow; text-align:center;"|In review<sup>[https://patchwork.kernel.org/project/linux-rockchip/list/?series=530823]</sup>
| <code>rockchip-usb2phy</code>
| <code>rockchip-usb2phy</code>
|
|
Line 115: Line 119:
| <code>ebc-dev</code>?
| <code>ebc-dev</code>?
| See [[RK3566 EBC Reverse-Engineering]]
| See [[RK3566 EBC Reverse-Engineering]]
|-
! scope="row" | Combo PHY
| colspan="2" style="background:#F99; text-align:center;"|Needs submitting
| <code>naneng-combphy</code>
| Partially submitted upstream, but driver patch got lost somewhere on the way.
|}
|}


Line 147: Line 156:
* [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>
* [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>
* Audio
* Audio
** Simple port of downstream i2s-tdm driver for analog audio output exists and works. Needs cleanup/rewrite before it's worthy of being submitted upstream.
** Driver for Analog audio being upstreamed by [[User:CounterPillow]], still in review though, but it works
** no HDMI or SPDIF yet
** SPDIF works
** no HDMI yet


=== Confirmed Broken ===
=== Confirmed Broken ===
Line 161: Line 171:


== TODO ==
== TODO ==
=== i2s-tdm Cleanup ===
The [https://gitlab.com/pine64-org/quartz-bsp/linux-next/-/tree/rk356x-i2s-tdm i2s-tdm driver] needs cleanup before it can be submitted upstream. For example, the probe function needs to be rewritten, the <code>udelay(150)</code> clear calls should be factored out into a function instead of repeated several times in the code, and other strange things in the code need to be cleaned up.


=== ebc-dev Reverse Engineering and Development ===
=== ebc-dev Reverse Engineering and Development ===
Line 174: Line 180:
The VOP2 portion of the <code>rockchip-drm</code> driver needs to be ported from the downstream kernel. This driver enables video output. Preliminary research has determined that this is a fairly big task.
The VOP2 portion of the <code>rockchip-drm</code> driver needs to be ported from the downstream kernel. This driver enables video output. Preliminary research has determined that this is a fairly big task.


Rumour has it that Collabora has written an unfinished port, but to our knowledge it was never published anywhere.
Collabora has an unpolished forward port that has some issues with HDMI, it can be found here: https://gitlab.collabora.com/benjamin.gaignard/for-upstream/-/tree/5.10_for_rockchip
 
pgwipeout has [https://gitlab.com/pine64-org/quartz-bsp/linux-next/-/tree/quartz64-vop2 a branch] for initial vop2 work/testing, very rough around the edges and does not successfully probe yet.
 
=== 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.


== Resources ==
== Resources ==
Line 180: Line 192:


* pgwipeout's kernel tree
* pgwipeout's kernel tree
** https://gitlab.com/pgwipeout/linux-next/-/tree/quartz64-5.14
** 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

Revision as of 07:11, 15 September 2021

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
Video Output Needs porting rockchipdrm/VOP-v2
3D Acceleration Linux Mainline Upstream Mesa panfrost
Video Decode Linux Staging Not in ffmpeg[1] hantro-vpu, using v4l2-requests Necessary device tree changes in review
Audio In review[2] rockchip-i2s-tdm Downstream: i2s i2s fix vad pdm
Linux Mainline rockchip-spdif As of 5.15[3]
Linux Mainline rk817-codec As of 5.14
u-boot Waiting on ATF sources
Device Tree Basic Quartz64 Model A device tree in linux-next[4]
Gigabit Ethernet Linux Mainline rk3566-gmac As of 5.14[5]
Linux Mainline yt8511-phy As of 5.14[6]
IOMMU Linux Mainline rockchip-iommu As of 5.14[7]
GPIO Linux Mainline gpio-rockchip As of 5.15[8]
pinctrl Linux Mainline
Thermal Regulation Linux Mainline rockchip-thermal As of 5.14[9]
PCIe Linux Mainline pcie-dw-rockchip As of 5.15[10]
Power Management Linux Mainline rockchip-pm-domain As of 5.14[11]
Voltage Control Linux Mainline rk3568-pmu-io-voltage-domain As of 5.15[12]
SPI Linux Mainline spi-rockchip As of 5.14[13]
Battery In review[14] rk817-charger In the BSP tree this is handled by rk817_battery.c and rk817_charger.c
Microphone Linux Mainline rockchip-saradc As of 5.15[15]. 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 In review[16] rockchip-usb2phy
e-Ink Needs reversing ebc-dev? See RK3566 EBC Reverse-Engineering
Combo PHY Needs submitting naneng-combphy Partially submitted upstream, but driver patch got lost somewhere on the way.

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

Partially Working

  • PCI-Express Controller — everything but devices that need cache coherency (e.g. dGPUs) should work
  • USB 3.0 — only works with very short cables and depends on the device. This is likely due to a hardware design issue relating to the coupling capacitors needed for SATA, which shares the same lines as USB 3.0.
  • SDMMC1 (Wi-Fi) — AP6256 working, BL602 needs some work to make it flash firmware
  • I2C — works but is not yet exposed to the Pi-bus
  • GIC — needs errata published by Rockchip to get upstream to add device-specific workarounds[17]
  • Audio
    • Driver for Analog audio being upstreamed by User:CounterPillow, still in review though, but it works
    • SPDIF works
    • no HDMI yet

Confirmed Broken

  • Nothing!

Needs Testing

  • GPU — need a VOP-v2 DRM driver to get display output
  • E-Paper — needs EBC driver
  • SPI

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.

VOP2 Porting

The VOP2 portion of the rockchip-drm driver needs to be ported from the downstream kernel. This driver enables video output. Preliminary research has determined that this is a fairly big task.

Collabora has an unpolished forward port that has some issues with HDMI, it can be found here: https://gitlab.collabora.com/benjamin.gaignard/for-upstream/-/tree/5.10_for_rockchip

pgwipeout has a branch for initial vop2 work/testing, very rough around the edges and does not successfully probe yet.

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.

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