[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b51c8f75-97f8-604d-cf1a-770cca4078aa@quicinc.com>
Date: Tue, 30 May 2023 12:21:05 -0700
From: Trilok Soni <quic_tsoni@...cinc.com>
To: Mao Jinlong <quic_jinlmao@...cinc.com>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
"Mike Leach" <mike.leach@...aro.org>, Leo Yan <leo.yan@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>
CC: <coresight@...ts.linaro.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
<devicetree@...r.kernel.org>,
Tingwei Zhang <quic_tingweiz@...cinc.com>,
Yuanfang Zhang <quic_yuanfang@...cinc.com>,
Tao Zhang <quic_taozha@...cinc.com>,
Hao Zhang <quic_hazha@...cinc.com>
Subject: Re: [PATCH v1 1/3] Coresight: Add driver to support for CSR
On 5/26/2023 8:35 AM, Mao Jinlong wrote:
> This driver provides support for CoreSight Slave Register block
> that hosts miscellaneous configuration registers. Those
> configuration registers can be used to control, various coresight
> configurations.
>
> Signed-off-by: Hao Zhang <quic_hazha@...cinc.com>
> Signed-off-by: Mao Jinlong <quic_jinlmao@...cinc.com>
> ---
> drivers/hwtracing/coresight/Kconfig | 12 ++
> drivers/hwtracing/coresight/Makefile | 1 +
> drivers/hwtracing/coresight/coresight-csr.c | 142 ++++++++++++++++++++
> drivers/hwtracing/coresight/coresight-csr.h | 54 ++++++++
> 4 files changed, 209 insertions(+)
> create mode 100644 drivers/hwtracing/coresight/coresight-csr.c
> create mode 100644 drivers/hwtracing/coresight/coresight-csr.h
>
> diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig
> index 2b5bbfffbc4f..e769ea3709d9 100644
> --- a/drivers/hwtracing/coresight/Kconfig
> +++ b/drivers/hwtracing/coresight/Kconfig
> @@ -236,4 +236,16 @@ config CORESIGHT_TPDA
>
> To compile this driver as a module, choose M here: the module will be
> called coresight-tpda.
> +
> +config CORESIGHT_CSR
> + tristate "CoreSight Slave Register driver"
> + help
> + This driver provides support for CoreSight Slave Register block
> + that hosts miscellaneous configuration registers.
> + Those configuration registers can be used to control, various
> + coresight configurations.
> +
> + To compile this driver as a module, choose M here: the module will be
> + called coresight-csr.
> +
> endif
> diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile
> index 33bcc3f7b8ae..956c642d05f6 100644
> --- a/drivers/hwtracing/coresight/Makefile
> +++ b/drivers/hwtracing/coresight/Makefile
> @@ -30,3 +30,4 @@ obj-$(CONFIG_CORESIGHT_TPDA) += coresight-tpda.o
> coresight-cti-y := coresight-cti-core.o coresight-cti-platform.o \
> coresight-cti-sysfs.o
> obj-$(CONFIG_ULTRASOC_SMB) += ultrasoc-smb.o
> +obj-$(CONFIG_CORESIGHT_CSR) += coresight-csr.o
> diff --git a/drivers/hwtracing/coresight/coresight-csr.c b/drivers/hwtracing/coresight/coresight-csr.c
> new file mode 100644
> index 000000000000..a1403e8531ee
> --- /dev/null
> +++ b/drivers/hwtracing/coresight/coresight-csr.c
> @@ -0,0 +1,142 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/device.h>
> +#include <linux/platform_device.h>
> +#include <linux/io.h>
> +#include <linux/err.h>
> +#include <linux/slab.h>
> +
> +#include "coresight-priv.h"
> +#include "coresight-csr.h"
> +
> +DEFINE_CORESIGHT_DEVLIST(csr_devs, "csr");
> +
> +static LIST_HEAD(csr_list);
> +
> +/*
> + * Get the CSR by name.
> + */
> +struct coresight_csr *coresight_csr_get(const char *name)
> +{
> + struct coresight_csr *csr;
> +
> + list_for_each_entry(csr, &csr_list, link) {
> + if (!strcmp(csr->name, name))
> + return csr;
> + }
> + return ERR_PTR(-EINVAL);
> +}
> +EXPORT_SYMBOL(coresight_csr_get);
EXPORT_SYMBOL_GPL everywhere in this driver please.
> +
> +/*
> + * Get the device node's name from device tree.
> + */
> +int of_get_coresight_csr_name(struct device_node *node, const char **csr_name)
> +{
> + struct device_node *csr_node;
> +
> + csr_node = of_parse_phandle(node, "coresight-csr", 0);
> + if (!csr_node)
> + return -EINVAL;
> +
> + *csr_name = csr_node->full_name;
> + of_node_put(csr_node);
> + return 0;
> +}
> +EXPORT_SYMBOL(of_get_coresight_csr_name);
---Trilok Soni
Powered by blists - more mailing lists