From patchwork Thu Apr 24 09:31:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leela Krishna Amudala X-Patchwork-Id: 28955 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f200.google.com (mail-yk0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6AAB62036A for ; Thu, 24 Apr 2014 09:33:04 +0000 (UTC) Received: by mail-yk0-f200.google.com with SMTP id q9sf5099410ykb.3 for ; Thu, 24 Apr 2014 02:33:04 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=t2eD3YmSbwIX5tgIZTyJNi12BUCceWox/BQsgaC4ei8=; b=LXe+EAaq8aG8WyFSfAo07VHXDpTvq/SRMZR7YoiUZ5/VFJzKCDlsmsGR/0ow3zW67g 9hQAQT1T36R1u8DtSQm9wra7cpqbSNt4sAEdGpR+WXfsVq+Q/yXHVpNN41WH5/JuAJ9w fSgoS5ZxOWULe9HJ2Njdnu74sbjiVhjLFX+03+3rwm1aLwixIUH8+itgs0bTQzI54odz Fiq5TYH8Qu8aPpk76+1tm9smcTsTOXSp7PuWvN1akpsR8VqqEYHclr6XE3Z17GEVYt/C M9lo9WhnjRr6wQG2+B9l1972xsefcfYE0hD+RcTh3jAMdeZofpYM1I8ssnS+ii/V/J62 lLxw== X-Gm-Message-State: ALoCoQlGZv/c7J3aZUfyvAeQthdbCMgNbsYRINFwvYm3LOzc0PHtj4i5lXXk1vCRDaWYTSALg8Xp X-Received: by 10.236.92.15 with SMTP id i15mr529212yhf.8.1398331984198; Thu, 24 Apr 2014 02:33:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.104.78 with SMTP id z72ls460110qge.37.gmail; Thu, 24 Apr 2014 02:33:04 -0700 (PDT) X-Received: by 10.220.10.2 with SMTP id n2mr500291vcn.26.1398331983958; Thu, 24 Apr 2014 02:33:03 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id sc7si800587vdc.49.2014.04.24.02.33.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 02:33:03 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id pa12so2695088veb.28 for ; Thu, 24 Apr 2014 02:33:03 -0700 (PDT) X-Received: by 10.52.166.102 with SMTP id zf6mr430155vdb.2.1398331983873; Thu, 24 Apr 2014 02:33:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp1874vcb; Thu, 24 Apr 2014 02:33:03 -0700 (PDT) X-Received: by 10.68.129.169 with SMTP id nx9mr1423354pbb.136.1398331983073; Thu, 24 Apr 2014 02:33:03 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kp8si2321776pbc.160.2014.04.24.02.33.02; Thu, 24 Apr 2014 02:33:02 -0700 (PDT) Received-SPF: none (google.com: linux-samsung-soc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753035AbaDXJc7 (ORCPT + 9 others); Thu, 24 Apr 2014 05:32:59 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:46880 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753669AbaDXJbu (ORCPT ); Thu, 24 Apr 2014 05:31:50 -0400 Received: by mail-pd0-f172.google.com with SMTP id w10so1733925pde.17 for ; Thu, 24 Apr 2014 02:31:49 -0700 (PDT) X-Received: by 10.69.26.103 with SMTP id ix7mr63306606pbd.41.1398331909470; Thu, 24 Apr 2014 02:31:49 -0700 (PDT) Received: from lk-linux.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id yv5sm7847048pbb.49.2014.04.24.02.31.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 02:31:48 -0700 (PDT) From: Leela Krishna Amudala To: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: daniel.lezcano@linaro.org, nicolas.pitre@linaro.org, kgene.kim@samsung.com, amit.kucheria@linaro.org Subject: [PATCH 1/2] ARM: EXYNOS: Add generic cpu power control functions for all exynos based SoCs Date: Thu, 24 Apr 2014 15:01:58 +0530 Message-Id: <1398331919-28321-2-git-send-email-leela.krishna@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1398331919-28321-1-git-send-email-leela.krishna@linaro.org> References: <1398331919-28321-1-git-send-email-leela.krishna@linaro.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: leela.krishna@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add generic cpu power control functions for exynos based SoCS for cpu power up/down and to know the cpu status. Signed-off-by: Leela Krishna Amudala --- arch/arm/mach-exynos/common.h | 3 +++ arch/arm/mach-exynos/pm.c | 36 ++++++++++++++++++++++++++++++++++++ arch/arm/mach-exynos/regs-pmu.h | 6 ++++++ 3 files changed, 45 insertions(+) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 9ef3f83..566f222 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -62,5 +62,8 @@ struct exynos_pmu_conf { }; extern void exynos_sys_powerdown_conf(enum sys_powerdown mode); +extern void exynos_cpu_powerdown(int cpu); +extern void exynos_cpu_powerup(int cpu); +extern int exynos_cpu_power_state(int cpu); #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */ diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index 15af0ce..6651028 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -100,6 +100,42 @@ static int exynos_irq_set_wake(struct irq_data *data, unsigned int state) return -ENOENT; } +/** + * exynos_cpu_powerdown : power down the specified cpu + * @cpu : the cpu to power down + * + * Power downs the specified cpu. The sequence must be finished by a + * call to cpu_do_idle() + * + */ +void exynos_cpu_powerdown(int cpu) +{ + __raw_writel(0, EXYNOS_ARM_CORE_CONFIGURATION(cpu)); +} + +/** + * exynos_cpu_powerup : power up the specified cpu + * @cpu : the cpu to power up + * + * Power up the specified cpu + */ +void exynos_cpu_powerup(int cpu) +{ + __raw_writel(S5P_CORE_LOCAL_PWR_EN, + EXYNOS_ARM_CORE_CONFIGURATION(cpu)); +} + +/** + * exynos_cpu_power_state : returns the power state of the cpu + * @cpu : the cpu to retrieve the power state from + * + */ +int exynos_cpu_power_state(int cpu) +{ + return (__raw_readl(EXYNOS_ARM_CORE_STATUS(cpu)) & + S5P_CORE_LOCAL_PWR_EN); +} + /* For Cortex-A9 Diagnostic and Power control register */ static unsigned int save_arm_register[2]; diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h index 4f6a256..0bdfcbc 100644 --- a/arch/arm/mach-exynos/regs-pmu.h +++ b/arch/arm/mach-exynos/regs-pmu.h @@ -121,6 +121,12 @@ #define S5P_CHECK_SLEEP 0x00000BAD +#define EXYNOS_ARM_CORE0_CONFIGURATION S5P_PMUREG(0x2000) +#define EXYNOS_ARM_CORE_CONFIGURATION(_nr) \ + (EXYNOS_ARM_CORE0_CONFIGURATION + (0x80 * (_nr))) +#define EXYNOS_ARM_CORE_STATUS(_nr) \ + (EXYNOS_ARM_CORE_CONFIGURATION(_nr) + 0x4) + /* Only for EXYNOS4210 */ #define S5P_CMU_CLKSTOP_LCD1_LOWPWR S5P_PMUREG(0x1154) #define S5P_CMU_RESET_LCD1_LOWPWR S5P_PMUREG(0x1174)