From patchwork Tue Apr 22 17:32:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Chaugule X-Patchwork-Id: 4033961 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CEB049F319 for ; Tue, 22 Apr 2014 17:39:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8497201EC for ; Tue, 22 Apr 2014 17:39:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5DFF3201F4 for ; Tue, 22 Apr 2014 17:39:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WceZr-0000ku-R0; Tue, 22 Apr 2014 17:33:51 +0000 Received: from mail-wi0-f170.google.com ([209.85.212.170]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WceZB-0000Rw-A5 for linux-arm-kernel@lists.infradead.org; Tue, 22 Apr 2014 17:33:09 +0000 Received: by mail-wi0-f170.google.com with SMTP id bs8so3437011wib.1 for ; Tue, 22 Apr 2014 10:32:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=EkWPEF3nIu9bkrjLZqh+ovUx7yr64Db42tumhJk87Es=; b=DpikLlrOJbaBQSNa5SiBW/6WrhGvPZ373tesIONE9nPH5WL8XTTRMWtt0cxH0tWI8U jOXK64RRxV6N254+NFaXLNylgvi1pp+h5C2h/gboEGMjpNtLefHIhovzUFbNQ7aNgLU/ A7seOxVbnVUyFL6jo8iLg6tjdGTeHA5L/+Bl5K+EV5++ru0axgc571X5wv4YWXZQOwzd RhS1ipvDtOh+f3CZt9yVJBTDASlHHBcvlN8yJxH5EinMMSNZ222Kw1qtrqRt5BfUekY7 nAhB34qJ28quJRaUp3VrEu7byQBzG0ucSPd4uB6ywEEjZ5jHUNSsDUEi6JLAjqhJNM1U 1w5g== X-Gm-Message-State: ALoCoQkxOxsTnXfv6OzadLm0UMHYJDEbxa+FEvVA+DNURRxbHefUaFfYKtxTHqDF6an/2Ou+nIk0 MIME-Version: 1.0 X-Received: by 10.180.91.1 with SMTP id ca1mr19822055wib.32.1398187965471; Tue, 22 Apr 2014 10:32:45 -0700 (PDT) Received: by 10.217.42.202 with HTTP; Tue, 22 Apr 2014 10:32:45 -0700 (PDT) In-Reply-To: References: <1397762146-8337-1-git-send-email-ashwin.chaugule@linaro.org> <1397762146-8337-2-git-send-email-ashwin.chaugule@linaro.org> Date: Tue, 22 Apr 2014 13:32:45 -0400 Message-ID: Subject: Re: [PATCH v6 1/3] PSCI: Add initial support for PSCIv0.2 functions From: Ashwin Chaugule To: Anup Patel X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140422_103309_497665_01930F75 X-CRM114-Status: GOOD ( 10.88 ) X-Spam-Score: -0.7 (/) Cc: Mark Rutland , Rob Herring , "linaro-acpi@lists.linaro.org" , Marc Zyngier , Patch Tracking , linux-arm-kernel , Christoffer Dall X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 21 April 2014 02:23, Anup Patel wrote: > Hi Ashwin, > > Please include system reboot & shutdown implementation > in this patch using PSCI v0.2 SYSTEM_OFF and > SYSTEM_RESET functions. hm, I had thought these relied on having the (optional) MIGRATE function. But thats not the case. So, how about this.. ---------------------8<--------------------- Acked-by: Rob Herring diff --git a/arch/arm/kernel/psci.c b/arch/arm/kernel/psci.c index ead8cdb..5a54f2f 100644 --- a/arch/arm/kernel/psci.c +++ b/arch/arm/kernel/psci.c @@ -17,6 +17,8 @@ #include #include +#include +#include #include #include @@ -24,6 +26,7 @@ #include #include #include +#include struct psci_operations psci_ops; @@ -196,6 +199,16 @@ static int get_set_conduit_method(struct device_node *np) return 0; } +static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd) +{ + invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); +} + +static void psci_sys_off(void) +{ + invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0); +} + /* * PSCI Function IDs for v0.2+ are well defined so use * standard values. @@ -249,6 +262,10 @@ static int psci_0_2_init(struct device_node *np) PSCI_0_2_FN_MIGRATE_INFO_TYPE; psci_ops.migrate_info_type = psci_migrate_info_type; + arm_pm_restart = psci_sys_reset; + + pm_power_off = psci_sys_off; + out_put_node: of_node_put(np); return err; diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c index 63a7685..583b7c3 100644 --- a/arch/arm64/kernel/psci.c +++ b/arch/arm64/kernel/psci.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include @@ -25,6 +27,7 @@ #include #include #include +#include #define PSCI_POWER_STATE_TYPE_STANDBY 0 #define PSCI_POWER_STATE_TYPE_POWER_DOWN 1 @@ -217,6 +220,16 @@ static int get_set_conduit_method(struct device_node *np) return 0; } +static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd) +{ + invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); +} + +static void psci_sys_off(void) +{ + invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0); +} + /* * PSCI Function IDs for v0.2+ are well defined so use * standard values. @@ -270,6 +283,10 @@ static int psci_0_2_init(struct device_node *np) PSCI_0_2_FN_MIGRATE_INFO_TYPE; psci_ops.migrate_info_type = psci_migrate_info_type; + arm_pm_restart = psci_sys_reset; + + pm_power_off = psci_sys_off; + out_put_node: of_node_put(np); return err;