aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bus
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/bus')
-rw-r--r--drivers/bus/arm-cci.c24
-rw-r--r--drivers/bus/mvebu-mbus.c3
2 files changed, 14 insertions, 13 deletions
diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index 962fd35cbd8d..5a86da97a70b 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -31,7 +31,6 @@
31 31
32#define DRIVER_NAME "CCI-400" 32#define DRIVER_NAME "CCI-400"
33#define DRIVER_NAME_PMU DRIVER_NAME " PMU" 33#define DRIVER_NAME_PMU DRIVER_NAME " PMU"
34#define PMU_NAME "CCI_400"
35 34
36#define CCI_PORT_CTRL 0x0 35#define CCI_PORT_CTRL 0x0
37#define CCI_CTRL_STATUS 0xc 36#define CCI_CTRL_STATUS 0xc
@@ -88,8 +87,7 @@ static unsigned long cci_ctrl_phys;
88 87
89#define CCI_REV_R0 0 88#define CCI_REV_R0 0
90#define CCI_REV_R1 1 89#define CCI_REV_R1 1
91#define CCI_REV_R0_P4 4 90#define CCI_REV_R1_PX 5
92#define CCI_REV_R1_P2 6
93 91
94#define CCI_PMU_EVT_SEL 0x000 92#define CCI_PMU_EVT_SEL 0x000
95#define CCI_PMU_CNTR 0x004 93#define CCI_PMU_CNTR 0x004
@@ -163,6 +161,15 @@ static struct pmu_port_event_ranges port_event_range[] = {
163 }, 161 },
164}; 162};
165 163
164/*
165 * Export different PMU names for the different revisions so userspace knows
166 * because the event ids are different
167 */
168static char *const pmu_names[] = {
169 [CCI_REV_R0] = "CCI_400",
170 [CCI_REV_R1] = "CCI_400_r1",
171};
172
166struct cci_pmu_drv_data { 173struct cci_pmu_drv_data {
167 void __iomem *base; 174 void __iomem *base;
168 struct arm_pmu *cci_pmu; 175 struct arm_pmu *cci_pmu;
@@ -193,21 +200,16 @@ static int probe_cci_revision(void)
193 rev = readl_relaxed(cci_ctrl_base + CCI_PID2) & CCI_PID2_REV_MASK; 200 rev = readl_relaxed(cci_ctrl_base + CCI_PID2) & CCI_PID2_REV_MASK;
194 rev >>= CCI_PID2_REV_SHIFT; 201 rev >>= CCI_PID2_REV_SHIFT;
195 202
196 if (rev <= CCI_REV_R0_P4) 203 if (rev < CCI_REV_R1_PX)
197 return CCI_REV_R0; 204 return CCI_REV_R0;
198 else if (rev <= CCI_REV_R1_P2) 205 else
199 return CCI_REV_R1; 206 return CCI_REV_R1;
200
201 return -ENOENT;
202} 207}
203 208
204static struct pmu_port_event_ranges *port_range_by_rev(void) 209static struct pmu_port_event_ranges *port_range_by_rev(void)
205{ 210{
206 int rev = probe_cci_revision(); 211 int rev = probe_cci_revision();
207 212
208 if (rev < 0)
209 return NULL;
210
211 return &port_event_range[rev]; 213 return &port_event_range[rev];
212} 214}
213 215
@@ -526,7 +528,7 @@ static void pmu_write_counter(struct perf_event *event, u32 value)
526static int cci_pmu_init(struct arm_pmu *cci_pmu, struct platform_device *pdev) 528static int cci_pmu_init(struct arm_pmu *cci_pmu, struct platform_device *pdev)
527{ 529{
528 *cci_pmu = (struct arm_pmu){ 530 *cci_pmu = (struct arm_pmu){
529 .name = PMU_NAME, 531 .name = pmu_names[probe_cci_revision()],
530 .max_period = (1LLU << 32) - 1, 532 .max_period = (1LLU << 32) - 1,
531 .get_hw_events = pmu_get_hw_events, 533 .get_hw_events = pmu_get_hw_events,
532 .get_event_idx = pmu_get_event_idx, 534 .get_event_idx = pmu_get_event_idx,
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index 2ac754e18bcf..293e2e0a0a87 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -890,13 +890,12 @@ int __init mvebu_mbus_dt_init(void)
890 const __be32 *prop; 890 const __be32 *prop;
891 int ret; 891 int ret;
892 892
893 np = of_find_matching_node(NULL, of_mvebu_mbus_ids); 893 np = of_find_matching_node_and_match(NULL, of_mvebu_mbus_ids, &of_id);
894 if (!np) { 894 if (!np) {
895 pr_err("could not find a matching SoC family\n"); 895 pr_err("could not find a matching SoC family\n");
896 return -ENODEV; 896 return -ENODEV;
897 } 897 }
898 898
899 of_id = of_match_node(of_mvebu_mbus_ids, np);
900 mbus_state.soc = of_id->data; 899 mbus_state.soc = of_id->data;
901 900
902 prop = of_get_property(np, "controller", NULL); 901 prop = of_get_property(np, "controller", NULL);