linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* FSL P5020/Cyrus+ Board: Poweroff and Restart Support
       [not found] <mailman.1087.1584789896.27067.linuxppc-dev@lists.ozlabs.org>
@ 2020-03-21 12:50 ` Christian Zigotzky
  0 siblings, 0 replies; only message in thread
From: Christian Zigotzky @ 2020-03-21 12:50 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Julian Margetson, Darren Stevens, contact, mad skateman, R.T.Dickinson

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

Hello,

We would like to add poweroff and restart support for the Cyrus+ board 
[1] [2] to the mainline vanilla kernel.
There is a patch for adding poweroff and restart support. (attached)
It works but I am not sure if it is good enough for the mainline vanilla 
kernel.
Please post some suggestions and comments about this patch.

Thanks,
Christian


[1] http://wiki.amiga.org/index.php?title=X5000
[2] https://www.amigaos.net/hardware/133/amigaone-x5000

[-- Attachment #2: cyrus_5.6-2.txt --]
[-- Type: text/plain, Size: 1708 bytes --]

diff -rupN a/arch/powerpc/boot/dts/fsl/cyrus_p5020.dts b/arch/powerpc/boot/dts/fsl/cyrus_p5020.dts
--- a/arch/powerpc/boot/dts/fsl/cyrus_p5020.dts	2020-02-10 01:08:48.000000000 +0100
+++ b/arch/powerpc/boot/dts/fsl/cyrus_p5020.dts	2020-02-10 08:49:47.953680947 +0100
@@ -146,6 +146,25 @@
 				  0 0x00010000>;
 		};
 	};
+
+	gpio-poweroff {
+		compatible = "gpio-poweroff";
+		gpios = <&gpio0 3 1>;
+	};
+
+	gpio-restart {
+		compatible = "gpio-restart";
+		gpios = <&gpio0 2 1>;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+		hdd {
+			label = "Disk activity";
+			gpios = <&gpio0 5 0>;
+			linux,default-trigger = "disk-activity";
+		};
+	};
 };
 
 /include/ "p5020si-post.dtsi"
diff -rupN a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
--- a/arch/powerpc/platforms/85xx/corenet_generic.c	2020-02-10 01:08:48.000000000 +0100
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c	2020-02-10 08:49:47.953680947 +0100
@@ -46,6 +46,16 @@ void __init corenet_gen_pic_init(void)
 	mpic_init(mpic);
 }
 
+/* If someone has registered a poweroff callback, invoke it */
+static void __noreturn corenet_generic_halt(void)
+{
+	if (pm_power_off)
+	pm_power_off();
+
+	/* Should not return */
+	for(;;);
+}
+
 /*
  * Setup the architecture
  */
@@ -99,6 +109,15 @@ static const struct of_device_id of_devi
 	{
 		.name		= "handles",
 	},
+	{
+		.name		= "gpio-poweroff",
+	},
+	{
+		.name		= "gpio-restart",
+	},
+	{
+		.name		= "leds",
+	},
 	{}
 };
 
@@ -149,6 +168,8 @@ static int __init corenet_generic_probe(
 	extern struct smp_ops_t smp_85xx_ops;
 #endif
 
+	ppc_md.halt = corenet_generic_halt;
+
 	if (of_device_compatible_match(of_root, boards))
 		return 1;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-21 12:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.1087.1584789896.27067.linuxppc-dev@lists.ozlabs.org>
2020-03-21 12:50 ` FSL P5020/Cyrus+ Board: Poweroff and Restart Support Christian Zigotzky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).