12ace831fSPaul Walmsley /* 22ace831fSPaul Walmsley * OMAP4 PRCM_MPU module functions 32ace831fSPaul Walmsley * 42ace831fSPaul Walmsley * Copyright (C) 2009 Nokia Corporation 52ace831fSPaul Walmsley * Paul Walmsley 62ace831fSPaul Walmsley * 72ace831fSPaul Walmsley * This program is free software; you can redistribute it and/or modify 82ace831fSPaul Walmsley * it under the terms of the GNU General Public License version 2 as 92ace831fSPaul Walmsley * published by the Free Software Foundation. 102ace831fSPaul Walmsley */ 112ace831fSPaul Walmsley 122ace831fSPaul Walmsley #include <linux/kernel.h> 132ace831fSPaul Walmsley #include <linux/types.h> 142ace831fSPaul Walmsley #include <linux/errno.h> 152ace831fSPaul Walmsley #include <linux/err.h> 162ace831fSPaul Walmsley #include <linux/io.h> 172ace831fSPaul Walmsley 18ee0839c2STony Lindgren #include "iomap.h" 194e65331cSTony Lindgren #include "common.h" 202ace831fSPaul Walmsley #include "prcm_mpu44xx.h" 212ace831fSPaul Walmsley #include "cm-regbits-44xx.h" 222ace831fSPaul Walmsley 23d9a16f9aSPaul Walmsley /* 24d9a16f9aSPaul Walmsley * prcm_mpu_base: the virtual address of the start of the PRCM_MPU IP 25d9a16f9aSPaul Walmsley * block registers 26d9a16f9aSPaul Walmsley */ 27d9a16f9aSPaul Walmsley void __iomem *prcm_mpu_base; 28d9a16f9aSPaul Walmsley 292ace831fSPaul Walmsley /* PRCM_MPU low-level functions */ 302ace831fSPaul Walmsley 312ace831fSPaul Walmsley u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg) 322ace831fSPaul Walmsley { 332ace831fSPaul Walmsley return __raw_readl(OMAP44XX_PRCM_MPU_REGADDR(inst, reg)); 342ace831fSPaul Walmsley } 352ace831fSPaul Walmsley 362ace831fSPaul Walmsley void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg) 372ace831fSPaul Walmsley { 382ace831fSPaul Walmsley __raw_writel(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg)); 392ace831fSPaul Walmsley } 402ace831fSPaul Walmsley 412ace831fSPaul Walmsley u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg) 422ace831fSPaul Walmsley { 432ace831fSPaul Walmsley u32 v; 442ace831fSPaul Walmsley 452ace831fSPaul Walmsley v = omap4_prcm_mpu_read_inst_reg(inst, reg); 462ace831fSPaul Walmsley v &= ~mask; 472ace831fSPaul Walmsley v |= bits; 482ace831fSPaul Walmsley omap4_prcm_mpu_write_inst_reg(v, inst, reg); 492ace831fSPaul Walmsley 502ace831fSPaul Walmsley return v; 512ace831fSPaul Walmsley } 52d9a16f9aSPaul Walmsley 53d9a16f9aSPaul Walmsley /** 54d9a16f9aSPaul Walmsley * omap2_set_globals_prcm_mpu - set the MPU PRCM base address (for early use) 55d9a16f9aSPaul Walmsley * @prcm_mpu: PRCM_MPU base virtual address 56d9a16f9aSPaul Walmsley * 57d9a16f9aSPaul Walmsley * XXX Will be replaced when the PRM/CM drivers are completed. 58d9a16f9aSPaul Walmsley */ 59d9a16f9aSPaul Walmsley void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu) 60d9a16f9aSPaul Walmsley { 61d9a16f9aSPaul Walmsley prcm_mpu_base = prcm_mpu; 62d9a16f9aSPaul Walmsley } 63