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: 28828 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 158BF203AC for ; Tue, 22 Apr 2014 17:32:48 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf22682135pdb.1 for ; Tue, 22 Apr 2014 10:32:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=EkWPEF3nIu9bkrjLZqh+ovUx7yr64Db42tumhJk87Es=; b=Ie89WfW3J+2fHeI//lSA/HU1cG9uR1UQs7UWeqfov4hMcF45w5ML3vp7ZsK7wwLvkn dn0AvqbOqU+6uZ0XRMKUVJ0TWCzCLJ6VN/F5ojsIMOzf9WdJaaIbc5OMtiJwxdXJM+8Y 2Pe4fNwyeGW96ylYjXVXQUNzIHhgFKGdhFnm67os/QVFNyHgD85dWaI9pHnF6JeJbvS4 NCd2Z91gKOtSaMOH9HNq46bjrYsK5LVWFUQHHWm5GeDTbD+BEDBTdnu2NeXSSPxnqYhw KOrMGeoN/JEGkIMY0mwSdXf3HOVMEX8IRHj6MotAwFLqWetRtitglZR9UD24F9qhh2d+ kn8Q== X-Gm-Message-State: ALoCoQnpADqf/9SCLiWNIjeON5Ym9JEeF/Qi1N9M1gJvvjpQOeEXxLQmuj0Lrjx+mp8xYpuS+2gi X-Received: by 10.66.190.202 with SMTP id gs10mr22620611pac.0.1398187968326; Tue, 22 Apr 2014 10:32:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.91.36 with SMTP id y33ls221760qgd.82.gmail; Tue, 22 Apr 2014 10:32:48 -0700 (PDT) X-Received: by 10.221.63.1 with SMTP id xc1mr1464846vcb.35.1398187968153; Tue, 22 Apr 2014 10:32:48 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id vd8si7002411vdc.70.2014.04.22.10.32.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Apr 2014 10:32:48 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so9764090veb.39 for ; Tue, 22 Apr 2014 10:32:48 -0700 (PDT) X-Received: by 10.58.1.5 with SMTP id 5mr41427437vei.8.1398187968056; Tue, 22 Apr 2014 10:32:48 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp42531vcb; Tue, 22 Apr 2014 10:32:47 -0700 (PDT) X-Received: by 10.194.236.232 with SMTP id ux8mr8690545wjc.46.1398187966189; Tue, 22 Apr 2014 10:32:46 -0700 (PDT) Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by mx.google.com with ESMTPS id o9si5701704wik.77.2014.04.22.10.32.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Apr 2014 10:32:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.177 is neither permitted nor denied by best guess record for domain of ashwin.chaugule@linaro.org) client-ip=209.85.212.177; Received: by mail-wi0-f177.google.com with SMTP id cc10so3667598wib.4 for ; Tue, 22 Apr 2014 10:32:45 -0700 (PDT) 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 Cc: Mark Rutland , "linaro-acpi@lists.linaro.org" , linux-arm-kernel , Rob Herring , Christoffer Dall , Marc Zyngier , Patch Tracking X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ashwin.chaugule@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;