Monday, September 12, 2022

Use Quartz64 SATA controller

Intro

Quartz64[1] is a remarkable piece of hardware.




When I first heard of it, the first thing that caught my eye was the opportunity to simultaneously use an excellent aarch64 machine and a SATA disk.

The important note here, if you really want to use the SATA feature, you must purchase their SATA power cable.

The quartz64 board exposes a connector for the SATA power that is not standard. Moreover, this connector provides only the +12V (yellow line), and the standard ATA requires +12v and +5v. The cable they sold for the purpose has a power voltage converter board included in the cable.



So then, as soon as I got one of these, I intended to set up a SATA disk and see its performance.

I proceeded as anyone else would: I consulted the list of supported OSes and downloaded the one declared to support all the hardware.

The Manjaro[2] is the operating system claiming compatibility with all the Quartz64 hardware, so I proceeded with it.

After installation, I found that out of the box, there was no support for the SATA hardware.


Booting Linux on physical CPU 0x0000000000 [0x412fd050]
Linux version 5.19.0-rc1-0.5-MANJARO-ARM-Q64 (builduser@fh-mjr-build-lon-large) (gcc (GCC) 12.1.0, GNU ld (GNU Binutils) 2.38) #1 SMP PREEMPT Sun Jul 24 21:50:03 UTC 2022
Machine model: Pine64 RK3566 Quartz64-A Board
efi: UEFI not found.
Zone ranges:
  DMA      [mem 0x0000000000200000-0x00000000ffffffff]
  DMA32    empty
  Normal   [mem 0x0000000100000000-0x00000001ffffffff]
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x0000000000200000-0x00000000083fffff]
  node   0: [mem 0x0000000009400000-0x00000000efffffff]
  node   0: [mem 0x0000000100000000-0x00000001ffffffff]
Initmem setup node 0 [mem 0x0000000000200000-0x00000001ffffffff]
On node 0, zone DMA: 512 pages in unavailable ranges
On node 0, zone DMA: 4096 pages in unavailable ranges
cma: Reserved 256 MiB at 0x00000000e0000000
psci: probing for conduit method from DT.
psci: PSCIv1.1 detected in firmware.
psci: Using standard PSCI v0.2 function IDs
psci: Trusted OS migration not required
psci: SMC Calling Convention v1.2
percpu: Embedded 20 pages/cpu s42152 r8192 d31576 u81920
pcpu-alloc: s42152 r8192 d31576 u81920 alloc=20*4096
3 
Detected VIPT I-cache on CPU0
CPU features: detected: GIC system register CPU interface
CPU features: detected: Virtualization Host Extensions
CPU features: detected: ARM errata 1165522, 1319367, or 1530923
alternatives: patching kernel code
Built 1 zonelists, mobility grouping on.  Total pages: 1995336
Kernel command line: initrd=/initramfs-linux.img console=ttyS2,1500000 root=PARTUUID=af1e5257-6fef-49b0-9c89-806eeb81dfec rw rootwait audit=0 splash plymouth.ignore-serial-consoles
audit: disabled (until reboot)
Unknown kernel command line parameters "splash", will be passed to user space.
Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
mem auto-init: stack:off, heap alloc:off, heap free:off
(64MB)
Memory: 7586928K/8108032K available (15808K kernel code, 2056K rwdata, 6244K rodata, 3200K init, 675K bss, 258960K reserved, 262144K cma-reserved)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
rcu: Preemptible hierarchical RCU implementation.
rcu: 	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
	Trampoline variant of Tasks RCU enabled.
	Tracing variant of Tasks RCU enabled.
rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
GICv3: GIC: Using split EOI/Deactivate mode
GICv3: 320 SPIs implemented
GICv3: 0 Extended SPIs implemented
GICv3: MBI range [296:319]
GICv3: Using MBI frame 0x00000000fd410000
Root IRQ handler: gic_handle_irq
GICv3: GICv3 features: 16 PPIs
GICv3: CPU0: found redistributor 0 region 0:0x00000000fd460000
ITS: No ITS available, not enabling LPIs
rcu: srcu_init: Setting srcu_struct sizes based on contention.
arch_timer: cp15 timer(s) running at 24.00MHz (phys).
clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
Console: colour dummy device 80x25
Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
pid_max: default: 32768 minimum: 301
LSM: Security Framework initializing
Yama: becoming mindful.
AppArmor: AppArmor initialized
Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
cblist_init_generic: Setting adjustable number of callback queues.
cblist_init_generic: Setting shift to 2 and lim to 1.
cblist_init_generic: Setting shift to 2 and lim to 1.
rcu: Hierarchical SRCU implementation.
EFI services will not be available.
smp: Bringing up secondary CPUs ...
Detected VIPT I-cache on CPU1
GICv3: CPU1: found redistributor 100 region 0:0x00000000fd480000
CPU1: Booted secondary processor 0x0000000100 [0x412fd050]
Detected VIPT I-cache on CPU2
GICv3: CPU2: found redistributor 200 region 0:0x00000000fd4a0000
CPU2: Booted secondary processor 0x0000000200 [0x412fd050]
Detected VIPT I-cache on CPU3
GICv3: CPU3: found redistributor 300 region 0:0x00000000fd4c0000
CPU3: Booted secondary processor 0x0000000300 [0x412fd050]
smp: Brought up 1 node, 4 CPUs
SMP: Total of 4 processors activated.
CPU features: detected: 32-bit EL0 Support
CPU features: detected: 32-bit EL1 Support
CPU features: detected: Data cache clean to the PoU not required for I/D coherence
CPU features: detected: Common not Private translations
CPU features: detected: CRC32 instructions
CPU features: detected: RCpc load-acquire (LDAPR)
CPU features: detected: LSE atomic instructions
CPU features: detected: Privileged Access Never
CPU features: detected: RAS Extension Support
CPU features: detected: Speculative Store Bypassing Safe (SSBS)
CPU: All CPU(s) started at EL2
devtmpfs: initialized
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
pinctrl core: initialized pinctrl subsystem
DMI not present or invalid.
NET: Registered PF_NETLINK/PF_ROUTE protocol family
DMA: preallocated 1024 KiB GFP_KERNEL pool for atomic allocations
DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
thermal_sys: Registered thermal governor 'fair_share'
thermal_sys: Registered thermal governor 'bang_bang'
thermal_sys: Registered thermal governor 'step_wise'
thermal_sys: Registered thermal governor 'user_space'
cpuidle: using governor ladder
cpuidle: using governor menu
hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
ASID allocator initialised with 65536 entries
HugeTLB: can optimize 4095 vmemmap pages for hugepages-1048576kB
HugeTLB: can optimize 127 vmemmap pages for hugepages-32768kB
HugeTLB: can optimize 7 vmemmap pages for hugepages-2048kB
HugeTLB: can optimize 0 vmemmap pages for hugepages-64kB
platform fe0a0000.hdmi: Fixing up cyclic dependency with fe040000.vop
rockchip-gpio fdd60000.gpio: probed /pinctrl/gpio@fdd60000
rockchip-gpio fe740000.gpio: probed /pinctrl/gpio@fe740000
rockchip-gpio fe750000.gpio: probed /pinctrl/gpio@fe750000
rockchip-gpio fe760000.gpio: probed /pinctrl/gpio@fe760000
rockchip-gpio fe770000.gpio: probed /pinctrl/gpio@fe770000
platform hdmi-con: Fixing up cyclic dependency with fe0a0000.hdmi
HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
cryptd: max_cpu_qlen set to 1000
ACPI: Interpreter disabled.
iommu: Default domain type: Translated 
iommu: DMA domain TLB invalidation policy: strict mode 
SCSI subsystem initialized
libata version 3.00 loaded.
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
mc: Linux media interface: v0.10
videodev: Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
EDAC MC: Ver: 3.0.0
arm-scmi firmware:scmi: Enabled polling mode TX channel - prot_id:16
arm-scmi firmware:scmi: SCMI Notifications - Core Enabled.
arm-scmi firmware:scmi: Malformed reply - real_sz:8  calc_sz:4  (loop_num_ret:3)
arm-scmi firmware:scmi: SCMI Protocol v2.0 'rockchip:' Firmware version 0x0
Advanced Linux Sound Architecture Driver Initialized.
NetLabel: Initializing
NetLabel:  domain hash size = 128
NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
NetLabel:  unlabeled traffic allowed by default
vgaarb: loaded
clocksource: Switched to clocksource arch_sys_counter
VFS: Disk quotas dquot_6.6.0
VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
AppArmor: AppArmor Filesystem Enabled
pnp: PnP ACPI: disabled
NET: Registered PF_INET protocol family
IP idents hash table entries: 131072 (order: 8, 1048576 bytes, linear)
tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes, linear)
TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
TCP bind bhash tables hash table entries: 65536 (order: 8, 1572864 bytes, linear)
TCP: Hash tables configured (established 65536 bind 65536)
UDP hash table entries: 4096 (order: 5, 131072 bytes, linear)
UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes, linear)
NET: Registered PF_UNIX/PF_LOCAL protocol family
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
PCI: CLS 0 bytes, default 64
Trying to unpack rootfs image as initramfs...
hw perfevents: enabled with armv8_cortex_a55 PMU driver, 7 counters available
kvm [1]: IPA Size Limit: 40 bits
kvm [1]: GICv3: no GICV resource entry
kvm [1]: disabling GICv2 emulation
kvm [1]: GIC system register CPU interface enabled
kvm [1]: vgic interrupt IRQ9
kvm [1]: VHE mode initialized successfully
Initialise system trusted keyrings
workingset: timestamp_bits=46 max_order=21 bucket_order=0
zbud: loaded
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
nfs4filelayout_init: NFSv4 File Layout Driver Registering...
nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
ntfs: driver 2.1.32 [Flags: R/W].
fuse: init (API version 7.36)
SGI XFS with ACLs, security attributes, quota, no debug enabled
NET: Registered PF_ALG protocol family
xor: measuring software checksum speed
   8regs           :  1719 MB/sec
   32regs          :  1609 MB/sec
   arm64_neon      :  1692 MB/sec
