blob: fe5cc7bae4893ae431379e6bbfdfbf0c7b90e042 [file] [log] [blame]
Paul Walmsley2ace8312010-12-21 21:05:14 -07001/*
2 * OMAP4 CM1, CM2 module low-level functions
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * These functions are intended to be used only by the cminst44xx.c file.
12 * XXX Perhaps we should just move them there and make them static.
13 */
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/io.h>
20
Paul Walmsley2ace8312010-12-21 21:05:14 -070021#include "cm.h"
22#include "cm1_44xx.h"
23#include "cm2_44xx.h"
Paul Walmsley2ace8312010-12-21 21:05:14 -070024
25/* CM1 hardware module low-level functions */
26
27/* Read a register in CM1 */
28u32 omap4_cm1_read_inst_reg(s16 inst, u16 reg)
29{
Tony Lindgrenea351c12014-05-16 15:26:22 -070030 return readl_relaxed(cm_base + inst + reg);
Paul Walmsley2ace8312010-12-21 21:05:14 -070031}
32
33/* Write into a register in CM1 */
34void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 reg)
35{
Tony Lindgrenea351c12014-05-16 15:26:22 -070036 writel_relaxed(val, cm_base + inst + reg);
Paul Walmsley2ace8312010-12-21 21:05:14 -070037}
38
39/* Read a register in CM2 */
40u32 omap4_cm2_read_inst_reg(s16 inst, u16 reg)
41{
Tony Lindgrenea351c12014-05-16 15:26:22 -070042 return readl_relaxed(cm2_base + inst + reg);
Paul Walmsley2ace8312010-12-21 21:05:14 -070043}
44
45/* Write into a register in CM2 */
46void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 reg)
47{
Tony Lindgrenea351c12014-05-16 15:26:22 -070048 writel_relaxed(val, cm2_base + inst + reg);
Paul Walmsley2ace8312010-12-21 21:05:14 -070049}