Skip to contentSkip to conversation

Add remoteproc driver for Hexagon Q6 - WCSS integrated core

PATCH Superseded Sricharan R 4 participants 11 messages Jun 29, 2017 – Jul 31, 2017

Subsystems (4)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover Add remoteproc driver for Hexagon Q6 - WCSS integrated core

IPQ8074 has an integrated Hexagon dsp core Q6v5 and a wireless lan (Lithium) IP. This series adds the remoteproc driver to reset, load and boot Q6 firmware. The first patch is to make the mdt_loader authenticate the firmware only if required, so that the code can be reused for self-authenticating firmware like the Q6v5 core in IPQ8074.

Sricharan R (3):
drivers: remoteproc: Make mdt_loader firmware authentication optional
drivers: remoteproc: Add Hexagon Q6 - WCSS integrated core driver
dt-binding: remoteproc: Add the bindings required for Hexagon - WCSS
core

 .../bindings/remoteproc/qcom,q6v5-wcss.txt         | 139 ++++
 drivers/remoteproc/Kconfig                         |  13 +
 drivers/remoteproc/Makefile                        |   1 +
 drivers/remoteproc/q6v5-wcss.c                     | 784 +++++++++++++++++++++
 drivers/remoteproc/qcom_adsp_pil.c                 |   3 +-
 drivers/remoteproc/qcom_wcnss.c                    |   3 +-
 drivers/soc/qcom/mdt_loader.c                      |  24 +-
 include/linux/soc/qcom/mdt_loader.h                |   2 +-
 8 files changed, 956 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt
 create mode 100644 drivers/remoteproc/q6v5-wcss.c
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#1 lore raw

PATCH 1/3 drivers: remoteproc: Make mdt_loader firmware authentication optional

qcom_mdt_load function loads the mdt type firmware and authenticates it as well. Make the authentication only when requested by the caller, so that the function can be used by self-authenticating remoteproc as well.

---
 drivers/remoteproc/qcom_adsp_pil.c  |  3 ++-
 drivers/remoteproc/qcom_wcnss.c     |  3 ++-
 drivers/soc/qcom/mdt_loader.c       | 24 ++++++++++++++----------
 include/linux/soc/qcom/mdt_loader.h |  2 +-
 4 files changed, 19 insertions(+), 13 deletions(-)
