Page MenuHomeFreeBSD

arm64/rockchip: add RK3399 support
ClosedPublic

Authored by greg_unrelenting.technology on Aug 15 2018, 7:24 PM.

Details

Summary

This adds Rockchip RK3399 (e.g., Pine64 ROCKPro64) support:

  • Ethernet works, ~500mbps. Can netboot like on RK3328 (ROCK64)
  • I²C seems to work (rk805 PMIC driver (with 'rk808' name added) does not error)
  • clocks/PLLs work

To actually reclock the CPU, extra hacks are required for now. (Basically, making cpufreq not require voltage control. On ROCKPro64, the default voltage is enough for the max clock. Actually the default voltage might be the highest one, since the heatsink gets rather hot when just idling in FreeBSD.)

To reclock properly, we'll need the rk8xx driver mentioned above. And, at least on the ROCKPro64, a driver for the "silergy,syr827" (aka "fcs,fan53555") which controls voltage for the big (Cortex-A72) cores. Other boards might use other chips for that voltage I guess.

(upd: trying to write that driver — the cpufreq isn't finding the regulator…)

Diff Detail

Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 18825
Build 18489: arc lint + arc unit

Event Timeline

few style notes

sys/arm64/rockchip/clk/rk3399_cru.c
1049

maybe eliminate some empty lines?

1381

Is indentation correct here?

sys/arm64/rockchip/clk/rk3399_pmucru.c
875

same here

sys/arm64/rockchip/rk_pinctrl.c
92

This probably goes over 80 chars

245

Maybe you meant following?

static struct syscon *
rk3328_get_syscon(struct rk_pinctrl_softc *sc, uint32_t bank)

247

blank line before it and return (sc->grf);

387

same here as above

389

blank line before it

391

wrap return values with ()

399

comments rather with /* XXX */ style

gonzo added a subscriber: gonzo.Sep 29 2018, 11:33 PM
manu accepted this revision.Oct 12 2018, 12:27 PM

This looks good, just remove the pmu driver for now as we don't use it.

sys/arm64/rockchip/rk_pmu.c
52

Not sure we need a driver for this now, the generic syscon should work. Note that no nodes seems to use the device node, linux tend to add syscon to everything ...
(Also I have a patch for simple-mfd that will make the subnode probe).

This revision is now accepted and ready to land.Oct 12 2018, 12:27 PM
manu requested changes to this revision.Oct 22 2018, 8:23 AM

I meant to set this to "request changes", sorry.

This revision now requires changes to proceed.Oct 22 2018, 8:23 AM
greg_unrelenting.technology updated this revision to Diff 49436.

removed pmu driver

manu accepted this revision.Nov 28 2018, 3:04 PM

Currently building world for my rockpro64, will test and commit after.

This revision is now accepted and ready to land.Nov 28 2018, 3:04 PM
manu requested changes to this revision.Nov 28 2018, 4:03 PM

This doesn't work.
The PLL in the pmucru are wait different.

This revision now requires changes to proceed.Nov 28 2018, 4:03 PM

Only ppll is in pmucru.. you mean it has different rates?

What exactly doesn't work?

manu added a comment.Nov 28 2018, 5:50 PM

Only ppll is in pmucru.. you mean it has different rates?
What exactly doesn't work?

Just look at the TRM

In D16732#390517, @manu wrote:

Just look at the TRM

That's not very helpful ;)

Is it the gate_shift in ppll? Should be 1 instead of 0?

manu added a comment.Nov 28 2018, 7:04 PM
In D16732#390517, @manu wrote:

Just look at the TRM

That's not very helpful ;)

Just compare RK3328 and RK3399 TRM, you will see.

Is it the gate_shift in ppll? Should be 1 instead of 0?

No.
Every PLL is different in RK3399, I'm working on a patch.

manu added a comment.Nov 29 2018, 6:40 PM

There is also problem with the pinctrl (I have this mostly worked out now).
I2C doesn't work (doesn't know why for now).
Some clocks IDs aren't correct.
I honestly don't know how this was tested.

In D16732#390886, @manu wrote:

I honestly don't know how this was tested.

I got it to boot to multiuser on NFS. And to reclock the CPU.

I2C doesn't work

hm, the rk805 driver was reporting something. I thought it wouldn't report anything without working i2c?

Some clocks IDs aren't correct.

IIRC they were different between the TRM and the Linux drivers and I picked the ones that Linux used, because I thought that would align with what's actually in the (rockchip, not mainline) device tree, or something.

manu added a comment.Nov 29 2018, 7:10 PM
In D16732#390886, @manu wrote:

I honestly don't know how this was tested.

I got it to boot to multiuser on NFS. And to reclock the CPU.

Not possible, the PLL weren't correctly defined.

I2C doesn't work

hm, the rk805 driver was reporting something. I thought it wouldn't report anything without working i2c?

It does since it's only added because of the compat string in the dtb.

Some clocks IDs aren't correct.

IIRC they were different between the TRM and the Linux drivers and I picked the ones that Linux used, because I thought that would align with what's actually in the (rockchip, not mainline) device tree, or something.

No some where different that in the dt-bindings (PCLK_ALIVE for example)

In D16732#390901, @manu wrote:

I got it to boot to multiuser on NFS. And to reclock the CPU.

Not possible, the PLL weren't correctly defined.

Either they don't need to be, or they are actually correct enough ¯\_(ツ)_/¯

https://dmesgd.nycbug.org/index.cgi?do=view&id=4298

When you said

Every PLL is different in RK3399

Did you mean they are different between each other? I didn't find that anywhere, the TRM says

The chip uses 3.2GHz VCO PLL for all eight PLLs.

And like in section 2.9.1 "PLL usage" it even shows glob style wildcards like CRU_*PLL_CON0

This revision was not accepted when it landed; it landed in state Needs Revision.Dec 1 2018, 8:28 PM
This revision was automatically updated to reflect the committed changes.