blob: 5add541e3b414ed0fae850de70ee7397bffada2a [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001// SPDX-License-Identifier: GPL-2.0-only
Paul Walmsley2ace8312010-12-21 21:05:14 -07002/*
3 * OMAP4 PRCM_MPU module functions
4 *
5 * Copyright (C) 2009 Nokia Corporation
6 * Paul Walmsley
Paul Walmsley2ace8312010-12-21 21:05:14 -07007 */
8
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <linux/errno.h>
12#include <linux/err.h>
13#include <linux/io.h>
14
Tony Lindgrenee0839c2012-02-24 10:34:35 -080015#include "iomap.h"
Tony Lindgren4e653312011-11-10 22:45:17 +010016#include "common.h"
Paul Walmsley2ace8312010-12-21 21:05:14 -070017#include "prcm_mpu44xx.h"
18#include "cm-regbits-44xx.h"
19
Paul Walmsleyd9a16f92012-10-29 20:57:39 -060020/*
21 * prcm_mpu_base: the virtual address of the start of the PRCM_MPU IP
22 * block registers
23 */
Tero Kristo90129332017-05-31 18:00:00 +030024struct omap_domain_base prcm_mpu_base;
Paul Walmsleyd9a16f92012-10-29 20:57:39 -060025
Paul Walmsley2ace8312010-12-21 21:05:14 -070026/* PRCM_MPU low-level functions */
27
28u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)
29{
Victor Kamenskyedfaf052014-04-15 20:37:46 +030030 return readl_relaxed(OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
Paul Walmsley2ace8312010-12-21 21:05:14 -070031}
32
33void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg)
34{
Victor Kamenskyedfaf052014-04-15 20:37:46 +030035 writel_relaxed(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
Paul Walmsley2ace8312010-12-21 21:05:14 -070036}
37
38u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
39{
40 u32 v;
41
42 v = omap4_prcm_mpu_read_inst_reg(inst, reg);
43 v &= ~mask;
44 v |= bits;
45 omap4_prcm_mpu_write_inst_reg(v, inst, reg);
46
47 return v;
48}
Paul Walmsleyd9a16f92012-10-29 20:57:39 -060049
50/**
51 * omap2_set_globals_prcm_mpu - set the MPU PRCM base address (for early use)
52 * @prcm_mpu: PRCM_MPU base virtual address
53 *
54 * XXX Will be replaced when the PRM/CM drivers are completed.
55 */
56void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu)
57{
Tero Kristo90129332017-05-31 18:00:00 +030058 prcm_mpu_base.va = prcm_mpu;
Paul Walmsleyd9a16f92012-10-29 20:57:39 -060059}