2 * OMAP4 PRM instance functions
4 * Copyright (C) 2009 Nokia Corporation
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>
18 #include <plat/common.h>
21 #include "prminst44xx.h"
22 #include "prm-regbits-44xx.h"
24 #include "prcm_mpu44xx.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
||
42 return __raw_readl(OMAP2_L4_IO_ADDRESS(_prm_bases
[part
] + inst
+
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
||
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
,
61 v
= omap4_prminst_read_inst_reg(part
, inst
, idx
);
64 omap4_prminst_write_inst_reg(v
, part
, inst
, idx
);