Chintan Pandya | 9a42993 | 2012-02-13 19:14:16 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 | |
Chintan Pandya | 9a42993 | 2012-02-13 19:14:16 +0530 | [diff] [blame] | 17 | static struct resource cpu_pmu_resource[] = { |
| 18 | { |
| 19 | .start = INT_ARMQC_PERFMON, |
| 20 | .end = INT_ARMQC_PERFMON, |
| 21 | .flags = IORESOURCE_IRQ, |
| 22 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 23 | }; |
| 24 | |
| 25 | #ifdef CONFIG_CPU_HAS_L2_PMU |
Chintan Pandya | 9a42993 | 2012-02-13 19:14:16 +0530 | [diff] [blame] | 26 | static struct resource l2_pmu_resource[] = { |
| 27 | { |
| 28 | .start = SC_SICL2PERFMONIRPTREQ, |
| 29 | .end = SC_SICL2PERFMONIRPTREQ, |
| 30 | .flags = IORESOURCE_IRQ, |
| 31 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | static struct platform_device l2_pmu_device = { |
| 35 | .name = "l2-arm-pmu", |
Ashwin Chaugule | 4a81cb8 | 2012-06-07 13:40:54 -0400 | [diff] [blame] | 36 | .id = ARM_PMU_DEVICE_L2CC, |
Chintan Pandya | 9a42993 | 2012-02-13 19:14:16 +0530 | [diff] [blame] | 37 | .resource = l2_pmu_resource, |
| 38 | .num_resources = ARRAY_SIZE(l2_pmu_resource), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | #endif |
| 42 | |
| 43 | static struct platform_device cpu_pmu_device = { |
| 44 | .name = "cpu-arm-pmu", |
| 45 | .id = ARM_PMU_DEVICE_CPU, |
Chintan Pandya | 9a42993 | 2012-02-13 19:14:16 +0530 | [diff] [blame] | 46 | .resource = cpu_pmu_resource, |
| 47 | .num_resources = ARRAY_SIZE(cpu_pmu_resource), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | static struct platform_device *pmu_devices[] = { |
| 51 | &cpu_pmu_device, |
| 52 | #ifdef CONFIG_CPU_HAS_L2_PMU |
| 53 | &l2_pmu_device, |
| 54 | #endif |
| 55 | }; |
| 56 | |
| 57 | static int __init msm_pmu_init(void) |
| 58 | { |
| 59 | return platform_add_devices(pmu_devices, ARRAY_SIZE(pmu_devices)); |
| 60 | } |
| 61 | |
| 62 | arch_initcall(msm_pmu_init); |