xor: using function: 8regs (1719 MB/sec)
Key type asymmetric registered
Asymmetric key parser 'x509' registered
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 242)
io scheduler mq-deadline registered
io scheduler kyber registered
io scheduler bfq registered
rockchip-usb2phy fe8a0000.usb2phy: failed to create phy
IPMI message handler: version 39.2
dma-pl330 fe530000.dma-controller: Loaded driver for PL330 DMAC-241330
dma-pl330 fe530000.dma-controller: 	DBUFF-128x8bytes Num_Chans-8 Num_Peri-32 Num_Events-16
dma-pl330 fe550000.dma-controller: Loaded driver for PL330 DMAC-241330
dma-pl330 fe550000.dma-controller: 	DBUFF-128x8bytes Num_Chans-8 Num_Peri-32 Num_Events-16
arm-scmi firmware:scmi: Failed. SCMI protocol 22 not active.
Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
fdd50000.serial: ttyS0 at MMIO 0xfdd50000 (irq = 29, base_baud = 1500000) is a 16550A
fe650000.serial: ttyS1 at MMIO 0xfe650000 (irq = 30, base_baud = 1500000) is a 16550A
serial serial0: tty port ttyS1 registered
fe660000.serial: ttyS2 at MMIO 0xfe660000 (irq = 31, base_baud = 1500000) is a 16550A
enabled
printing thread started
cacheinfo: Unable to detect cache hierarchy for CPU 0
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
ehci-platform: EHCI generic platform driver
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-pci: OHCI PCI platform driver
ohci-platform: OHCI generic platform driver
uhci_hcd: USB Universal Host Controller Interface driver
SPI driver max3421-hcd has no spi_device_id for maxim,max3421
usbcore: registered new interface driver uas
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver ums-alauda
usbcore: registered new interface driver ums-cypress
usbcore: registered new interface driver ums-datafab
usbcore: registered new interface driver ums_eneub6250
usbcore: registered new interface driver ums-freecom
usbcore: registered new interface driver ums-isd200
usbcore: registered new interface driver ums-jumpshot
usbcore: registered new interface driver ums-karma
usbcore: registered new interface driver ums-onetouch
usbcore: registered new interface driver ums-realtek
usbcore: registered new interface driver ums-sddr09
usbcore: registered new interface driver ums-sddr55
usbcore: registered new interface driver ums-usbat
ehci-platform fd800000.usb: EHCI Host Controller
ohci-platform fd840000.usb: Generic Platform OHCI controller
usbcore: registered new interface driver usbserial_generic
ehci-platform fd880000.usb: EHCI Host Controller
usbserial: USB Serial support registered for generic
ohci-platform fd8c0000.usb: Generic Platform OHCI controller
ohci-platform fd840000.usb: new USB bus registered, assigned bus number 1
ehci-platform fd880000.usb: new USB bus registered, assigned bus number 3
ohci-platform fd840000.usb: irq 35, io mem 0xfd840000
ehci-platform fd880000.usb: irq 34, io mem 0xfd880000
ohci-platform fd8c0000.usb: new USB bus registered, assigned bus number 2
ohci-platform fd8c0000.usb: irq 36, io mem 0xfd8c0000
ehci-platform fd800000.usb: new USB bus registered, assigned bus number 4
ehci-platform fd800000.usb: irq 33, io mem 0xfd800000
mousedev: PS/2 mouse device common for all mice
i2c_dev: i2c /dev entries driver
Detected!
rk808 0-0020: chip id: 0x8170
ehci-platform fd880000.usb: USB 2.0 started, EHCI 1.00
usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.19
usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb3: Product: EHCI Host Controller
usb usb3: Manufacturer: Linux 5.19.0-rc1-0.5-MANJARO-ARM-Q64 ehci_hcd
usb usb3: SerialNumber: fd880000.usb
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 1 port detected
ehci-platform fd800000.usb: USB 2.0 started, EHCI 1.00
usb usb4: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.19
usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb4: Product: EHCI Host Controller
usb usb4: Manufacturer: Linux 5.19.0-rc1-0.5-MANJARO-ARM-Q64 ehci_hcd
usb usb4: SerialNumber: fd800000.usb
hub 4-0:1.0: USB hub found
hub 4-0:1.0: 1 port detected
rk808-regulator rk808-regulator: there is no dvs0 gpio
rk808-regulator rk808-regulator: there is no dvs1 gpio
usb usb2: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 5.19
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: Generic Platform OHCI controller
usb usb2: Manufacturer: Linux 5.19.0-rc1-0.5-MANJARO-ARM-Q64 ohci_hcd
usb usb2: SerialNumber: fd8c0000.usb
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
usb usb1: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 5.19
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: Generic Platform OHCI controller
usb usb1: Manufacturer: Linux 5.19.0-rc1-0.5-MANJARO-ARM-Q64 ohci_hcd
usb usb1: SerialNumber: fd840000.usb
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
vccio_acodec: Bringing 1800000uV into 3300000-3300000uV
vcc2v8_dvp: Bringing 1800000uV into 2800000-2800000uV
boost: Bringing 4700000uV into 5000000-5000000uV
input: rk805 pwrkey as /devices/platform/fdd40000.i2c/i2c-0/0-0020/rk805-pwrkey/input/input0
device-mapper: uevent: version 1.0.3
device-mapper: ioctl: 4.46.0-ioctl (2022-02-22) initialised: dm-devel@redhat.com
arm-scmi firmware:scmi: Failed. SCMI protocol 19 not active.
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
Synopsys Designware Multimedia Card Interface Driver
sdhci-pltfm: SDHCI platform and OF driver helper
dwmmc_rockchip fe2c0000.mmc: IDMAC supports 32-bit address mode.
dwmmc_rockchip fe2c0000.mmc: Using internal DMA controller.
dwmmc_rockchip fe2c0000.mmc: Version ID is 270a
dwmmc_rockchip fe2c0000.mmc: DW MMC controller at irq 64,32 bit host data width,256 deep fifo
ledtrig-cpu: registered to indicate activity on CPUs
dwmmc_rockchip fe2c0000.mmc: allocated mmc-pwrseq
mmc_host mmc2: card is non-removable.
No iBFT detected.
arm-scmi firmware:scmi: Failed. SCMI protocol 17 not active.
SMCCC: SOC_ID: ARCH_SOC_ID not implemented, skipping ....
hid: raw HID events driver (C) Jiri Kosina
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
Initializing XFRM netlink socket
NET: Registered PF_INET6 protocol family
using ADMA
Freeing initrd memory: 8328K
Segment Routing with IPv6
In-situ OAM (IOAM) with IPv6
mip6: Mobile IPv6
NET: Registered PF_PACKET protocol family
Key type dns_resolver registered
registered taskstats version 1
Loading compiled-in X.509 certificates
zswap: loaded using pool lzo/zbud
debug_vm_pgtable: [debug_vm_pgtable         ]: Validating architecture page table helpers
Key type ._fscrypt registered
Key type .fscrypt registered
Key type fscrypt-provisioning registered
Key type encrypted registered
mmc_host mmc2: Bus speed (slot 0) = 375000Hz (slot req 400000Hz, actual 375000HZ div = 0)
reg-fixed-voltage vcc5v0_usb20_otg: nonexclusive access to GPIO for vcc5v0_usb20_otg
rockchip-dw-pcie 3c0000000.pcie: host bridge /pcie@fe260000 ranges:
rockchip-dw-pcie 3c0000000.pcie:       IO 0x033ef00000..0x033effffff -> 0x003ef00000
rockchip-dw-pcie 3c0000000.pcie:      MEM 0x0300000000..0x033eefffff -> 0x0000000000
rockchip-dw-pcie 3c0000000.pcie: iATU unroll: enabled
rockchip-dw-pcie 3c0000000.pcie: Detected iATU regions: 8 outbound, 8 inbound
rockchip-dw-pcie 3c0000000.pcie: Phy link never came up
rockchip-dw-pcie 3c0000000.pcie: PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [bus 00-0f]
(bus address [0x3ef00000-0x3effffff])
(bus address [0x00000000-0x3eefffff])
type 01 class 0x060400
pci 0000:00:00.0: reg 0x38: [mem 0x300000000-0x30000ffff pref]
pci 0000:00:00.0: supports D1 D2
pci 0000:00:00.0: PME# supported from D0 D1 D3hot
(conflicts with (null) [bus 00-0f])
pci 0000:00:00.0: BAR 6: assigned [mem 0x300000000-0x30000ffff pref]
pci 0000:00:00.0: PCI bridge to [bus 01-ff]
pcieport 0000:00:00.0: of_irq_parse_pci: failed with rc=-22
xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 5
xhci-hcd xhci-hcd.0.auto: USB3 root hub has no ports
xhci-hcd xhci-hcd.0.auto: hcc params 0x0220fe64 hci version 0x110 quirks 0x0000000002010010
xhci-hcd xhci-hcd.0.auto: irq 67, io mem 0xfcc00000
usb usb5: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.19
usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb5: Product: xHCI Host Controller
usb usb5: Manufacturer: Linux 5.19.0-rc1-0.5-MANJARO-ARM-Q64 xhci-hcd
usb usb5: SerialNumber: xhci-hcd.0.auto
hub 5-0:1.0: USB hub found
hub 5-0:1.0: 1 port detected
xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 6
xhci-hcd xhci-hcd.1.auto: hcc params 0x0220fe64 hci version 0x110 quirks 0x0000000002010010
xhci-hcd xhci-hcd.1.auto: irq 68, io mem 0xfd000000
xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 7
xhci-hcd xhci-hcd.1.auto: Host supports USB 3.0 SuperSpeed
usb usb6: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.19
usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb6: Product: xHCI Host Controller
usb usb6: Manufacturer: Linux 5.19.0-rc1-0.5-MANJARO-ARM-Q64 xhci-hcd
usb usb6: SerialNumber: xhci-hcd.1.auto
hub 6-0:1.0: USB hub found
hub 6-0:1.0: 1 port detected
usb usb7: We don't know the algorithms for LPM for this host, disabling LPM.
usb usb7: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.19
usb usb7: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb7: Product: xHCI Host Controller
usb usb7: Manufacturer: Linux 5.19.0-rc1-0.5-MANJARO-ARM-Q64 xhci-hcd
usb usb7: SerialNumber: xhci-hcd.1.auto
hub 7-0:1.0: USB hub found
hub 7-0:1.0: 1 port detected
ALSA device list:
  No soundcards found.
