From patchwork Tue Feb 28 15:06:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 94638 Delivered-To: patch@linaro.org Received: by 10.140.20.113 with SMTP id 104csp1366046qgi; Tue, 28 Feb 2017 07:17:40 -0800 (PST) X-Received: by 10.98.86.68 with SMTP id k65mr3079111pfb.13.1488295060625; Tue, 28 Feb 2017 07:17:40 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s2si2047388pgd.4.2017.02.28.07.17.40; Tue, 28 Feb 2017 07:17:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751660AbdB1PRj (ORCPT + 7 others); Tue, 28 Feb 2017 10:17:39 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:34973 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751135AbdB1PRi (ORCPT ); Tue, 28 Feb 2017 10:17:38 -0500 Received: by mail-pf0-f180.google.com with SMTP id j5so4886755pfb.2 for ; Tue, 28 Feb 2017 07:16:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=Cp7AuFlhtE4fJG8aY8VbshtYV847O7UW521FPWzisf8=; b=ACf32OpK0WBk7t5Mh837Rz7P+acfunxpXKBv8qp6xYSIAVWBN07yJt61XcscVrhD/+ bJNlplYTfJkkCdDHLaoFgNRLFZKmSzijjG4D7FRgoMiTT5yR2jrub/846sVsPwzijMSL yesQ3atO1Ieh2Y+VCNCO2rjnBEF2D6u91EShU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Cp7AuFlhtE4fJG8aY8VbshtYV847O7UW521FPWzisf8=; b=pEnPy3go6NtoA+jkrsCMbDXIABxXbC9D6DIFUXj7X+zGRlmND2WbxBGz0yktbYetG6 audWRF4/7/8GO2qPAKct0GAwPc/j1Clw3/wSpK1/44/bH7JIWo5XwzvGBz0KfPoKmcm7 iCpX7PVKzGA1qNxjSdOWQifpvT+EjmtRrvkum8sMZeAkpKHUhAg2dRBs7zCCeHqntN27 bU7Ig+8R06aSeTXBHTXk2C1ojdusPjRwGy40526qu3RgwAYvNpKfjB3HGaEiSfff91aJ HOcneoFf0NxkhuRt0W8LmOYD+i9jmzKathS6WXqpNxszaMOmaDjOIPwXIbZIvdP0A9lq YilQ== X-Gm-Message-State: AMke39lu8Hep1zuk8crwizIGERXXTNrPDNIH5BfTfRqoMt2MoH4zWbasLi5+EY0Ga7w1+6Sd X-Received: by 10.84.208.227 with SMTP id c32mr3568510plj.71.1488294483770; Tue, 28 Feb 2017 07:08:03 -0800 (PST) Received: from localhost.localdomain ([103.192.224.50]) by smtp.gmail.com with ESMTPSA id c64sm4926145pfa.45.2017.02.28.07.07.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Feb 2017 07:08:02 -0800 (PST) From: Leo Yan To: Rob Herring , Mark Rutland , Mathieu Poirier , Leo Yan , Greg Kroah-Hartman , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org Subject: [PATCH v2 1/3] coresight: bindings for debug module Date: Tue, 28 Feb 2017 23:06:58 +0800 Message-Id: <1488294420-14188-2-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488294420-14188-1-git-send-email-leo.yan@linaro.org> References: <1488294420-14188-1-git-send-email-leo.yan@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org According to ARMv8 architecture reference manual (ARM DDI 0487A.k) Chapter 'Part H: External debug', the CPU can integrate debug module and it can support self-hosted debug and external debug. Especially for supporting self-hosted debug, this means the program can access the debug module from mmio region; and usually the mmio region is integrated with coresight. So add document for binding debug component, includes binding to APB clock; and also need specify the CPU node which the debug module is dedicated to specific CPU. Suggested-by: Mike Leach Signed-off-by: Leo Yan --- .../devicetree/bindings/arm/coresight-debug.txt | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/coresight-debug.txt -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/arm/coresight-debug.txt b/Documentation/devicetree/bindings/arm/coresight-debug.txt new file mode 100644 index 0000000..89820d5 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/coresight-debug.txt @@ -0,0 +1,40 @@ +* CoreSight Debug Component: + +CoreSight debug component are compliant with the ARMv8 architecture reference +manual (ARM DDI 0487A.k) Chapter 'Part H: External debug'. The external debug +module is mainly used for two modes: self-hosted debug and external debug, and +it can be accessed from mmio region from Coresight and eventually the debug +module connects with CPU for debugging. And the debug module provides +sample-based profiling extension, which can be used to sample CPU program +counter, secure state and exception level, etc; usually every CPU has one +dedicated debug module to be connected. + +Required properties: + +- compatible : should be + * "arm,coresight-debug", "arm,primecell"; supplemented with + "arm,primecell" as driver is using the AMBA bus interface. + +- reg : physical base address and length of the register set. + +- clocks : the clock associated to this component. + +- clock-names : the name of the clock referenced by the code. Since we are + using the AMBA framework, the name of the clock providing + the interconnect should be "apb_pclk" and the clock is + mandatory. The interface between the debug logic and the + processor core is clocked by the internal CPU clock, so it + is enabled with CPU clock by default. + +- cpu : the cpu phandle the debug module is affined to. When omitted + the source is considered to belong to CPU0. + +Example: + + debug@f6590000 { + compatible = "arm,coresight-debug","arm,primecell"; + reg = <0 0xf6590000 0 0x1000>; + clocks = <&sys_ctrl HI6220_DAPB_CLK>; + clock-names = "apb_pclk"; + cpu = <&cpu0>; + }; From patchwork Tue Feb 28 15:06:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 94630 Delivered-To: patch@linaro.org Received: by 10.140.20.113 with SMTP id 104csp1362094qgi; Tue, 28 Feb 2017 07:09:11 -0800 (PST) X-Received: by 10.99.122.71 with SMTP id j7mr3106180pgn.52.1488294551332; Tue, 28 Feb 2017 07:09:11 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a91si2007213pld.245.2017.02.28.07.09.11; Tue, 28 Feb 2017 07:09:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751986AbdB1PJJ (ORCPT + 7 others); Tue, 28 Feb 2017 10:09:09 -0500 Received: from mail-pg0-f45.google.com ([74.125.83.45]:34494 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751507AbdB1PJI (ORCPT ); Tue, 28 Feb 2017 10:09:08 -0500 Received: by mail-pg0-f45.google.com with SMTP id p5so6194770pga.1 for ; Tue, 28 Feb 2017 07:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=/oF6k4xAOGxl6YX+AVR2szNvAgCg7QI0Rj1zJDeITOk=; b=YFGPgA3SnioC7XOjoER5GLnxYCyC6rrfVwZzsUc6AtTaPrdsueesAET/+pkvt0A79P Bk6WgSBBi5vF+1bzoh7k3A8iO21apJhE1b1pTsQ3fOGwEyTEmYfPizgYVZ0Ho7yQAR1E ioAu28QvypEUrxVRLUryr2h1B541hRhA8/rAo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=/oF6k4xAOGxl6YX+AVR2szNvAgCg7QI0Rj1zJDeITOk=; b=XTEa/qn0V6oTwn74Bs4i+dcb1mPhwTGt1rVcTsTGoc/yyIo+B5mu4RIakoNuIB7eI4 oIQYcss0b9avo9/9OPguCF5hOJXWMy+gSnwwkjzO43gClf56UXjUZD/XZAIvHsCgghxo 73DDy7iRkG+NMRjjeT4yYYvjaKtHULy8EsKoVf1cRCEF0cEgIBgTIOIi7mKAcl3pzj1X srjAuvkFUQZoZ0SM25/lrMJTM+aPs4p5LlATY4a6sXjstQBG2PS7BPQXcKo3fStkdexZ UshPjtqiUoGe+yeLgGNSa127eE9huMg0k31TxHpX/4WxPXtmxo/rA55bZiUDQIEtiQuF iJHA== X-Gm-Message-State: AMke39kk6chdTTCUcyuFb5AGkZGVKKsvfGMRjOnT2OoNic7ekz/bINdn5VZ9kS3KzQEC1rQD X-Received: by 10.99.111.8 with SMTP id k8mr1959298pgc.29.1488294488582; Tue, 28 Feb 2017 07:08:08 -0800 (PST) Received: from localhost.localdomain ([103.192.224.50]) by smtp.gmail.com with ESMTPSA id c64sm4926145pfa.45.2017.02.28.07.08.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Feb 2017 07:08:07 -0800 (PST) From: Leo Yan To: Rob Herring , Mark Rutland , Mathieu Poirier , Leo Yan , Greg Kroah-Hartman , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org Subject: [PATCH v2 2/3] coresight: refactor with function of_coresight_get_cpu Date: Tue, 28 Feb 2017 23:06:59 +0800 Message-Id: <1488294420-14188-3-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488294420-14188-1-git-send-email-leo.yan@linaro.org> References: <1488294420-14188-1-git-send-email-leo.yan@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This is refactor to add function of_coresight_get_cpu(), so it's used to retrieve CPU id for coresight component. Finally can use it as a common function for multiple places. Suggested-by: Mathieu Poirier Signed-off-by: Leo Yan --- drivers/hwtracing/coresight/of_coresight.c | 35 ++++++++++++++++++++---------- include/linux/coresight.h | 2 ++ 2 files changed, 25 insertions(+), 12 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c index 629e031..2e7bbe2 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/of_coresight.c @@ -101,14 +101,34 @@ static int of_coresight_alloc_memory(struct device *dev, return 0; } +int of_coresight_get_cpu(struct device_node *node) +{ + int cpu; + struct device_node *dn; + + dn = of_parse_phandle(node, "cpu", 0); + + /* Affinity defaults to CPU0 */ + if (!dn) + return 0; + + for_each_possible_cpu(cpu) { + if (dn == of_get_cpu_node(cpu, NULL)) + break; + } + of_node_put(dn); + + return cpu; +} +EXPORT_SYMBOL_GPL(of_coresight_get_cpu); + struct coresight_platform_data *of_get_coresight_platform_data( struct device *dev, struct device_node *node) { - int i = 0, ret = 0, cpu; + int i = 0, ret = 0; struct coresight_platform_data *pdata; struct of_endpoint endpoint, rendpoint; struct device *rdev; - struct device_node *dn; struct device_node *ep = NULL; struct device_node *rparent = NULL; struct device_node *rport = NULL; @@ -175,16 +195,7 @@ struct coresight_platform_data *of_get_coresight_platform_data( } while (ep); } - /* Affinity defaults to CPU0 */ - pdata->cpu = 0; - dn = of_parse_phandle(node, "cpu", 0); - for (cpu = 0; dn && cpu < nr_cpu_ids; cpu++) { - if (dn == of_get_cpu_node(cpu, NULL)) { - pdata->cpu = cpu; - break; - } - } - of_node_put(dn); + pdata->cpu = of_coresight_get_cpu(node); return pdata; } diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 2a5982c..6709561 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -263,11 +263,13 @@ static inline int coresight_timeout(void __iomem *addr, u32 offset, #endif #ifdef CONFIG_OF +extern int of_coresight_get_cpu(struct device_node *node); extern struct coresight_platform_data *of_get_coresight_platform_data( struct device *dev, struct device_node *node); #else static inline struct coresight_platform_data *of_get_coresight_platform_data( struct device *dev, struct device_node *node) { return NULL; } +static int of_coresight_get_cpu(struct device_node *node) { return 0; } #endif #ifdef CONFIG_PID_NS