ARM: mm: Recreate kernel mappings in early_paging_init()
[linux/fpc-iii.git] / drivers / devfreq / exynos / exynos_ppmu.c
blob85fc5ac1036af0f22acc61b2bc766c9e8af6044f
1 /*
2 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com/
5 * EXYNOS - PPMU support
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.
12 #include <linux/kernel.h>
13 #include <linux/types.h>
14 #include <linux/io.h>
16 #include "exynos_ppmu.h"
18 void exynos_ppmu_reset(void __iomem *ppmu_base)
20 __raw_writel(PPMU_CYCLE_RESET | PPMU_COUNTER_RESET, ppmu_base);
21 __raw_writel(PPMU_ENABLE_CYCLE |
22 PPMU_ENABLE_COUNT0 |
23 PPMU_ENABLE_COUNT1 |
24 PPMU_ENABLE_COUNT2 |
25 PPMU_ENABLE_COUNT3,
26 ppmu_base + PPMU_CNTENS);
29 void exynos_ppmu_setevent(void __iomem *ppmu_base, unsigned int ch,
30 unsigned int evt)
32 __raw_writel(evt, ppmu_base + PPMU_BEVTSEL(ch));
35 void exynos_ppmu_start(void __iomem *ppmu_base)
37 __raw_writel(PPMU_ENABLE, ppmu_base);
40 void exynos_ppmu_stop(void __iomem *ppmu_base)
42 __raw_writel(PPMU_DISABLE, ppmu_base);
45 unsigned int exynos_ppmu_read(void __iomem *ppmu_base, unsigned int ch)
47 unsigned int total;
49 if (ch == PPMU_PMNCNT3)
50 total = ((__raw_readl(ppmu_base + PMCNT_OFFSET(ch)) << 8) |
51 __raw_readl(ppmu_base + PMCNT_OFFSET(ch + 1)));
52 else
53 total = __raw_readl(ppmu_base + PMCNT_OFFSET(ch));
55 return total;