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 184e65331cSTony Lindgren #include "common.h" 192ace831fSPaul Walmsley 202ace831fSPaul Walmsley #include "prcm_mpu44xx.h" 212ace831fSPaul Walmsley #include "cm-regbits-44xx.h" 222ace831fSPaul Walmsley 232ace831fSPaul Walmsley /* PRCM_MPU low-level functions */ 242ace831fSPaul Walmsley 252ace831fSPaul Walmsley u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg) 262ace831fSPaul Walmsley { 272ace831fSPaul Walmsley return __raw_readl(OMAP44XX_PRCM_MPU_REGADDR(inst, reg)); 282ace831fSPaul Walmsley } 292ace831fSPaul Walmsley 302ace831fSPaul Walmsley void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg) 312ace831fSPaul Walmsley { 322ace831fSPaul Walmsley __raw_writel(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg)); 332ace831fSPaul Walmsley } 342ace831fSPaul Walmsley 352ace831fSPaul Walmsley u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg) 362ace831fSPaul Walmsley { 372ace831fSPaul Walmsley u32 v; 382ace831fSPaul Walmsley 392ace831fSPaul Walmsley v = omap4_prcm_mpu_read_inst_reg(inst, reg); 402ace831fSPaul Walmsley v &= ~mask; 412ace831fSPaul Walmsley v |= bits; 422ace831fSPaul Walmsley omap4_prcm_mpu_write_inst_reg(v, inst, reg); 432ace831fSPaul Walmsley 442ace831fSPaul Walmsley return v; 452ace831fSPaul Walmsley } 46