From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, robh@kernel.org,
frowand.list@gmail.com, mark.rutland@arm.com,
sudeep.holla@arm.com, arm@kernel.org,
linux-kernel@vger.kernel.org, matt.sealey@arm.com,
john.horley@arm.com, charles.garcia-tobin@arm.com,
coresight@lists.linaro.org, devicetree@vger.kernel.org,
mike.leach@linaro.org
Subject: Re: [PATCH 08/20] coresight: dts: Cleanup device tree graph bindings
Date: Fri, 8 Jun 2018 15:22:11 -0600 [thread overview]
Message-ID: <20180608212211.GG30587@xps15> (raw)
In-Reply-To: <1528235011-30691-9-git-send-email-suzuki.poulose@arm.com>
On Tue, Jun 05, 2018 at 10:43:19PM +0100, Suzuki K Poulose wrote:
> The coresight drivers relied on default bindings for graph
> in DT, while reusing the "reg" field of the "ports" to indicate
> the actual hardware port number for the connections. However,
> with the rules getting stricter w.r.t to the address mismatch
> with the label, it is no longer possible to use the port address
> field for the hardware port number. Hence, we add an explicit
> property to denote the hardware port number, "coresight,hwid"
> which must be specified for each "endpoint".
>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Rob Herring <robh@kernel.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
> .../devicetree/bindings/arm/coresight.txt | 29 ++++++++++---
> drivers/hwtracing/coresight/of_coresight.c | 49 +++++++++++++++++-----
> 2 files changed, 62 insertions(+), 16 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/arm/coresight.txt b/Documentation/devicetree/bindings/arm/coresight.txt
> index ed6b555..bf75ab3 100644
> --- a/Documentation/devicetree/bindings/arm/coresight.txt
> +++ b/Documentation/devicetree/bindings/arm/coresight.txt
> @@ -108,8 +108,13 @@ following properties to uniquely identify the connection details.
> "slave-mode"
>
> * Hardware Port number at the component:
> - - The hardware port number is assumed to be the address of the "port"
> - component.
> + - Each "endpoint" must define the hardware port of the local end of the
> + connection using the following property :
> +
> + "coresight,hwid" - 32bit integer, local hardware port.
> +
> + - [ ** Obsolete ** ] The hardware port number is assumed to be the address
> + of the "port" component.
>
>
>
> @@ -126,6 +131,7 @@ Example:
> etb_in_port: endpoint@0 {
> slave-mode;
> remote-endpoint = <&replicator_out_port0>;
> + coresight,hwid = <0>;
> };
> };
> };
> @@ -140,6 +146,7 @@ Example:
> tpiu_in_port: endpoint@0 {
> slave-mode;
> remote-endpoint = <&replicator_out_port1>;
> + coresight,hwid = <0>;
> };
> };
> };
> @@ -160,6 +167,7 @@ Example:
> reg = <0>;
> replicator_out_port0: endpoint {
> remote-endpoint = <&etb_in_port>;
> + coresight,hwid = <0>;
> };
> };
>
> @@ -167,15 +175,17 @@ Example:
> reg = <1>;
> replicator_out_port1: endpoint {
> remote-endpoint = <&tpiu_in_port>;
> + coresight,hwid = <1>;
> };
> };
>
> /* replicator input port */
> port@2 {
> - reg = <0>;
> + reg = <1>;
> replicator_in_port0: endpoint {
> slave-mode;
> remote-endpoint = <&funnel_out_port0>;
> + coresight,hwid = <0>;
> };
> };
> };
> @@ -197,31 +207,35 @@ Example:
> funnel_out_port0: endpoint {
> remote-endpoint =
> <&replicator_in_port0>;
> + coresight,hwid = <0>;
> };
> };
>
> /* funnel input ports */
> port@1 {
> - reg = <0>;
> + reg = <1>;
> funnel_in_port0: endpoint {
> slave-mode;
> remote-endpoint = <&ptm0_out_port>;
> + coresight,hwid = <0>;
> };
> };
>
> port@2 {
> - reg = <1>;
> + reg = <2>;
> funnel_in_port1: endpoint {
> slave-mode;
> remote-endpoint = <&ptm1_out_port>;
> + coresight,hwid = <1>;
> };
> };
>
> port@3 {
> - reg = <2>;
> + reg = <3>;
> funnel_in_port2: endpoint {
> slave-mode;
> remote-endpoint = <&etm0_out_port>;
> + coresight,hwid = <2>;
> };
> };
>
> @@ -239,6 +253,7 @@ Example:
> port {
> ptm0_out_port: endpoint {
> remote-endpoint = <&funnel_in_port0>;
> + coresight,hwid = <0>;
> };
> };
> };
> @@ -253,6 +268,7 @@ Example:
> port {
> ptm1_out_port: endpoint {
> remote-endpoint = <&funnel_in_port1>;
> + coresight,hwid = <0>;
> };
> };
> };
> @@ -269,6 +285,7 @@ Example:
> port {
> stm_out_port: endpoint {
> remote-endpoint = <&main_funnel_in_port2>;
> + coresight,hwid = <0>;
> };
> };
> };
For the binding part:
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c
> index d01a9ce..d23d7dd 100644
> --- a/drivers/hwtracing/coresight/of_coresight.c
> +++ b/drivers/hwtracing/coresight/of_coresight.c
> @@ -99,6 +99,31 @@ int of_coresight_get_cpu(const struct device_node *node)
> EXPORT_SYMBOL_GPL(of_coresight_get_cpu);
>
> /*
> + * of_coresight_endpoint_get_port_id : Get the hardware port number for the
> + * given endpoint device node. Prefer the explicit "coresight,hwid" property
> + * over the endpoint register id (obsolete bindings).
> + */
> +static int of_coresight_endpoint_get_port_id(struct device *dev,
> + struct device_node *ep_node)
> +{
> + struct of_endpoint ep;
> + int rc, port_id;
> +
> +
> + if (!of_property_read_u32(ep_node, "coresight,hwid", &port_id))
> + return port_id;
> +
> + rc = of_graph_parse_endpoint(ep_node, &ep);
> + if (rc)
> + return rc;
> + dev_warn_once(dev,
> + "ep%d: Mandatory \"coresight,hwid\" property missing.\n",
> + ep.port);
> + dev_warn_once(dev, "DT uses obsolete coresight bindings\n");
> + return ep.port;
> +}
> +
> +/*
> * of_coresight_parse_endpoint : Parse the given output endpoint @ep
> * and fill the connection information in *@pconn.
> *
> @@ -109,11 +134,11 @@ EXPORT_SYMBOL_GPL(of_coresight_get_cpu);
> * 0 - If the parsing completed without any fatal errors.
> * -Errno - Fatal error, abort the scanning.
> */
> -static int of_coresight_parse_endpoint(struct device_node *ep,
> +static int of_coresight_parse_endpoint(struct device *dev,
> + struct device_node *ep,
> struct coresight_connection **pconn)
> {
> - int ret = 0;
> - struct of_endpoint endpoint, rendpoint;
> + int ret = 0, local_port, child_port;
> struct device_node *rparent = NULL;
> struct device_node *rep = NULL;
> struct device *rdev = NULL;
> @@ -128,7 +153,8 @@ static int of_coresight_parse_endpoint(struct device_node *ep,
> break;
>
> /* Parse the local port details */
> - if (of_graph_parse_endpoint(ep, &endpoint))
> + local_port = of_coresight_endpoint_get_port_id(dev, ep);
> + if (local_port < 0)
> break;
> /*
> * Get a handle on the remote endpoint and the device it is
> @@ -140,9 +166,6 @@ static int of_coresight_parse_endpoint(struct device_node *ep,
> rparent = of_graph_get_port_parent(rep);
> if (!rparent)
> break;
> - if (of_graph_parse_endpoint(rep, &rendpoint))
> - break;
> -
> /* If the remote device is not available, defer probing */
> rdev = of_coresight_get_endpoint_device(rparent);
> if (!rdev) {
> @@ -150,9 +173,15 @@ static int of_coresight_parse_endpoint(struct device_node *ep,
> break;
> }
>
> - conn->outport = endpoint.port;
> + child_port = of_coresight_endpoint_get_port_id(rdev, rep);
> + if (child_port < 0) {
> + ret = 0;
Why returning '0' on an error condition? Same for 'local_port' above.
> + break;
> + }
> +
> + conn->outport = local_port;
> conn->child_name = dev_name(rdev);
> - conn->child_port = rendpoint.port;
> + conn->child_port = child_port;
> /* Move the connection record */
> (*pconn)++;
> } while (0);
> @@ -200,7 +229,7 @@ of_get_coresight_platform_data(struct device *dev,
> ep = of_graph_get_next_endpoint(node, ep);
> if (!ep)
> break;
> - ret = of_coresight_parse_endpoint(ep, &conn);
> + ret = of_coresight_parse_endpoint(dev, ep, &conn);
> if (ret)
> return ERR_PTR(ret);
> } while (ep);
> --
> 2.7.4
>
next prev parent reply other threads:[~2018-06-08 21:22 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-05 21:43 [PATCH 00/20] coresight: Update device tree bindings Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 01/20] coresight: Fix memory leak in coresight_register Suzuki K Poulose
2018-06-06 6:44 ` Arvind Yadav
2018-06-06 10:16 ` Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 02/20] coresight: of: Fix refcounting for graph nodes Suzuki K Poulose
2018-06-08 19:55 ` Mathieu Poirier
2018-06-11 9:18 ` Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 03/20] coresight: Fix remote endpoint parsing Suzuki K Poulose
2018-06-08 20:05 ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 04/20] coresight: Cleanup platform description data Suzuki K Poulose
2018-06-08 19:41 ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 05/20] coresight: platform: Cleanup coresight connection handling Suzuki K Poulose
2018-06-08 20:18 ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 06/20] coresight: Handle errors in finding input/output ports Suzuki K Poulose
2018-06-08 20:24 ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 07/20] coresight: dts: Document usage of graph bindings Suzuki K Poulose
2018-06-08 20:30 ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 08/20] coresight: dts: Cleanup device tree " Suzuki K Poulose
2018-06-08 21:22 ` Mathieu Poirier [this message]
2018-06-11 9:22 ` Suzuki K Poulose
2018-06-11 16:52 ` Mathieu Poirier
2018-06-11 16:55 ` Suzuki K Poulose
2018-06-11 21:51 ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 09/20] coresight: dts: Define new bindings for direction of data flow Suzuki K Poulose
2018-06-08 21:39 ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 10/20] dts: juno: Update coresight bindings for hw port Suzuki K Poulose
2018-06-08 21:49 ` Mathieu Poirier
2018-06-08 21:52 ` Mathieu Poirier
2018-06-12 9:50 ` Suzuki K Poulose
2018-06-12 10:42 ` Sudeep Holla
2018-06-05 21:43 ` [PATCH 11/20] dts: hisilicon: Update coresight bindings for hw ports Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 12/20] dts: spreadtrum: " Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 13/20] dts: qcom: " Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 14/20] dts: arm: hisilicon: Update coresight bindings for hardware port Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 15/20] dts: arm: imx7{d,s}: Update coresight binding for hardware ports Suzuki K Poulose
2018-06-19 2:12 ` Shawn Guo
2018-06-19 10:35 ` Stefan Agner
2018-06-19 14:57 ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 16/20] dts: arm: omap: Update coresight bindings " Suzuki K Poulose
2018-07-03 7:09 ` Tony Lindgren
2018-07-03 7:59 ` Suzuki K Poulose
2018-07-03 8:12 ` Tony Lindgren
2018-06-05 21:43 ` [PATCH 17/20] dts: arm: qcom: " Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 18/20] dts: sama5d2: " Suzuki K Poulose
2018-06-19 21:24 ` Alexandre Belloni
2018-06-20 9:44 ` Suzuki K Poulose
2018-06-20 10:53 ` Alexandre Belloni
2018-06-05 21:43 ` [PATCH 19/20] dts: ste-dbx5x0: Update coresight bindings for hardware port Suzuki K Poulose
2018-06-26 9:30 ` Linus Walleij
2018-06-26 9:31 ` Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 20/20] dts: tc2: Update coresight bindings for hardware ports Suzuki K Poulose
2018-06-20 9:53 ` [PATCH 00/20] coresight: Update device tree bindings Suzuki K Poulose
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180608212211.GG30587@xps15 \
--to=mathieu.poirier@linaro.org \
--cc=arm@kernel.org \
--cc=charles.garcia-tobin@arm.com \
--cc=coresight@lists.linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=john.horley@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=matt.sealey@arm.com \
--cc=mike.leach@linaro.org \
--cc=robh@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=suzuki.poulose@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).