blob: 81d4e5beb5d04fd4b3773284b5fd537e6e1885c9 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/platform_device.h>
14#include <asm/pmu.h>
15#include <mach/irqs.h>
16
17static struct resource cpu_pmu_resource = {
18 .start = INT_ARMQC_PERFMON,
19 .end = INT_ARMQC_PERFMON,
20 .flags = IORESOURCE_IRQ,
21};
22
23#ifdef CONFIG_CPU_HAS_L2_PMU
24static struct resource l2_pmu_resource = {
25 .start = SC_SICL2PERFMONIRPTREQ,
26 .end = SC_SICL2PERFMONIRPTREQ,
27 .flags = IORESOURCE_IRQ,
28};
29
30static struct platform_device l2_pmu_device = {
31 .name = "l2-arm-pmu",
32 .id = ARM_PMU_DEVICE_L2,
33 .resource = &l2_pmu_resource,
34 .num_resources = 1,
35};
36
37#endif
38
39static struct platform_device cpu_pmu_device = {
40 .name = "cpu-arm-pmu",
41 .id = ARM_PMU_DEVICE_CPU,
42 .resource = &cpu_pmu_resource,
43 .num_resources = 1,
44};
45
46static struct platform_device *pmu_devices[] = {
47 &cpu_pmu_device,
48#ifdef CONFIG_CPU_HAS_L2_PMU
49 &l2_pmu_device,
50#endif
51};
52
53static int __init msm_pmu_init(void)
54{
55 return platform_add_devices(pmu_devices, ARRAY_SIZE(pmu_devices));
56}
57
58arch_initcall(msm_pmu_init);