From patchwork Fri Jan 23 19:35:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 5697591 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CDD65C058D for ; Fri, 23 Jan 2015 19:39:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3BD6202C8 for ; Fri, 23 Jan 2015 19:39:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CEDCD202BE for ; Fri, 23 Jan 2015 19:39:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YEk26-00017A-Ds; Fri, 23 Jan 2015 19:36:42 +0000 Received: from mail-pd0-f176.google.com ([209.85.192.176]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YEk22-0000z4-QA for linux-arm-kernel@lists.infradead.org; Fri, 23 Jan 2015 19:36:39 +0000 Received: by mail-pd0-f176.google.com with SMTP id y10so10295068pdj.7 for ; Fri, 23 Jan 2015 11:36:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=R4OAbvB6RT7Lb8/1qlHNtgxVlzpUbgKH7qH5i35xNoE=; b=JaFF5jRY5ZYG+EUA/PEQ5t3/I4N2YVlqvoexnRywqu/ZFZ9rmjTBFLfKCRLtl4gJYH SC3lKNadOzajRXZ//oPqtALv+Sh8cvTVnEw1IFUL7wQONPSA4hP0O9mBkC5smBFrYLD5 TL/+2Ic5p9F4QQjbJKgTpOHz6sdtEnp80CRb2a1p5q5Z+5J6voMhlGjRKEpNolIjOjQS r8WSky2pQhvQ90bwy9kU3aesVfB3J64/uLuyLCJWvB4y5eWPaOpkByZuH8SMCIW5TK8e KL68xHFGi1/fIcFv6vkWMtQtNYgle+dJC6pEy9UR3JPSBWbX/mGr5JaFfADaxzDqhOpI O6ig== X-Gm-Message-State: ALoCoQnaZCmM0XylFXv6OXrkoaoDBlP8jydPjvL2zjydfGJBtkCgM6ukEu2aMee6L8w1A2wtsMz2 X-Received: by 10.66.121.168 with SMTP id ll8mr14064884pab.34.1422041777136; Fri, 23 Jan 2015 11:36:17 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [70.73.24.112]) by mx.google.com with ESMTPSA id mt4sm2691998pdb.55.2015.01.23.11.36.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Jan 2015 11:36:16 -0800 (PST) From: mathieu.poirier@linaro.org To: mathieu.poirier@linaro.org Subject: [PATCH] coresight: fixing CPU hwid lookup in device tree Date: Fri, 23 Jan 2015 12:35:41 -0700 Message-Id: <1422041741-26803-1-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150123_113638_882166_439DD8DE X-CRM114-Status: GOOD ( 11.09 ) X-Spam-Score: -0.7 (/) Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mathieu Poirier 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 --- drivers/coresight/of_coresight.c | 16 +++++++++------- 1 file 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; }