1 /* linux/arch/arm/mach-s5pv310/ppmu.c
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
6 * S5PV310 - CPU PPMU support
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/types.h>
14 #include <linux/kernel.h>
15 #include <linux/err.h>
19 #include <mach/regs-clock.h>
20 #include <mach/ppmu.h>
22 void s5pv310_ppmu_reset(struct s5pv310_ppmu_hw *ppmu)
24 void __iomem *ppmu_base = ppmu->hw_base;
26 __raw_writel(0x3 << 1, ppmu_base);
27 __raw_writel(0x8000000f, ppmu_base + 0x0010);
28 __raw_writel(0x8000000f, ppmu_base + 0x0030);
30 __raw_writel(0x0, ppmu_base + DEVT0_ID);
31 __raw_writel(0x0, ppmu_base + DEVT0_IDMSK);
33 __raw_writel(0x0, ppmu_base + DEVT1_ID);
34 __raw_writel(0x0, ppmu_base + DEVT1_IDMSK);
44 void s5pv310_ppmu_setevent(struct s5pv310_ppmu_hw *ppmu,
45 unsigned int evt, unsigned int evt_num)
47 void __iomem *ppmu_base = ppmu->hw_base;
51 __raw_writel(evt , ppmu_base + DEVT0_SEL + (evt_num * 0x100));
54 void s5pv310_ppmu_start(struct s5pv310_ppmu_hw *ppmu)
56 void __iomem *ppmu_base = ppmu->hw_base;
58 __raw_writel(0x1, ppmu_base);
61 void s5pv310_ppmu_stop(struct s5pv310_ppmu_hw *ppmu)
63 void __iomem *ppmu_base = ppmu->hw_base;
65 __raw_writel(0x0, ppmu_base);
68 void s5pv310_ppmu_update(struct s5pv310_ppmu_hw *ppmu)
70 void __iomem *ppmu_base = ppmu->hw_base;
73 ppmu->ccnt = __raw_readl(ppmu_base + 0x0100);
76 for (i = 0; i < NUMBER_OF_COUNTER; i++) {
78 __raw_readl(ppmu_base + (0x110 + (0x10 * i)));