Page MenuHomeFreeBSD

arm/ti: take the register offset from a ti,clksel parent
Needs ReviewPublic

Authored by rick_sloservers.com on Sun, Aug 23, 10:24 AM.
Tags
Referenced Files
F170655026: D59120.diff
Sat, Sep 5, 8:25 PM
F170652756: D59120.id184771.diff
Sat, Sep 5, 8:07 PM
F170612949: D59120.diff
Sat, Sep 5, 3:40 PM
F170607090: D59120.diff
Sat, Sep 5, 3:06 PM
F170550846: D59120.diff
Sat, Sep 5, 9:05 AM
F170526113: D59120.id.diff
Sat, Sep 5, 6:05 AM
F170516293: D59120.id.diff
Sat, Sep 5, 4:54 AM
Unknown Object (File)
Fri, Sep 4, 10:48 PM
Subscribers
None

Details

Reviewers
oh
imp
manu
andrew
Summary

Under the ti,clksel binding the parent node holds the register offset and
a child's "reg" is an index matching its unit address rather than an
address. Reading the child's "reg" as an offset produced unaligned syscon
accesses and a fatal alignment fault while registering mux clocks on
am335x:

ti_clksel0: <TI CLKSEL> on ofw_clkbus0
ti_mux12: <TI Mux Clock> on ti_clksel0
Fatal kernel mode data abort: 'Alignment Fault' on read
FSR=00000001, FAR=ffd00001

ti_mux_clock.c, ti_divider_clock.c and ti_gate_clock.c all test the
child's "reg" first and fall back to the parent, so fixing only the mux
hits the same fault twice more. All three are changed the same way: if the
parent is ti,clksel, take the offset from the parent; otherwise use the
child's "reg"; otherwise fail attach rather than silently using a wrong
offset.

The existing comment "assume parent is clksel..." suggests the expectation
was that clksel children carry no "reg" property. The shipped device tree
gives them one.

Depends on D41888 (introduces ti_clksel_get_reg) and D46723 (introduces
the code being corrected).

Found by booting a BeagleBone Black Rev B3.

Test Plan

Boots to multi-user on a BeagleBone Black Rev B3 with the full stack
applied, rebased onto stable/15. Without this change the boot dies at the
alignment fault above while registering mux clocks; with it, the TI clock
tree registers completely (mux, gate, divider and DPLL nodes all attach)
and the board reaches login with zero device attach failures across six
reboot cycles.

Full evidence: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297800

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Applying the published diffs in dependency order onto current main
(ee81cd1d8f55):

apply cleanly : D46703 D46712 D46713 D41888 D46722 D46742 D46746*
FAIL          : D46714 D46723 D46743 D46744
* D46746 needs -p0; it uses the older "Index:" diff format with no a//b/
  prefixes. That is a format quirk, not code drift.