drivers/remoteproc/qcom_adsp_pil.c +2 -1
index 49fe2f8..e168375 100644
@@ -79,7 +79,8 @@ static int adsp_load(struct rproc *rproc, const struct firmware *fw)
 	struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv;
 
 	return qcom_mdt_load(adsp->dev, fw, rproc->firmware, adsp->pas_id,
-			     adsp->mem_region, adsp->mem_phys, adsp->mem_size);
+			     adsp->mem_region, adsp->mem_phys, adsp->mem_size,
+			     true);
 }
 
 static const struct rproc_fw_ops adsp_fw_ops = {
drivers/remoteproc/qcom_wcnss.c +2 -1
index c768639..b41b9b5 100644
@@ -153,7 +153,8 @@ static int wcnss_load(struct rproc *rproc, const struct firmware *fw)
 	struct qcom_wcnss *wcnss = (struct qcom_wcnss *)rproc->priv;
 
 	return qcom_mdt_load(wcnss->dev, fw, rproc->firmware, WCNSS_PAS_ID,
-			     wcnss->mem_region, wcnss->mem_phys, wcnss->mem_size);
+			     wcnss->mem_region, wcnss->mem_phys,
+			     wcnss->mem_size, true);
 }
 
 static const struct rproc_fw_ops wcnss_fw_ops = {
drivers/soc/qcom/mdt_loader.c +14 -10
index bd63df0..b3947d0 100644
@@ -88,7 +88,7 @@ ssize_t qcom_mdt_get_size(const struct firmware *fw)
  */
 int qcom_mdt_load(struct device *dev, const struct firmware *fw,
 		  const char *firmware, int pas_id, void *mem_region,
-		  phys_addr_t mem_phys, size_t mem_size)
+		  phys_addr_t mem_phys, size_t mem_size, bool auth)
 {
 	const struct elf32_phdr *phdrs;
 	const struct elf32_phdr *phdr;
@@ -119,10 +119,12 @@ int qcom_mdt_load(struct device *dev, const struct firmware *fw,
 	if (!fw_name)
 		return -ENOMEM;
 
-	ret = qcom_scm_pas_init_image(pas_id, fw->data, fw->size);
-	if (ret) {
-		dev_err(dev, "invalid firmware metadata\n");
-		goto out;
+	if (auth) {
+		ret = qcom_scm_pas_init_image(pas_id, fw->data, fw->size);
+		if (ret) {
+			dev_err(dev, "invalid firmware metadata\n");
+			goto out;
+		}
 	}
 
 	for (i = 0; i < ehdr->e_phnum; i++) {
@@ -142,12 +144,14 @@ int qcom_mdt_load(struct device *dev, const struct firmware *fw,
 	}
 
 	if (relocate) {
-		ret = qcom_scm_pas_mem_setup(pas_id, mem_phys, max_addr - min_addr);
-		if (ret) {
-			dev_err(dev, "unable to setup relocation\n");
-			goto out;
+		if (auth) {
+			ret = qcom_scm_pas_mem_setup(pas_id, mem_phys,
+						     max_addr - min_addr);
+			if (ret) {
+				dev_err(dev, "unable to setup relocation\n");
+				goto out;
+			}
 		}
-
 		/*
 		 * The image is relocatable, so offset each segment based on
 		 * the lowest segment address.
include/linux/soc/qcom/mdt_loader.h +1 -1
index f423001..7ff4dd3 100644
@@ -13,6 +13,6 @@
 ssize_t qcom_mdt_get_size(const struct firmware *fw);
 int qcom_mdt_load(struct device *dev, const struct firmware *fw,
 		  const char *fw_name, int pas_id, void *mem_region,
-		  phys_addr_t mem_phys, size_t mem_size);
+		  phys_addr_t mem_phys, size_t mem_size, bool auth);
 
 #endif
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#2 lore raw

Re: [PATCH 1/3] drivers: remoteproc: Make mdt_loader firmware authentication optional

Quoted 5 lines · Sricharan R

qcom_mdt_load function loads the mdt type firmware and authenticates it as well. Make the authentication only when requested by the caller, so that the function can be used by self-authenticating remoteproc as well.

This is good, we should be able to save some duplication the current MSA PIL as well by this.

Quoted 6 lines
---
 drivers/remoteproc/qcom_adsp_pil.c  |  3 ++-
 drivers/remoteproc/qcom_wcnss.c     |  3 ++-
 drivers/soc/qcom/mdt_loader.c       | 24 ++++++++++++++----------
 include/linux/soc/qcom/mdt_loader.h |  2 +-

We have two additional callers being merged, so changing the prototype of qcom_mdt_load() will cause issues.

I think the best approach is to leave all callers untouched, make the current implementation of qcom_mdt_load() internal and provide two exported wrapper functions: qcom_mdt_load() and qcom_mdt_load_no_init().

These wrappers would call the internal function with the appropriate value of the boolean.

[..]

Quoted 1 line
drivers/soc/qcom/mdt_loader.c +0 -0

[..]

drivers/soc/qcom/mdt_loader.c ssize_t qcom_mdt_get_size(const struct firmware *fw) · line 91

Quoted 4 lines

int qcom_mdt_load(struct device *dev, const struct firmware *fw,

drivers/soc/qcom/mdt_loader.c +1 -1
 		  const char *firmware, int pas_id, void *mem_region,
-		  phys_addr_t mem_phys, size_t mem_size)
+		  phys_addr_t mem_phys, size_t mem_size, bool auth)

We're not authenticating even with @auth=true, so please name this "pas_init".

Quoted 3 lines

{

drivers/soc/qcom/mdt_loader.c +0 -0
 	const struct elf32_phdr *phdrs;
 	const struct elf32_phdr *phdr;

[..]

Quoted 7 lines
drivers/soc/qcom/mdt_loader.c +0 -3
@@ -142,12 +144,14 @@ int qcom_mdt_load(struct device *dev, const struct firmware *fw,
 	}
 
 	if (relocate) {
-		ret = qcom_scm_pas_mem_setup(pas_id, mem_phys, max_addr - min_addr);
-		if (ret) {
-			dev_err(dev, "unable to setup relocation\n");

drivers/soc/qcom/mdt_loader.c int qcom_mdt_load(struct device *dev, const struct firmware *fw, · line 150

Quoted 10 lines
drivers/soc/qcom/mdt_loader.c +7 -2
-			goto out;
+		if (auth) {
+			ret = qcom_scm_pas_mem_setup(pas_id, mem_phys,
+						     max_addr - min_addr);
+			if (ret) {
+				dev_err(dev, "unable to setup relocation\n");
+				goto out;
+			}
 		}
-

I like this empty line, please let me have it.

drivers/soc/qcom/mdt_loader.c int qcom_mdt_load(struct device *dev, const struct firmware *fw, · line 157

Quoted 3 lines
drivers/soc/qcom/mdt_loader.c +0 -0
 		/*
 		 * The image is relocatable, so offset each segment based on
 		 * the lowest segment address.

Regards,
Bjorn

#3 lore raw

Re: [PATCH 1/3] drivers: remoteproc: Make mdt_loader firmware authentication optional

Hi Bjorn,
Thanks for the review !

Quoted 21 lines · Bjorn Andersson
Quoted 5 lines · Sricharan R

qcom_mdt_load function loads the mdt type firmware and authenticates it as well. Make the authentication only when requested by the caller, so that the function can be used by self-authenticating remoteproc as well.

This is good, we should be able to save some duplication the current MSA PIL as well by this.

Quoted 6 lines
---
 drivers/remoteproc/qcom_adsp_pil.c  |  3 ++-
 drivers/remoteproc/qcom_wcnss.c     |  3 ++-
 drivers/soc/qcom/mdt_loader.c       | 24 ++++++++++++++----------
 include/linux/soc/qcom/mdt_loader.h |  2 +-

We have two additional callers being merged, so changing the prototype of qcom_mdt_load() will cause issues.

Quoted 7 lines

I think the best approach is to leave all callers untouched, make the current implementation of qcom_mdt_load() internal and provide two exported wrapper functions: qcom_mdt_load() and qcom_mdt_load_no_init().

These wrappers would call the internal function with the appropriate value of the boolean.

ok, will do.

Quoted 11 lines

[..]

Quoted 1 line
drivers/soc/qcom/mdt_loader.c +0 -0

[..]

drivers/soc/qcom/mdt_loader.c ssize_t qcom_mdt_get_size(const struct firmware *fw) · line 91

Quoted 4 lines

int qcom_mdt_load(struct device *dev, const struct firmware *fw,

drivers/soc/qcom/mdt_loader.c +1 -1
 		  const char *firmware, int pas_id, void *mem_region,
-		  phys_addr_t mem_phys, size_t mem_size)
+		  phys_addr_t mem_phys, size_t mem_size, bool auth)

We're not authenticating even with @auth=true, so please name this "pas_init".

ok will rename.

Quoted 7 lines
Quoted 3 lines

{

drivers/soc/qcom/mdt_loader.c +0 -0
 	const struct elf32_phdr *phdrs;
 	const struct elf32_phdr *phdr;

[..]

Quoted 3 lines
drivers/soc/qcom/mdt_loader.c +0 -0
@@ -142,12 +144,14 @@ int qcom_mdt_load(struct device *dev, const struct firmware *fw,
 	}
 
Quoted 17 lines
Quoted 4 lines
drivers/soc/qcom/mdt_loader.c +0 -3
 	if (relocate) {
-		ret = qcom_scm_pas_mem_setup(pas_id, mem_phys, max_addr - min_addr);
-		if (ret) {
-			dev_err(dev, "unable to setup relocation\n");

drivers/soc/qcom/mdt_loader.c int qcom_mdt_load(struct device *dev, const struct firmware *fw, · line 150

Quoted 10 lines
drivers/soc/qcom/mdt_loader.c +7 -2
-			goto out;
+		if (auth) {
+			ret = qcom_scm_pas_mem_setup(pas_id, mem_phys,
+						     max_addr - min_addr);
+			if (ret) {
+				dev_err(dev, "unable to setup relocation\n");
+				goto out;
+			}
 		}
-

I like this empty line, please let me have it.

ok.

Regards,
Sricharan

Signature · 10 lines
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

PATCH 2/3 drivers: remoteproc: Add Hexagon Q6 - WCSS integrated core driver

In reply to Sricharan R

IPQ8074 has an integrated Hexagon dsp core Q6v5 and a wireless lan (Lithium) IP. This patch adds the remoteproc driver to reset, load and boot Q6 firmware.

---
 drivers/remoteproc/Kconfig     |  13 +
 drivers/remoteproc/Makefile    |   1 +
 drivers/remoteproc/q6v5-wcss.c | 784 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 798 insertions(+)
 create mode 100644 drivers/remoteproc/q6v5-wcss.c
drivers/remoteproc/Kconfig +13 -0
index faad69a..a08eb1d 100644
@@ -114,6 +114,19 @@ config QCOM_WCNSS_PIL
 	  Say y here to support the Peripheral Image Loader for the Qualcomm
 	  Wireless Connectivity Subsystem.
 
+config QCOM_Q6V5_WCNSS_PIL
+	tristate "Qualcomm Q6V5-WCNSS Peripheral Image Loader"
+	depends on OF && ARCH_QCOM
+	depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
+	depends on QCOM_SMEM
+	depends on REMOTEPROC
+	select QCOM_MDT_LOADER
+	select QCOM_RPROC_COMMON
+	select QCOM_SCM
+	help
+	  Say y here to support the Peripheral Image Loader for the Qualcomm
+	  Hexagon V5 + Wireless Connectivity Subsystem.
+
 config ST_REMOTEPROC
 	tristate "ST remoteproc support"
 	depends on ARCH_STI
drivers/remoteproc/Makefile +1 -0
index ffc5e43..ebe339f 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_QCOM_ADSP_PIL)		+= qcom_adsp_pil.o
 obj-$(CONFIG_QCOM_RPROC_COMMON)		+= qcom_common.o
 obj-$(CONFIG_QCOM_Q6V5_PIL)		+= qcom_q6v5_pil.o
 obj-$(CONFIG_QCOM_WCNSS_PIL)		+= qcom_wcnss_pil.o
+obj-$(CONFIG_QCOM_Q6V5_WCNSS_PIL)	+= q6v5-wcss.o
 qcom_wcnss_pil-y			+= qcom_wcnss.o
 qcom_wcnss_pil-y			+= qcom_wcnss_iris.o
 obj-$(CONFIG_ST_REMOTEPROC)		+= st_remoteproc.o
drivers/remoteproc/q6v5-wcss.c new file +784 -0

784 lines not on this page · raw message

Signature · 6 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

Re: [PATCH 2/3] drivers: remoteproc: Add Hexagon Q6 - WCSS integrated core driver

url: https://github.com/0day-ci/linux/commits/Sricharan-R/drivers-remoteproc-Make-mdt_loader-firmware-authentication-optional/20170702-123208 config: arm64-allmodconfig (attached as .config)…

Hi Sricharan,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.12-rc7 next-20170630]
[cannot apply to remoteproc/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Sricharan-R/drivers-remoteproc-Make-mdt_loader-firmware-authentication-optional/20170702-123208
config: arm64-allmodconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

drivers//remoteproc/q6v5-wcss.c: In function 'q6_rproc_probe':

>> drivers//remoteproc/q6v5-wcss.c:126:14: warning: 'i' may be used uninitialized in this function [-Wmaybe-uninitialized]
      qproc->clks[i++] = c;
                 ^
   drivers//remoteproc/q6v5-wcss.c:103:6: note: 'i' was declared here
     int i;
         ^

vim +/i +126 drivers//remoteproc/q6v5-wcss.c

110 if (!qproc->clk_cnt)
111 return 0;
112
113 qproc->clks = devm_kzalloc(dev, sizeof(*qproc->clks) * qproc->clk_cnt,
114 GFP_KERNEL);
115
116 of_property_for_each_string(dev->of_node, "clock-names", prop, cname) {
117 struct clk *c = devm_clk_get(dev, cname);
118
119 if (IS_ERR_OR_NULL(c)) {
120 if (PTR_ERR(c) != -EPROBE_DEFER)
121 dev_err(dev, "Failed to get %s clock\n", cname);
122
123 return PTR_ERR(c);
124 }
125

 > 126			qproc->clks[i++] = c;

127 }
128
129 return 0;
130 }
131
132 static int q6v5_clk_enable(struct q6v5 *qproc)
133 {
134 int rc;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#6 lore raw

Re: [PATCH 2/3] drivers: remoteproc: Add Hexagon Q6 - WCSS integrated core driver

In reply to Sricharan R
Quoted 4 lines · Sricharan R

IPQ8074 has an integrated Hexagon dsp core Q6v5 and a wireless lan (Lithium) IP. This patch adds the remoteproc driver to reset, load and boot Q6 firmware.

There is a fair amount of code in this driver that seems to be equivalent to Avaneesh q6v5 patches for MSM8996.

The differences coming from the MBA + MPSS vs single-image we have to live with, but can we do something about the Q6 programming sequences? E.g. extract them to a common file?

Quoted 5 lines
---
 drivers/remoteproc/Kconfig     |  13 +
 drivers/remoteproc/Makefile    |   1 +
 drivers/remoteproc/q6v5-wcss.c | 784 +++++++++++++++++++++++++++++++++++++++++

Please keep the qcom_* naming scheme.

[..]

Quoted 1 line
drivers/remoteproc/q6v5-wcss.c +0 -0

[..]

Quoted 1 line

+#include <linux/elf.h>

Doesn't look like you need this anymore.

[..]

Quoted 1 line

+#include <linux/qcom_scm.h>

You don't need this.

[..]

Quoted 14 lines
drivers/remoteproc/q6v5-wcss.c +14 -0
+
+#define WCSS_CRASH_REASON_SMEM 421
+#define WCNSS_PAS_ID		6
+#define STOP_ACK_TIMEOUT_MS 10000
+
+#define QDSP6SS_RST_EVB 0x10
+#define QDSP6SS_RESET 0x14
+#define QDSP6SS_DBG_CFG 0x18
+#define QDSP6SS_XO_CBCR 0x38
+#define QDSP6SS_MEM_PWR_CTL 0xb0
+#define QDSP6SS_BHS_STATUS 0x78
+#define TCSR_GLOBAL_CFG0 0x0
+#define TCSR_GLOBAL_CFG1 0x4
+

drivers/remoteproc/q6v5-wcss.c line 63

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+#define QDSP6SS_GFMUX_CTL 0x20
+#define QDSP6SS_PWR_CTL 0x30
+#define TCSR_HALTREQ 0x0
+#define TCSR_HALTACK 0x4
+#define TCSR_Q6_HALTREQ 0x0
+#define TCSR_Q6_HALTACK 0x4
+#define SSCAON_CONFIG 0x8
+#define SSCAON_STATUS 0xc
+#define HALTACK BIT(0)
+#define BHS_EN_REST_ACK BIT(0)

It would be nice to have the values of these indented, to make things a little bit easier to read.

[..]

drivers/remoteproc/q6v5-wcss.c line 93

Quoted 3 lines
drivers/remoteproc/q6v5-wcss.c +3 -0
+static struct resource_table *q6v5_find_rsc_table(struct rproc *rproc,
+						  const struct firmware *fw,
+						  int *tablesz)

You can omit this function, there's a dummy in qcom_common.[ch] with the same name for the same purpose.

Quoted 8 lines
drivers/remoteproc/q6v5-wcss.c +8 -0
+{
+	static struct resource_table table = { .ver = 1, };
+
+	*tablesz = sizeof(table);
+	return &table;
+}
+
+static int q6v5_init_clocks(struct device *dev, struct q6v5 *qproc)

drivers/remoteproc/q6v5-wcss.c line 111

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+{
+	int i;
+	const char *cname;
+	struct property *prop;
+
+	qproc->clk_cnt = of_property_count_strings(dev->of_node,
+						   "clock-names");
+
+	if (!qproc->clk_cnt)
+		return 0;

I strongly prefer that you explicitly list the clocks expected here, rather than trusting DT.

And please transition this to the newly added clk-bulk interface (see clk_bulk_get() et al).

Quoted 28 lines
drivers/remoteproc/q6v5-wcss.c +28 -0
+
+	qproc->clks = devm_kzalloc(dev, sizeof(*qproc->clks) * qproc->clk_cnt,
+				   GFP_KERNEL);
+
+	of_property_for_each_string(dev->of_node, "clock-names", prop, cname) {
+		struct clk *c = devm_clk_get(dev, cname);
+
+		if (IS_ERR_OR_NULL(c)) {
+			if (PTR_ERR(c) != -EPROBE_DEFER)
+				dev_err(dev, "Failed to get %s clock\n", cname);
+
+			return PTR_ERR(c);
+		}
+
+		qproc->clks[i++] = c;
+	}
+
+	return 0;
+}
+
+static int q6v5_clk_enable(struct q6v5 *qproc)
+{
+	int rc;
+	int i;
+
+	for (i = 0; i < qproc->clk_cnt; i++) {
+		rc = clk_prepare_enable(qproc->clks[i]);
+		if (rc)

drivers/remoteproc/q6v5-wcss.c line 149

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+			goto err;
+	}
+
+	return 0;
+err:
+	for (i--; i >= 0; i--)
+		clk_disable_unprepare(qproc->clks[i]);
+
+	return rc;
+}

As of v4.13-rc1 you can call clk_bulk_prepare_enable() instead of this function.

drivers/remoteproc/q6v5-wcss.c line 157

Quoted 8 lines
drivers/remoteproc/q6v5-wcss.c +8 -0
+
+static int wcss_powerdown(struct q6v5 *qproc)
+{
+	unsigned int nretry = 0;
+	unsigned int val = 0;
+	int ret;
+
+	/* Assert WCSS/Q6 HALTREQ - 1 */

I presume the numbers at the end of these comments corresponds to the steps in your programming manual, if so it's okay to keep them. But please make move them to the front, like /* N: comment */

drivers/remoteproc/q6v5-wcss.c line 161

Quoted 4 lines
drivers/remoteproc/q6v5-wcss.c +4 -0
+	nretry = 0;
+
+	ret = regmap_update_bits(qproc->tcsr, qproc->halt_wcss + TCSR_HALTREQ,
+				 1, 1);

Is there a reason to do read-modify-write on this register? I use regmap_write() in the other driver.

Quoted 5 lines
drivers/remoteproc/q6v5-wcss.c +5 -0
+	if (ret)
+		return ret;
+
+	while (1) {
+		regmap_read(qproc->tcsr, qproc->halt_wcss + TCSR_HALTACK,

drivers/remoteproc/q6v5-wcss.c line 176

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+			    &val);
+		if (val & HALTACK)
+			break;
+		mdelay(1);
+		nretry++;
+		if (nretry >= 10) {
+			pr_warn("can't get TCSR haltACK\n");
+			break;
+		}
+	}

Would it be possible to move q6v5proc_halt_axi_port() to qcom_common.c (or a tcsr driver?) and use that instead?

drivers/remoteproc/q6v5-wcss.c

Quoted 2 lines
drivers/remoteproc/q6v5-wcss.c +2 -0
+
+	/* Check HALTACK */

I presume this comment does not relate to the code that follows it?

drivers/remoteproc/q6v5-wcss.c line 179

Quoted 1 line
drivers/remoteproc/q6v5-wcss.c +1 -0
+	/* Set MPM_SSCAON_CONFIG 13 - 2 */

Shouldn't this be "Disable MPM_WCSSAON_CONFIG 13"?

drivers/remoteproc/q6v5-wcss.c line 189

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+	val = readl(qproc->mpm_base + SSCAON_CONFIG);
+	val |= BIT(13);
+	writel(val, qproc->mpm_base + SSCAON_CONFIG);
+
+	/* Set MPM_SSCAON_CONFIG 15 - 3 */
+	val = readl(qproc->mpm_base + SSCAON_CONFIG);
+	val |= BIT(15);
+	val &= ~(BIT(16));
+	val &= ~(BIT(17));
+	val &= ~(BIT(18));

Skip all the extra parenthesis.

Quoted 12 lines
drivers/remoteproc/q6v5-wcss.c +12 -0
+	writel(val, qproc->mpm_base + SSCAON_CONFIG);
+
+	/* Set MPM_SSCAON_CONFIG 1 - 4 */
+	val = readl(qproc->mpm_base + SSCAON_CONFIG);
+	val |= BIT(1);
+	writel(val, qproc->mpm_base + SSCAON_CONFIG);
+
+	/* wait for SSCAON_STATUS to be 0x400 - 5 */
+	nretry = 0;
+	while (1) {
+		val = readl(qproc->mpm_base + SSCAON_STATUS);
+		/* ignore bits 16 to 31 */

drivers/remoteproc/q6v5-wcss.c line 211

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+		val &= 0xffff;
+		if (val == BIT(10))
+			break;
+		nretry++;
+		mdelay(1);
+		if (nretry == 10) {
+			pr_warn("can't get SSCAON_STATUS\n");
+			break;
+		}
+	}

Please replace this loop with:

	ret = readl_poll_timeout(qproc->mpm_base + SSCAON_STATUS, val,
				 val & 0xffff == 0x400, 1000, 10000);

drivers/remoteproc/q6v5-wcss.c line 218

Quoted 7 lines
drivers/remoteproc/q6v5-wcss.c +7 -0
+
+	/* Enable Q6/WCSS BLOCK ARES - 6 */
+	reset_control_assert(qproc->wcss_aon_reset);
+
+	/* Enable MPM_WCSSAON_CONFIG 13 - 7 */
+	val = readl(qproc->mpm_base + SSCAON_CONFIG);
+	val &= (~(BIT(13)));

Skip all the extra parenthesis.

Quoted 27 lines
drivers/remoteproc/q6v5-wcss.c +27 -0
+	writel(val, qproc->mpm_base + SSCAON_CONFIG);
+
+	/* Enable A2AB/ACMT/ECHAB ARES - 8 */
+	/* De-assert WCSS/Q6 HALTREQ - 8 */
+	reset_control_assert(qproc->wcss_reset);
+
+	ret = regmap_update_bits(qproc->tcsr, qproc->halt_wcss + TCSR_HALTREQ,
+				 1, 0);
+
+	return ret;
+}
+
+static int q6_powerdown(struct q6v5 *qproc)
+{
+	int i = 0, ret;
+	unsigned int nretry = 0;
+	unsigned int val = 0;
+
+	/* Halt Q6 bus interface - 9*/
+	ret = regmap_update_bits(qproc->tcsr, qproc->halt_q6 + TCSR_Q6_HALTREQ,
+				 1, 1);
+	if (ret)
+		return ret;
+
+	nretry = 0;
+	while (1) {
+		regmap_read(qproc->tcsr, qproc->halt_q6 + TCSR_Q6_HALTACK,

drivers/remoteproc/q6v5-wcss.c line 255

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+			    &val);
+		if (val & HALTACK)
+			break;
+		mdelay(1);
+		nretry++;
+		if (nretry >= 10) {
+			pr_err("can't get TCSR Q6 haltACK\n");
+			break;
+		}
+	}

Again, can we utilize q6v5proc_halt_axi_port()? (Or replace the tcsr syscon with a driver)

drivers/remoteproc/q6v5-wcss.c line 259

Quoted 4 lines
drivers/remoteproc/q6v5-wcss.c +4 -0
+
+	/* Disable Q6 Core clock - 10 */
+	val = readl(qproc->q6_base + QDSP6SS_GFMUX_CTL);
+	val &= (~(BIT(1)));

Parenthesis.

Quoted 16 lines
drivers/remoteproc/q6v5-wcss.c +16 -0
+	writel(val, qproc->q6_base + QDSP6SS_GFMUX_CTL);
+
+	/* Clamp I/O - 11 */
+	val = readl(qproc->q6_base + QDSP6SS_PWR_CTL);
+	val |= BIT(20);
+	writel(val, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* Clamp WL - 12 */
+	val = readl(qproc->q6_base + QDSP6SS_PWR_CTL);
+	val |= BIT(21);
+	writel(val, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* Clear Erase standby - 13 */
+	val = readl(qproc->q6_base + QDSP6SS_PWR_CTL);
+	val &= (~(BIT(18)));
+	writel(val, qproc->q6_base + QDSP6SS_PWR_CTL);

drivers/remoteproc/q6v5-wcss.c line 285

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+
+	/* Clear Sleep RTN - 14 */
+	val = readl(qproc->q6_base + QDSP6SS_PWR_CTL);
+	val &= (~(BIT(19)));
+	writel(val, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* turn off QDSP6 memory foot/head switch one bank at a time - 15*/
+	for (i = 0; i < 20; i++) {
+		val = readl(qproc->q6_base + QDSP6SS_MEM_PWR_CTL);
+		val &= (~(BIT(i)));

Parenthesis.

Quoted 17 lines
drivers/remoteproc/q6v5-wcss.c +17 -0
+		writel(val, qproc->q6_base + QDSP6SS_MEM_PWR_CTL);
+		mdelay(1);
+	}
+
+	/* Assert QMC memory RTN - 16 */
+	val = readl(qproc->q6_base + QDSP6SS_PWR_CTL);
+	val |= BIT(22);
+	writel(val, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* Turn off BHS - 17 */
+	val = readl(qproc->q6_base + QDSP6SS_PWR_CTL);
+	val &= (~(BIT(24)));
+	writel(val, qproc->q6_base + QDSP6SS_PWR_CTL);
+	udelay(1);
+	/* Wait till BHS Reset is done */
+	nretry = 0;
+	while (1) {

drivers/remoteproc/q6v5-wcss.c line 312

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+		val = readl(qproc->q6_base + QDSP6SS_BHS_STATUS);
+		if (!(val & BHS_EN_REST_ACK))
+			break;
+		mdelay(1);
+		nretry++;
+		if (nretry >= 10) {
+			pr_err("BHS_STATUS not OFF\n");
+			break;
+		}
+	}

readl_poll_timeout()

Quoted 54 lines
drivers/remoteproc/q6v5-wcss.c +54 -0
+
+	/* HALT CLEAR - 18 */
+	ret = regmap_update_bits(qproc->tcsr, qproc->halt_q6 + TCSR_Q6_HALTREQ,
+				 1, 0);
+	if (ret)
+		return ret;
+
+	/* Enable Q6 Block reset - 19 */
+	reset_control_assert(qproc->wcss_q6_reset);
+
+	return 0;
+}
+
+static int q6_rproc_stop(struct rproc *rproc)
+{
+	struct q6v5 *qproc = rproc->priv;
+	int ret = 0;
+
+	qproc->running = false;
+
+	/* WCSS powerdown */
+	qcom_smem_state_update_bits(qproc->state, BIT(qproc->stop_bit),
+				    BIT(qproc->stop_bit));
+
+	ret = wait_for_completion_timeout(&qproc->stop_done,
+					  msecs_to_jiffies(5000));
+	if (ret == 0) {
+		dev_err(qproc->dev, "timed out on wait\n");
+		return -ETIMEDOUT;
+	}
+
+	qcom_smem_state_update_bits(qproc->state, BIT(qproc->stop_bit), 0);
+
+	ret = wcss_powerdown(qproc);
+	if (ret)
+		return ret;
+
+	/* Q6 Power down */
+	ret = q6_powerdown(qproc);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static int q6_rproc_start(struct rproc *rproc)
+{
+	struct q6v5 *qproc = rproc->priv;
+	int temp = 19;
+	unsigned long val = 0;
+	unsigned int nretry = 0;
+	int ret = 0;
+
+	ret = q6v5_clk_enable(qproc);

drivers/remoteproc/q6v5-wcss.c line 376

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+	if (ret) {
+		dev_err(qproc->dev, "failed to enable clocks\n");
+		return ret;
+	}
+
+	/* Release Q6 and WCSS reset */
+	reset_control_deassert(qproc->wcss_reset);
+	reset_control_deassert(qproc->wcss_q6_reset);
+
+	/* Lithium configuration - clock gating and bus arbitration */

Should this go in a tcsr driver?

Quoted 8 lines
drivers/remoteproc/q6v5-wcss.c +8 -0
+	ret = regmap_update_bits(qproc->tcsr,
+				 qproc->halt_gbl + TCSR_GLOBAL_CFG0,
+				 0x1F, 0x14);
+	if (ret)
+		return ret;
+
+	ret = regmap_update_bits(qproc->tcsr,
+				 qproc->halt_gbl + TCSR_GLOBAL_CFG1,

drivers/remoteproc/q6v5-wcss.c line 394

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+				 1, 0);
+	if (ret)
+		return ret;
+
+	/* Write bootaddr to EVB so that Q6WCSS will jump there after reset */
+	writel(rproc->bootaddr >> 4, qproc->q6_base + QDSP6SS_RST_EVB);
+	/* Turn on XO clock. It is required for BHS and memory operation */
+	writel(0x1, qproc->q6_base + QDSP6SS_XO_CBCR);
+	/* Turn on BHS */
+	writel(0x1700000, qproc->q6_base + QDSP6SS_PWR_CTL);

Avaneesh provided defines for most of these magic numbers, please follow that.

Quoted 4 lines
drivers/remoteproc/q6v5-wcss.c +4 -0
+	udelay(1);
+
+	/* Wait till BHS Reset is done */
+	while (1) {

drivers/remoteproc/q6v5-wcss.c line 408

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+		val = readl(qproc->q6_base + QDSP6SS_BHS_STATUS);
+		if (val & BHS_EN_REST_ACK)
+			break;
+		mdelay(1);
+		nretry++;
+		if (nretry >= 10) {
+			pr_err("BHS_STATUS not ON\n");
+			break;
+		}
+	}

Use readl_poll_timeout()

drivers/remoteproc/q6v5-wcss.c line 418

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+
+	/* Put LDO in bypass mode */
+	writel(0x3700000, qproc->q6_base + QDSP6SS_PWR_CTL);
+	/* De-assert QDSP6 complier memory clamp */
+	writel(0x3300000, qproc->q6_base + QDSP6SS_PWR_CTL);
+	/* De-assert memory peripheral sleep and L2 memory standby */
+	writel(0x33c0000, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* turn on QDSP6 memory foot/head switch one bank at a time */
+	while  (temp >= 0) {

Please use a for loop, and replace "temp" with "i".

This is identical to Avaneesh patch, so let's make sure the code is identical as well.

drivers/remoteproc/q6v5-wcss.c line 420

Quoted 2 lines
drivers/remoteproc/q6v5-wcss.c +2 -0
+		val = readl(qproc->q6_base + QDSP6SS_MEM_PWR_CTL);
+		val = val | 1 << temp;

val |= BIT(temp);

drivers/remoteproc/q6v5-wcss.c line 422

Quoted 2 lines
drivers/remoteproc/q6v5-wcss.c +2 -0
+		writel(val, qproc->q6_base + QDSP6SS_MEM_PWR_CTL);
+		val = readl(qproc->q6_base + QDSP6SS_MEM_PWR_CTL);

Please include a comment on the read back here.

Quoted 166 lines
drivers/remoteproc/q6v5-wcss.c +166 -0
+		mdelay(10);
+		temp -= 1;
+	}
+	/* Remove the QDSP6 core memory word line clamp */
+	writel(0x31FFFFF, qproc->q6_base + QDSP6SS_PWR_CTL);
+	/* Remove QDSP6 I/O clamp */
+	writel(0x30FFFFF, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* Bring Q6 out of reset and stop the core */
+	writel(0x5, qproc->q6_base + QDSP6SS_RESET);
+
+	/* Retain debugger state during next QDSP6 reset */
+	writel(0x0, qproc->q6_base + QDSP6SS_DBG_CFG);
+	/* Turn on the QDSP6 core clock */
+	writel(0x102, qproc->q6_base + QDSP6SS_GFMUX_CTL);
+	/* Enable the core to run */
+	writel(0x4, qproc->q6_base + QDSP6SS_RESET);
+
+	ret = wait_for_completion_timeout(&qproc->start_done,
+					  msecs_to_jiffies(5000));
+	if (ret == 0) {
+		dev_err(qproc->dev, "start timed out\n");
+		return -ETIMEDOUT;
+	}
+
+	qproc->running = true;
+
+	return 0;
+}
+
+static struct rproc_ops q6v5_rproc_ops = {
+	.start		= q6_rproc_start,
+	.stop		= q6_rproc_stop,
+};
+
+static struct rproc_fw_ops q6_fw_ops;
+
+static int q6v5_request_irq(struct q6v5 *qproc,
+			    struct platform_device *pdev,
+			    const char *name,
+			    irq_handler_t thread_fn)
+{
+	int ret;
+
+	ret = platform_get_irq_byname(pdev, name);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "no %s IRQ defined\n", name);
+		return ret;
+	}
+
+	ret = devm_request_threaded_irq(&pdev->dev, ret,
+					NULL, thread_fn,
+					IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+					"q6v5", qproc);
+	if (ret)
+		dev_err(&pdev->dev, "request %s IRQ failed\n", name);
+
+	return ret;
+}
+
+static irqreturn_t q6v5_fatal_interrupt(int irq, void *dev)
+{
+	struct q6v5 *qproc = dev;
+	char *msg;
+	size_t len;
+
+	if (!qproc->running)
+		return IRQ_HANDLED;
+
+	msg = qcom_smem_get(QCOM_SMEM_HOST_ANY, WCSS_CRASH_REASON_SMEM, &len);
+	if (!IS_ERR(msg) && len > 0 && msg[0])
+		dev_err(qproc->dev, "Fatal error from wcss: %s\n", msg);
+	else
+		dev_err(qproc->dev, "Fatal error received no message!\n");
+
+	rproc_report_crash(qproc->rproc, RPROC_FATAL_ERROR);
+
+	if (!IS_ERR(msg))
+		msg[0] = '\0';
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t q6v5_handover_interrupt(int irq, void *dev)
+{
+	struct q6v5 *qproc = dev;
+
+	complete(&qproc->start_done);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t q6v5_stop_ack_interrupt(int irq, void *dev)
+{
+	struct q6v5 *qproc = dev;
+
+	complete(&qproc->stop_done);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t q6v5_wdog_interrupt(int irq, void *dev)
+{
+	struct q6v5 *qproc = dev;
+	char *msg;
+	size_t len;
+
+	if (!qproc->running) {
+		complete(&qproc->stop_done);
+		return IRQ_HANDLED;
+	}
+
+	msg = qcom_smem_get(QCOM_SMEM_HOST_ANY, WCSS_CRASH_REASON_SMEM, &len);
+	if (!IS_ERR(msg) && len > 0 && msg[0])
+		dev_err(qproc->dev, "Watchdog bite from wcss %s\n", msg);
+	else
+		dev_err(qproc->dev, "Watchdog bit received no message!\n");
+
+	rproc_report_crash(qproc->rproc, RPROC_WATCHDOG);
+
+	if (!IS_ERR(msg))
+		msg[0] = '\0';
+
+	return IRQ_HANDLED;
+}
+
+static int q6v5_load(struct rproc *rproc, const struct firmware *fw)
+{
+	struct q6v5 *qproc = (struct q6v5 *)rproc->priv;
+
+	return qcom_mdt_load(qproc->dev, fw, rproc->firmware, WCNSS_PAS_ID,
+			     qproc->mem_region, qproc->mem_phys,
+			     qproc->mem_size, false);
+}
+
+static int q6_alloc_memory_region(struct q6v5 *qproc)
+{
+	struct device_node *node;
+	struct resource r;
+	int ret;
+
+	node = of_parse_phandle(qproc->dev->of_node, "memory-region", 0);
+	if (!node) {
+		dev_err(qproc->dev, "no memory-region specified\n");
+		return -EINVAL;
+	}
+
+	ret = of_address_to_resource(node, 0, &r);
+	if (ret)
+		return ret;
+
+	qproc->mem_phys = r.start;
+	qproc->mem_size = resource_size(&r);
+	qproc->mem_region = devm_ioremap_wc(qproc->dev, qproc->mem_phys,
+					    qproc->mem_size);
+	if (!qproc->mem_region) {
+		dev_err(qproc->dev, "unable to map memory region: %pa+%zx\n",
+			&r.start, qproc->mem_size);
+		return -EBUSY;
+	}
+
+	return 0;
+}
+
+static int q6v5_init_mem(struct q6v5 *qproc, struct platform_device *pdev)
+{
+	struct of_phandle_args args;
+	struct resource *res;

drivers/remoteproc/q6v5-wcss.c line 598

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+	int ret;
+
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+					   "mpm");
+	if (IS_ERR_OR_NULL(res))
+		return -ENODEV;
+
+	qproc->mpm_base = ioremap(res->start, resource_size(res));
+	if (IS_ERR_OR_NULL(qproc->mpm_base))
+		return PTR_ERR(qproc->mpm_base);

Is this the same MPM block that is used to configure sleep related things later? If so I think we shouldn't map it directly here, but introduce a separate driver for it.

drivers/remoteproc/q6v5-wcss.c line 607

Quoted 9 lines
drivers/remoteproc/q6v5-wcss.c +9 -0
+
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+					   "q6");
+	if (IS_ERR_OR_NULL(res)) {
+		ret = -ENODEV;
+		goto free_mpm;
+	}
+
+	qproc->q6_base = ioremap(res->start, resource_size(res));

Except for the error path of this function these memory regions are never unmapped. Please use devm_ioremap_wc() instead.

Quoted 52 lines
drivers/remoteproc/q6v5-wcss.c +52 -0
+	if (IS_ERR_OR_NULL(qproc->q6_base)) {
+		ret = PTR_ERR(qproc->q6_base);
+		goto free_mpm;
+	}
+
+	ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
+					       "qcom,halt-regs", 3,
+					       0, &args);
+	if (ret < 0)
+		goto free_q6;
+
+	qproc->tcsr = syscon_node_to_regmap(args.np);
+	of_node_put(args.np);
+	if (IS_ERR_OR_NULL(qproc->tcsr)) {
+		ret = PTR_ERR(qproc->tcsr);
+		goto free_q6;
+	}
+
+	qproc->halt_gbl = args.args[0];
+	qproc->halt_q6 = args.args[1];
+	qproc->halt_wcss = args.args[2];
+
+	return 0;
+
+free_q6:
+	iounmap(qproc->q6_base);
+
+free_mpm:
+	iounmap(qproc->mpm_base);
+
+	return ret;
+}
+
+static int q6_rproc_probe(struct platform_device *pdev)
+{
+	struct q6v5 *qproc;
+	struct rproc *rproc;
+	int ret;
+	struct qcom_smem_state *state;
+	unsigned int stop_bit;
+	const char *firmware_name = of_device_get_match_data(&pdev->dev);
+
+	state = qcom_smem_state_get(&pdev->dev, "stop",
+				    &stop_bit);
+	if (IS_ERR(state))
+		/* Wait till SMP2P is registered and up */
+		return -EPROBE_DEFER;
+
+	rproc = rproc_alloc(&pdev->dev, pdev->name, &q6v5_rproc_ops,
+			    firmware_name,
+			    sizeof(*qproc));
+	if (unlikely(!rproc))

drivers/remoteproc/q6v5-wcss.c line 669

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+		return -ENOMEM;
+
+	qproc = rproc->priv;
+	qproc->dev = &pdev->dev;
+	qproc->rproc = rproc;
+	rproc->has_iommu = false;
+
+	q6_fw_ops = *rproc->fw_ops;
+	q6_fw_ops.find_rsc_table = q6v5_find_rsc_table;
+	q6_fw_ops.load = q6v5_load;

I would prefer that you do define a static const object with these, like in the other qcom drivers.

But in order to do that you would need to export rproc_elf_get_boot_addr(), which is in line with another item on my todo list, so please do this.

[..]

drivers/remoteproc/q6v5-wcss.c line 748

Quoted 3 lines
drivers/remoteproc/q6v5-wcss.c +3 -0
+
+free_rproc:
+	rproc_put(rproc);

Use rproc_free() instead of rproc_put() to free up resources of rproc_alloc()

drivers/remoteproc/q6v5-wcss.c line 761

Quoted 13 lines
drivers/remoteproc/q6v5-wcss.c +13 -0
+	return -EIO;
+}
+
+static int q6_rproc_remove(struct platform_device *pdev)
+{
+	struct q6v5 *qproc;
+	struct rproc *rproc;
+
+	qproc = platform_get_drvdata(pdev);
+	rproc = qproc->rproc;
+
+	rproc_del(rproc);
+	rproc_put(rproc);

rproc_free()

drivers/remoteproc/q6v5-wcss.c line 125

Quoted 4 lines
drivers/remoteproc/q6v5-wcss.c +4 -0
+
+	return 0;
+}
+

Regards,
Bjorn

#7 lore raw

Re: [PATCH 2/3] drivers: remoteproc: Add Hexagon Q6 - WCSS integrated core driver

Hi Bjorn,

Quoted 7 lines · Bjorn Andersson
Quoted 4 lines · Sricharan R

IPQ8074 has an integrated Hexagon dsp core Q6v5 and a wireless lan (Lithium) IP. This patch adds the remoteproc driver to reset, load and boot Q6 firmware.

Quoted 7 lines

There is a fair amount of code in this driver that seems to be equivalent to Avaneesh q6v5 patches for MSM8996.

The differences coming from the MBA + MPSS vs single-image we have to live with, but can we do something about the Q6 programming sequences? E.g. extract them to a common file?

hmm, initially was trying to do that, but Q6 programming sequence was not that much common. So added this as a new driver. But let me try once more.

Quoted 8 lines
Quoted 5 lines
---
 drivers/remoteproc/Kconfig     |  13 +
 drivers/remoteproc/Makefile    |   1 +
 drivers/remoteproc/q6v5-wcss.c | 784 +++++++++++++++++++++++++++++++++++++++++

Please keep the qcom_* naming scheme.

ok

Quoted 7 lines

[..]

Quoted 1 line
drivers/remoteproc/q6v5-wcss.c +0 -0

[..]

Quoted 1 line

+#include <linux/elf.h>

Doesn't look like you need this anymore.

ok

Quoted 5 lines

[..]

Quoted 1 line

+#include <linux/qcom_scm.h>

You don't need this.

right, will remove

Quoted 20 lines

[..]

Quoted 19 lines
drivers/remoteproc/q6v5-wcss.c +19 -0
+
+#define WCSS_CRASH_REASON_SMEM 421
+#define WCNSS_PAS_ID		6
+#define STOP_ACK_TIMEOUT_MS 10000
+
+#define QDSP6SS_RST_EVB 0x10
+#define QDSP6SS_RESET 0x14
+#define QDSP6SS_DBG_CFG 0x18
+#define QDSP6SS_XO_CBCR 0x38
+#define QDSP6SS_MEM_PWR_CTL 0xb0
+#define QDSP6SS_BHS_STATUS 0x78
+#define TCSR_GLOBAL_CFG0 0x0
+#define TCSR_GLOBAL_CFG1 0x4
+
+#define QDSP6SS_GFMUX_CTL 0x20
+#define QDSP6SS_PWR_CTL 0x30
+#define TCSR_HALTREQ 0x0
+#define TCSR_HALTACK 0x4
+#define TCSR_Q6_HALTREQ 0x0
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 63

Quoted 5 lines
drivers/remoteproc/q6v5-wcss.c +5 -0
+#define TCSR_Q6_HALTACK 0x4
+#define SSCAON_CONFIG 0x8
+#define SSCAON_STATUS 0xc
+#define HALTACK BIT(0)
+#define BHS_EN_REST_ACK BIT(0)

It would be nice to have the values of these indented, to make things a little bit easier to read.

ok

Quoted 8 lines

[..]

drivers/remoteproc/q6v5-wcss.c line 93

Quoted 3 lines
drivers/remoteproc/q6v5-wcss.c +3 -0
+static struct resource_table *q6v5_find_rsc_table(struct rproc *rproc,
+						  const struct firmware *fw,
+						  int *tablesz)

You can omit this function, there's a dummy in qcom_common.[ch] with the same name for the same purpose.

ok

Quoted 13 lines
Quoted 13 lines
drivers/remoteproc/q6v5-wcss.c +13 -0
+{
+	static struct resource_table table = { .ver = 1, };
+
+	*tablesz = sizeof(table);
+	return &table;
+}
+
+static int q6v5_init_clocks(struct device *dev, struct q6v5 *qproc)
+{
+	int i;
+	const char *cname;
+	struct property *prop;
+
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 111

Quoted 5 lines
drivers/remoteproc/q6v5-wcss.c +5 -0
+	qproc->clk_cnt = of_property_count_strings(dev->of_node,
+						   "clock-names");
+
+	if (!qproc->clk_cnt)
+		return 0;

I strongly prefer that you explicitly list the clocks expected here, rather than trusting DT.

ok.

Quoted 3 lines

And please transition this to the newly added clk-bulk interface (see clk_bulk_get() et al).

ok.

Quoted 33 lines
Quoted 33 lines
drivers/remoteproc/q6v5-wcss.c +33 -0
+
+	qproc->clks = devm_kzalloc(dev, sizeof(*qproc->clks) * qproc->clk_cnt,
+				   GFP_KERNEL);
+
+	of_property_for_each_string(dev->of_node, "clock-names", prop, cname) {
+		struct clk *c = devm_clk_get(dev, cname);
+
+		if (IS_ERR_OR_NULL(c)) {
+			if (PTR_ERR(c) != -EPROBE_DEFER)
+				dev_err(dev, "Failed to get %s clock\n", cname);
+
+			return PTR_ERR(c);
+		}
+
+		qproc->clks[i++] = c;
+	}
+
+	return 0;
+}
+
+static int q6v5_clk_enable(struct q6v5 *qproc)
+{
+	int rc;
+	int i;
+
+	for (i = 0; i < qproc->clk_cnt; i++) {
+		rc = clk_prepare_enable(qproc->clks[i]);
+		if (rc)
+			goto err;
+	}
+
+	return 0;
+err:
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 149

Quoted 5 lines
drivers/remoteproc/q6v5-wcss.c +5 -0
+	for (i--; i >= 0; i--)
+		clk_disable_unprepare(qproc->clks[i]);
+
+	return rc;
+}

As of v4.13-rc1 you can call clk_bulk_prepare_enable() instead of this function.

ok.

Quoted 4 lines
Quoted 4 lines
drivers/remoteproc/q6v5-wcss.c +4 -0
+
+static int wcss_powerdown(struct q6v5 *qproc)
+{
+	unsigned int nretry = 0;
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 157

Quoted 4 lines
drivers/remoteproc/q6v5-wcss.c +4 -0
+	unsigned int val = 0;
+	int ret;
+
+	/* Assert WCSS/Q6 HALTREQ - 1 */

I presume the numbers at the end of these comments corresponds to the steps in your programming manual, if so it's okay to keep them. But please make move them to the front, like /* N: comment */

right, it corresponds to the manual. Will change as suggested.

Quoted 8 lines

drivers/remoteproc/q6v5-wcss.c line 161

Quoted 4 lines
drivers/remoteproc/q6v5-wcss.c +4 -0
+	nretry = 0;
+
+	ret = regmap_update_bits(qproc->tcsr, qproc->halt_wcss + TCSR_HALTREQ,
+				 1, 1);

Is there a reason to do read-modify-write on this register? I use regmap_write() in the other driver.

Just did a ditto of what was mentioned in the manual. May be a direct write would also suffice. Will check and update if it works.

Quoted 10 lines
Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+	if (ret)
+		return ret;
+
+	while (1) {
+		regmap_read(qproc->tcsr, qproc->halt_wcss + TCSR_HALTACK,
+			    &val);
+		if (val & HALTACK)
+			break;
+		mdelay(1);
+		nretry++;
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 176

Quoted 5 lines
drivers/remoteproc/q6v5-wcss.c +5 -0
+		if (nretry >= 10) {
+			pr_warn("can't get TCSR haltACK\n");
+			break;
+		}
+	}

Would it be possible to move q6v5proc_halt_axi_port() to qcom_common.c (or a tcsr driver?) and use that instead?

ok, qcom_common.c, this can be used in both qcom_q6v5_pil.c as well.

Quoted 5 lines

drivers/remoteproc/q6v5-wcss.c

Quoted 2 lines
drivers/remoteproc/q6v5-wcss.c +2 -0
+
+	/* Check HALTACK */

I presume this comment does not relate to the code that follows it?

ok, will remove.

Quoted 4 lines

drivers/remoteproc/q6v5-wcss.c line 179

Quoted 1 line
drivers/remoteproc/q6v5-wcss.c +1 -0
+	/* Set MPM_SSCAON_CONFIG 13 - 2 */

Shouldn't this be "Disable MPM_WCSSAON_CONFIG 13"?

Right, will update.

Quoted 4 lines
Quoted 4 lines
drivers/remoteproc/q6v5-wcss.c +4 -0
+	val = readl(qproc->mpm_base + SSCAON_CONFIG);
+	val |= BIT(13);
+	writel(val, qproc->mpm_base + SSCAON_CONFIG);
+
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 189

Quoted 6 lines
drivers/remoteproc/q6v5-wcss.c +6 -0
+	/* Set MPM_SSCAON_CONFIG 15 - 3 */
+	val = readl(qproc->mpm_base + SSCAON_CONFIG);
+	val |= BIT(15);
+	val &= ~(BIT(16));
+	val &= ~(BIT(17));
+	val &= ~(BIT(18));

Skip all the extra parenthesis.

ok.

Quoted 24 lines
Quoted 12 lines
drivers/remoteproc/q6v5-wcss.c +12 -0
+	writel(val, qproc->mpm_base + SSCAON_CONFIG);
+
+	/* Set MPM_SSCAON_CONFIG 1 - 4 */
+	val = readl(qproc->mpm_base + SSCAON_CONFIG);
+	val |= BIT(1);
+	writel(val, qproc->mpm_base + SSCAON_CONFIG);
+
+	/* wait for SSCAON_STATUS to be 0x400 - 5 */
+	nretry = 0;
+	while (1) {
+		val = readl(qproc->mpm_base + SSCAON_STATUS);
+		/* ignore bits 16 to 31 */

drivers/remoteproc/q6v5-wcss.c line 211

Quoted 10 lines
drivers/remoteproc/q6v5-wcss.c +10 -0
+		val &= 0xffff;
+		if (val == BIT(10))
+			break;
+		nretry++;
+		mdelay(1);
+		if (nretry == 10) {
+			pr_warn("can't get SSCAON_STATUS\n");
+			break;
+		}
+	}

Please replace this loop with:

Quoted 3 lines
	ret = readl_poll_timeout(qproc->mpm_base + SSCAON_STATUS, val,
				 val & 0xffff == 0x400, 1000, 10000);

sure, thanks.

Quoted 10 lines

drivers/remoteproc/q6v5-wcss.c line 218

Quoted 7 lines
drivers/remoteproc/q6v5-wcss.c +7 -0
+
+	/* Enable Q6/WCSS BLOCK ARES - 6 */
+	reset_control_assert(qproc->wcss_aon_reset);
+
+	/* Enable MPM_WCSSAON_CONFIG 13 - 7 */
+	val = readl(qproc->mpm_base + SSCAON_CONFIG);
+	val &= (~(BIT(13)));

Skip all the extra parenthesis.

ok.

Quoted 32 lines
Quoted 32 lines
drivers/remoteproc/q6v5-wcss.c +32 -0
+	writel(val, qproc->mpm_base + SSCAON_CONFIG);
+
+	/* Enable A2AB/ACMT/ECHAB ARES - 8 */
+	/* De-assert WCSS/Q6 HALTREQ - 8 */
+	reset_control_assert(qproc->wcss_reset);
+
+	ret = regmap_update_bits(qproc->tcsr, qproc->halt_wcss + TCSR_HALTREQ,
+				 1, 0);
+
+	return ret;
+}
+
+static int q6_powerdown(struct q6v5 *qproc)
+{
+	int i = 0, ret;
+	unsigned int nretry = 0;
+	unsigned int val = 0;
+
+	/* Halt Q6 bus interface - 9*/
+	ret = regmap_update_bits(qproc->tcsr, qproc->halt_q6 + TCSR_Q6_HALTREQ,
+				 1, 1);
+	if (ret)
+		return ret;
+
+	nretry = 0;
+	while (1) {
+		regmap_read(qproc->tcsr, qproc->halt_q6 + TCSR_Q6_HALTACK,
+			    &val);
+		if (val & HALTACK)
+			break;
+		mdelay(1);
+		nretry++;
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 255

Quoted 5 lines
drivers/remoteproc/q6v5-wcss.c +5 -0
+		if (nretry >= 10) {
+			pr_err("can't get TCSR Q6 haltACK\n");
+			break;
+		}
+	}

Again, can we utilize q6v5proc_halt_axi_port()? (Or replace the tcsr syscon with a driver)

Ya, the halt_axi_port across both of these Q6 drivers can be put in qcom_common.c.

Quoted 7 lines

drivers/remoteproc/q6v5-wcss.c line 259

Quoted 4 lines
drivers/remoteproc/q6v5-wcss.c +4 -0
+
+	/* Disable Q6 Core clock - 10 */
+	val = readl(qproc->q6_base + QDSP6SS_GFMUX_CTL);
+	val &= (~(BIT(1)));

Parenthesis.

ok.

Quoted 20 lines
Quoted 20 lines
drivers/remoteproc/q6v5-wcss.c +20 -0
+	writel(val, qproc->q6_base + QDSP6SS_GFMUX_CTL);
+
+	/* Clamp I/O - 11 */
+	val = readl(qproc->q6_base + QDSP6SS_PWR_CTL);
+	val |= BIT(20);
+	writel(val, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* Clamp WL - 12 */
+	val = readl(qproc->q6_base + QDSP6SS_PWR_CTL);
+	val |= BIT(21);
+	writel(val, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* Clear Erase standby - 13 */
+	val = readl(qproc->q6_base + QDSP6SS_PWR_CTL);
+	val &= (~(BIT(18)));
+	writel(val, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* Clear Sleep RTN - 14 */
+	val = readl(qproc->q6_base + QDSP6SS_PWR_CTL);
+	val &= (~(BIT(19)));
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 285

Quoted 6 lines
drivers/remoteproc/q6v5-wcss.c +6 -0
+	writel(val, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* turn off QDSP6 memory foot/head switch one bank at a time - 15*/
+	for (i = 0; i < 20; i++) {
+		val = readl(qproc->q6_base + QDSP6SS_MEM_PWR_CTL);
+		val &= (~(BIT(i)));

Parenthesis.

ok.

Quoted 21 lines
Quoted 21 lines
drivers/remoteproc/q6v5-wcss.c +21 -0
+		writel(val, qproc->q6_base + QDSP6SS_MEM_PWR_CTL);
+		mdelay(1);
+	}
+
+	/* Assert QMC memory RTN - 16 */
+	val = readl(qproc->q6_base + QDSP6SS_PWR_CTL);
+	val |= BIT(22);
+	writel(val, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* Turn off BHS - 17 */
+	val = readl(qproc->q6_base + QDSP6SS_PWR_CTL);
+	val &= (~(BIT(24)));
+	writel(val, qproc->q6_base + QDSP6SS_PWR_CTL);
+	udelay(1);
+	/* Wait till BHS Reset is done */
+	nretry = 0;
+	while (1) {
+		val = readl(qproc->q6_base + QDSP6SS_BHS_STATUS);
+		if (!(val & BHS_EN_REST_ACK))
+			break;
+		mdelay(1);
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 312

Quoted 6 lines
drivers/remoteproc/q6v5-wcss.c +6 -0
+		nretry++;
+		if (nretry >= 10) {
+			pr_err("BHS_STATUS not OFF\n");
+			break;
+		}
+	}

readl_poll_timeout()

ok.

Quoted 58 lines
Quoted 58 lines
drivers/remoteproc/q6v5-wcss.c +58 -0
+
+	/* HALT CLEAR - 18 */
+	ret = regmap_update_bits(qproc->tcsr, qproc->halt_q6 + TCSR_Q6_HALTREQ,
+				 1, 0);
+	if (ret)
+		return ret;
+
+	/* Enable Q6 Block reset - 19 */
+	reset_control_assert(qproc->wcss_q6_reset);
+
+	return 0;
+}
+
+static int q6_rproc_stop(struct rproc *rproc)
+{
+	struct q6v5 *qproc = rproc->priv;
+	int ret = 0;
+
+	qproc->running = false;
+
+	/* WCSS powerdown */
+	qcom_smem_state_update_bits(qproc->state, BIT(qproc->stop_bit),
+				    BIT(qproc->stop_bit));
+
+	ret = wait_for_completion_timeout(&qproc->stop_done,
+					  msecs_to_jiffies(5000));
+	if (ret == 0) {
+		dev_err(qproc->dev, "timed out on wait\n");
+		return -ETIMEDOUT;
+	}
+
+	qcom_smem_state_update_bits(qproc->state, BIT(qproc->stop_bit), 0);
+
+	ret = wcss_powerdown(qproc);
+	if (ret)
+		return ret;
+
+	/* Q6 Power down */
+	ret = q6_powerdown(qproc);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static int q6_rproc_start(struct rproc *rproc)
+{
+	struct q6v5 *qproc = rproc->priv;
+	int temp = 19;
+	unsigned long val = 0;
+	unsigned int nretry = 0;
+	int ret = 0;
+
+	ret = q6v5_clk_enable(qproc);
+	if (ret) {
+		dev_err(qproc->dev, "failed to enable clocks\n");
+		return ret;
+	}
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 376

Quoted 6 lines
drivers/remoteproc/q6v5-wcss.c +6 -0
+
+	/* Release Q6 and WCSS reset */
+	reset_control_deassert(qproc->wcss_reset);
+	reset_control_deassert(qproc->wcss_q6_reset);
+
+	/* Lithium configuration - clock gating and bus arbitration */

Should this go in a tcsr driver?

Not sure i understand this. So you mean we should have a driver that wrappers the access to tcsr registers. So that means that driver populates the syscon_to_regmap and passes back the regmap handle. Then the client driver like Q6 uses tcsr_ apis on top of that ?

Quoted 13 lines
Quoted 13 lines
drivers/remoteproc/q6v5-wcss.c +13 -0
+	ret = regmap_update_bits(qproc->tcsr,
+				 qproc->halt_gbl + TCSR_GLOBAL_CFG0,
+				 0x1F, 0x14);
+	if (ret)
+		return ret;
+
+	ret = regmap_update_bits(qproc->tcsr,
+				 qproc->halt_gbl + TCSR_GLOBAL_CFG1,
+				 1, 0);
+	if (ret)
+		return ret;
+
+	/* Write bootaddr to EVB so that Q6WCSS will jump there after reset */
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 394

Quoted 5 lines
drivers/remoteproc/q6v5-wcss.c +5 -0
+	writel(rproc->bootaddr >> 4, qproc->q6_base + QDSP6SS_RST_EVB);
+	/* Turn on XO clock. It is required for BHS and memory operation */
+	writel(0x1, qproc->q6_base + QDSP6SS_XO_CBCR);
+	/* Turn on BHS */
+	writel(0x1700000, qproc->q6_base + QDSP6SS_PWR_CTL);

Avaneesh provided defines for most of these magic numbers, please follow that.

ok.

Quoted 8 lines
Quoted 8 lines
drivers/remoteproc/q6v5-wcss.c +8 -0
+	udelay(1);
+
+	/* Wait till BHS Reset is done */
+	while (1) {
+		val = readl(qproc->q6_base + QDSP6SS_BHS_STATUS);
+		if (val & BHS_EN_REST_ACK)
+			break;
+		mdelay(1);
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 408

Quoted 6 lines
drivers/remoteproc/q6v5-wcss.c +6 -0
+		nretry++;
+		if (nretry >= 10) {
+			pr_err("BHS_STATUS not ON\n");
+			break;
+		}
+	}

Use readl_poll_timeout()

ok.

Quoted 4 lines
Quoted 4 lines
drivers/remoteproc/q6v5-wcss.c +4 -0
+
+	/* Put LDO in bypass mode */
+	writel(0x3700000, qproc->q6_base + QDSP6SS_PWR_CTL);
+	/* De-assert QDSP6 complier memory clamp */
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 418

Quoted 6 lines
drivers/remoteproc/q6v5-wcss.c +6 -0
+	writel(0x3300000, qproc->q6_base + QDSP6SS_PWR_CTL);
+	/* De-assert memory peripheral sleep and L2 memory standby */
+	writel(0x33c0000, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* turn on QDSP6 memory foot/head switch one bank at a time */
+	while  (temp >= 0) {

Please use a for loop, and replace "temp" with "i".

ok.

Quoted 3 lines

This is identical to Avaneesh patch, so let's make sure the code is identical as well.

ok.

Quoted 11 lines

drivers/remoteproc/q6v5-wcss.c line 420

Quoted 3 lines
drivers/remoteproc/q6v5-wcss.c +2 -0
+		val = readl(qproc->q6_base + QDSP6SS_MEM_PWR_CTL);
+		val = val | 1 << temp;

val |= BIT(temp);

drivers/remoteproc/q6v5-wcss.c line 422

Quoted 2 lines
drivers/remoteproc/q6v5-wcss.c +2 -0
+		writel(val, qproc->q6_base + QDSP6SS_MEM_PWR_CTL);
+		val = readl(qproc->q6_base + QDSP6SS_MEM_PWR_CTL);

Please include a comment on the read back here.

ok.

Quoted 172 lines
Quoted 172 lines
drivers/remoteproc/q6v5-wcss.c +172 -0
+		mdelay(10);
+		temp -= 1;
+	}
+	/* Remove the QDSP6 core memory word line clamp */
+	writel(0x31FFFFF, qproc->q6_base + QDSP6SS_PWR_CTL);
+	/* Remove QDSP6 I/O clamp */
+	writel(0x30FFFFF, qproc->q6_base + QDSP6SS_PWR_CTL);
+
+	/* Bring Q6 out of reset and stop the core */
+	writel(0x5, qproc->q6_base + QDSP6SS_RESET);
+
+	/* Retain debugger state during next QDSP6 reset */
+	writel(0x0, qproc->q6_base + QDSP6SS_DBG_CFG);
+	/* Turn on the QDSP6 core clock */
+	writel(0x102, qproc->q6_base + QDSP6SS_GFMUX_CTL);
+	/* Enable the core to run */
+	writel(0x4, qproc->q6_base + QDSP6SS_RESET);
+
+	ret = wait_for_completion_timeout(&qproc->start_done,
+					  msecs_to_jiffies(5000));
+	if (ret == 0) {
+		dev_err(qproc->dev, "start timed out\n");
+		return -ETIMEDOUT;
+	}
+
+	qproc->running = true;
+
+	return 0;
+}
+
+static struct rproc_ops q6v5_rproc_ops = {
+	.start		= q6_rproc_start,
+	.stop		= q6_rproc_stop,
+};
+
+static struct rproc_fw_ops q6_fw_ops;
+
+static int q6v5_request_irq(struct q6v5 *qproc,
+			    struct platform_device *pdev,
+			    const char *name,
+			    irq_handler_t thread_fn)
+{
+	int ret;
+
+	ret = platform_get_irq_byname(pdev, name);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "no %s IRQ defined\n", name);
+		return ret;
+	}
+
+	ret = devm_request_threaded_irq(&pdev->dev, ret,
+					NULL, thread_fn,
+					IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+					"q6v5", qproc);
+	if (ret)
+		dev_err(&pdev->dev, "request %s IRQ failed\n", name);
+
+	return ret;
+}
+
+static irqreturn_t q6v5_fatal_interrupt(int irq, void *dev)
+{
+	struct q6v5 *qproc = dev;
+	char *msg;
+	size_t len;
+
+	if (!qproc->running)
+		return IRQ_HANDLED;
+
+	msg = qcom_smem_get(QCOM_SMEM_HOST_ANY, WCSS_CRASH_REASON_SMEM, &len);
+	if (!IS_ERR(msg) && len > 0 && msg[0])
+		dev_err(qproc->dev, "Fatal error from wcss: %s\n", msg);
+	else
+		dev_err(qproc->dev, "Fatal error received no message!\n");
+
+	rproc_report_crash(qproc->rproc, RPROC_FATAL_ERROR);
+
+	if (!IS_ERR(msg))
+		msg[0] = '\0';
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t q6v5_handover_interrupt(int irq, void *dev)
+{
+	struct q6v5 *qproc = dev;
+
+	complete(&qproc->start_done);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t q6v5_stop_ack_interrupt(int irq, void *dev)
+{
+	struct q6v5 *qproc = dev;
+
+	complete(&qproc->stop_done);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t q6v5_wdog_interrupt(int irq, void *dev)
+{
+	struct q6v5 *qproc = dev;
+	char *msg;
+	size_t len;
+
+	if (!qproc->running) {
+		complete(&qproc->stop_done);
+		return IRQ_HANDLED;
+	}
+
+	msg = qcom_smem_get(QCOM_SMEM_HOST_ANY, WCSS_CRASH_REASON_SMEM, &len);
+	if (!IS_ERR(msg) && len > 0 && msg[0])
+		dev_err(qproc->dev, "Watchdog bite from wcss %s\n", msg);
+	else
+		dev_err(qproc->dev, "Watchdog bit received no message!\n");
+
+	rproc_report_crash(qproc->rproc, RPROC_WATCHDOG);
+
+	if (!IS_ERR(msg))
+		msg[0] = '\0';
+
+	return IRQ_HANDLED;
+}
+
+static int q6v5_load(struct rproc *rproc, const struct firmware *fw)
+{
+	struct q6v5 *qproc = (struct q6v5 *)rproc->priv;
+
+	return qcom_mdt_load(qproc->dev, fw, rproc->firmware, WCNSS_PAS_ID,
+			     qproc->mem_region, qproc->mem_phys,
+			     qproc->mem_size, false);
+}
+
+static int q6_alloc_memory_region(struct q6v5 *qproc)
+{
+	struct device_node *node;
+	struct resource r;
+	int ret;
+
+	node = of_parse_phandle(qproc->dev->of_node, "memory-region", 0);
+	if (!node) {
+		dev_err(qproc->dev, "no memory-region specified\n");
+		return -EINVAL;
+	}
+
+	ret = of_address_to_resource(node, 0, &r);
+	if (ret)
+		return ret;
+
+	qproc->mem_phys = r.start;
+	qproc->mem_size = resource_size(&r);
+	qproc->mem_region = devm_ioremap_wc(qproc->dev, qproc->mem_phys,
+					    qproc->mem_size);
+	if (!qproc->mem_region) {
+		dev_err(qproc->dev, "unable to map memory region: %pa+%zx\n",
+			&r.start, qproc->mem_size);
+		return -EBUSY;
+	}
+
+	return 0;
+}
+
+static int q6v5_init_mem(struct q6v5 *qproc, struct platform_device *pdev)
+{
+	struct of_phandle_args args;
+	struct resource *res;
+	int ret;
+
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+					   "mpm");
+	if (IS_ERR_OR_NULL(res))
+		return -ENODEV;
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 598

Quoted 4 lines
drivers/remoteproc/q6v5-wcss.c +4 -0
+
+	qproc->mpm_base = ioremap(res->start, resource_size(res));
+	if (IS_ERR_OR_NULL(qproc->mpm_base))
+		return PTR_ERR(qproc->mpm_base);

Is this the same MPM block that is used to configure sleep related things later? If so I think we shouldn't map it directly here, but introduce a separate driver for it.

Yeah, thats the one. But in this context it is used to configure some magic register. The downstream's irqchip type of functionality is not used here. Infact there may not be a usecase at all for this.

Quoted 4 lines
Quoted 4 lines
drivers/remoteproc/q6v5-wcss.c +4 -0
+
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+					   "q6");
+	if (IS_ERR_OR_NULL(res)) {
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 607

Quoted 5 lines
drivers/remoteproc/q6v5-wcss.c +5 -0
+		ret = -ENODEV;
+		goto free_mpm;
+	}
+
+	qproc->q6_base = ioremap(res->start, resource_size(res));

Except for the error path of this function these memory regions are never unmapped. Please use devm_ioremap_wc() instead.

ok.

Quoted 57 lines
Quoted 57 lines
drivers/remoteproc/q6v5-wcss.c +57 -0
+	if (IS_ERR_OR_NULL(qproc->q6_base)) {
+		ret = PTR_ERR(qproc->q6_base);
+		goto free_mpm;
+	}
+
+	ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
+					       "qcom,halt-regs", 3,
+					       0, &args);
+	if (ret < 0)
+		goto free_q6;
+
+	qproc->tcsr = syscon_node_to_regmap(args.np);
+	of_node_put(args.np);
+	if (IS_ERR_OR_NULL(qproc->tcsr)) {
+		ret = PTR_ERR(qproc->tcsr);
+		goto free_q6;
+	}
+
+	qproc->halt_gbl = args.args[0];
+	qproc->halt_q6 = args.args[1];
+	qproc->halt_wcss = args.args[2];
+
+	return 0;
+
+free_q6:
+	iounmap(qproc->q6_base);
+
+free_mpm:
+	iounmap(qproc->mpm_base);
+
+	return ret;
+}
+
+static int q6_rproc_probe(struct platform_device *pdev)
+{
+	struct q6v5 *qproc;
+	struct rproc *rproc;
+	int ret;
+	struct qcom_smem_state *state;
+	unsigned int stop_bit;
+	const char *firmware_name = of_device_get_match_data(&pdev->dev);
+
+	state = qcom_smem_state_get(&pdev->dev, "stop",
+				    &stop_bit);
+	if (IS_ERR(state))
+		/* Wait till SMP2P is registered and up */
+		return -EPROBE_DEFER;
+
+	rproc = rproc_alloc(&pdev->dev, pdev->name, &q6v5_rproc_ops,
+			    firmware_name,
+			    sizeof(*qproc));
+	if (unlikely(!rproc))
+		return -ENOMEM;
+
+	qproc = rproc->priv;
+	qproc->dev = &pdev->dev;
+	qproc->rproc = rproc;
Quoted 9 lines

drivers/remoteproc/q6v5-wcss.c line 669

Quoted 5 lines
drivers/remoteproc/q6v5-wcss.c +5 -0
+	rproc->has_iommu = false;
+
+	q6_fw_ops = *rproc->fw_ops;
+	q6_fw_ops.find_rsc_table = q6v5_find_rsc_table;
+	q6_fw_ops.load = q6v5_load;

I would prefer that you do define a static const object with these, like in the other qcom drivers.

ok.

Quoted 5 lines

But in order to do that you would need to export rproc_elf_get_boot_addr(), which is in line with another item on my todo list, so please do this.

[..]

hmm, in this case, boot_addr is not programmed. So would we still require the rproc_elf_get_boot_addr ?

Regards,
Sricharan

Signature · 10 lines
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw

PATCH 3/3 dt-binding: remoteproc: Add the bindings required for Q6 - WCSS core

In reply to Sricharan R

IPQ8074 has an integrated Q6V5 Hexagon dsp - Lithium Wlan (WCSS) core. This patch adds the required bindings to load, boot, shutdown that remoteproc subsystem.

---
 .../bindings/remoteproc/qcom,q6v5-wcss.txt         | 139 +++++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +139 -0
new file mode 100644
index 0000000..f664c26
@@ -0,0 +1,139 @@
+Qualcomm Hexagon (Q6) - WCSS Peripheral Image Loader
+
+This document defines the binding for a component that loads and boots firmware
+on the integrated Qualcomm Hexagon - WCSS core.
+
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,q6v5-wcss-pil",
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the qdsp6 and
+		    mpm (msm power manager) register blocks.
+
+- reg-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "q6" and "mpm"
+
+- interrupts-extended:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must list the watchdog, fatal IRQs ready, handover and
+		    stop-ack IRQs
+
+- interrupt-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "wdog", "fatal", "ready", "handover", "stop-ack"
+
+- clocks:
+	Usage: required
+	Value type: <phandle>
+	Definition: references to the axim-q6, axim2-q6, axi-wcss,
+		    ahb-q6, ahbs-q6, ahb-wcss, ahbs-wcss, sysnoc and mem.
+		    to be held on behalf of the booting of the Hexagon and WCSS
+		    core. These are the interface, bus, mem clocks required for
+		    the Q6 and WCSS cores.
+
+- clock-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "axim-q6", "axim2-q6", "axi-wcss", "ahb-q6",
+			    "ahbs-q6", "ahb-wcss", "ahbs-wcss", "sysnoc", "mem"
+
+- resets:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reset-controller for the Q6-WCSS sub-system
+
+- reset-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "wcss_aon_reset", "wcss_reset", "wcss_q6_reset"
+
+- qcom,smem-states:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the smem state for requesting the Hexagon to
+		    shut down
+
+- qcom,smem-state-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "stop"
+
+- qcom,halt-regs:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: a phandle reference to a syscon representing TCSR followed
+		    by the three offsets within syscon for q6, wcss and tcsr global
+		    halt registers.
+
+= SUBNODES:
+The Hexagon node must contain a subnode, named "q6" representing
+the memory region used by the Hexagon firmware. The sub-node must contain:
+
+- memory-region:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reserved-memory for the Q6 firmware region
+
+= EXAMPLE
+The following example describes the resources needed to boot control the
+Hexagon, as it is found on IPQ8074 boards.
+
+	q6v5_wcss: q6v5_wcss@CD00000 {
+		compatible = "q6v5-wcss-pil";
+		reg = <0xCD00000 0x4040>,
+		      <0x4ab000 0x20>;
+		reg-names = "q6",
+			    "mpm";
+		interrupts-extended = <&intc 0 325 1>,
+				      <&wcss_smp2p_in 0 0>,
+				      <&wcss_smp2p_in 1 0>,
+				      <&wcss_smp2p_in 3 0>;
+		interrupt-names = "wdog",
+				  "fatal",
+				  "handover",
+				  "stop-ack";
+		clocks = <&gcc GCC_SYS_NOC_WCSS_AHB_CLK>,
+			 <&gcc GCC_WCSS_AHB_S_CLK>,
+			 <&gcc GCC_WCSS_ECAHB_CLK>,
+			 <&gcc GCC_Q6_AHB_CLK>,
+			 <&gcc GCC_Q6_AHB_S_CLK>,
+			 <&gcc GCC_WCSS_AXI_M_CLK>,
+			 <&gcc GCC_MEM_NOC_Q6_AXI_CLK>,
+			 <&gcc GCC_Q6_AXIM_CLK>,
+			 <&gcc GCC_Q6_AXIM2_CLK>;
+		clock-names = "sysnoc",
+			      "ahb-wcss",
+			      "ahbs-wcss",
+			      "ahb-q6",
+			      "ahbs-q6",
+			      "axi-wcss",
+			      "memnoc",
+			      "axim-q6",
+			      "axim2-q6";
+
+		resets = <&gcc GCC_WCSSAON_RESET>,
+			 <&gcc GCC_WCSS_BCR>,
+			 <&gcc GCC_WCSS_Q6_BCR>;
+
+		reset-names = "wcss_aon_reset",
+			      "wcss_reset",
+			      "wcss_q6_reset";
+
+		qcom,halt-regs = <&tcsr_mutex_block 0x0 0xA000 0xD000>;
+
+		qcom,smem-states = <&wcss_smp2p_out 0>,
+				   <&wcss_smp2p_out 1>;
+		qcom,smem-state-names = "shutdown",
+					"stop";
+		q6 {
+			memory-region = <&q6_region>;
+		};
+	};
Signature · 6 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#9 lore raw

Re: [PATCH 3/3] dt-binding: remoteproc: Add the bindings required for Q6 - WCSS core

Quoted 31 lines · Sricharan R

IPQ8074 has an integrated Q6V5 Hexagon dsp - Lithium Wlan (WCSS) core. This patch adds the required bindings to load, boot, shutdown that remoteproc subsystem.

---
 .../bindings/remoteproc/qcom,q6v5-wcss.txt         | 139 +++++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +15 -0
new file mode 100644
index 0000000..f664c26
@@ -0,0 +1,139 @@
+Qualcomm Hexagon (Q6) - WCSS Peripheral Image Loader
+
+This document defines the binding for a component that loads and boots firmware
+on the integrated Qualcomm Hexagon - WCSS core.
+
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,q6v5-wcss-pil",
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the qdsp6 and
+		    mpm (msm power manager) register blocks.

Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt line 25

Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +10 -0
+
+- reg-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "q6" and "mpm"
+
+- interrupts-extended:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must list the watchdog, fatal IRQs ready, handover and

fatal, ready, ...

Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt line 35

Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +10 -0
+		    stop-ack IRQs
+
+- interrupt-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "wdog", "fatal", "ready", "handover", "stop-ack"
+
+- clocks:
+	Usage: required
+	Value type: <phandle>

These are not just a phandle.

Quoted 6 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +6 -0
+	Definition: references to the axim-q6, axim2-q6, axi-wcss,
+		    ahb-q6, ahbs-q6, ahb-wcss, ahbs-wcss, sysnoc and mem.
+		    to be held on behalf of the booting of the Hexagon and WCSS
+		    core. These are the interface, bus, mem clocks required for
+		    the Q6 and WCSS cores.
+

Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt line 51

Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +10 -0
+- clock-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "axim-q6", "axim2-q6", "axi-wcss", "ahb-q6",
+			    "ahbs-q6", "ahb-wcss", "ahbs-wcss", "sysnoc", "mem"
+
+- resets:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reset-controller for the Q6-WCSS sub-system

This should be a list of 3 resets.

Quoted 17 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +17 -0
+
+- reset-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "wcss_aon_reset", "wcss_reset", "wcss_q6_reset"
+
+- qcom,smem-states:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the smem state for requesting the Hexagon to
+		    shut down
+
+- qcom,smem-state-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "stop"
+

Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt line 78

Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +10 -0
+- qcom,halt-regs:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: a phandle reference to a syscon representing TCSR followed
+		    by the three offsets within syscon for q6, wcss and tcsr global
+		    halt registers.
+
+= SUBNODES:
+The Hexagon node must contain a subnode, named "q6" representing
+the memory region used by the Hexagon firmware. The sub-node must contain:

Why does this need a sub-node?

Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt line 89

Quoted 11 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +11 -0
+
+- memory-region:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reserved-memory for the Q6 firmware region
+
+= EXAMPLE
+The following example describes the resources needed to boot control the
+Hexagon, as it is found on IPQ8074 boards.
+
+	q6v5_wcss: q6v5_wcss@CD00000 {

s/_/-/ in the node name.

Quoted 53 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +50 -0
+		compatible = "q6v5-wcss-pil";
+		reg = <0xCD00000 0x4040>,
+		      <0x4ab000 0x20>;
+		reg-names = "q6",
+			    "mpm";
+		interrupts-extended = <&intc 0 325 1>,
+				      <&wcss_smp2p_in 0 0>,
+				      <&wcss_smp2p_in 1 0>,
+				      <&wcss_smp2p_in 3 0>;
+		interrupt-names = "wdog",
+				  "fatal",
+				  "handover",
+				  "stop-ack";
+		clocks = <&gcc GCC_SYS_NOC_WCSS_AHB_CLK>,
+			 <&gcc GCC_WCSS_AHB_S_CLK>,
+			 <&gcc GCC_WCSS_ECAHB_CLK>,
+			 <&gcc GCC_Q6_AHB_CLK>,
+			 <&gcc GCC_Q6_AHB_S_CLK>,
+			 <&gcc GCC_WCSS_AXI_M_CLK>,
+			 <&gcc GCC_MEM_NOC_Q6_AXI_CLK>,
+			 <&gcc GCC_Q6_AXIM_CLK>,
+			 <&gcc GCC_Q6_AXIM2_CLK>;
+		clock-names = "sysnoc",
+			      "ahb-wcss",
+			      "ahbs-wcss",
+			      "ahb-q6",
+			      "ahbs-q6",
+			      "axi-wcss",
+			      "memnoc",
+			      "axim-q6",
+			      "axim2-q6";
+
+		resets = <&gcc GCC_WCSSAON_RESET>,
+			 <&gcc GCC_WCSS_BCR>,
+			 <&gcc GCC_WCSS_Q6_BCR>;
+
+		reset-names = "wcss_aon_reset",
+			      "wcss_reset",
+			      "wcss_q6_reset";
+
+		qcom,halt-regs = <&tcsr_mutex_block 0x0 0xA000 0xD000>;
+
+		qcom,smem-states = <&wcss_smp2p_out 0>,
+				   <&wcss_smp2p_out 1>;
+		qcom,smem-state-names = "shutdown",
+					"stop";
+		q6 {
+			memory-region = <&q6_region>;
+		};
+	};
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

Re: [PATCH 3/3] dt-binding: remoteproc: Add the bindings required for Q6 - WCSS core

Hi Rob,

Thanks for the review.

Quoted 36 lines · Rob Herring
Quoted 35 lines · Sricharan R

IPQ8074 has an integrated Q6V5 Hexagon dsp - Lithium Wlan (WCSS) core. This patch adds the required bindings to load, boot, shutdown that remoteproc subsystem.

---
 .../bindings/remoteproc/qcom,q6v5-wcss.txt         | 139 +++++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +19 -0
new file mode 100644
index 0000000..f664c26
@@ -0,0 +1,139 @@
+Qualcomm Hexagon (Q6) - WCSS Peripheral Image Loader
+
+This document defines the binding for a component that loads and boots firmware
+on the integrated Qualcomm Hexagon - WCSS core.
+
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,q6v5-wcss-pil",
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the qdsp6 and
+		    mpm (msm power manager) register blocks.
+
+- reg-names:
+	Usage: required
+	Value type: <stringlist>
Quoted 8 lines

Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt line 25

Quoted 6 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +6 -0
+	Definition: must be "q6" and "mpm"
+
+- interrupts-extended:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must list the watchdog, fatal IRQs ready, handover and

fatal, ready, ...

ok, will simplify.

Quoted 13 lines

Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt line 35

Quoted 11 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +10 -0
+		    stop-ack IRQs
+
+- interrupt-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "wdog", "fatal", "ready", "handover", "stop-ack"
+
+- clocks:
+	Usage: required
+	Value type: <phandle>

These are not just a phandle.

hmm ok. Will correct.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +10 -0
+	Definition: references to the axim-q6, axim2-q6, axi-wcss,
+		    ahb-q6, ahbs-q6, ahb-wcss, ahbs-wcss, sysnoc and mem.
+		    to be held on behalf of the booting of the Hexagon and WCSS
+		    core. These are the interface, bus, mem clocks required for
+		    the Q6 and WCSS cores.
+
+- clock-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "axim-q6", "axim2-q6", "axi-wcss", "ahb-q6",
Quoted 8 lines

Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt line 51

Quoted 6 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +6 -0
+			    "ahbs-q6", "ahb-wcss", "ahbs-wcss", "sysnoc", "mem"
+
+- resets:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reset-controller for the Q6-WCSS sub-system

This should be a list of 3 resets.

ok.

Quoted 21 lines
Quoted 21 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +21 -0
+
+- reset-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "wcss_aon_reset", "wcss_reset", "wcss_q6_reset"
+
+- qcom,smem-states:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the smem state for requesting the Hexagon to
+		    shut down
+
+- qcom,smem-state-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "stop"
+
+- qcom,halt-regs:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: a phandle reference to a syscon representing TCSR followed
Quoted 8 lines

Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt line 78

Quoted 6 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +6 -0
+		    by the three offsets within syscon for q6, wcss and tcsr global
+		    halt registers.
+
+= SUBNODES:
+The Hexagon node must contain a subnode, named "q6" representing
+the memory region used by the Hexagon firmware. The sub-node must contain:

Why does this need a sub-node?

Right, just the property. Had it correctly in code, missed to change here.

Quoted 14 lines

Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt line 89

Quoted 12 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5-wcss.txt new file +11 -0
+
+- memory-region:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reserved-memory for the Q6 firmware region
+
+= EXAMPLE
+The following example describes the resources needed to boot control the
+Hexagon, as it is found on IPQ8074 boards.
+
+	q6v5_wcss: q6v5_wcss@CD00000 {

s/_/-/ in the node name.

ok.

Regards,
Sricharan

Signature · 5 lines
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus