summaryrefslogtreecommitdiff
path: root/arch/arm/mach-omap2/control.c
blob: a5d86a49c213a57328db56d38ef547b42cee55c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * OMAP2/3 System Control Module register access
 *
 * Copyright (C) 2007 Texas Instruments, Inc.
 * Copyright (C) 2007 Nokia Corporation
 *
 * Written by Paul Walmsley
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#undef DEBUG

#include <linux/kernel.h>

#include <asm/io.h>

#include <asm/arch/control.h>

static u32 omap2_ctrl_base;

#define OMAP_CTRL_REGADDR(reg)	(void __iomem *)IO_ADDRESS(omap2_ctrl_base \
								+ (reg))

void omap_ctrl_base_set(u32 base)
{
	omap2_ctrl_base = base;
}

u32 omap_ctrl_base_get(void)
{
	return omap2_ctrl_base;
}

u8 omap_ctrl_readb(u16 offset)
{
	return __raw_readb(OMAP_CTRL_REGADDR(offset));
}

u16 omap_ctrl_readw(u16 offset)
{
	return __raw_readw(OMAP_CTRL_REGADDR(offset));
}

u32 omap_ctrl_readl(u16 offset)
{
	return __raw_readl(OMAP_CTRL_REGADDR(offset));
}

void omap_ctrl_writeb(u8 val, u16 offset)
{
	pr_debug("omap_ctrl_writeb: writing 0x%0x to 0x%0x\n", val,
		 (u32)OMAP_CTRL_REGADDR(offset));

	__raw_writeb(val, OMAP_CTRL_REGADDR(offset));
}

void omap_ctrl_writew(u16 val, u16 offset)
{
	pr_debug("omap_ctrl_writew: writing 0x%0x to 0x%0x\n", val,
		 (u32)OMAP_CTRL_REGADDR(offset));

	__raw_writew(val, OMAP_CTRL_REGADDR(offset));
}

void omap_ctrl_writel(u32 val, u16 offset)
{
	pr_debug("omap_ctrl_writel: writing 0x%0x to 0x%0x\n", val,
		 (u32)OMAP_CTRL_REGADDR(offset));

	__raw_writel(val, OMAP_CTRL_REGADDR(offset));
}