summaryrefstree
path: root/kernel/arch/arm/mach-exynos/include/mach/cpuidle.h
blob: e8028cffe4e9797a123336fc0341631eebce01d2 (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
/*
 * copyright (c) 2014 samsung electronics co., ltd.
 *		http://www.samsung.com/
 *
 * 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.
*/

#include <linux/compiler.h>

#include <asm/io.h>

#define REG_DIRECTGO_ADDR	(S5P_VA_SYSRAM_NS + 0x24)
#define REG_DIRECTGO_FLAG	(S5P_VA_SYSRAM_NS + 0x20)

#define L2_CCI_OFF		(1 << 1)

struct check_reg {
	void __iomem	*reg;
	unsigned int	check_bit;
};

int exynos_check_reg_status(struct check_reg *reg_list,
				    unsigned int list_cnt)
{
	unsigned int i;
	unsigned int tmp;

	for (i = 0; i < list_cnt; i++) {
		tmp = __raw_readl(reg_list[i].reg);
		if (tmp & reg_list[i].check_bit)
			return -EBUSY;
	}

	return 0;
}

struct sfr_bit_ctrl {
	void __iomem	*reg;
	unsigned int	offset;
	unsigned int	mask;
	unsigned int	val;
};

#define SFR_CTRL(_reg, _offset, _mask, _val)	\
	{					\
		.reg	= _reg,			\
		.offset = _offset,		\
		.mask	= _mask,		\
		.val	= _val,			\
	}

void exynos_set_sfr(struct sfr_bit_ctrl *ptr, int count)
{
	unsigned int tmp;

	for (; count > 0; count--, ptr++) {
		tmp = __raw_readl(ptr->reg);
		tmp &= ~(ptr->mask << ptr->offset);
		tmp |= (ptr->val << ptr->offset);
		__raw_writel(tmp, ptr->reg);
	}
}