linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christian Zigotzky <chzigotzky@xenosoft.de>
To: linuxppc-dev@lists.ozlabs.org
Cc: Julian Margetson <runaway@candw.ms>,
	Darren Stevens <darren@stevens-zone.net>,
	"contact@a-eon.com" <contact@a-eon.com>,
	mad skateman <madskateman@gmail.com>,
	"R.T.Dickinson" <rtd2@xtra.co.nz>
Subject: FSL P5020/Cyrus+ Board: Poweroff and Restart Support
Date: Sat, 21 Mar 2020 13:50:22 +0100	[thread overview]
Message-ID: <fb1762ec-5c08-a92d-0b2a-5e2b48380b29@xenosoft.de> (raw)
In-Reply-To: <mailman.1087.1584789896.27067.linuxppc-dev@lists.ozlabs.org>

[-- 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;
 

           reply	other threads:[~2020-03-21 12:56 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <mailman.1087.1584789896.27067.linuxppc-dev@lists.ozlabs.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb1762ec-5c08-a92d-0b2a-5e2b48380b29@xenosoft.de \
    --to=chzigotzky@xenosoft.de \
    --cc=contact@a-eon.com \
    --cc=darren@stevens-zone.net \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=madskateman@gmail.com \
    --cc=rtd2@xtra.co.nz \
    --cc=runaway@candw.ms \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).