Created attachment 212825 [details]
Use external or internal clock source
Tested on stable r359316
The RTC on AM335x are used in the shutdown process of the system. Current code assumes it exists an external 32kHz clock source and configure register RTC_OSC_REG with bit RTC_OSC_REG set .
PocketBeagle doent have a external clock as a consequence it cant power down correctly.
Attached patch check if RTC contains a clock  it assumes its an external clock otherwise an internal clock source.
Maybe a better solution is to check the name of the clocks if it contains "ext-clk" as defined in sys/gnu/dts/arm/am335x-bone-common.dtsi (used by BBB)
 ch 22.214.171.124 http://www.ti.com/lit/ug/spruh73q/spruh73q.pdf
Since we have no proper clock support on AM33XX I think it would be better the at least check the clock names and do the proper thing based on if ext-clk/int-clk is present. This will not break if pocketbeagle dts is updated to include the internal clock.
Is this bug still relevant after your clock driver ?
(In reply to Emmanuel Vadot from comment #2)
Yes, i will update with new code.