Page MenuHomeFreeBSD

Take 2: Update syscon_generic.c to support simplebus

Authored by on Sep 11 2020, 2:30 PM.



A combination of D26401 and D26402 inspired from sys/arm/allwinner/aw_syscon.c

Just add support for simplebus in syscon_generic.c and nothing else.

Keep ti_scm_syscon.c which "inherit" syscon_generic.c and do TI specific stuffs

  • The probe function needs both syscon and simple-bus in compatible field from DTS to match.
  • Add clkdev interface to syscon_generic.
  • Lower the priority to BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE (otherwise the node will attach to simplebus driver)

Diff Detail

rS FreeBSD src repository - subversion
Lint Skipped
Unit Tests Skipped

Event Timeline

mmel requested changes to this revision.Sep 14 2020, 3:37 PM
mmel added inline comments.

This code has the same problem as original one. Assume that you have GENERIC kernel (thuswith all drivers compiled in) and two boards, one TI and one more other. Also assume that both board have ""syscon,simple-bus" compatible node in their DT. How do you ensure that 'ti_scm_syscon' wins on one but 'syscon_generic' on the other?
I'm sorry, but this is wrong approach. The 'simple-bus', 'syscon' or 'clock-bus' drivers are universal and there is no way how you can stole it for TI specific bits.

Seems that Ti have 2 groups of clocks ->
scm clock (from am35xx-clocks.dtsi) these uses syscon based access and 'ti,sysc' (from am33xx-l4.dtsi) with register based access (by using bus_read() an bus_write() ).

Thus I think that all what is needed is (in above of generic_syscon simple-bus extension, see my comments in D26402) is enhance syscon based clocks ('ti,mux-clock', 'ti,gate-clock'...) to use syscon based access.
In these drivers, clkdev_write_4() should be converted to syscon_write_4() and so...

This revision now requires changes to proceed.Sep 14 2020, 3:37 PM