Hi Robert,
> Am 09.09.2020 um 17:22 schrieb H. Nikolaus Schaller <
h...@computer.org>:
>
>
>> Am 09.09.2020 um 17:15 schrieb Robert Nelson <
robert...@gmail.com>:
>>
>>> Ah, ok. I'll look into that.
>>>
>>> But does it mean it is not a kernel problem? Is there no kernel-only solution (without touching u-boot)?
>>> I do not need the RTC or RTC wakeup, just safe power-down by user-command...
>>
>> RTC "sub-system" is used for Power Off on am335x, from what i've read,
>> that RTC register can only be set in u-boot (aka very early)..
>
> Ok, I'll dig into that code and direction...
I have checked your patch and I have found that my U-Boot already includes rtc32k_enable().
It is compiled into SPL/MLO and seems to work because depending on
writel((0 << 3) | (1 << 6), &rtc->osc);
or
writel((1 << 3) | (1 << 6), &rtc->osc);
I can read different values from Linux:
root@letux:~# devmem2 0x44E3E054
/dev/mem opened.
Memory mapped at address 0xb6fba000.
Value at address 0x44E3E054 (0xb6fba054): 0x40
root@letux:~#
or
root@letux:~# devmem2 0x44E3E054
/dev/mem opened.
Memory mapped at address 0xb6f77000.
Value at address 0x44E3E054 (0xb6f77054): 0x48
root@letux:~#
But it has no influence on the "poweroff" behaviour. In either case reboot does not
shut down the PMIC like pressing the power button 10 seconds.
Did I miss something what your patch is doing in addition to handle the osd3358?
I didn't mention, but
* "reboot" works
* rtcwake -m mem -s 10 fails to wake up (sleeps and there is no activity LED flickering like with poweroff)
* 32kHz XTAL is working and active (even during suspend and in the strange poweroff state)
* oscillator is off after forced poweroff (there is no backup battery connected)
Suspend seems to be a deeper sleep state than power off?
Interestingly, hwclock -r stalls for 10 seconds, reports 00:00:57 (or similar after cold boot)
and does not increment. I can write the hwclock but it still does not increment.
So for some reason the RTC isn't running but can be accessed.