From patchwork Fri May 9 13:05:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 29901 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DAC18202FE for ; Fri, 9 May 2014 13:05:13 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id kq14sf1075658pab.10 for ; Fri, 09 May 2014 06:05:13 -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=BopVkLtCVK7s7dPjHvNI7oIUuiIsnNyolv+hTcja8QY=; b=YVjEe2eaOLR3TenXS9y/zDUbpTGWsfqR8Rop43nAKxNwpSzkLNQNRh9kQ1u0ift+DL B5N2G+X9+8AmKF/RAdVwui3FeovQZKvOW52K0EKatKVswrtsMDtZvjR7jdlQm1j+Z6Ge cz9Epigl3m/uL1ZkUs9T9QuOPCjXSsQT98Cp9U4DpDZRa6hBT151V1yHy8P15lIt68Eu 6vNtrxrp3GJ1f8Lvfkl/qNInyfU9dtUfbjf20zoJoGvMajEkV4YflXN2XLGpyZrnpoM6 dIB/9AWFLW0uvmkahA39fupR8alEu2qY30hZv3IiA1yUcwe8mMYilhqXVnMdET5umkJb UkYw== X-Gm-Message-State: ALoCoQlfjrAd0rqk+U17TCMi03bXLnO8orhYdFZZ7SkMdmQgRNM41GfkwATas6mZ6rn0bCXB0Knh X-Received: by 10.66.157.138 with SMTP id wm10mr2570398pab.23.1399640713068; Fri, 09 May 2014 06:05:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.20.138 with SMTP id 10ls290153qgj.92.gmail; Fri, 09 May 2014 06:05:12 -0700 (PDT) X-Received: by 10.221.34.7 with SMTP id sq7mr8213028vcb.5.1399640712896; Fri, 09 May 2014 06:05:12 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id tj4si710422vdc.177.2014.05.09.06.05.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 09 May 2014 06:05:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id la4so5270909vcb.27 for ; Fri, 09 May 2014 06:05:12 -0700 (PDT) X-Received: by 10.52.181.132 with SMTP id dw4mr259536vdc.86.1399640712781; Fri, 09 May 2014 06:05:12 -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 ib8csp77659vcb; Fri, 9 May 2014 06:05:11 -0700 (PDT) X-Received: by 10.152.29.168 with SMTP id l8mr1866289lah.35.1399640711132; Fri, 09 May 2014 06:05:11 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx.google.com with ESMTPS id ji9si1708245lbc.224.2014.05.09.06.05.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 09 May 2014 06:05:11 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id q8so5304073lbi.41 for ; Fri, 09 May 2014 06:05:10 -0700 (PDT) X-Received: by 10.152.21.200 with SMTP id x8mr635757lae.58.1399640710481; Fri, 09 May 2014 06:05:10 -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 u4sm1226933lal.8.2014.05.09.06.05.08 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 09 May 2014 06:05:09 -0700 (PDT) From: Ulf Hansson To: linux-arm-kernel@lists.infradead.org, Linus Walleij , Alessandro Rubini , Russell King Cc: linux-pm@vger.kernel.org, Tomasz Figa , devicetree@vger.kernel.org, "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson Subject: [PATCH 1/3] ARM: ux500: Initial support for power domains Date: Fri, 9 May 2014 15:05:02 +0200 Message-Id: <1399640704-12289-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1399640704-12289-1-git-send-email-ulf.hansson@linaro.org> References: <1399640704-12289-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.220.182 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: , Initial support for power domains for ux500. To enable this feature we require to use DT, thus we need to add bindings for the ux500 specific parts as well. The implementation of the ux500 power domains is based upon the generic power domain. Cc: Tomasz Figa Cc: devicetree@vger.kernel.org Cc: linux-pm@vger.kernel.org Signed-off-by: Ulf Hansson --- .../devicetree/bindings/arm/ux500/power_domain.txt | 35 +++++++++ arch/arm/mach-ux500/Kconfig | 5 ++ 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 +++++ include/dt-bindings/arm/ux500_pm_domains.h | 15 ++++ 7 files changed, 154 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/ux500/power_domain.txt create mode 100644 arch/arm/mach-ux500/pm_domains.c create mode 100644 arch/arm/mach-ux500/pm_domains.h create mode 100644 include/dt-bindings/arm/ux500_pm_domains.h diff --git a/Documentation/devicetree/bindings/arm/ux500/power_domain.txt b/Documentation/devicetree/bindings/arm/ux500/power_domain.txt new file mode 100644 index 0000000..1c98f01 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/ux500/power_domain.txt @@ -0,0 +1,35 @@ +* ST-Ericsson UX500 Power Domains + +UX500 supports multiple power domains which are used to gate power to one or +more peripherals on the SOC. + +The implementation of power domains for UX500 are based upon the generic power +domain and use the corresponding DT bindings. + +==Power domain providers== + +Required properties: + - compatible: Must be "stericsson,ux500-pm-domains". + - #power-domain-cells : Number of cells in a power domain specifier, must be 1. + +Example: + pm_domains: pm_domains0 { + compatible = "stericsson,ux500-pm-domains"; + #power-domain-cells = <1>; + }; + +==Power domain consumers== + +Required properties: + - power-domains: A phandle and power domain specifier. Below are the list of + valid specifiers: + + Index Specifier + ----- --------- + 0 DOMAIN_VAPE + +Example: + sdi0_per1@80126000 { + compatible = "arm,pl18x", "arm,primecell"; + power-domains = <&pm_domains DOMAIN_VAPE> + }; diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig index b41a42d..0727fa7 100644 --- a/arch/arm/mach-ux500/Kconfig +++ b/arch/arm/mach-ux500/Kconfig @@ -77,4 +77,9 @@ config UX500_DEBUG_UART Choose the UART on which kernel low-level debug messages should be output. +config UX500_PM_DOMAINS + def_bool y + depends on PM_RUNTIME && OF + select PM_GENERIC_DOMAINS + endif diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index de544aa..0dc5d01 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile @@ -10,5 +10,6 @@ obj-$(CONFIG_MACH_MOP500) += board-mop500-sdi.o \ board-mop500-audio.o obj-$(CONFIG_SMP) += platsmp.o headsmp.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o +obj-$(CONFIG_UX500_PM_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..057a978 --- /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_UX500_PM_DOMAINS +extern int __init ux500_pm_domains_init(void); +#else +static inline int ux500_pm_domains_init(void) { return 0; } +#endif + +#endif diff --git a/include/dt-bindings/arm/ux500_pm_domains.h b/include/dt-bindings/arm/ux500_pm_domains.h new file mode 100644 index 0000000..73cf25a --- /dev/null +++ b/include/dt-bindings/arm/ux500_pm_domains.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2014 Linaro Ltd. + * + * Author: Ulf Hansson + * License terms: GNU General Public License (GPL) version 2 + */ +#ifndef _DT_BINDINGS_ARM_UX500_PM_DOMAINS_H +#define _DT_BINDINGS_ARM_UX500_PM_DOMAINS_H + +#define DOMAIN_VAPE 0 + +/* Number of power domains. */ +#define NR_DOMAINS (DOMAIN_VAPE + 1) + +#endif