blob: 5e339da6d15a97a7f77c8954b1c6a88c4ef9be34 [file] [log] [blame]
Chintan Pandya9a429932012-02-13 19:14:16 +05301/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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
Chintan Pandya9a429932012-02-13 19:14:16 +053017static struct resource cpu_pmu_resource[] = {
18 {
19 .start = INT_ARMQC_PERFMON,
20 .end = INT_ARMQC_PERFMON,
21 .flags = IORESOURCE_IRQ,
22 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070023};
24
25#ifdef CONFIG_CPU_HAS_L2_PMU
Chintan Pandya9a429932012-02-13 19:14:16 +053026static struct resource l2_pmu_resource[] = {
27 {
28 .start = SC_SICL2PERFMONIRPTREQ,
29 .end = SC_SICL2PERFMONIRPTREQ,
30 .flags = IORESOURCE_IRQ,
31 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032};
33
34static struct platform_device l2_pmu_device = {
35 .name = "l2-arm-pmu",
Ashwin Chaugule4a81cb82012-06-07 13:40:54 -040036 .id = ARM_PMU_DEVICE_L2CC,
Chintan Pandya9a429932012-02-13 19:14:16 +053037 .resource = l2_pmu_resource,
38 .num_resources = ARRAY_SIZE(l2_pmu_resource),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070039};
40
41#endif
42
43static struct platform_device cpu_pmu_device = {
44 .name = "cpu-arm-pmu",
45 .id = ARM_PMU_DEVICE_CPU,
Chintan Pandya9a429932012-02-13 19:14:16 +053046 .resource = cpu_pmu_resource,
47 .num_resources = ARRAY_SIZE(cpu_pmu_resource),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070048};
49
50static struct platform_device *pmu_devices[] = {
51 &cpu_pmu_device,
52#ifdef CONFIG_CPU_HAS_L2_PMU
53 &l2_pmu_device,
54#endif
55};
56
57static int __init msm_pmu_init(void)
58{
59 return platform_add_devices(pmu_devices, ARRAY_SIZE(pmu_devices));
60}
61
62arch_initcall(msm_pmu_init);