2 * OMAP4 PRM module functions
4 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include <linux/kernel.h>
15 #include <linux/delay.h>
16 #include <linux/errno.h>
17 #include <linux/err.h>
20 #include <plat/common.h>
22 #include <plat/prcm.h>
25 #include "prm-regbits-44xx.h"
27 /* PRM low-level functions */
29 /* Read a register in a CM/PRM instance in the PRM module */
30 u32 omap4_prm_read_inst_reg(s16 inst, u16 reg)
32 return __raw_readl(OMAP44XX_PRM_REGADDR(inst, reg));
35 /* Write into a register in a CM/PRM instance in the PRM module */
36 void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg)
38 __raw_writel(val, OMAP44XX_PRM_REGADDR(inst, reg));
41 /* Read-modify-write a register in a PRM module. Caller must lock */
42 u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
46 v = omap4_prm_read_inst_reg(inst, reg);
49 omap4_prm_write_inst_reg(v, inst, reg);
54 /* Read a PRM register, AND it, and shift the result down to bit 0 */
56 u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
67 /* Read-modify-write a register in a PRM module. Caller must lock */
69 u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
81 u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 reg)
83 return omap4_prm_rmw_inst_reg_bits(bits, bits, inst, reg);
86 u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 reg)
88 return omap4_prm_rmw_inst_reg_bits(bits, 0x0, inst, reg);
91 void omap4_prm_global_warm_sw_reset(void)
95 v = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
97 v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK;
98 omap4_prm_write_inst_reg(v, OMAP4430_PRM_DEVICE_INST,
102 v = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,