From patchwork Tue Jun 10 10:51:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 31642 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2FB1120675 for ; Tue, 10 Jun 2014 10:52:59 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id 9sf8209231ykp.5 for ; Tue, 10 Jun 2014 03:52:59 -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=zzRFbCwISMULfTAxAYql8UVX6luTGL91KHXO5U5vauk=; b=HtbCvprG8iDAgudRAREVDcpIiPS9dnsxnlFOavBfxPzAlLsMWG/tuxc4uYarKgjwU2 fp/t/oM/f0Ee59QD+R7VxRUxr1Ecbp4FQawliQz+vA/gi9t4kg1b4NaLMLQv1N5SKSIy 2DLG76WiwsoMDrsg6Y5Ze7p5ccfi/AV+Yzp5sM1fYJc4wrBbk/igEjbtVzW0V7YZZSQq j5vpbWfd4lTH0WZm9GNwNHjpy57snVNrvJvNnVWEFpIj+Vz3hBnGhsqPxtHPmz2+Tt16 YXafV015ETx07FswX3+gz8f2CqgmNMDMBGaXuWvWqIgZTC/TKSJGaSaGfIR5hMcnNhRP 0BFg== X-Gm-Message-State: ALoCoQkOUdEtk5oRnHZdSdNk9xefR7BOL3m+PkT7shjz8fHpId+splOcb6qm/Xyj5HaHnUsQqFXb X-Received: by 10.236.228.98 with SMTP id e92mr211449yhq.58.1402397579037; Tue, 10 Jun 2014 03:52:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.130 with SMTP id q2ls2152962qga.91.gmail; Tue, 10 Jun 2014 03:52:58 -0700 (PDT) X-Received: by 10.220.88.18 with SMTP id y18mr31633899vcl.26.1402397578863; Tue, 10 Jun 2014 03:52:58 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id dp9si12955596veb.24.2014.06.10.03.52.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Jun 2014 03:52:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id oz11so3238561veb.22 for ; Tue, 10 Jun 2014 03:52:58 -0700 (PDT) X-Received: by 10.52.185.72 with SMTP id fa8mr26962913vdc.12.1402397578785; Tue, 10 Jun 2014 03:52:58 -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.221.54.6 with SMTP id vs6csp215587vcb; Tue, 10 Jun 2014 03:52:58 -0700 (PDT) X-Received: by 10.112.149.71 with SMTP id ty7mr21309186lbb.34.1402397577477; Tue, 10 Jun 2014 03:52:57 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx.google.com with ESMTPS id bf10si21060202lab.85.2014.06.10.03.52.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Jun 2014 03:52:57 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id pv20so3879503lab.13 for ; Tue, 10 Jun 2014 03:52:56 -0700 (PDT) X-Received: by 10.152.36.38 with SMTP id n6mr22315015laj.0.1402397576901; Tue, 10 Jun 2014 03:52:56 -0700 (PDT) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id y6sm18329925laj.17.2014.06.10.03.52.54 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Jun 2014 03:52:56 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Kevin Hilman , Alan Stern , Greg Kroah-Hartman , Daniel Lezcano , Tomasz Figa , devicetree@vger.kernel.org, Linus Walleij , Simon Horman , Magnus Damm , Ben Dooks , Kukjin Kim , Stephen Boyd , Philipp Zabel , Mark Brown , Ulf Hansson Subject: [PATCH 21/24] ARM: ux500: Initial support for power domains Date: Tue, 10 Jun 2014 12:51:34 +0200 Message-Id: <1402397497-26737-22-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1402397497-26737-1-git-send-email-ulf.hansson@linaro.org> References: <1402397497-26737-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.128.177 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 power domain and requires the domains to be specified through DT. Currently the callbacks for handling power gating are empty functions which shall be implemented once each device are handled properly from a runtime PM perspective. Cc: Linus Walleij Cc: Tomasz Figa Cc: devicetree@vger.kernel.org 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 | 77 ++++++++++++++++++++++++++++++++++++++ arch/arm/mach-ux500/pm_domains.h | 17 +++++++++ 4 files changed, 99 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..dbc115b --- /dev/null +++ b/arch/arm/mach-ux500/pm_domains.c @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2014 Linaro Ltd. + * + * Author: Ulf Hansson + * License terms: GNU General Public License (GPL) version 2 + * + * Implements power domains as generic power domains 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 power domain regulator here. + * Drivers/subsystems operating the devices in the power domain needs + * to handle register context save/restore to be able to enable power + * domain gating/ungating. + */ + return 0; +} + +static int pd_power_on(struct generic_pm_domain *domain) +{ + /* + * Handle the ungating of the power domain regulator here. + * Drivers/subsystems operating the devices in the power domain needs + * to handle register context save/restore to be able to enable power + * 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->domain_num = ARRAY_SIZE(ux500_pm_domains); + genpd_data->domains = 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(np, of_genpd_xlate_onecell, 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