ARM: cpu topology: Add debugfs interface for cpu_power
[cmplus.git] / arch / arm / mach-omap2 / prminst44xx.c
blobb6a286f9c9e3b7cc53b7d1b5a495e5f19a2379eb
1 /*
2 * OMAP4 PRM instance functions
4 * Copyright (C) 2009 Nokia Corporation
5 * Paul Walmsley
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/types.h>
14 #include <linux/errno.h>
15 #include <linux/err.h>
16 #include <linux/io.h>
18 #include <plat/common.h>
20 #include "prm44xx.h"
21 #include "prminst44xx.h"
22 #include "prm-regbits-44xx.h"
23 #include "prcm44xx.h"
24 #include "prcm_mpu44xx.h"
25 #include "scrm44xx.h"
27 static u32 _prm_bases[OMAP4_MAX_PRCM_PARTITIONS] = {
28 [OMAP4430_INVALID_PRCM_PARTITION] = 0,
29 [OMAP4430_PRM_PARTITION] = OMAP4430_PRM_BASE,
30 [OMAP4430_CM1_PARTITION] = 0,
31 [OMAP4430_CM2_PARTITION] = 0,
32 [OMAP4430_SCRM_PARTITION] = OMAP4_SCRM_BASE,
33 [OMAP4430_PRCM_MPU_PARTITION] = OMAP4430_PRCM_MPU_BASE,
36 /* Read a register in a PRM instance */
37 u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
39 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
40 part == OMAP4430_INVALID_PRCM_PARTITION ||
41 !_prm_bases[part]);
42 return __raw_readl(OMAP2_L4_IO_ADDRESS(_prm_bases[part] + inst +
43 idx));
46 /* Write into a register in a PRM instance */
47 void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
49 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
50 part == OMAP4430_INVALID_PRCM_PARTITION ||
51 !_prm_bases[part]);
52 __raw_writel(val, OMAP2_L4_IO_ADDRESS(_prm_bases[part] + inst + idx));
55 /* Read-modify-write a register in PRM. Caller must lock */
56 u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16 inst,
57 s16 idx)
59 u32 v;
61 v = omap4_prminst_read_inst_reg(part, inst, idx);
62 v &= ~mask;
63 v |= bits;
64 omap4_prminst_write_inst_reg(v, part, inst, idx);
66 return v;