From 0b9bd1cc8d48a4dcb61aa01a4a80d690f99f24a1 Mon Sep 17 00:00:00 2001 From: Jon Medhurst Date: Fri, 10 May 2013 14:47:27 +0100 Subject: [PATCH] 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 --- arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | 10 +++++ drivers/bus/arm-cci.c | 51 ++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts index 12bd4ea07eac..9d802fc71fcf 100644 --- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts +++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts @@ -129,6 +129,16 @@ }; }; + cci-pmu@2c099000 { + compatible = "arm,cci-400-pmu"; + reg = <0 0x2c099000 0 0x6000>; + interrupts = <0 101 4>, + <0 102 4>, + <0 103 4>, + <0 104 4>, + <0 105 4>; + }; + memory-controller@7ffd0000 { compatible = "arm,pl354", "arm,primecell"; reg = <0 0x7ffd0000 0 0x1000>; diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c index 380319ebf729..a621d3d8b90f 100644 --- a/drivers/bus/arm-cci.c +++ b/drivers/bus/arm-cci.c @@ -17,12 +17,15 @@ #include #include #include +#include #include #include #include #include +#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"); -- 2.34.1