Page MenuHomeFreeBSD

arm64: initial support for px30 and rk3326
Needs ReviewPublic

Authored by royger on Mar 17 2021, 11:40 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 8, 2:21 AM
Unknown Object (File)
Mon, Mar 18, 6:06 AM
Unknown Object (File)
Feb 27 2024, 12:33 AM
Unknown Object (File)
Dec 22 2023, 11:35 PM
Unknown Object (File)
Dec 20 2023, 6:59 AM
Unknown Object (File)
Nov 6 2023, 11:03 PM
Unknown Object (File)
Oct 19 2023, 12:23 PM
Unknown Object (File)
Oct 13 2023, 8:43 PM

Details

Reviewers
manu
Group Reviewers
arm64
Summary

This is based on the devices found in Odroid Go Advance/Super, so I've
left a lot of clocks out that don't seem to be used on those devices,
at least for this initial port.

Still quite incomplete, as it's missing a bunch of clocks. Do we
really need to implement support for all possible clocks from the SoC,
even if we have no drivers that use them?

There's also an issue with pmucru and cru ordering, which I added a
dirty workaround for. Under current circumstances cru will attach
before pmucru, and panic because it's missing the 'gpll' pll. I'm not
sure what's the proper way to make cru depend on pmucru, shouldn't
that be done automatically from the DT?

AFAICT MMC and USB works, and we can boot into multiuser using the
serial console.

I see some weird message from failing to set the frequency for cpll,
not sure what's going on with that.

Also there are some messages from cpufreq missing a regulator, I
haven't looked at what's missing for those.

This is the current boot log:

GDB: debug ports: uart
GDB: current port: uart
KDB: debugger backends: ddb gdb
KDB: current backend: ddb
Copyright (c) 1992-2021 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 14.0-CURRENT #24: Tue Mar 16 13:45:52 CET 2021
    root@nuc2:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64