dw-apb-uart fe660000.serial: forbid DMA for kernel console
dwmmc_rockchip fe2b0000.mmc: IDMAC supports 32-bit address mode.
dwmmc_rockchip fe2b0000.mmc: Using internal DMA controller.
dwmmc_rockchip fe2b0000.mmc: Version ID is 270a
dwmmc_rockchip fe2b0000.mmc: DW MMC controller at irq 69,32 bit host data width,256 deep fifo
dwmmc_rockchip fe2b0000.mmc: Got CD GPIO
mmc_host mmc0: Bus speed (slot 0) = 375000Hz (slot req 400000Hz, actual 375000HZ div = 0)
Freeing unused kernel memory: 3200K
Run /init as init process
  with arguments:
    /init
    splash
  with environment:
    HOME=/
    TERM=linux
mmc_host mmc0: Bus speed (slot 0) = 150000000Hz (slot req 150000000Hz, actual 150000000HZ div = 0)
dwmmc_rockchip fe2b0000.mmc: Successfully tuned phase to 29
mmc0: new ultra high speed SDR104 SDXC card at address 0001
mmcblk0: mmc0:0001 SPCC 58.2 GiB 
 mmcblk0: p1 p2 p3
rk808-rtc rk808-rtc: registered as rtc0
rk808-rtc rk808-rtc: setting system clock to 2022-09-12T08:11:05 UTC (1662970265)
rockchip-vop2 fe040000.vop: Adding to iommu group 0
clk: couldn't set vpll clk rate to 32768 (-22), current rate: 24000000
rockchip-drm display-subsystem: bound fe040000.vop (ops vop2_component_ops [rockchipdrm])
dwhdmi-rockchip fe0a0000.hdmi: Detected HDMI TX controller v2.11a with HDCP (DWC HDMI 2.0 TX PHY)
dwhdmi-rockchip fe0a0000.hdmi: registered DesignWare HDMI I2C bus driver
rockchip-drm display-subsystem: bound fe0a0000.hdmi (ops dw_hdmi_rockchip_ops [rockchipdrm])
Initialized rockchip 1.0.0 20140818 for display-subsystem on minor 0
Cannot find any crtc or sizes
Cannot find any crtc or sizes
EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Quota mode: none.

Looking at motivations, it appears that during the boot, no SATA controller were found.

Reasons for this might be:

  • the hardware is not there
  • the driver is not there
    • the driver is a module and was not loaded
    • the driver was not included in the kernel tree
    • the ACPI/Device tree didn't report it (which makes sense since this driver is not a PCI device able to be enumerated)

Check driver in the upstream exists

Reading at the documentation for the Rockchip RK3566, it appears that the SATA and the usb3 devices share the same phy, which needs to be configured accordingly. Tracking down the driver for the phy, It appears to be implemented in the drivers/phy/rockchip/phy-rockchip-naneng-combphy.c.

Check driver presence in running kernel

The next step is verifying the currently active kernel has, for example, the driver defined symbols:

quartz64$ sudo cat /proc/kallsyms | grep rockchip_combphy_probe
ffff800008711ce0 t rockchip_combphy_probe

This result confirms that both the driver is included in this kernel tree and that it is not a module.

Check device tree

Now that we know the driver is there, we need to understand how it is configured.

Looking at the device tree for this board included the upstream kernel:

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)

/dts-v1/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/rockchip.h>
#include <dt-bindings/soc/rockchip,vop2.h>
#include "rk3566.dtsi"

/ {
	model = "Pine64 RK3566 Quartz64-A Board";
	compatible = "pine64,quartz64-a", "rockchip,rk3566";

	aliases {
		ethernet0 = &gmac1;
		mmc0 = &sdmmc0;
		mmc1 = &sdhci;
	};

	chosen: chosen {
		stdout-path = "serial2:1500000n8";
	};

	gmac1_clkin: external-gmac1-clock {
		compatible = "fixed-clock";
		clock-frequency = <125000000>;
		clock-output-names = "gmac1_clkin";
		#clock-cells = <0>;
	};

	fan: gpio_fan {
		compatible = "gpio-fan";
		gpios = <&gpio0 RK_PD5 GPIO_ACTIVE_HIGH>;
		gpio-fan,speed-map = <0    0
				      4500 1>;
		pinctrl-names = "default";
		pinctrl-0 = <&fan_en_h>;
		#cooling-cells = <2>;
	};

	hdmi-con {
		compatible = "hdmi-connector";
		type = "a";

		port {
			hdmi_con_in: endpoint {
				remote-endpoint = <&hdmi_out_con>;
			};
		};
	};

	leds {
		compatible = "gpio-leds";

		led-work {
			label = "work-led";
			default-state = "off";
			gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>;
			pinctrl-names = "default";
			pinctrl-0 = <&work_led_enable_h>;
			retain-state-suspended;
		};

		led-diy {
			label = "diy-led";
			default-state = "on";
			gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
			pinctrl-names = "default";
			pinctrl-0 = <&diy_led_enable_h>;
			retain-state-suspended;
		};
	};

	rk817-sound {
		compatible = "simple-audio-card";
		simple-audio-card,format = "i2s";
		simple-audio-card,name = "Analog RK817";
		simple-audio-card,mclk-fs = <256>;

		simple-audio-card,cpu {
			sound-dai = <&i2s1_8ch>;
		};

		simple-audio-card,codec {
			sound-dai = <&rk817>;
		};
	};

	sdio_pwrseq: sdio-pwrseq {
		compatible = "mmc-pwrseq-simple";
		clocks = <&rk817 1>;
		clock-names = "ext_clock";
		pinctrl-names = "default";
		pinctrl-0 = <&wifi_enable_h>;
		post-power-on-delay-ms = <100>;
		power-off-delay-us = <5000000>;
		reset-gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_LOW>;
	};

	spdif_dit: spdif-dit {
		compatible = "linux,spdif-dit";
		#sound-dai-cells = <0>;
	};

	spdif_sound: spdif-sound {
		compatible = "simple-audio-card";
		simple-audio-card,name = "SPDIF";

		simple-audio-card,cpu {
			sound-dai = <&spdif>;
		};

		simple-audio-card,codec {
			sound-dai = <&spdif_dit>;
		};
	};

	vcc12v_dcin: vcc12v_dcin {
		compatible = "regulator-fixed";
		regulator-name = "vcc12v_dcin";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
	};

	/* vbus feeds the rk817 usb input.
	 * With no battery attached, also feeds vcc_bat+
	 * via ON/OFF_BAT jumper
	 */
	vbus: vbus {
		compatible = "regulator-fixed";
		regulator-name = "vbus";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc12v_dcin>;
	};

	vcc3v3_pcie_p: vcc3v3-pcie-p-regulator {
		compatible = "regulator-fixed";
		enable-active-high;
		gpio = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&pcie_enable_h>;
		regulator-name = "vcc3v3_pcie_p";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&vcc_3v3>;
	};

	vcc5v0_usb: vcc5v0_usb {
		compatible = "regulator-fixed";
		regulator-name = "vcc5v0_usb";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc12v_dcin>;
	};

	/* all four ports are controlled by one gpio
	 * the host ports are sourced from vcc5v0_usb
	 * the otg port is sourced from vcc5v0_midu
	 */
	vcc5v0_usb20_host: vcc5v0_usb20_host {
		compatible = "regulator-fixed";
		enable-active-high;
		gpio = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&vcc5v0_usb20_host_en>;
		regulator-name = "vcc5v0_usb20_host";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc5v0_usb>;
	};

	vcc5v0_usb20_otg: vcc5v0_usb20_otg {
		compatible = "regulator-fixed";
		enable-active-high;
		gpio = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>;
		regulator-name = "vcc5v0_usb20_otg";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&dcdc_boost>;
	};

	vcc3v3_sd: vcc3v3_sd {
		compatible = "regulator-fixed";
		enable-active-low;
		gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&vcc_sd_h>;
		regulator-boot-on;
		regulator-name = "vcc3v3_sd";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&vcc_3v3>;
	};

	/* sourced from vbus and vcc_bat+ via rk817 sw5 */
	vcc_sys: vcc_sys {
		compatible = "regulator-fixed";
		regulator-name = "vcc_sys";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <4400000>;
		regulator-max-microvolt = <4400000>;
		vin-supply = <&vbus>;
	};

	/* sourced from vcc_sys, sdio module operates internally at 3.3v */
	vcc_wl: vcc_wl {
		compatible = "regulator-fixed";
		regulator-name = "vcc_wl";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&vcc_sys>;
	};
};

&combphy1 {
	status = "okay";
};

&combphy2 {
	status = "okay";
};

&cpu0 {
	cpu-supply = <&vdd_cpu>;
};

&cpu1 {
	cpu-supply = <&vdd_cpu>;
};

&cpu2 {
	cpu-supply = <&vdd_cpu>;
};

&cpu3 {
	cpu-supply = <&vdd_cpu>;
};

&cpu_thermal {
	trips {
		cpu_hot: cpu_hot {
			temperature = <55000>;
			hysteresis = <2000>;
			type = "active";
		};
	};

	cooling-maps {
		map1 {
			trip = <&cpu_hot>;
			cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
		};
	};
};

&gmac1 {
	assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>;
	assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>, <&gmac1_clkin>;
	clock_in_out = "input";
	phy-supply = <&vcc_3v3>;
	phy-mode = "rgmii";
	pinctrl-names = "default";
	pinctrl-0 = <&gmac1m0_miim
		     &gmac1m0_tx_bus2
		     &gmac1m0_rx_bus2
		     &gmac1m0_rgmii_clk
		     &gmac1m0_clkinout
		     &gmac1m0_rgmii_bus>;
	snps,reset-gpio = <&gpio0 RK_PC3 GPIO_ACTIVE_LOW>;
	snps,reset-active-low;
	/* Reset time is 20ms, 100ms for rtl8211f */
	snps,reset-delays-us = <0 20000 100000>;
	tx_delay = <0x30>;
	rx_delay = <0x10>;
	phy-handle = <&rgmii_phy1>;
	status = "okay";
};

