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)
Sun, Sep 8, 8:01 PM
Unknown Object (File)
Sun, Sep 8, 6:45 PM
Unknown Object (File)
Sat, Sep 7, 10:23 AM
Unknown Object (File)
Thu, Aug 29, 4:31 AM
Unknown Object (File)
Thu, Aug 29, 4:31 AM
Unknown Object (File)
Thu, Aug 29, 4:30 AM
Unknown Object (File)
Thu, Aug 29, 3:55 AM
Unknown Object (File)
Aug 5 2024, 11:07 AM
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
Lint Skipped
Unit
Tests Skipped

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 ↗(On Diff #3097)

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

179 ↗(On Diff #3097)

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

190 ↗(On Diff #3097)

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 ↗(On Diff #3097)

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 ↗(On Diff #3097)

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

190 ↗(On Diff #3097)

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).