1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 22ace831fSPaul Walmsley /* 32ace831fSPaul Walmsley * OMAP4 PRCM_MPU module functions 42ace831fSPaul Walmsley * 52ace831fSPaul Walmsley * Copyright (C) 2009 Nokia Corporation 62ace831fSPaul Walmsley * Paul Walmsley 72ace831fSPaul Walmsley */ 82ace831fSPaul Walmsley 92ace831fSPaul Walmsley #include <linux/kernel.h> 102ace831fSPaul Walmsley #include <linux/types.h> 112ace831fSPaul Walmsley #include <linux/errno.h> 122ace831fSPaul Walmsley #include <linux/err.h> 132ace831fSPaul Walmsley #include <linux/io.h> 142ace831fSPaul Walmsley 15ee0839c2STony Lindgren #include "iomap.h" 164e65331cSTony Lindgren #include "common.h" 172ace831fSPaul Walmsley #include "prcm_mpu44xx.h" 182ace831fSPaul Walmsley #include "cm-regbits-44xx.h" 192ace831fSPaul Walmsley 20d9a16f9aSPaul Walmsley /* 21d9a16f9aSPaul Walmsley * prcm_mpu_base: the virtual address of the start of the PRCM_MPU IP 22d9a16f9aSPaul Walmsley * block registers 23d9a16f9aSPaul Walmsley */ 2490129336STero Kristo struct omap_domain_base prcm_mpu_base; 25d9a16f9aSPaul Walmsley 262ace831fSPaul Walmsley /* PRCM_MPU low-level functions */ 272ace831fSPaul Walmsley 282ace831fSPaul Walmsley u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg) 292ace831fSPaul Walmsley { 30edfaf05cSVictor Kamensky return readl_relaxed(OMAP44XX_PRCM_MPU_REGADDR(inst, reg)); 312ace831fSPaul Walmsley } 322ace831fSPaul Walmsley 332ace831fSPaul Walmsley void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg) 342ace831fSPaul Walmsley { 35edfaf05cSVictor Kamensky writel_relaxed(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg)); 362ace831fSPaul Walmsley } 372ace831fSPaul Walmsley 382ace831fSPaul Walmsley u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg) 392ace831fSPaul Walmsley { 402ace831fSPaul Walmsley u32 v; 412ace831fSPaul Walmsley 422ace831fSPaul Walmsley v = omap4_prcm_mpu_read_inst_reg(inst, reg); 432ace831fSPaul Walmsley v &= ~mask; 442ace831fSPaul Walmsley v |= bits; 452ace831fSPaul Walmsley omap4_prcm_mpu_write_inst_reg(v, inst, reg); 462ace831fSPaul Walmsley 472ace831fSPaul Walmsley return v; 482ace831fSPaul Walmsley } 49d9a16f9aSPaul Walmsley 50d9a16f9aSPaul Walmsley /** 51d9a16f9aSPaul Walmsley * omap2_set_globals_prcm_mpu - set the MPU PRCM base address (for early use) 52d9a16f9aSPaul Walmsley * @prcm_mpu: PRCM_MPU base virtual address 53d9a16f9aSPaul Walmsley * 54d9a16f9aSPaul Walmsley * XXX Will be replaced when the PRM/CM drivers are completed. 55d9a16f9aSPaul Walmsley */ 56d9a16f9aSPaul Walmsley void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu) 57d9a16f9aSPaul Walmsley { 5890129336STero Kristo prcm_mpu_base.va = prcm_mpu; 59d9a16f9aSPaul Walmsley } 60