&gpu {
	mali-supply = <&vdd_gpu>;
	status = "okay";
};

&hdmi {
	avdd-0v9-supply = <&vdda_0v9>;
	avdd-1v8-supply = <&vcc_1v8>;
	status = "okay";
};

&hdmi_in {
	hdmi_in_vp0: endpoint {
		remote-endpoint = <&vp0_out_hdmi>;
	};
};

&hdmi_out {
	hdmi_out_con: endpoint {
		remote-endpoint = <&hdmi_con_in>;
	};
};

&hdmi_sound {
	status = "okay";
};

&i2c0 {
	status = "okay";

	vdd_cpu: regulator@1c {
		compatible = "tcs,tcs4525";
		reg = <0x1c>;
		fcs,suspend-voltage-selector = <1>;
		regulator-name = "vdd_cpu";
		regulator-min-microvolt = <800000>;
		regulator-max-microvolt = <1150000>;
		regulator-ramp-delay = <2300>;
		regulator-always-on;
		regulator-boot-on;
		vin-supply = <&vcc_sys>;

		regulator-state-mem {
			regulator-off-in-suspend;
		};
	};

	rk817: pmic@20 {
		compatible = "rockchip,rk817";
		reg = <0x20>;
		interrupt-parent = <&gpio0>;
		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
		assigned-clocks = <&cru I2S1_MCLKOUT_TX>;
		assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>;
		clock-names = "mclk";
		clocks = <&cru I2S1_MCLKOUT_TX>;
		clock-output-names = "rk808-clkout1", "rk808-clkout2";
		#clock-cells = <1>;
		pinctrl-names = "default";
		pinctrl-0 = <&pmic_int_l>, <&i2s1m0_mclk>;
		rockchip,system-power-controller;
		#sound-dai-cells = <0>;
		wakeup-source;

		vcc1-supply = <&vcc_sys>;
		vcc2-supply = <&vcc_sys>;
		vcc3-supply = <&vcc_sys>;
		vcc4-supply = <&vcc_sys>;
		vcc5-supply = <&vcc_sys>;
		vcc6-supply = <&vcc_sys>;
		vcc7-supply = <&vcc_sys>;
		vcc8-supply = <&vcc_sys>;
		vcc9-supply = <&dcdc_boost>;

		regulators {
			vdd_logic: DCDC_REG1 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1350000>;
				regulator-init-microvolt = <900000>;
				regulator-ramp-delay = <6001>;
				regulator-initial-mode = <0x2>;
				regulator-name = "vdd_logic";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <900000>;
				};
			};

			vdd_gpu: DCDC_REG2 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1350000>;
				regulator-init-microvolt = <900000>;
				regulator-ramp-delay = <6001>;
				regulator-initial-mode = <0x2>;
				regulator-name = "vdd_gpu";
					regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc_ddr: DCDC_REG3 {
				regulator-always-on;
				regulator-boot-on;
				regulator-initial-mode = <0x2>;
				regulator-name = "vcc_ddr";
				regulator-state-mem {
					regulator-on-in-suspend;
				};
			};

			vcc_3v3: DCDC_REG4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-initial-mode = <0x2>;
				regulator-name = "vcc_3v3";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcca1v8_pmu: LDO_REG1 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcca1v8_pmu";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1800000>;
				};
			};

			vdda_0v9: LDO_REG2 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <900000>;
				regulator-max-microvolt = <900000>;
				regulator-name = "vdda_0v9";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vdda0v9_pmu: LDO_REG3 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <900000>;
				regulator-max-microvolt = <900000>;
				regulator-name = "vdda0v9_pmu";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <900000>;
				};
			};

			vccio_acodec: LDO_REG4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vccio_acodec";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vccio_sd: LDO_REG5 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vccio_sd";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc3v3_pmu: LDO_REG6 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vcc3v3_pmu";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <3300000>;
				};
			};

			vcc_1v8: LDO_REG7 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcc_1v8";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc1v8_dvp: LDO_REG8 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcc1v8_dvp";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc2v8_dvp: LDO_REG9 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <2800000>;
				regulator-max-microvolt = <2800000>;
				regulator-name = "vcc2v8_dvp";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			dcdc_boost: BOOST {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <5000000>;
				regulator-max-microvolt = <5000000>;
				regulator-name = "boost";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			otg_switch: OTG_SWITCH {
				regulator-name = "otg_switch";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};
		};
	};
};

/* i2c3 is exposed on con40
 * pin 3 - i2c3_sda_m0, pullup to vcc_3v3
 * pin 5 - i2c3_scl_m0, pullup to vcc_3v3
 */
&i2c3 {
	status = "okay";
};

&i2s0_8ch {
	status = "okay";
};

&i2s1_8ch {
	pinctrl-names = "default";
	pinctrl-0 = <&i2s1m0_sclktx
		     &i2s1m0_lrcktx
		     &i2s1m0_sdi0
		     &i2s1m0_sdo0>;
	rockchip,trcm-sync-tx-only;
	status = "okay";
};

&mdio1 {
	rgmii_phy1: ethernet-phy@0 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <0>;
	};
};

&pcie2x1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pcie_reset_h>;
	reset-gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>;
	vpcie3v3-supply = <&vcc3v3_pcie_p>;
	status = "okay";
};

