Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm-cci: Split the code for PMU vs driver support

This patch separates the PMU driver code from the low level
CCI driver code and enables the PMU driver for ARM64.

Introduces config options for both.

ARM_CCI400_PORT_CTRL - controls the low level driver code for
CCI400 ports.
ARM_CCI400_PMU - controls the PMU driver code
ARM_CCI400_COMMON - Common defintions for CCI400

This patch also changes:
ARM_CCI - common code for probing the CCI devices. This can be
used for adding support for newer CCI versions(e.g, CCI-500).

Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Abhilash Kesavan <a.kesavan@samsung.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Punit Agrawal <punit.agrawal@arm.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Acked-by: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>

authored by

Suzuki K. Poulose and committed by
Will Deacon
ee8e5d5f 772742a6

+53 -12
+1 -1
arch/arm/mach-exynos/Kconfig
··· 123 123 config EXYNOS5420_MCPM 124 124 bool "Exynos5420 Multi-Cluster PM support" 125 125 depends on MCPM && SOC_EXYNOS5420 126 - select ARM_CCI 126 + select ARM_CCI400_PORT_CTRL 127 127 select ARM_CPU_SUSPEND 128 128 help 129 129 This is needed to provide CPU and cluster power management
+2 -2
arch/arm/mach-vexpress/Kconfig
··· 53 53 config ARCH_VEXPRESS_DCSCB 54 54 bool "Dual Cluster System Control Block (DCSCB) support" 55 55 depends on MCPM 56 - select ARM_CCI 56 + select ARM_CCI400_PORT_CTRL 57 57 help 58 58 Support for the Dual Cluster System Configuration Block (DCSCB). 59 59 This is needed to provide CPU and cluster power management ··· 71 71 config ARCH_VEXPRESS_TC2_PM 72 72 bool "Versatile Express TC2 power management" 73 73 depends on MCPM 74 - select ARM_CCI 74 + select ARM_CCI400_PORT_CTRL 75 75 select ARCH_VEXPRESS_SPC 76 76 select ARM_CPU_SUSPEND 77 77 help
+24 -4
drivers/bus/Kconfig
··· 43 43 help 44 44 Driver to enable OMAP interconnect error handling driver. 45 45 46 - config ARM_CCI 47 - bool "ARM CCI driver support" 46 + config ARM_CCI400_PORT_CTRL 47 + bool 48 48 depends on ARM && OF && CPU_V7 49 + select ARM_CCI400_COMMON 49 50 help 50 - Driver supporting the CCI cache coherent interconnect for ARM 51 - platforms. 51 + Low level power management driver for CCI400 cache coherent 52 + interconnect for ARM platforms. 53 + 54 + config ARM_CCI400_PMU 55 + bool "ARM CCI400 PMU support" 56 + default y 57 + depends on ARM || ARM64 58 + depends on HW_PERF_EVENTS 59 + select ARM_CCI400_COMMON 60 + help 61 + Support for PMU events monitoring on the ARM CCI cache coherent 62 + interconnect. 63 + 64 + If unsure, say Y 65 + 66 + config ARM_CCI400_COMMON 67 + bool 68 + select ARM_CCI 69 + 70 + config ARM_CCI 71 + bool 52 72 53 73 config ARM_CCN 54 74 bool "ARM CCN driver support"
+20 -4
drivers/bus/arm-cci.c
··· 32 32 static void __iomem *cci_ctrl_base; 33 33 static unsigned long cci_ctrl_phys; 34 34 35 + #ifdef CONFIG_ARM_CCI400_PORT_CTRL 35 36 struct cci_nb_ports { 36 37 unsigned int nb_ace; 37 38 unsigned int nb_ace_lite; ··· 43 42 .nb_ace_lite = 3 44 43 }; 45 44 45 + #define CCI400_PORTS_DATA (&cci400_ports) 46 + #else 47 + #define CCI400_PORTS_DATA (NULL) 48 + #endif 49 + 46 50 static const struct of_device_id arm_cci_matches[] = { 47 - {.compatible = "arm,cci-400", .data = &cci400_ports }, 51 + #ifdef CONFIG_ARM_CCI400_COMMON 52 + {.compatible = "arm,cci-400", .data = CCI400_PORTS_DATA }, 53 + #endif 48 54 {}, 49 55 }; 50 56 51 - #ifdef CONFIG_HW_PERF_EVENTS 57 + #ifdef CONFIG_ARM_CCI400_PMU 52 58 53 59 #define DRIVER_NAME "CCI-400" 54 60 #define DRIVER_NAME_PMU DRIVER_NAME " PMU" ··· 1030 1022 return platform_driver_register(&cci_platform_driver); 1031 1023 } 1032 1024 1033 - #else /* !CONFIG_HW_PERF_EVENTS */ 1025 + #else /* !CONFIG_ARM_CCI400_PMU */ 1034 1026 1035 1027 static int __init cci_platform_init(void) 1036 1028 { 1037 1029 return 0; 1038 1030 } 1039 1031 1040 - #endif /* CONFIG_HW_PERF_EVENTS */ 1032 + #endif /* CONFIG_ARM_CCI400_PMU */ 1033 + 1034 + #ifdef CONFIG_ARM_CCI400_PORT_CTRL 1041 1035 1042 1036 #define CCI_PORT_CTRL 0x0 1043 1037 #define CCI_CTRL_STATUS 0xc ··· 1470 1460 1471 1461 return 0; 1472 1462 } 1463 + #else /* !CONFIG_ARM_CCI400_PORT_CTRL */ 1464 + static inline int cci_probe_ports(struct device_node *np) 1465 + { 1466 + return 0; 1467 + } 1468 + #endif /* CONFIG_ARM_CCI400_PORT_CTRL */ 1473 1469 1474 1470 static int cci_probe(void) 1475 1471 {
+6 -1
include/linux/arm-cci.h
··· 30 30 31 31 #ifdef CONFIG_ARM_CCI 32 32 extern bool cci_probed(void); 33 + #else 34 + static inline bool cci_probed(void) { return false; } 35 + #endif 36 + 37 + #ifdef CONFIG_ARM_CCI400_PORT_CTRL 33 38 extern int cci_ace_get_port(struct device_node *dn); 34 39 extern int cci_disable_port_by_cpu(u64 mpidr); 35 40 extern int __cci_control_port_by_device(struct device_node *dn, bool enable); 36 41 extern int __cci_control_port_by_index(u32 port, bool enable); 37 42 #else 38 - static inline bool cci_probed(void) { return false; } 39 43 static inline int cci_ace_get_port(struct device_node *dn) 40 44 { 41 45 return -ENODEV; ··· 55 51 return -ENODEV; 56 52 } 57 53 #endif 54 + 58 55 #define cci_disable_port_by_device(dev) \ 59 56 __cci_control_port_by_device(dev, false) 60 57 #define cci_enable_port_by_device(dev) \