aboutsummaryrefslogtreecommitdiff
path: root/drivers/bus
diff options
context:
space:
mode:
authorJon Medhurst <tixy@linaro.org>2013-05-10 14:47:27 +0100
committerJon Medhurst <tixy@linaro.org>2013-07-01 11:04:53 +0100
commit0b9bd1cc8d48a4dcb61aa01a4a80d690f99f24a1 (patch)
tree9e85f94157f8c515f5af3aaef43ddd70edae0be2 /drivers/bus
parent1d36a70525f2876794e1b3e4bc8b82c7d43682b4 (diff)
drivers: ARM CCI: Add a platform driver stub for the PMU
This is a hack to enable the old CCI PMU patches to be used with the new CCI driver. The CCI PMU is (mis)represented by a separate node in TC2 device-tree. Signed-off-by: Jon Medhurst <tixy@linaro.org>
Diffstat (limited to 'drivers/bus')
-rw-r--r--drivers/bus/arm-cci.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index 380319ebf72..a621d3d8b90 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -17,12 +17,15 @@
#include <linux/arm-cci.h>
#include <linux/io.h>
#include <linux/module.h>
+#include <linux/platform_device.h>
#include <linux/of_address.h>
#include <linux/slab.h>
#include <asm/cacheflush.h>
#include <asm/smp_plat.h>
+#define DRIVER_NAME "CCI"
+
#define CCI_PORT_CTRL 0x0
#define CCI_CTRL_STATUS 0xc
@@ -54,6 +57,53 @@ static unsigned int nb_cci_ports;
static void __iomem *cci_ctrl_base;
static unsigned long cci_ctrl_phys;
+#ifdef CONFIG_HW_PERF_EVENTS
+
+static void __iomem *cci_pmu_base;
+
+static int cci_pmu_probe(struct platform_device *pdev)
+{
+ struct resource *res;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ cci_pmu_base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(cci_pmu_base))
+ return PTR_ERR(cci_pmu_base);
+
+ return 0;
+}
+
+static const struct of_device_id arm_cci_pmu_matches[] = {
+ {.compatible = "arm,cci-400-pmu"},
+ {},
+};
+
+static struct platform_driver cci_pmu_platform_driver = {
+ .driver = {
+ .name = DRIVER_NAME,
+ .of_match_table = arm_cci_pmu_matches,
+ },
+ .probe = cci_pmu_probe,
+};
+
+static int __init cci_pmu_init(void)
+{
+ if (platform_driver_register(&cci_pmu_platform_driver))
+ WARN(1, "unable to register CCI platform driver\n");
+ return 0;
+}
+
+#else
+
+static int __init cci_pmu_init(void)
+{
+ return 0;
+}
+
+static void cci_pmu_destroy(void) { }
+
+#endif /* CONFIG_HW_PERF_EVENTS */
+
struct cpu_port {
u64 mpidr;
u32 port;
@@ -529,5 +579,6 @@ bool __init cci_probed(void)
EXPORT_SYMBOL_GPL(cci_probed);
early_initcall(cci_init);
+core_initcall(cci_pmu_init);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("ARM CCI support");