&pinctrl {
	bt {
		bt_enable_h: bt-enable-h {
			rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		bt_host_wake_l: bt-host-wake-l {
			rockchip,pins = <2 RK_PC0 RK_FUNC_GPIO &pcfg_pull_down>;
		};

		bt_wake_l: bt-wake-l {
			rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	fan {
		fan_en_h: fan-en-h {
			rockchip,pins = <0 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	leds {
		work_led_enable_h: work-led-enable-h {
			rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		diy_led_enable_h: diy-led-enable-h {
			rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	pcie {
		pcie_enable_h: pcie-enable-h {
			rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		pcie_reset_h: pcie-reset-h {
			rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	pmic {
		pmic_int_l: pmic-int-l {
			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
		};
	};

	usb2 {
		vcc5v0_usb20_host_en: vcc5v0-usb20-host-en {
			rockchip,pins = <4 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	sdio-pwrseq {
		wifi_enable_h: wifi-enable-h {
			rockchip,pins = <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	vcc_sd {
		vcc_sd_h: vcc-sd-h {
			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};
};

&pmu_io_domains {
	pmuio1-supply = <&vcc3v3_pmu>;
	pmuio2-supply = <&vcc3v3_pmu>;
	vccio1-supply = <&vccio_acodec>;
	vccio2-supply = <&vcc_1v8>;
	vccio3-supply = <&vccio_sd>;
	vccio4-supply = <&vcc_1v8>;
	vccio5-supply = <&vcc_3v3>;
	vccio6-supply = <&vcc1v8_dvp>;
	vccio7-supply = <&vcc_3v3>;
	status = "okay";
};

&sdhci {
	bus-width = <8>;
	mmc-hs200-1_8v;
	non-removable;
	vmmc-supply = <&vcc_3v3>;
	vqmmc-supply = <&vcc_1v8>;
	status = "okay";
};

&sdmmc0 {
	bus-width = <4>;
	cap-sd-highspeed;
	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
	disable-wp;
	pinctrl-names = "default";
	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
	sd-uhs-sdr104;
	vmmc-supply = <&vcc3v3_sd>;
	vqmmc-supply = <&vccio_sd>;
	status = "okay";
};

&sdmmc1 {
	bus-width = <4>;
	cap-sd-highspeed;
	cap-sdio-irq;
	keep-power-in-suspend;
	mmc-pwrseq = <&sdio_pwrseq>;
	non-removable;
	pinctrl-names = "default";
	pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>;
	sd-uhs-sdr104;
	vmmc-supply = <&vcc_wl>;
	vqmmc-supply = <&vcc_1v8>;
	status = "okay";
};

&sfc {
	pinctrl-0 = <&fspi_pins>;
	pinctrl-names = "default";
	#address-cells = <1>;
	#size-cells = <0>;
	status = "disabled";

	flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <24000000>;
		spi-rx-bus-width = <4>;
		spi-tx-bus-width = <1>;
	};
};

/* spdif is exposed on con40 pin 18 */
&spdif {
	status = "okay";
};

/* spi1 is exposed on con40
 * pin 11 - spi1_mosi_m1
 * pin 13 - spi1_miso_m1
 * pin 15 - spi1_clk_m1
 * pin 17 - spi1_cs0_m1
 */
&spi1 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi1m1_cs0 &spi1m1_pins>;
};

&tsadc {
	/* tshut mode 0:CRU 1:GPIO */
	rockchip,hw-tshut-mode = <1>;
	/* tshut polarity 0:LOW 1:HIGH */
	rockchip,hw-tshut-polarity = <0>;
	status = "okay";
};

/* uart0 is exposed on con40
 * pin 12 - uart0_tx
 * pin 14 - uart0_rx
 */
&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_xfer>;
	status = "okay";
};

&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn>;
	status = "okay";
	uart-has-rtscts;

	bluetooth {
		compatible = "brcm,bcm43438-bt";
		clocks = <&rk817 1>;
		clock-names = "lpo";
		device-wakeup-gpios = <&gpio2 RK_PC1 GPIO_ACTIVE_HIGH>;
		host-wakeup-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>;
		shutdown-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
		vbat-supply = <&vcc_sys>;
		vddio-supply = <&vcca1v8_pmu>;
	};
};

/* uart2 is exposed on con40
 * pin 8 - uart2_tx_m0_debug
 * pin 10 - uart2_rx_m0_debug
 */
&uart2 {
	status = "okay";
};

&usb_host0_ehci {
	status = "okay";
};

&usb_host0_ohci {
	status = "okay";
};

&usb_host1_ehci {
	status = "okay";
};

&usb_host1_ohci {
	status = "okay";
};

&usb_host0_xhci {
	dr_mode = "host";
	status = "okay";
};

/* usb3 controller is muxed with sata1 */
&usb_host1_xhci {
	status = "okay";
};

&usb2phy0 {
	status = "okay";
};

&usb2phy0_host {
	phy-supply = <&vcc5v0_usb20_host>;
	status = "okay";
};

&usb2phy0_otg {
	phy-supply = <&vcc5v0_usb20_otg>;
	status = "okay";
};

&usb2phy1 {
	status = "okay";
};

&usb2phy1_host {
	phy-supply = <&vcc5v0_usb20_host>;
	status = "okay";
};

&usb2phy1_otg {
	phy-supply = <&vcc5v0_usb20_host>;
	status = "okay";
};

&vop {
	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
	status = "okay";
};

&vop_mmu {
	status = "okay";
};

&vp0 {
	vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
		reg = <ROCKCHIP_VOP2_EP_HDMI0>;
		remote-endpoint = <&hdmi_in_vp0>;
	};
};

At highlined, the device tree enables the usb3, and this is the reason why the SATA controller is not enabled.

Enable the driver

At this point, it is clear that if we want to use the SATA controller, we must replace it at the USB3.

Here is the suggested patch to enable the SATA

--- a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
@@ -789,7 +789,8 @@ &usb_host0_xhci {
 };
 
 /* usb3 controller is muxed with sata1 */
-&usb_host1_xhci {
+//&usb_host1_xhci {
+&sata1 {
        status = "okay";
 };

After the devicetree compilation (here a sample compiled just replace it in the /boot directory) the kernel boots with SATA support.

  • at line highlined in yellow you can see the data driver probed,
  • at line highlined in green a Samsung SATA hardisk detected.
Booting Linux on physical CPU 0x0000000000 [0x412fd050]
Linux version 5.19.0-rc1-0.5-MANJARO-ARM-Q64 (builduser@fh-mjr-build-lon-large) (gcc (GCC) 12.1.0, GNU ld (GNU Binutils) 2.38) #1 SMP PREEMPT Sun Jul 24 21:50:03 UTC 2022
Machine model: Pine64 RK3566 Quartz64-A Board
efi: UEFI not found.
Zone ranges:
  DMA      [mem 0x0000000000200000-0x00000000ffffffff]
  DMA32    empty
  Normal   [mem 0x0000000100000000-0x00000001ffffffff]
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x0000000000200000-0x00000000083fffff]
  node   0: [mem 0x0000000009400000-0x00000000efffffff]
  node   0: [mem 0x0000000100000000-0x00000001ffffffff]
Initmem setup node 0 [mem 0x0000000000200000-0x00000001ffffffff]
On node 0, zone DMA: 512 pages in unavailable ranges
On node 0, zone DMA: 4096 pages in unavailable ranges
cma: Reserved 256 MiB at 0x00000000e0000000
psci: probing for conduit method from DT.
psci: PSCIv1.1 detected in firmware.
psci: Using standard PSCI v0.2 function IDs
psci: Trusted OS migration not required
psci: SMC Calling Convention v1.2
percpu: Embedded 20 pages/cpu s42152 r8192 d31576 u81920
pcpu-alloc: s42152 r8192 d31576 u81920 alloc=20*4096
3 
Detected VIPT I-cache on CPU0
CPU features: detected: GIC system register CPU interface
CPU features: detected: Virtualization Host Extensions
CPU features: detected: ARM errata 1165522, 1319367, or 1530923
alternatives: patching kernel code
Built 1 zonelists, mobility grouping on.  Total pages: 1995336
Kernel command line: initrd=/initramfs-linux.img console=ttyS2,1500000 root=PARTUUID=af1e5257-6fef-49b0-9c89-806eeb81dfec rw rootwait audit=0 splash plymouth.ignore-serial-consoles
audit: disabled (until reboot)
Unknown kernel command line parameters "splash", will be passed to user space.
Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
mem auto-init: stack:off, heap alloc:off, heap free:off
(64MB)
Memory: 7587248K/8108032K available (15808K kernel code, 2056K rwdata, 6244K rodata, 3200K init, 675K bss, 258640K reserved, 262144K cma-reserved)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
rcu: Preemptible hierarchical RCU implementation.
rcu: 	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
	Trampoline variant of Tasks RCU enabled.
	Tracing variant of Tasks RCU enabled.
rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
GICv3: GIC: Using split EOI/Deactivate mode
GICv3: 320 SPIs implemented
GICv3: 0 Extended SPIs implemented
GICv3: MBI range [296:319]
GICv3: Using MBI frame 0x00000000fd410000
Root IRQ handler: gic_handle_irq
GICv3: GICv3 features: 16 PPIs
GICv3: CPU0: found redistributor 0 region 0:0x00000000fd460000
ITS: No ITS available, not enabling LPIs
rcu: srcu_init: Setting srcu_struct sizes based on contention.
arch_timer: cp15 timer(s) running at 24.00MHz (phys).
clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
Console: colour dummy device 80x25
Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
pid_max: default: 32768 minimum: 301
LSM: Security Framework initializing
Yama: becoming mindful.
AppArmor: AppArmor initialized
Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
cblist_init_generic: Setting adjustable number of callback queues.
cblist_init_generic: Setting shift to 2 and lim to 1.
cblist_init_generic: Setting shift to 2 and lim to 1.
rcu: Hierarchical SRCU implementation.
EFI services will not be available.
smp: Bringing up secondary CPUs ...
Detected VIPT I-cache on CPU1
GICv3: CPU1: found redistributor 100 region 0:0x00000000fd480000
CPU1: Booted secondary processor 0x0000000100 [0x412fd050]
Detected VIPT I-cache on CPU2
GICv3: CPU2: found redistributor 200 region 0:0x00000000fd4a0000
CPU2: Booted secondary processor 0x0000000200 [0x412fd050]
Detected VIPT I-cache on CPU3
GICv3: CPU3: found redistributor 300 region 0:0x00000000fd4c0000
CPU3: Booted secondary processor 0x0000000300 [0x412fd050]
smp: Brought up 1 node, 4 CPUs
SMP: Total of 4 processors activated.
CPU features: detected: 32-bit EL0 Support
CPU features: detected: 32-bit EL1 Support
CPU features: detected: Data cache clean to the PoU not required for I/D coherence
CPU features: detected: Common not Private translations
CPU features: detected: CRC32 instructions
CPU features: detected: RCpc load-acquire (LDAPR)
CPU features: detected: LSE atomic instructions
CPU features: detected: Privileged Access Never
CPU features: detected: RAS Extension Support
CPU features: detected: Speculative Store Bypassing Safe (SSBS)
CPU: All CPU(s) started at EL2
devtmpfs: initialized
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
pinctrl core: initialized pinctrl subsystem
DMI not present or invalid.
NET: Registered PF_NETLINK/PF_ROUTE protocol family
DMA: preallocated 1024 KiB GFP_KERNEL pool for atomic allocations
DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
thermal_sys: Registered thermal governor 'fair_share'
thermal_sys: Registered thermal governor 'bang_bang'
thermal_sys: Registered thermal governor 'step_wise'
thermal_sys: Registered thermal governor 'user_space'
cpuidle: using governor ladder
cpuidle: using governor menu
hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
ASID allocator initialised with 65536 entries
HugeTLB: can optimize 4095 vmemmap pages for hugepages-1048576kB
HugeTLB: can optimize 127 vmemmap pages for hugepages-32768kB
HugeTLB: can optimize 7 vmemmap pages for hugepages-2048kB
HugeTLB: can optimize 0 vmemmap pages for hugepages-64kB
platform fe0a0000.hdmi: Fixing up cyclic dependency with fe040000.vop
rockchip-gpio fdd60000.gpio: probed /pinctrl/gpio@fdd60000
rockchip-gpio fe740000.gpio: probed /pinctrl/gpio@fe740000
rockchip-gpio fe750000.gpio: probed /pinctrl/gpio@fe750000
rockchip-gpio fe760000.gpio: probed /pinctrl/gpio@fe760000
rockchip-gpio fe770000.gpio: probed /pinctrl/gpio@fe770000
platform hdmi-con: Fixing up cyclic dependency with fe0a0000.hdmi
HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
cryptd: max_cpu_qlen set to 1000
ACPI: Interpreter disabled.
iommu: Default domain type: Translated 
iommu: DMA domain TLB invalidation policy: strict mode 
SCSI subsystem initialized
libata version 3.00 loaded.
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
mc: Linux media interface: v0.10
videodev: Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
EDAC MC: Ver: 3.0.0
arm-scmi firmware:scmi: Enabled polling mode TX channel - prot_id:16
arm-scmi firmware:scmi: SCMI Notifications - Core Enabled.
arm-scmi firmware:scmi: Malformed reply - real_sz:8  calc_sz:4  (loop_num_ret:3)
arm-scmi firmware:scmi: SCMI Protocol v2.0 'rockchip:' Firmware version 0x0
Advanced Linux Sound Architecture Driver Initialized.
NetLabel: Initializing
NetLabel:  domain hash size = 128
NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
NetLabel:  unlabeled traffic allowed by default
vgaarb: loaded
clocksource: Switched to clocksource arch_sys_counter
VFS: Disk quotas dquot_6.6.0
VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
AppArmor: AppArmor Filesystem Enabled
pnp: PnP ACPI: disabled
NET: Registered PF_INET protocol family
IP idents hash table entries: 131072 (order: 8, 1048576 bytes, linear)
tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes, linear)
TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
TCP bind bhash tables hash table entries: 65536 (order: 8, 1572864 bytes, linear)
TCP: Hash tables configured (established 65536 bind 65536)
UDP hash table entries: 4096 (order: 5, 131072 bytes, linear)
UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes, linear)
NET: Registered PF_UNIX/PF_LOCAL protocol family
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
PCI: CLS 0 bytes, default 64
Trying to unpack rootfs image as initramfs...
hw perfevents: enabled with armv8_cortex_a55 PMU driver, 7 counters available
kvm [1]: IPA Size Limit: 40 bits
kvm [1]: GICv3: no GICV resource entry
kvm [1]: disabling GICv2 emulation
kvm [1]: GIC system register CPU interface enabled
kvm [1]: vgic interrupt IRQ9
kvm [1]: VHE mode initialized successfully
Initialise system trusted keyrings
workingset: timestamp_bits=46 max_order=21 bucket_order=0
zbud: loaded
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
nfs4filelayout_init: NFSv4 File Layout Driver Registering...
nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
ntfs: driver 2.1.32 [Flags: R/W].
fuse: init (API version 7.36)
SGI XFS with ACLs, security attributes, quota, no debug enabled
NET: Registered PF_ALG protocol family
xor: measuring software checksum speed
   8regs           :  1719 MB/sec
   32regs          :  1610 MB/sec
   arm64_neon      :  1685 MB/sec
xor: using function: 8regs (1719 MB/sec)
Key type asymmetric registered
Asymmetric key parser 'x509' registered
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 242)
io scheduler mq-deadline registered
io scheduler kyber registered
io scheduler bfq registered
rockchip-usb2phy fe8a0000.usb2phy: failed to create phy
IPMI message handler: version 39.2
dma-pl330 fe530000.dma-controller: Loaded driver for PL330 DMAC-241330
dma-pl330 fe530000.dma-controller: 	DBUFF-128x8bytes Num_Chans-8 Num_Peri-32 Num_Events-16
dma-pl330 fe550000.dma-controller: Loaded driver for PL330 DMAC-241330
dma-pl330 fe550000.dma-controller: 	DBUFF-128x8bytes Num_Chans-8 Num_Peri-32 Num_Events-16
arm-scmi firmware:scmi: Failed. SCMI protocol 22 not active.
Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
fdd50000.serial: ttyS0 at MMIO 0xfdd50000 (irq = 29, base_baud = 1500000) is a 16550A
fe650000.serial: ttyS1 at MMIO 0xfe650000 (irq = 30, base_baud = 1500000) is a 16550A
serial serial0: tty port ttyS1 registered
fe660000.serial: ttyS2 at MMIO 0xfe660000 (irq = 31, base_baud = 1500000) is a 16550A
printing thread started
enabled
cacheinfo: Unable to detect cache hierarchy for CPU 0
ahci fc400000.sata: supply ahci not found, using dummy regulator
ahci fc400000.sata: supply phy not found, using dummy regulator
ahci fc400000.sata: supply target not found, using dummy regulator
ahci fc400000.sata: forcing port_map 0x0 -> 0x1
ahci fc400000.sata: AHCI 0001.0300 32 slots 1 ports 6 Gbps 0x1 impl platform mode
ahci fc400000.sata: flags: ncq sntf pm led clo only pmp fbs pio slum part ccc apst 
ahci fc400000.sata: port 0 is not capable of FBS
scsi host0: ahci
port 0x100 irq 33
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
ehci-platform: EHCI generic platform driver
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-pci: OHCI PCI platform driver
ohci-platform: OHCI generic platform driver
uhci_hcd: USB Universal Host Controller Interface driver
SPI driver max3421-hcd has no spi_device_id for maxim,max3421
usbcore: registered new interface driver uas
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver ums-alauda
usbcore: registered new interface driver ums-cypress
usbcore: registered new interface driver ums-datafab
usbcore: registered new interface driver ums_eneub6250
usbcore: registered new interface driver ums-freecom
usbcore: registered new interface driver ums-isd200
usbcore: registered new interface driver ums-jumpshot
usbcore: registered new interface driver ums-karma
usbcore: registered new interface driver ums-onetouch
usbcore: registered new interface driver ums-realtek
usbcore: registered new interface driver ums-sddr09
usbcore: registered new interface driver ums-sddr55
usbcore: registered new interface driver ums-usbat
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial support registered for generic
ehci-platform fd880000.usb: EHCI Host Controller
ehci-platform fd800000.usb: EHCI Host Controller
ohci-platform fd840000.usb: Generic Platform OHCI controller
ehci-platform fd880000.usb: new USB bus registered, assigned bus number 1
ohci-platform fd8c0000.usb: Generic Platform OHCI controller
ehci-platform fd880000.usb: irq 34, io mem 0xfd880000
ehci-platform fd800000.usb: new USB bus registered, assigned bus number 2
ohci-platform fd840000.usb: new USB bus registered, assigned bus number 3
ehci-platform fd800000.usb: irq 35, io mem 0xfd800000
ohci-platform fd8c0000.usb: new USB bus registered, assigned bus number 4
ohci-platform fd840000.usb: irq 36, io mem 0xfd840000
ohci-platform fd8c0000.usb: irq 37, io mem 0xfd8c0000
mousedev: PS/2 mouse device common for all mice
i2c_dev: i2c /dev entries driver
Detected!
rk808 0-0020: chip id: 0x8170
ehci-platform fd880000.usb: USB 2.0 started, EHCI 1.00
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.19
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: EHCI Host Controller
usb usb1: Manufacturer: Linux 5.19.0-rc1-0.5-MANJARO-ARM-Q64 ehci_hcd
usb usb1: SerialNumber: fd880000.usb
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ehci-platform fd800000.usb: USB 2.0 started, EHCI 1.00
usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.19
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: EHCI Host Controller
usb usb2: Manufacturer: Linux 5.19.0-rc1-0.5-MANJARO-ARM-Q64 ehci_hcd
usb usb2: SerialNumber: fd800000.usb
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
usb usb3: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 5.19
usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb3: Product: Generic Platform OHCI controller
usb usb3: Manufacturer: Linux 5.19.0-rc1-0.5-MANJARO-ARM-Q64 ohci_hcd
usb usb3: SerialNumber: fd840000.usb
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 1 port detected
usb usb4: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 5.19
usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb4: Product: Generic Platform OHCI controller
usb usb4: Manufacturer: Linux 5.19.0-rc1-0.5-MANJARO-ARM-Q64 ohci_hcd
usb usb4: SerialNumber: fd8c0000.usb
hub 4-0:1.0: USB hub found
hub 4-0:1.0: 1 port detected
rk808-regulator rk808-regulator: there is no dvs0 gpio
rk808-regulator rk808-regulator: there is no dvs1 gpio
vccio_acodec: Bringing 1800000uV into 3300000-3300000uV
vcc2v8_dvp: Bringing 1800000uV into 2800000-2800000uV
boost: Bringing 4700000uV into 5000000-5000000uV
input: rk805 pwrkey as /devices/platform/fdd40000.i2c/i2c-0/0-0020/rk805-pwrkey/input/input0
device-mapper: uevent: version 1.0.3
device-mapper: ioctl: 4.46.0-ioctl (2022-02-22) initialised: dm-devel@redhat.com
arm-scmi firmware:scmi: Failed. SCMI protocol 19 not active.
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
Synopsys Designware Multimedia Card Interface Driver
sdhci-pltfm: SDHCI platform and OF driver helper
dwmmc_rockchip fe2c0000.mmc: IDMAC supports 32-bit address mode.
dwmmc_rockchip fe2c0000.mmc: Using internal DMA controller.
dwmmc_rockchip fe2c0000.mmc: Version ID is 270a
dwmmc_rockchip fe2c0000.mmc: DW MMC controller at irq 65,32 bit host data width,256 deep fifo
ledtrig-cpu: registered to indicate activity on CPUs
No iBFT detected.
dwmmc_rockchip fe2c0000.mmc: allocated mmc-pwrseq
mmc_host mmc2: card is non-removable.
arm-scmi firmware:scmi: Failed. SCMI protocol 17 not active.
SMCCC: SOC_ID: ARCH_SOC_ID not implemented, skipping ....
hid: raw HID events driver (C) Jiri Kosina
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
Initializing XFRM netlink socket
NET: Registered PF_INET6 protocol family
using ADMA
Freeing initrd memory: 8328K
Segment Routing with IPv6
In-situ OAM (IOAM) with IPv6
mip6: Mobile IPv6
NET: Registered PF_PACKET protocol family
Key type dns_resolver registered
registered taskstats version 1
Loading compiled-in X.509 certificates
zswap: loaded using pool lzo/zbud
debug_vm_pgtable: [debug_vm_pgtable         ]: Validating architecture page table helpers
Key type ._fscrypt registered
Key type .fscrypt registered
Key type fscrypt-provisioning registered
Key type encrypted registered
mmc_host mmc2: Bus speed (slot 0) = 375000Hz (slot req 400000Hz, actual 375000HZ div = 0)
reg-fixed-voltage vcc5v0_usb20_otg: nonexclusive access to GPIO for vcc5v0_usb20_otg
rockchip-dw-pcie 3c0000000.pcie: host bridge /pcie@fe260000 ranges:
rockchip-dw-pcie 3c0000000.pcie:       IO 0x033ef00000..0x033effffff -> 0x003ef00000
rockchip-dw-pcie 3c0000000.pcie:      MEM 0x0300000000..0x033eefffff -> 0x0000000000
rockchip-dw-pcie 3c0000000.pcie: iATU unroll: enabled
rockchip-dw-pcie 3c0000000.pcie: Detected iATU regions: 8 outbound, 8 inbound
ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata1.00: ATA-8: SAMSUNG HN-M250MBB, 2AR10001, max UDMA/133
ata1.00: 488397168 sectors, multi 0: LBA48 NCQ (depth 32)
ata1.00: configured for UDMA/133
scsi 0:0:0:0: Direct-Access     ATA      SAMSUNG HN-M250M 0001 PQ: 0 ANSI: 5
sd 0:0:0:0: Attached scsi generic sg0 type 0
488397168 512-byte logical blocks: (250 GB/233 GiB)
Write Protect is off
Mode Sense: 00 3a 00 00
Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Preferred minimum I/O size 512 bytes
Attached SCSI disk
rockchip-dw-pcie 3c0000000.pcie: Phy link never came up
rockchip-dw-pcie 3c0000000.pcie: PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [bus 00-0f]
(bus address [0x3ef00000-0x3effffff])
(bus address [0x00000000-0x3eefffff])
type 01 class 0x060400
pci 0000:00:00.0: reg 0x38: [mem 0x300000000-0x30000ffff pref]
pci 0000:00:00.0: supports D1 D2
pci 0000:00:00.0: PME# supported from D0 D1 D3hot
(conflicts with (null) [bus 00-0f])
pci 0000:00:00.0: BAR 6: assigned [mem 0x300000000-0x30000ffff pref]
pci 0000:00:00.0: PCI bridge to [bus 01-ff]
pcieport 0000:00:00.0: of_irq_parse_pci: failed with rc=-22
xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 5
xhci-hcd xhci-hcd.0.auto: USB3 root hub has no ports
xhci-hcd xhci-hcd.0.auto: hcc params 0x0220fe64 hci version 0x110 quirks 0x0000000002010010
xhci-hcd xhci-hcd.0.auto: irq 68, io mem 0xfcc00000
usb usb5: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.19
usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb5: Product: xHCI Host Controller
usb usb5: Manufacturer: Linux 5.19.0-rc1-0.5-MANJARO-ARM-Q64 xhci-hcd
usb usb5: SerialNumber: xhci-hcd.0.auto
hub 5-0:1.0: USB hub found
hub 5-0:1.0: 1 port detected
ALSA device list:
  No soundcards found.
dw-apb-uart fe660000.serial: forbid DMA for kernel console
dwmmc_rockchip fe2b0000.mmc: IDMAC supports 32-bit address mode.
dwmmc_rockchip fe2b0000.mmc: Using internal DMA controller.
dwmmc_rockchip fe2b0000.mmc: Version ID is 270a
dwmmc_rockchip fe2b0000.mmc: DW MMC controller at irq 69,32 bit host data width,256 deep fifo
dwmmc_rockchip fe2b0000.mmc: Got CD GPIO
mmc_host mmc0: Bus speed (slot 0) = 375000Hz (slot req 400000Hz, actual 375000HZ div = 0)
Freeing unused kernel memory: 3200K
Run /init as init process
  with arguments:
    /init
    splash
  with environment:
    HOME=/
    TERM=linux
mmc_host mmc0: Bus speed (slot 0) = 150000000Hz (slot req 150000000Hz, actual 150000000HZ div = 0)
dwmmc_rockchip fe2b0000.mmc: Successfully tuned phase to 22
mmc0: new ultra high speed SDR104 SDXC card at address 0001
mmcblk0: mmc0:0001 SPCC 58.2 GiB 
 mmcblk0: p1 p2 p3
rk808-rtc rk808-rtc: registered as rtc0
rk808-rtc rk808-rtc: setting system clock to 2017-08-05T09:00:05 UTC (1501923605)
rockchip-vop2 fe040000.vop: Adding to iommu group 0
rockchip-drm display-subsystem: bound fe040000.vop (ops vop2_component_ops [rockchipdrm])
dwhdmi-rockchip fe0a0000.hdmi: Detected HDMI TX controller v2.11a with HDCP (DWC HDMI 2.0 TX PHY)
dwhdmi-rockchip fe0a0000.hdmi: registered DesignWare HDMI I2C bus driver
rockchip-drm display-subsystem: bound fe0a0000.hdmi (ops dw_hdmi_rockchip_ops [rockchipdrm])
Initialized rockchip 1.0.0 20140818 for display-subsystem on minor 0
Cannot find any crtc or sizes
Cannot find any crtc or sizes
EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Quota mode: none.

References

Tuesday, October 20, 2020

kernel Lockdown

No more easy tasks during the "kernel Lockdown"

No more easy tasks during the “kernel Lockdown”

Today I wanted to show my Exein fellow how to extract a standard x86_64 Bios image from a live PC.
Quite easy and common task that should not have any issue.
So I triggered the dd command to accomplish the task:

sudo dd if=/dev/mem of=bios.rom bs=64k skip=15 count=1

No problem was expected; still something weird caught my attention:

$ sudo dd if=/dev/mem of=pcbios.rom bs=64k skip=15 count=1
dd: failed to open '/dev/mem': Operation not permitted

Investigating on the issue, it came out that a reasonably new LSM was acting behind the scenes preventing me from accomplishing the easy task I wanted to do.

$ sudo cat /sys/kernel/security/lockdown 
none [integrity] confidentiality
$ dmesg
[    0.000000] Kernel is locked down from EFI Secure Boot mode; see man kernel_lockdown.7
[...]
[    0.787348] Lockdown: swapper/0: hibernation is restricted; see man kernel_lockdown.7
[...]
[   21.638946] Lockdown: systemd: /dev/mem,kmem,port is restricted; see man kernel_lockdown.7
[...]
[   24.578882] Lockdown: Xorg: raw io port access is restricted; see man kernel_lockdown.7
[...]
[   26.249451] Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
[...]
[   26.254389] Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
[...]
[  921.376121] Lockdown: dd: /dev/mem,kmem,port is restricted; see man kernel_lockdown.7

Now the question is, what this Lockdown is, and what is it doing on my PC.
According to LWN, Lockdown is a new way to keep the kernel secure from cyber-attacks, which is part of the Linux kernel starting from Aug 20, 2019, when the commit 000d388ed3bbed745f366ce71b2bb7c2ee70f449 integrated it within the official main branch of the Linux Kernel.

This was the 5.4-RC1 version.
What exactly does this Lockdown restrict?
First off, it will restrict access to kernel features that may allow arbitrary code execution, block processes from reading/writing to /dev/mem, and /dev/kmem memory, and /dev/port.
Other features include:

  • Enforcing kernel module signatures.
  • Prevents even the root account from modifying the kernel code.
  • Kexec reboot.
  • Restrict the use of hardware that could potentially generate direct memory addressing (DMA).
  • Restrict the use of KDADDIO, KDDELIO, KDENABIO and KDDISABIO console ioctls.

There are two modes available to the Lockdown module: Integrity and Confidentiality. When in Integrity mode, kernel features which would allow userland code to modify the running kernel are disabled. When in Confidentiality mode, userland code to extract confidential information from the kernel will be disabled.
At the end of the day, Lockdown is installed by default on many Linux distributions, including the one I was using.

This also means, It is like I can not dump the BIOS right now.

Now let’s see what can be done to disable it.
Where to start, the kernel log mentioned kernel_lockdown.7; let’s start from here!

Quick note: the distro I am using, Linux Mint 20 does not include the mentioned man page.

Sure, I can find it on the internet; for example, here is the man page mentioned in the kernel logs.

According to this source and others I found on the internet, there’s no way to disable Lockdown LSM but by being at the main console and pressing a SysReq combination: “SysReq+x”.

Trying to do what is suggested, nothing happened, and looking in the kernel message log, the following message appeared:

sysrq: HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u) force-fb(V) show-blocked-tasks(w) dump-ftrace-buffer(z)

which in turn indicates the combination has not been implemented.
Investigating on this latter, more obscure scenario is shown; in the Linux Kernel source tree, as far as the last available Linux Kernel version (5.9.1), there’s no evidence this combination has been ever implemented.

*sysrq_key_table[36] = {
[...]
        &sysrq_showstate_blocked_op,    /* w */
        /* x: May be registered on mips for TLB dump */
        /* x: May be registered on ppc/powerpc for xmon */
        /* x: May be registered on sparc64 for global PMU dump */
        NULL,                           /* x */
        /* y: May be registered on sparc64 for global register dump */
        NULL,                           /* y */
        &sysrq_ftrace_dump_op,          /* z */
};

Further investigations have shown that the mentioned feature has indeed been proposed, but it has not yet been merged with the main branch.

Looking carefully at the official Linux kernel code, another fact is realized:
There’s not even a location within the official Linux Kernel source tree that changes the kernel_locked_down, the variable that keeps the LSM status.
This leads to another question: why the Lockdown is enforced on my PC?
Reading at the Kernel log messages, one of the very first lines suggest the cause…

[    0.000000] Kernel is locked down from EFI Secure Boot mode; see man kernel_lockdown.7

Looking at the message text, it can be guessed that a call to lock_kernel_down("EFI Secure Boot mode", LOCKDOWN_INTEGRITY_MAX) may have this message generated, but it is not yet clear where this call has been issued. Considering the message timestamp, it appears clear that it must be an early just after the kernel takes the control.
The function setup_arch(char **cmdline_p) in the /arch/x86/kernel/setup.c file seams to be a perfect fit for this call. Investigating on this direction, another patch can be found on the internet.

Situation now is that Linux Mint 20, but also Ubuntu 20.04 are using a Linux Kernel with an unofficial patch for implementing the Secure Boot Lockdown trigger, but they do not bother to implement any unofficial mechanism to disable the Lockdown if needed.
Why has this happen is not known, but many discussions can be found on the necessity EFI Secure boot to enable the Kernel Lockdown. LWN, Linux Journal, Linux GIT
Back to the main topic, read /dev/mem, please note that Lockdown do not expect to reduce the Lockdown level.

static int lock_kernel_down(const char *where, enum lockdown_reason level)
{
        if (kernel_locked_down >= level)
                return -EPERM;

        kernel_locked_down = level;
        pr_notice("Kernel is locked down from %s; see man kernel_lockdown.7\n",
                  where);
        return 0;
}

So the fact is that at this moment, I can do nothing to read the Bios and show my colleague how easy it can be doing such a thing.

Am I still sure it is easy?!

That’s what brought me to the following solution to decrease the Lockdown level.

To compose a solution I’ve been through a few issues:

  • The symbol kernel_locked_down is not exported.
  • Starting from Kernel 5.7 kallsyms_lookup_name, a function that does the essential task of looking for unexported symbols, is no more exported.
  • Due to the fact that Kernel Lockdown level is LOCKDOWN_INTEGRITY_MAX, install unsigned modules is restricted.

Sunday, October 2, 2016

RS-485 Anti-theft system commands

Some of you may have read on of my previous post, where I tried interpret the keypad print command.
If you did, well some of the interpretations I wrote on it were wrong.
This post is the second attempt to interpretate the dialogue exchanged between main board and the keypad.

After some researches and tests, I came out with the following, which if it is not the correct frame format, it is very close to it.


Each device connected to this bus, seems to follow this rule in the format of the frames produced.


Length is the first byte of each frame. It appears to be one byte long, which also means that a frame cannot be larger than 258 bytes including the length and checksum bytes. This does not seem to be a problem, all traffic I watched, no frame was longer than 25 bytes.


ADDR is the layer level address of the device. Few facts I noticed about the ADDR field:
  • The address 0x00 seems to be reserved to the main board. All devices, when queried, simply answers to this address.
  • Keypads are ranged from 0x10 to 0x1f (on the PCB of each device there are 4 deepswitch which can be used to select the low order four bits). The master keypad on the actual system must be the 0x10 address. In fact main board appears to send bytes directly to this address during normal operation.
  • The RFID readers seem to be ranged at 0x50 and 0x5f.
  • It seems there is some sort of multicast address ranged probably from 0xf0 to 0xff, not clear how does this work, but when mainboard starts, it seems to query 0xff. It also appears that 0xfe must be some sort of multicast directed to keypads. The keypad I have does not seem to recognize this kind of addresses btw.
CMD is the place where you tell to the addressed device what you want. Every device has its own mapped functions. No need to be discussed in this section.

DATA is the field where, if needed, the command data is placed. Not all commands have data, and if data is needed, it depends from the command.

Checksum is where a redundancy code is calculated to guaranty the integrity of the frame. The checksum is calculated on all the frame excluded the length field which is not included in the sum. Also I determined that this particular checksum can be calculated adding all bytes in a 16 bit integer and then checksum the 16 bit accumulator into a 8 bit value. eg. this frame tells a keypad to print "Hello World!" string in the upper line of the display. 1310140048656c6c6f20776f726c64212020202006 checksum is the last byte of the string an is calculated as: 
16bitsum(10+14+00+48+65+6c+6c+6f+20+77+6f+72+6c+64+21+20+20+20+20)=0501
8bitsum(05+01)=06

Thursday, September 29, 2016

Keypad print string command

( Warning this is an early examination and interpretation of the data, some of the deductions I made are not accurate)
This is the first of a series of posts, where I'll try examine the list of commands I logged from a dialogue between the keypad and the mainboard.

Here the first: Print on display

A stream starting with the byte 0x13 seems to have the means of "print command".
This command seems to have a fixed length of 21 bytes.



Command example:
The following sequence prints on screen starting on top left: “Hello world!”
1310140048656c6c6f20776f726c64212020202006

0x13 print command
0x10 address of the first keyboard on the bus.
0x14 Unknown at the moment, but it must be present
0x00 the position 0x00 on the display, which means corner top – left
0x48,0x65,..,0x64,0x21,0x20,0x20,0x20,0x20 “Hello world!    ” 
0x06 checksum: 10+14+00+48+65+6c+6c+6f+20+77+6f+72+6c+64+21+20+20+20+20=>0501=>05+01=06

Anti-theft system keypad


In this post I want to log my experience in reverse engineer the protocol used in ROKONET and possibly other manufacturers' anti-theft system peripherals.

Somewhere in the past I bought an anti-theft system for my home, but because I'm a systems nerd, I chose one which claims it can be interfaced with computers in a computers network.
Unfortunately, what I got after my purchase, was very different from my expectations!
 
I got a closed system which could be configured through an IP network using its manufacturer's proprietary software running only under MS-Windows. If this was not enough, manufacturer won't assist end-users, that because the system is not meant to be installed or configured by the end user, but it have to be installed and configured only by manufacturer authorized personnel. However, if enduser wants, he can buy it and then arrange himself a solution.Very disappointing.

In spite this system cost me good money, it remained in a dusty drawer for a long time, until I found the time to work on it.
Now I'm here logging my progresses on this matter and sharing them with the world, hoping those can be useful to someone other than me.

The big picture is to open the anti-theft systems to the world of the open source, letting open source software such as Asterisk, Motion, Zone Minder and guess you what, integrates with proprietary hardware such as keypads, RFID scanners, PID sensors, proximity sensors, and other anti-theft systems specific hardware.

I'm still far from the target, but at least let dreams fly high!

Back on Earth,  let's start with something, let's start with a keypad, the most common piece of hardware every anti-theft system should have.


Manufacturers divide peripherals in two main classes: dumb and intelligent. To "dumb" class belong for example sensors such as PID, contacts and all the sensors which communicates with just a open-closed contact communication. Intelligent ones such as keypads, RFIDs and audio systems use so called "BUS" for connecting the main board of the system.

Keypads belong to the latter class so the first step is to identify what this, so called "bus", actually is.

BUS is a 4 wires line which connect more than one peripheral to the main board of the system.
Usually these 4 wires have a fixed color scheme, which is RED, BLACK, YELLOW and GREEN.
This color scheme is wide spread among vendors and manufacturers, and it seems to be a de facto standard among anti-theft system.
Hypothesis is that this so called BUS is nothing more than an half-duplex RS-485 implementation and a couple of wires with power supply.
A close look at the circuitry seems to confirm this hypothesis.
You can see on the board distinctly the RS-485 driver SP485EC which connects directly to the keypad MCU UART pins.
Looking at the RS-485 input circuitry, you can find two of the best practise the rs-485 designer have published: fail safe resistors (a pull-up and a pull-down resistor) and two diodes operating as transient overcurrent protections.

It is now important to familiarize with the data passing over this connection.
To do this, my first guess has been trying to sniff the data on the wires.
A simple guess (9600,8,n,1) of the serial settings an I had a dump of bytes main board and keypad are exchanging.
Beware, the fact that you can read from a serial stream, and that data you read is meaningful or correct, DOES NOT mean you have the correct serial setting.
At the time I didn't know this detail yet, and it cost me several hours struggling on why I couldn't transmit anything to the keyboard.

Here you can see a comparison between my generated message (bottom), and the same  generated by the original main board (upper).
Several hours later, I finally found that this particular setup wants a serial setting with 2 stop bits, which means 9600,8,n,2 and not 9600,8,n,1.

Another problem is that sniffing from an half duplex dialogue made on the same pair, gives you a detailed list of bytes exchanged, but doesn't give you any information about direction of those bytes, nor the timing.
Sniff data on the UART pin on the MCU gave me a better understanding fo that dialogue.
Using this I finally could get a precise list of messages exchanged between main board and the keypad.
Here for you an piece of the message exchanged between those two. I indicated with *xxx* messages originated by the keypad.



02ff0404
02101a2a                                                   *0200a3a3*
0310058095                                                 *02002323*
02030407
02050409
02500454
0285078c
020a040e
03fe168095
13fe140050524f4752414d4d415a494f4e453a209c
13fe1410534953542e204e4f4e2050524f4e544fa5
02fe1a19
02101a2a                                                   *02002323*
031019022b                                                 *02002323*
041022031146                                               *02002323*
041018000028                                               *02002323*
131014000000000000000000000000000000000024                 *02002323*
131014100000000000000000000000000000000034                 *02002323*
0310160026                                                 *02002323*
02030407
02050409
02500454
04850f01099e
0285078c
020a040e
03fe168095
13fe140050524f4752414d4d415a494f4e453a209c
13fe1410534953542e204e4f4e2050524f4e544fa5
02fe1a19
02101a2a                                                   *02002323*
041022031146                                               *02002323*
02030407
02050409
02500454
04850f01099e
0285078c
020a040e
03fe168095
13fe140050524f4752414d4d415a494f4e453a209c
13fe1410534953542e204e4f4e2050524f4e544fa5
02fe1a19
02101a2a                                                   *02002323*
04101820236b                                               *02002323*
1310140050415254495a494f4e45203120202020fd                 *02002323*
1310141020202020414c4c41524d45202020202055                 *02002323*
03101680a6                                                 *02002323*

Thursday, September 8, 2016

Cisco 3500 XL fan subsystem failure.

It is quite old, yet still useful. I'm talking about an old Cisco 3500 XL series switch, I use every day in the lab of the company I work to. I don't want to talk about all the good points this switch has, but rather I'd like to talk about a failure it had, after almost 20 years it worked continously.
After all this years it broke its fan system.
It's summer, and if I want it last other 20 years, I had to fix it somehow.
The very first thing to do is understand how fan subsystem works.
Not the hardest task in the world, you just need to follow the tracks on the PCB from fan backwards to components.

Doing this you you'll identify the two main components the subsystem:
HP4410D: the  MOSFET used to command the power 5V circuit
TC648: the fan speed PWM controller.

One of those twos must be the broken one.
Roughly, the fan subsystem should look something like:

Both devices are packaged into a SOIC8 package, people skilled more than I am, are able to remove this package without damage the PCB nor the component using just iron. About me, I'm not that good and I had to use my cheap rework station.
Once the PWM controller is removed, it is possible to probe Vin. By using the TC648 datasheet you know that at this point tension should range from 1.25V to 2.65V, according to enviroment temperature.
In my case it was 2.4V which is a resonable.
With TC648 removed, the base of the mosfet is exposed to manual drive, I could therefore short Vout to Vdd and GND and observe fan spin at maximum rate, and fan to stop when Vout is put to GND.
This leaded me to the conclusion that  the MOSFET HP4410D had to be ok.
As counterproof, test the TC648 was a little more difficult since its package is not breadboard friendly.

Using this I could be sure the TC648 was broken, and than changing it I could fix my switch.
I hope someone else could found this article useful.





Wednesday, December 30, 2015

Fiat Panda windscreen wiper timer

My Panda, after almost 16 years of service, begins to show its years.
This time, the front  wiper does not work properly.
You may read almost evreywhere, Google is your friend....
About this matter, it seems nobody ever went deeper, and to my issue, which seems to be quite widespread, Google wouldn't helped that much; the only answer I found by it is "change the motor and its controlling circuit". This solution can be quite expansive, looking around for prices,  it seems you can not find it for less than 100€.
On the other hand, looking at the controlling circuit, it does not seem to be very complicated, so I decided to use some time to resolve my issue, and therefore save 100€.



As from the image I included in this post, circuit itself is not too complicated.
I also made some schemas to help myself in understanding its behaviour.

The switch appearing in the bottom of the schema, is embedded in the gear inside the transmission of the motor. Its rotation make the controller understand about the wiper position. It is a plastic gear with the core made of conductor material. It appears as follow:
Where the RED part is the metallic core, and the black lines is where contact from the control circuit goes.

Well, I guess this is the time where I tell you which is my problem, after all.
Problem is as follow:  the "SLOW" speed of the wipers does not work, and when it is set to the "FAST" speed, if you turn off the wiper it stops where it is, without return to its home postion.
After several hours of analysis, I found where the problem lies.
It is due to the oxidation of the normally open contact of the relay.





This way I saved myself more than 100€ for the spare part, I hope anyone else could found my info useful and save his money.