FreeBSD clang version 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)
WARNING: WITNESS option enabled, expect reduced performance.
VT: init without driver.
module firmware already present!
real memory  = 1071415296 (1021 MB)
avail memory = 1019858944 (972 MB)
Starting CPU 1 (1)
Starting CPU 2 (2)
Starting CPU 3 (3)
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
random: unblocking device.
random: entropy device external interface
MAP 3cf29000 mode 2 pages 4
MAP 3cf2e000 mode 2 pages 4
MAP 3ff40000 mode 2 pages 16
WARNING: Device "kbd" is Giant locked and may be deleted before FreeBSD 14.0.
kbd0 at kbdmux0
WARNING: Device "openfirm" is Giant locked and may be deleted before FreeBSD 14.0.
ofwbus0: <Open Firmware Device Tree>
clk_fixed0: <Fixed clock> on ofwbus0
clk_fixed1: <Fixed clock> on ofwbus0
simplebus0: <Flattened device tree simple bus> on ofwbus0
px30_pmucru0: <Rockchip PX30 PMU Clock and Reset Unit> mem 0xff2bc000-0xff2bcfff on ofwbus0
regfix0: <Fixed Regulator> on ofwbus0
regfix1: <Fixed Regulator> on ofwbus0
simple_mfd0: <Simple MFD (Multi-Functions Device)> mem 0xff000000-0xff000fff on ofwbus0
simple_mfd1: <Simple MFD (Multi-Functions Device)> mem 0xff010000-0xff010fff on ofwbus0
simple_mfd2: <Simple MFD (Multi-Functions Device)> mem 0xff140000-0xff140fff on ofwbus0
px30_cru0: <Rockchip PX30 Clock and Reset Unit> mem 0xff2b0000-0xff2b0fff on ofwbus0
Cannot set frequency for clk: cpll, error: 22
px30_cru0: Failed to set cpll to a frequency of 17000000
simple_mfd3: <Simple MFD (Multi-Functions Device)> mem 0xff2c0000-0xff2cffff on ofwbus0
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
gic0: <ARM Generic Interrupt Controller> mem 0xff131000-0xff131fff,0xff132000-0xff133fff,0xff134000-0xff135fff,0xff136000-0xff137fff irq 11 on ofwbus0
gic0: pn 0x2, arch 0x2, rev 0x1, implementer 0x43b irqs 160
rk_i2c0: <RockChip I2C> mem 0xff180000-0xff180fff irq 17 on ofwbus0
iicbus0: <OFW I2C bus> on rk_i2c0
rk_i2c1: <RockChip I2C> mem 0xff190000-0xff190fff irq 18 on ofwbus0
iicbus1: <OFW I2C bus> on rk_i2c1
generic_timer0: <ARMv8 Generic Timer> irq 4,5,6,7 on ofwbus0
Timecounter "ARM MPCore Timecounter" frequency 24000000 Hz quality 1000
Event timer "ARM MPCore Eventtimer" frequency 24000000 Hz quality 1000
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
cpufreq_dt0: <Generic cpufreq driver> on cpu0
cpufreq_dt0: no regulator for cpu@0
device_attach: cpufreq_dt0 attach returned 6
cpu1: <Open Firmware CPU> on cpulist0
cpufreq_dt1: <Generic cpufreq driver> on cpu1
cpufreq_dt1: no regulator for cpu@1
device_attach: cpufreq_dt1 attach returned 6
cpu2: <Open Firmware CPU> on cpulist0
cpufreq_dt2: <Generic cpufreq driver> on cpu2
cpufreq_dt2: no regulator for cpu@2
device_attach: cpufreq_dt2 attach returned 6
cpu3: <Open Firmware CPU> on cpulist0
cpufreq_dt3: <Generic cpufreq driver> on cpu3
cpufreq_dt3: no regulator for cpu@3
device_attach: cpufreq_dt3 attach returned 6
pmu0: <Performance Monitoring Unit> irq 0,1,2,3 on ofwbus0
uart0: <16750 or compatible> mem 0xff158000-0xff1580ff irq 12 on ofwbus0
uart1: <16750 or compatible> mem 0xff160000-0xff1600ff irq 13 on ofwbus0
uart1: console (115384,n,8,1)
iicbus0: <unknown card> at addr 0x40
iic0: <I2C generic I/O> on iicbus0
iic1: <I2C generic I/O> on iicbus1
dwcotg0: <DWC OTG 2.0 integrated USB controller> mem 0xff300000-0xff33ffff irq 27 on ofwbus0
usbus1 on dwcotg0
rockchip_dwmmc0: <Synopsys DesignWare Mobile Storage Host Controller (RockChip)> mem 0xff370000-0xff373fff irq 31 on ofwbus0
rockchip_dwmmc0: Hardware version ID is 270a
mmc0: <MMC/SD bus> on rockchip_dwmmc0
gpioled0: <GPIO LEDs> on ofwbus0
gpioled0: <blue:heartbeat> failed to map pin
armv8crypto0: <AES-CBC,AES-XTS,AES-GCM>
cpufreq_dt0: <Generic cpufreq driver> on cpu0
cpufreq_dt0: no regulator for cpu@0
device_attach: cpufreq_dt0 attach returned 6
cpufreq_dt1: <Generic cpufreq driver> on cpu1
cpufreq_dt1: no regulator for cpu@1
device_attach: cpufreq_dt1 attach returned 6
cpufreq_dt2: <Generic cpufreq driver> on cpu2
cpufreq_dt2: no regulator for cpu@2
device_attach: cpufreq_dt2 attach returned 6
cpufreq_dt3: <Generic cpufreq driver> on cpu3
cpufreq_dt3: no regulator for cpu@3
device_attach: cpufreq_dt3 attach returned 6
Timecounters tick every 1.000 msec
usbus1: 480Mbps High Speed USB v2.0
ugen1.1: <DWCOTG OTG Root HUB> at usbus1
uhub0 on usbus1
uhub0: <DWCOTG OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
mmcsd0: 31GB <SDHC SD32G 6.0 SN 012FA707 MFG 09/2020 by 39 PH> at mmc0 50.0MHz/4bit/1021-block
Release APs...done
CPU  0: ARM Cortex-A35 r0p2 affinity:  0
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
                   Cache Type = <64 byte D-cacheline,64 byte I-cacheline,VIPT ICache,64 byte ERG,64 byte CWG>
 Instruction Set Attributes 0 = <CRC32,SHA2,SHA1,AES+PMULL>
 Instruction Set Attributes 1 = <>
         Processor Features 0 = <AdvSIMD,FP,EL3 32,EL2 32,EL1 32,EL0 32>
         Processor Features 1 = <>
      Memory Model Features 0 = <TGran4,TGran64,TGran16,SNSMem,BigEnd,16bit ASID,1TB PA>
      Memory Model Features 1 = <8bit VMID>
      Memory Model Features 2 = <32bit CCIDX,48bit VA>
             Debug Features 0 = <2 CTX BKPTs,4 Watchpoints,6 Breakpoints,PMUv3,Debugv8>
             Debug Features 1 = <>
         Auxiliary Features 0 = <>
         Auxiliary Features 1 = <>
