From patchwork Tue Oct 14 09:12:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 38698 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 24A7A20973 for ; Tue, 14 Oct 2014 09:13:29 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id p9sf5062324lbv.4 for ; Tue, 14 Oct 2014 02:13:27 -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:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=IFbuMnXWOCnYMXMgeIKwYiFcw5BB3NwGLq4cGlgl0rc=; b=GXJ5LeQvm77dfVp047AM9AuzMSNMLEA2vUsDax1K4Bk8ia3MHCsECC8XBqX0Cbl17D xjmp2TyPeJC1VT+zD2wH1wz6tm2caOFo1joCqn9p6r9B0la5ZIi3PdVPb20dSZVqkUhp MCWAIhJHpr5Plcu3grGsldvfOJb3xl0UPzg/EDfjVggDWRUgPhaswWIa6h7qQNyYbSTw x14bm6JYdCsnxpWcmYSduQoMBEZhNYq1Frbp6YIfcrugnWAhenwMnv8d8Sjul+y+9p/x KuRBvjh2uHfuJQGrvLvf65iXPn8eSFnwt3SitO5cPNXcoRYU0MIHdR9nFA66f7XtKqiL PEtg== X-Gm-Message-State: ALoCoQn6fSsCfjkcPU0FDluNN1i0Pc/SoeZMd9CQKS2pZd1upbq8zEhcNdSoL0g1RSJpBc7aUBO+ X-Received: by 10.194.161.195 with SMTP id xu3mr25765wjb.7.1413278007878; Tue, 14 Oct 2014 02:13:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.4 with SMTP id t4ls577666laz.33.gmail; Tue, 14 Oct 2014 02:13:27 -0700 (PDT) X-Received: by 10.112.182.1 with SMTP id ea1mr4043102lbc.16.1413278007661; Tue, 14 Oct 2014 02:13:27 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id r9si9491312lag.32.2014.10.14.02.13.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 02:13:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id s18so8075593lam.23 for ; Tue, 14 Oct 2014 02:13:27 -0700 (PDT) X-Received: by 10.152.36.103 with SMTP id p7mr4023584laj.44.1413278007585; Tue, 14 Oct 2014 02:13:27 -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.112.84.229 with SMTP id c5csp358648lbz; Tue, 14 Oct 2014 02:13:27 -0700 (PDT) X-Received: by 10.152.88.70 with SMTP id be6mr4049099lab.72.1413278006993; Tue, 14 Oct 2014 02:13:26 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com [209.85.215.52]) by mx.google.com with ESMTPS id mr6si25459085lbb.137.2014.10.14.02.13.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 02:13:26 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by mail-la0-f52.google.com with SMTP id hz20so7987006lab.39 for ; Tue, 14 Oct 2014 02:13:26 -0700 (PDT) X-Received: by 10.152.29.100 with SMTP id j4mr3895770lah.51.1413278006868; Tue, 14 Oct 2014 02:13:26 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id w2sm5379034lad.30.2014.10.14.02.13.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Oct 2014 02:13:26 -0700 (PDT) From: Ulf Hansson To: linux-arm-kernel@lists.infradead.org, Linus Walleij Cc: devicetree@vger.kernel.org, Rob Herring , "Rafael J. Wysocki" , Tomasz Figa , Kevin Hilman , Russell King , Geert Uytterhoeven , Philipp Zabel , Jack Dai , Jinkun Hong , Ulf Hansson Subject: [PATCH 3/8] ARM: ux500: Initial support for PM domains Date: Tue, 14 Oct 2014 11:12:56 +0200 Message-Id: <1413277981-27451-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413277981-27451-1-git-send-email-ulf.hansson@linaro.org> References: <1413277981-27451-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) 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: , The ux500 SoC uses the generic PM domain and requires the domains to be specified through DT. Currently the genpd callbacks for handling power gating|ungating are implemented as dummy functions. To be able to enable those to perform PM domain gating/ungating, each device that resides in the VAPE domain must be properly handled from a runtime PM perspective. Signed-off-by: Ulf Hansson --- arch/arm/mach-ux500/Makefile | 1 + arch/arm/mach-ux500/pm.c | 4 ++ arch/arm/mach-ux500/pm_domains.c | 79 ++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-ux500/pm_domains.h | 17 +++++++++ 4 files changed, 101 insertions(+) create mode 100644 arch/arm/mach-ux500/pm_domains.c create mode 100644 arch/arm/mach-ux500/pm_domains.h diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index 9741de95..4418a50 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile @@ -9,5 +9,6 @@ obj-$(CONFIG_MACH_MOP500) += board-mop500-regulators.o \ board-mop500-audio.o obj-$(CONFIG_SMP) += platsmp.o headsmp.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o +obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o CFLAGS_hotplug.o += -march=armv7-a diff --git a/arch/arm/mach-ux500/pm.c b/arch/arm/mach-ux500/pm.c index b80a9a2..2cb587b 100644 --- a/arch/arm/mach-ux500/pm.c +++ b/arch/arm/mach-ux500/pm.c @@ -17,6 +17,7 @@ #include #include "db8500-regs.h" +#include "pm_domains.h" /* ARM WFI Standby signal register */ #define PRCM_ARM_WFI_STANDBY (prcmu_base + 0x130) @@ -191,4 +192,7 @@ void __init ux500_pm_init(u32 phy_base, u32 size) /* Set up ux500 suspend callbacks. */ suspend_set_ops(UX500_SUSPEND_OPS); + + /* Initialize ux500 power domains */ + ux500_pm_domains_init(); } diff --git a/arch/arm/mach-ux500/pm_domains.c b/arch/arm/mach-ux500/pm_domains.c new file mode 100644 index 0000000..0d4b5b4 --- /dev/null +++ b/arch/arm/mach-ux500/pm_domains.c @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2014 Linaro Ltd. + * + * Author: Ulf Hansson + * License terms: GNU General Public License (GPL) version 2 + * + * Implements PM domains using the generic PM domain for ux500. + */ +#include +#include +#include +#include +#include + +#include +#include "pm_domains.h" + +static int pd_power_off(struct generic_pm_domain *domain) +{ + /* + * Handle the gating of the PM domain regulator here. + * + * Drivers/subsystems handling devices in the PM domain needs to perform + * register context save/restore from their respective runtime PM + * callbacks, to be able to enable PM domain gating/ungating. + */ + return 0; +} + +static int pd_power_on(struct generic_pm_domain *domain) +{ + /* + * Handle the ungating of the PM domain regulator here. + * + * Drivers/subsystems handling devices in the PM domain needs to perform + * register context save/restore from their respective runtime PM + * callbacks, to be able to enable PM domain gating/ungating. + */ + return 0; +} + +static struct generic_pm_domain ux500_pm_domain_vape = { + .name = "VAPE", + .power_off = pd_power_off, + .power_on = pd_power_on, +}; + +static struct generic_pm_domain *ux500_pm_domains[NR_DOMAINS] = { + [DOMAIN_VAPE] = &ux500_pm_domain_vape, +}; + +static struct of_device_id ux500_pm_domain_matches[] = { + { .compatible = "stericsson,ux500-pm-domains", }, + { }, +}; + +int __init ux500_pm_domains_init(void) +{ + struct device_node *np; + struct genpd_onecell_data *genpd_data; + int i; + + np = of_find_matching_node(NULL, ux500_pm_domain_matches); + if (!np) + return -ENODEV; + + genpd_data = kzalloc(sizeof(*genpd_data), GFP_KERNEL); + if (!genpd_data) + return -ENOMEM; + + genpd_data->domains = ux500_pm_domains; + genpd_data->num_domains = ARRAY_SIZE(ux500_pm_domains); + + for (i = 0; i < ARRAY_SIZE(ux500_pm_domains); ++i) + pm_genpd_init(ux500_pm_domains[i], NULL, false); + + of_genpd_add_provider_onecell(np, genpd_data); + return 0; +} diff --git a/arch/arm/mach-ux500/pm_domains.h b/arch/arm/mach-ux500/pm_domains.h new file mode 100644 index 0000000..263d3ba --- /dev/null +++ b/arch/arm/mach-ux500/pm_domains.h @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2014 Linaro Ltd. + * + * Author: Ulf Hansson + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef __MACH_UX500_PM_DOMAINS_H +#define __MACH_UX500_PM_DOMAINS_H + +#ifdef CONFIG_PM_GENERIC_DOMAINS +extern int __init ux500_pm_domains_init(void); +#else +static inline int ux500_pm_domains_init(void) { return 0; } +#endif + +#endif