From patchwork Sat Mar 21 12:50:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Zigotzky X-Patchwork-Id: 1259441 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48l0xr3mLBz9sPR for ; Sat, 21 Mar 2020 23:56:00 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xenosoft.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=xenosoft.de header.i=@xenosoft.de header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=NvocYwx0; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48l0xr2NxszF0Br for ; Sat, 21 Mar 2020 23:56:00 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.helo=mo6-p00-ob.smtp.rzone.de (client-ip=2a01:238:20a:202:5300::7; helo=mo6-p00-ob.smtp.rzone.de; envelope-from=chzigotzky@xenosoft.de; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=xenosoft.de Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=xenosoft.de header.i=@xenosoft.de header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=NvocYwx0; dkim-atps=neutral X-Greylist: delayed 177 seconds by postgrey-1.36 at bilbo; Sat, 21 Mar 2020 23:53:33 AEDT Received: from mo6-p00-ob.smtp.rzone.de (mo6-p00-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5300::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48l0v14w0KzDrR7 for ; Sat, 21 Mar 2020 23:53:32 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1584795207; s=strato-dkim-0002; d=xenosoft.de; h=In-Reply-To:Date:Message-ID:Cc:From:References:To:Subject: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=ldimWoRLsCAE5JRXdvCkK4s0HAn6/zloCegzZ88k+n0=; b=NvocYwx0dHaxNLEQOMRuH/L/xQIG8WMXJY2HaUV0IcZh6rtX6bixjtGEzTS/ndqSWL azSWHBKNtNnl7i4Cyc+eYNNjAlqFsgyTdZ3RiN/6rF9SX+azmoThwb6mI6/jxESOCjyc ROZrvF67EAWXNM5DYOBFDQEdmR0H5+AdTIrDWChteslaXpUmd3+JLM6h/9Jv5behVim7 1oMCF+mP98byOuQaUR0xJ1PkEasm6PfmdzVf87BQdAc6/DFuic8bzJFlLqRcEPVUfggR URJnMHj2rxgxz9aCx4WmzBhzp1WnCQoXSLP/CD/fFviH4q+Vpbs8BYKwFA1PT/0GBRTu u3aw== X-RZG-AUTH: ":L2QefEenb+UdBJSdRCXu93KJ1bmSGnhMdmOod1DhGM4l4Hio94KKxRySfLxnHfJ+Dkjp5DdBJSrwuuqxvPhQL/vFUhOeFBFYLgGijN1As3g7WQ==" X-RZG-CLASS-ID: mo00 Received: from [IPv6:2a02:8109:89c0:ebfc:3924:3dd8:fb3f:a8eb] by smtp.strato.de (RZmta 46.2.1 AUTH) with ESMTPSA id c060e4w2LCoNBZf (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 21 Mar 2020 13:50:23 +0100 (CET) Subject: FSL P5020/Cyrus+ Board: Poweroff and Restart Support To: linuxppc-dev@lists.ozlabs.org References: From: Christian Zigotzky Message-ID: Date: Sat, 21 Mar 2020 13:50:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Language: de-DE X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julian Margetson , Darren Stevens , "contact@a-eon.com" , mad skateman , "R.T.Dickinson" Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 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;