CPU  1: ARM Cortex-A35 r0p2 affinity:  1
CPU  2: ARM Cortex-A35 r0p2 affinity:  2
CPU  3: ARM Cortex-A35 r0p2 affinity:  3
WARNING: WITNESS option enabled, expect reduced performance.
Warning: no time-of-day clock registered, system time will not be set accurately
Dual Console: Serial Primary, Video Secondary
uhub0: 1 port with 1 removable, self powered
No suitable dump device was found.
Setting hostuuid: 32316539-3534-3135-6339-303735376163.
Setting hostid: 0xa7ba03ff.
Starting file system checks:
/dev/ufs/rootfs: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ufs/rootfs: clean, 6673828 free (1652 frags, 834022 blocks, 0.0% fragmentation)
Mounting local filesystems:.
Building /boot/kernel/linker.hints
Setting up harvesting: [UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
Feeding entropy: .
Setting hostname: generic.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
Autoloading module: pwm_backlight.ko
pwm_backlight0: <PWM Backlight> on ofwbus0
pwm_backlight0: Cannot map pwm channel 19
device_attach: pwm_backlight0 attach returned 6
lo0: link state changed to UP
Starting Network: lo0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
	inet6 ::1 prefixlen 128
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
	inet 127.0.0.1 netmask 0xff000000
	groups: lo
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
Starting devd.
Autoloading module: pwm_backlight.ko
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
Updating /var/run/os-release done.
Creating and/or trimming log files.
Clearing /tmp (X related).
Updating motd:.
Starting syslogd.
Mounting late filesystems:.
Performing sanity check on sshd configuration.
Starting sshd.
Starting cron.
Starting background file system checks in 60 seconds.

Tue Mar 16 12:46:52 UTC 2021

FreeBSD/arm64 (generic) (ttyu1)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 37895
Build 34784: arc lint + arc unit

Event Timeline

We talked on irc but here is the brief version :

For cru/pmucru ordering one should use link clocks (which I think you have locally), this solve the problem of cru referencing a clock exposed by pmucru.
But there is still the problem of calling clk_set_assigned for the cru as the pmucru isn't available yet. @mmel do you have any idea of what we should do in that case ?

Sorry, I didn't have any more time to look into the clock ordering stuff. Using the link doesn't work fine here because FreeBSD will try to initialise clocks that rely on link sources and then fail. IMO the best way would be to init clocks once all the dependencies are meet, but I haven't looked into how to do it, maybe try to init the clock and just postpone if the full dependency tree cannot be initialised?

There's also the DTC shortcoming that prevents from building the fdt for the device: https://github.com/davidchisnall/dtc/issues/64