Page MenuHomeFreeBSD

Add poweroff(2) support to Beaglebone-black
ClosedPublic

Authored by loos on Jan 11 2015, 6:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 25, 12:06 AM
Unknown Object (File)
Fri, Oct 25, 12:06 AM
Unknown Object (File)
Fri, Oct 25, 12:05 AM
Unknown Object (File)
Thu, Oct 24, 11:44 PM
Unknown Object (File)
Oct 3 2024, 2:47 PM
Unknown Object (File)
Sep 30 2024, 10:16 PM
Unknown Object (File)
Sep 26 2024, 2:53 AM
Unknown Object (File)
Sep 25 2024, 3:03 PM
Subscribers

Details

Summary

Register the shutdown event at PMIC attach.

Once the PMIC is programmed to shutdown and it will wait for a change in pmic_pwr_enable pin to cut off the power.

Implements the RTC driver for am335x which is used to toggle the pmic_pwr_enable pin.

The pin is toggled when the ALARM2 fires, so we program the ALARM2 to fire 2 seconds in future (and then turn off the board).

The board can be powered up again by pressing the power button or by reapplying the power.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

loos retitled this revision from to Add poweroff(2) support to Beaglebone-black.
loos updated this object.
loos edited the test plan for this revision. (Show Details)
loos added a reviewer: ARM.
rpaulo added a reviewer: rpaulo.
rpaulo added a subscriber: rpaulo.

The code looks good, but I'm not familiar with the RTC hardware. Still, I'll mark it as reviewed.

sys/arm/ti/am335x/am335x_rtc.c
135

Shouldn't we also stop the RTC in this function?

179

We could avoid converting ct to ts and then back to ct, but this is easier to read, I think.

190

Is it just me or the comment disagrees with the code? "Start" vs "STOP". :-)
It's no big deal, but we don't really have to name the registers like the spec.

This revision is now accepted and ready to land.Jan 11 2015, 6:54 AM
sys/arm/ti/am335x/am335x_rtc.c
135

This isn't harmful. For most of uses the RTC would always be running, I just stop the RTC so I don't have to check the BUSY before every write and because the RTC is not used for anything at moment.

For our use we're not worried about the time correctness we just want to trigger the ALARM2 interrupt after 2 seconds.

The RTC on AM335x can be useful when we support some kind of suspend/resume as it is designed to keep running on SLEEP mode.

179

yeah, just use standard calls and avoid rolling our own (and maybe buggy) code.

190

No, you are right! I'll find a better name for this one :)

loos updated this revision to Diff 3122.

Closed by commit rS277042 (authored by @loos).