Page MenuHomeFreeBSD

TI SoC rework clk support
Needs ReviewPublic

Authored by oskar.holmlund_ohdata.se on Jan 2 2021, 11:52 AM.
Tags
Referenced Files
Unknown Object (File)
Tue, Mar 19, 9:27 PM
Unknown Object (File)
Tue, Mar 19, 7:17 PM
Unknown Object (File)
Tue, Mar 19, 3:24 PM
Unknown Object (File)
Tue, Mar 19, 3:23 PM
Unknown Object (File)
Feb 18 2024, 2:33 PM
Unknown Object (File)
Feb 14 2024, 12:58 PM
Unknown Object (File)
Jan 30 2024, 3:19 AM
Unknown Object (File)
Jan 9 2024, 3:56 PM
Subscribers

Details

Summary

Based on last subversion commit R368820

With guidance from mmel to move from standard memory access to syscon based methods.

Remove ti_scm_syscon.c due to interference with other SoCs (too generic compatible field "syscon", "simple-bus" in dts). Now the "scm_conf" node is picked up by syscon_generic.c

Due to the clocks uses the syscon interface it seems convenient that ti_prcm.c also derive from syscon_generic.c.
But "for now" its the best place to create parent clocks as clk_link aswell. But...i need to redefine the syscon_generic_attach() as public and it feels a lite bit wrong. Any suggestions?
I also need to define syscon_get_handle so i suspect i have done something wrong in ti_prcm.c in the DEFINE_CLASS_1() / EARLY_DRIVER_MODULE / ... ?

I cant find a way to get parents name from the devicetree without walking through everything first and pair clock reference with the actual name and a second turn through the device tree and pick up the parents name.
So i followed the example from arm64/rockchip/rk3399_cru and from your arm64/nvidia/tegra210 and did a lookup table for the nodes -> parents.

The system boots to login prompt on a beaglebone black, i have not tried anything else than query the sysctl hw.clock.

Todo: cleanup,
test and verify that the clocks are actually usable.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/arm/ti/clk/ti_gate_clock.c
247

For the am335x this is actually not needed to handle the ti,clkdm-gate-clock, its used on some omap3 and omap44 devices.

  • reg : offset for register controlling adjustable gate, not needed for

ti,clkdm-gate-clock type

https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/clock/ti/gate.txt

  • Add parents for ti,clkctrl.
  • since the node scm_conf@0 (compatible "syscon", "simple-bus") needs to be attached as soon as posible during boot and syscon_generic are in pass BUS_PASS_DEFAULT I readded ti_scm_syscon.c and removed more or less everything but the probe() function and "subclass" syscon_generic. Added checks in probe() to ensure it not connect to other SoCs syscon nodes.

Remove syscon_generic_handle from syscon_generic.c and add into ti_prcm.c and ti_scm_syscon.c

Update ti_prcm.c to add clk link in probe() instead of attach to avoid the need to declare syscon_generic.c attach as public.
Remove attach() function in ti_prcm.c and use inherited one from syscon_generic.c

am335x_gpio.c and ti_pinmux.c needs to adjust to be early_driver_module to be probed before device drivers are loaded, otherwise they fails if the gpios aint present.

more cleanups and remove debug outputs.

  • cleanup gpio gdbclk in ti_clk_clkctrl and use a TI_CLKCTRL_GATE subclock instead
  • prepare for am572x subtypes, am335x only use TI_CLKCTRL_GATE
  • Fix some wrong mappings like timer7 and so on

Update for latest DTS.
Previous I created clk_link in ti_prcm, but latest DTS introduce clkctrl in the very first ti,sysc nodes as a consequence the clk_link will be created in ti_sysc.c.
This patch alone will not boot the am335x, need a simplepmbus driver aswell.

Fix up this review to work with DTS import from Linux 6.4

To get BBB to boot to login prompt apply review D41889 and D41888 as well.
Still BBB is not useable unless D42124, D42126, D42015 is applied.

Be aware that not all PB(/BBB) will boot with the latest u-boot - I have not investigated that in details yet.