Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* 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 | |
| 17 | static 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 |
| 24 | static struct resource l2_pmu_resource = { |
| 25 | .start = SC_SICL2PERFMONIRPTREQ, |
| 26 | .end = SC_SICL2PERFMONIRPTREQ, |
| 27 | .flags = IORESOURCE_IRQ, |
| 28 | }; |
| 29 | |
| 30 | static 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 | |
| 39 | static 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 | |
| 46 | static struct platform_device *pmu_devices[] = { |
| 47 | &cpu_pmu_device, |
| 48 | #ifdef CONFIG_CPU_HAS_L2_PMU |
| 49 | &l2_pmu_device, |
| 50 | #endif |
| 51 | }; |
| 52 | |
| 53 | static int __init msm_pmu_init(void) |
| 54 | { |
| 55 | return platform_add_devices(pmu_devices, ARRAY_SIZE(pmu_devices)); |
| 56 | } |
| 57 | |
| 58 | arch_initcall(msm_pmu_init); |