Skip to contentSkip to conversation

power: reset: Add a driver for the Gemini poweroff

PATCH RESEND New Linus Walleij 2 participants 2 messages Mar 12, 2017 – Mar 15, 2017 System reset/shutdown drivers

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 2/2 power: reset: Add a driver for the Gemini poweroff

The Gemini (SL3516) SoC has a special power controller block that only deal with shutting down the system.

If you do not register a driver and activate the block, the power button on the systems utilizing this SoC will do an uncontrolled power cut, which is why it is important to have a special poweroff driver.

The most basic functionality is to just shut down the system by writing a special bit in the control register after the system has reached pm_poweroff.

It also handles the poweroff from a button or other sources:

When the poweroff button is pressed, or a signal is sent to poweroff from an infrared remote control, or when the RTC fires a special alarm (!) the system emits an interrupt. At this point, Linux must acknowledge the interrupt and proceed to do an orderly shutdown of the system.

After adding this driver, pressing the poweroff button gives this dmesg:

root at gemini:/
root at gemini:/ gemini-poweroff 4b000000.power-controller:
poweroff button pressed

calling shutdown scripts..
setting /dev/rtc0 from system time
unmounting file systems...
umount: tmpfs busy - remounted read-only
umount: can't unmount /: Invalid argument
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system poweroff
uhci_hcd 0000:00:09.1: HCRESET not completed yet! uhci_hcd 0000:00:09.0: HCRESET not completed yet!
reboot: Power down
gemini-poweroff 4b000000.power-controller: Gemini power off

Cc Janos Laube <[email protected]>
Cc Paulius Zaleckas <[email protected]>
Cc Hans Ulli Kroll <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc linux-pm at vger.kernel.org
Cc Sebastian Reichel <[email protected]>

---
Sebastian: please just merge this when your are pleased with it. I will funnel the ARM parts through the ARM SoC tree.

---
 drivers/power/reset/Kconfig           |   9 ++
 drivers/power/reset/Makefile          |   1 +
 drivers/power/reset/gemini-poweroff.c | 160 ++++++++++++++++++++++++++++++++++
 3 files changed, 170 insertions(+)
 create mode 100644 drivers/power/reset/gemini-poweroff.c
drivers/power/reset/Kconfig +9 -0
index b8cacccf18c8..13f1714cf6f7 100644
@@ -67,6 +67,15 @@ config POWER_RESET_BRCMSTB
 	  Say Y here if you have a Broadcom STB board and you wish
 	  to have restart support.
 
+config POWER_RESET_GEMINI_POWEROFF
+	bool "Cortina Gemini power-off driver"
+	depends on ARCH_GEMINI || COMPILE_TEST
+	depends on OF && HAS_IOMEM
+	default ARCH_GEMINI
+	help
+	  This driver supports turning off the Cortina Gemini SoC.
+	  Select this if you're building a kernel with Gemini SoC support.
+
 config POWER_RESET_GPIO
 	bool "GPIO power-off driver"
 	depends on OF_GPIO
drivers/power/reset/Makefile +1 -0
index 11dae3b56ff9..58cf5b30559f 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_POWER_RESET_AT91_SAMA5D2_SHDWC) += at91-sama5d2_shdwc.o
 obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o
 obj-$(CONFIG_POWER_RESET_BRCMKONA) += brcm-kona-reset.o
 obj-$(CONFIG_POWER_RESET_BRCMSTB) += brcmstb-reboot.o
+obj-$(CONFIG_POWER_RESET_GEMINI_POWEROFF) += gemini-poweroff.o
 obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
 obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o
 obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o
drivers/power/reset/gemini-poweroff.c new file +160 -0

160 lines not on this page · raw message

Signature · 1 line
2.9.3
#1 lore raw

PATCH RESEND 2/2 power: reset: Add a driver for the Gemini poweroff

Hi Linus,

Quoted 48 lines · Linus Walleij

The Gemini (SL3516) SoC has a special power controller block that only deal with shutting down the system.

If you do not register a driver and activate the block, the power button on the systems utilizing this SoC will do an uncontrolled power cut, which is why it is important to have a special poweroff driver.

The most basic functionality is to just shut down the system by writing a special bit in the control register after the system has reached pm_poweroff.

It also handles the poweroff from a button or other sources:

When the poweroff button is pressed, or a signal is sent to poweroff from an infrared remote control, or when the RTC fires a special alarm (!) the system emits an interrupt. At this point, Linux must acknowledge the interrupt and proceed to do an orderly shutdown of the system.

After adding this driver, pressing the poweroff button gives this dmesg:

root at gemini:/
root at gemini:/ gemini-poweroff 4b000000.power-controller:
poweroff button pressed

calling shutdown scripts..
setting /dev/rtc0 from system time
unmounting file systems...
umount: tmpfs busy - remounted read-only
umount: can't unmount /: Invalid argument
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system poweroff
uhci_hcd 0000:00:09.1: HCRESET not completed yet! uhci_hcd 0000:00:09.0: HCRESET not completed yet!
reboot: Power down
gemini-poweroff 4b000000.power-controller: Gemini power off

Cc Janos Laube <[email protected]>
Cc Paulius Zaleckas <[email protected]>
Cc Hans Ulli Kroll <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc linux-pm at vger.kernel.org
Cc Sebastian Reichel <[email protected]>
Quoted 3 lines

---
Sebastian: please just merge this when your are pleased with it. I will funnel the ARM parts through the ARM SoC tree.

DONE.

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170315/b19df2da/attachment.sig>