]> Pileus Git - ~andy/linux/commit
powerpc: Add support for CTS-1000 GPIO controlled system poweroff
authorBenjamin Collins <ben.c@servergy.com>
Mon, 17 Dec 2012 04:19:28 +0000 (04:19 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 29 Jan 2013 00:35:05 +0000 (11:35 +1100)
commit5611fe48c545a22e62273428ed74c9bfae4a9406
tree79514228d518fe3adb823290879190157d299c1c
parent34f364fef475f5d960b74bf074d65392ece50235
powerpc: Add support for CTS-1000 GPIO controlled system poweroff

CTS-1000 is based on P4080. GPIO 27 is used to signal the FPGA to
switch off power, and also associates IRQ 8 with front-panel button
press (which we use to call orderly_poweroff()).

The relevant device-tree looks like this:

gpio0: gpio@130000 {
compatible = "fsl,qoriq-gpio";
reg = <0x130000 0x1000>;
interrupts = <55 2 0 0>;
#gpio-cells = <2>;
gpio-controller;

/* Allows powering off the system via GPIO signal. */
gpio-halt@27 {
compatible = "sgy,gpio-halt";
gpios = <&gpio0 27 0>;
interrupts = <8 1 0 0>;
};
};

Because the driver cannot match on sgy,gpio-halt (because the node is never
processed through of_platform), it matches on fsl,qoriq-gpio and then
checks child nodes for the matching sgy,gpio-halt. This also ensures that
the GPIO controller is detected prior to sgy_cts1000's probe callback,
since that node wont match via of_platform until the controller is
registered.

Also, because the GPIO handler for triggering system poweroff might sleep,
the IRQ uses a workqueue to call orderly_poweroff().

As a final note, this driver may be expanded for other features specific to
the CTS-1000.

Signed-off-by: Ben Collins <ben.c@servergy.com>
Cc: Jack Smith <jack.s@servergy.com>
Cc: Vihar Rai <vihar.r@servergy.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/85xx/Kconfig
arch/powerpc/platforms/85xx/Makefile
arch/powerpc/platforms/85xx/sgy_cts1000.c [new file with mode: 0644]