summaryrefslogtreecommitdiffstats
path: root/drivers/coresight
diff options
context:
space:
mode:
authorMathieu Poirier <mathieu.poirier@linaro.org>2015-01-26 17:22:23 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-02-04 19:42:55 +0100
commit34a03c1d30f04ca7439c685c0ea9b7d79c353705 (patch)
tree19cfb12b7351e93ae67de3aff75e31dba29f3501 /drivers/coresight
parentcoresight: remove the unnecessary function coresight_is_bit_set() (diff)
downloadlinux-34a03c1d30f04ca7439c685c0ea9b7d79c353705.tar.xz
linux-34a03c1d30f04ca7439c685c0ea9b7d79c353705.zip
coresight: fixing CPU hwid lookup in device tree
Some DT specification will represent CPU nodes with address cells greater than one, making the current code fail. Using the proper retrieval helper function ensure the correct hwid for CPUs is read properly with different address cell size. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/coresight')
-rw-r--r--drivers/coresight/of_coresight.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/coresight/of_coresight.c b/drivers/coresight/of_coresight.c
index 9a5ff56f34d9..c3efa418a86d 100644
--- a/drivers/coresight/of_coresight.c
+++ b/drivers/coresight/of_coresight.c
@@ -117,7 +117,7 @@ struct coresight_platform_data *of_get_coresight_platform_data(
struct coresight_platform_data *pdata;
struct of_endpoint endpoint, rendpoint;
struct device *rdev;
- struct device_node *cpu;
+ struct device_node *dn;
struct device_node *ep = NULL;
struct device_node *rparent = NULL;
struct device_node *rport = NULL;
@@ -186,14 +186,16 @@ struct coresight_platform_data *of_get_coresight_platform_data(
/* Affinity defaults to CPU0 */
pdata->cpu = 0;
- cpu = of_parse_phandle(node, "cpu", 0);
- if (cpu) {
- const u32 *mpidr;
+ dn = of_parse_phandle(node, "cpu", 0);
+ if (dn) {
+ const u32 *cell;
int len, index;
+ u64 hwid;
- mpidr = of_get_property(cpu, "reg", &len);
- if (mpidr && len == 4) {
- index = get_logical_index(be32_to_cpup(mpidr));
+ cell = of_get_property(dn, "reg", &len);
+ if (cell) {
+ hwid = of_read_number(cell, of_n_addr_cells(dn));
+ index = get_logical_index(hwid);
if (index != -EINVAL)
pdata->cpu = index;
}