From: 黄涛 Date: Sat, 18 Dec 2010 06:43:38 +0000 (+0800) Subject: rk29: add pmu.h X-Git-Tag: firefly_0821_release~10922 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8952e70d0a9f089ea82246e9018abdbb38a05c5d;p=firefly-linux-kernel-4.4.55.git rk29: add pmu.h --- diff --git a/arch/arm/mach-rk29/include/mach/pmu.h b/arch/arm/mach-rk29/include/mach/pmu.h new file mode 100644 index 000000000000..c3ad47eddadf --- /dev/null +++ b/arch/arm/mach-rk29/include/mach/pmu.h @@ -0,0 +1,60 @@ +/* arch/arm/mach-rk29/include/mach/rk29_pmu.h + * + * Copyright (C) 2010 ROCKCHIP, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __ARCH_ARM_MACH_RK29_PMU_H + +#include +#include +#include + +#define PMU_WAKEUP_EN0 0x00 +#define PMU_WAKEUP_EN1 0x04 +#define PMU_WAKEUP_EN2 0x08 +#define PMU_PD_CON 0x10 +#define PMU_MISC_CON 0x14 +#define PMU_PLL_CNT 0x18 +#define PMU_PD_ST 0x1c +#define PMU_INT_ST 0x20 + +enum pmu_power_domain { + PD_ARM_CORE = 0, + PD_NEON, + PD_ETM_DBG, + PD_L2_CACHE, + PD_VCODEC, + PD_DISPLAY, + PD_GPU, + PD_PERIPHERAL, + PD_MINI, +}; + +static inline void pmu_set_power_domain(enum pmu_power_domain pd, bool on) +{ + unsigned long flags; + + local_irq_save(flags); + if (on) + writel(readl(RK29_PMU_BASE + PMU_PD_CON) & ~(1 << pd), RK29_PMU_BASE + PMU_PD_CON); + else + writel(readl(RK29_PMU_BASE + PMU_PD_CON) | (1 << pd), RK29_PMU_BASE + PMU_PD_CON); + local_irq_restore(flags); +} + +static inline bool pmu_power_domain_is_on(enum pmu_power_domain pd) +{ + return !(readl(RK29_PMU_BASE + PMU_PD_ST) & (1 << pd)); +} + +#endif diff --git a/arch/arm/mach-rk29/include/mach/rk29_iomap.h b/arch/arm/mach-rk29/include/mach/rk29_iomap.h index 0f6193e6cb13..5fffc05729c6 100644 --- a/arch/arm/mach-rk29/include/mach/rk29_iomap.h +++ b/arch/arm/mach-rk29/include/mach/rk29_iomap.h @@ -102,8 +102,9 @@ #define RK29_CRU_PHYS 0x20000000 #define RK29_CRU_BASE RK29_ADDR_BASE1 #define RK29_CRU_SIZE SZ_4K -#define RK29_PMU_PHYS 0x20004000 -#define RK29_PMU_SIZE SZ_16K +#define RK29_PMU_PHYS 0x20004000 +#define RK29_PMU_BASE (RK29_ADDR_BASE1 + 0x4000) +#define RK29_PMU_SIZE SZ_4K #define RK29_GRF_BASE (RK29_ADDR_BASE1+0x8000) #define RK29_GRF_PHYS 0x20008000 #define RK29_GRF_SIZE SZ_16K diff --git a/arch/arm/mach-rk29/io.c b/arch/arm/mach-rk29/io.c index c669bef19fd6..9815a2734756 100644 --- a/arch/arm/mach-rk29/io.c +++ b/arch/arm/mach-rk29/io.c @@ -41,6 +41,7 @@ static struct map_desc rk29_io_desc[] __initdata = { RK29_DEVICE(PWM), RK29_DEVICE(GRF), RK29_DEVICE(CRU), + RK29_DEVICE(PMU), RK29_DEVICE(GPIO0), RK29_DEVICE(GPIO1), RK29_DEVICE(GPIO2),