Commit 46a10fc3 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'rproc-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux

Pull remoteproc updates from Bjorn Andersson:
 "This introduces support for controlling the Cortex R7 co-processor in
  Renesas Gen3, support for R5F clusters and C71x DSPs on TI J721S2 and
  compute, audio and modem subsystems on Qualcomm SM6350.

  It fixes a couple of sparse errors related to memcpy_to/fromio and
  corrects the kerneldoc spelling of "Return:".

  The stm32 driver no longer attempts to communicate with the remote
  after the firmware has crashed"

* tag 'rproc-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux: (22 commits)
  remoteproc: stm32: Improve crash recovery time
  remoteproc: rcar_rproc: Remove trailing semicolon
  remoteproc: rcar_rproc: Fix pm_runtime_get_sync error check
  remoteproc: qcom: pas: Add SM6350 CDSP support
  remoteproc: qcom: pas: Add SM6350 ADSP support
  remoteproc: qcom: pas: Add SM6350 MPSS support
  dt-bindings: remoteproc: qcom: pas: Add SM6350 adsp, cdsp & mpss
  remoteproc: qcom: pas: Add missing power-domain "mxc" for CDSP
  remoteproc: imx_rproc: correct firmware reload
  remoteproc: qcom: pil_info: Don't memcpy_toio more than is provided
  remoteproc: Add Renesas rcar driver
  dt-bindings: remoteproc: Add Renesas R-Car
  remoteproc: Fix remaining wrong return formatting in documentation
  MAINTAINERS: Removing Ohad from remoteproc/rpmsg maintenance
  remoteproc: ingenic: Request IRQ disabled
  remoteproc: k3-r5: Extend support for R5F clusters on J721S2 SoCs
  remoteproc: k3-dsp: Extend support for C71x DSPs on J721S2 SoCs
  dt-bindings: remoteproc: k3-dsp: Update bindings for J721S2 SoCs
  dt-bindings: remoteproc: k3-r5f: Update bindings for J721S2 SoCs
  remoteproc: coredump: Correct argument 2 type for memcpy_fromio
  ...
parents fc9d6952 cfcabbb2
...@@ -315,6 +315,11 @@ S: Via Delle Palme, 9 ...@@ -315,6 +315,11 @@ S: Via Delle Palme, 9
S: Terni 05100 S: Terni 05100
S: Italy S: Italy
N: Ohad Ben Cohen
E: ohad@wizery.com
D: Remote Processor (remoteproc) subsystem
D: Remote Processor Messaging (rpmsg) subsystem
N: Krzysztof Benedyczak N: Krzysztof Benedyczak
E: golbi@mat.uni.torun.pl E: golbi@mat.uni.torun.pl
W: http://www.mat.uni.torun.pl/~golbi W: http://www.mat.uni.torun.pl/~golbi
......
...@@ -33,6 +33,9 @@ properties: ...@@ -33,6 +33,9 @@ properties:
- qcom,sdm845-adsp-pas - qcom,sdm845-adsp-pas
- qcom,sdm845-cdsp-pas - qcom,sdm845-cdsp-pas
- qcom,sdx55-mpss-pas - qcom,sdx55-mpss-pas
- qcom,sm6350-adsp-pas
- qcom,sm6350-cdsp-pas
- qcom,sm6350-mpss-pas
- qcom,sm8150-adsp-pas - qcom,sm8150-adsp-pas
- qcom,sm8150-cdsp-pas - qcom,sm8150-cdsp-pas
- qcom,sm8150-mpss-pas - qcom,sm8150-mpss-pas
...@@ -158,6 +161,9 @@ allOf: ...@@ -158,6 +161,9 @@ allOf:
- qcom,sc8180x-mpss-pas - qcom,sc8180x-mpss-pas
- qcom,sdm845-adsp-pas - qcom,sdm845-adsp-pas
- qcom,sdm845-cdsp-pas - qcom,sdm845-cdsp-pas
- qcom,sm6350-adsp-pas
- qcom,sm6350-cdsp-pas
- qcom,sm6350-mpss-pas
- qcom,sm8150-adsp-pas - qcom,sm8150-adsp-pas
- qcom,sm8150-cdsp-pas - qcom,sm8150-cdsp-pas
- qcom,sm8150-mpss-pas - qcom,sm8150-mpss-pas
...@@ -266,6 +272,8 @@ allOf: ...@@ -266,6 +272,8 @@ allOf:
- qcom,sc8180x-cdsp-pas - qcom,sc8180x-cdsp-pas
- qcom,sdm845-adsp-pas - qcom,sdm845-adsp-pas
- qcom,sdm845-cdsp-pas - qcom,sdm845-cdsp-pas
- qcom,sm6350-adsp-pas
- qcom,sm6350-cdsp-pas
- qcom,sm8150-adsp-pas - qcom,sm8150-adsp-pas
- qcom,sm8150-cdsp-pas - qcom,sm8150-cdsp-pas
- qcom,sm8150-slpi-pas - qcom,sm8150-slpi-pas
...@@ -301,6 +309,7 @@ allOf: ...@@ -301,6 +309,7 @@ allOf:
- qcom,sc7280-mpss-pas - qcom,sc7280-mpss-pas
- qcom,sc8180x-mpss-pas - qcom,sc8180x-mpss-pas
- qcom,sdx55-mpss-pas - qcom,sdx55-mpss-pas
- qcom,sm6350-mpss-pas
- qcom,sm8150-mpss-pas - qcom,sm8150-mpss-pas
- qcom,sm8350-mpss-pas - qcom,sm8350-mpss-pas
then: then:
...@@ -385,6 +394,23 @@ allOf: ...@@ -385,6 +394,23 @@ allOf:
- const: mx - const: mx
- const: mss - const: mss
- if:
properties:
compatible:
contains:
enum:
- qcom,sm6350-cdsp-pas
then:
properties:
power-domains:
items:
- description: CX power domain
- description: MX power domain
power-domain-names:
items:
- const: cx
- const: mx
- if: - if:
properties: properties:
compatible: compatible:
...@@ -405,6 +431,7 @@ allOf: ...@@ -405,6 +431,7 @@ allOf:
enum: enum:
- qcom,sc7280-mpss-pas - qcom,sc7280-mpss-pas
- qcom,sdx55-mpss-pas - qcom,sdx55-mpss-pas
- qcom,sm6350-mpss-pas
- qcom,sm8150-mpss-pas - qcom,sm8150-mpss-pas
- qcom,sm8350-mpss-pas - qcom,sm8350-mpss-pas
then: then:
...@@ -425,6 +452,7 @@ allOf: ...@@ -425,6 +452,7 @@ allOf:
enum: enum:
- qcom,sc8180x-adsp-pas - qcom,sc8180x-adsp-pas
- qcom,sc8180x-cdsp-pas - qcom,sc8180x-cdsp-pas
- qcom,sm6350-adsp-pas
- qcom,sm8150-slpi-pas - qcom,sm8150-slpi-pas
- qcom,sm8250-adsp-pas - qcom,sm8250-adsp-pas
- qcom,sm8250-slpi-pas - qcom,sm8250-slpi-pas
......
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: "http://devicetree.org/schemas/remoteproc/renesas,rcar-rproc.yaml#"
$schema: "http://devicetree.org/meta-schemas/core.yaml#"
title: Renesas R-Car remote processor controller bindings
maintainers:
- Julien Massot <julien.massot@iot.bzh>
description: |
This document defines the bindings for the remoteproc component that loads and
boots firmwares on the Renesas R-Car family chipset.
R-Car gen3 family may have a realtime processor, this processor shares peripheral
and RAM with the host processor with the same address map.
properties:
compatible:
const: renesas,rcar-cr7
resets:
maxItems: 1
power-domains:
maxItems: 1
memory-region:
description:
List of phandles to the reserved memory regions associated with the
remoteproc device. This is variable and describes the memories shared with
the remote processor (e.g. remoteproc firmware and carveouts, rpmsg
vrings, ...).
(see ../reserved-memory/reserved-memory.yaml)
required:
- compatible
- resets
- memory-region
- power-domains
additionalProperties: false
examples:
- |
#include <dt-bindings/clock/r8a7795-cpg-mssr.h>
#include <dt-bindings/power/r8a7795-sysc.h>
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
cr7_ram: cr7_ram@40040000 {
no-map;
reg = <0x0 0x40040000 0x0 0x1fc0000>;
};
};
cr7_rproc: cr7 {
compatible = "renesas,rcar-cr7";
memory-region = <&cr7_ram>;
power-domains = <&sysc R8A7795_PD_CR7>;
resets = <&cpg 222>;
};
...
...@@ -33,9 +33,11 @@ properties: ...@@ -33,9 +33,11 @@ properties:
enum: enum:
- ti,j721e-c66-dsp - ti,j721e-c66-dsp
- ti,j721e-c71-dsp - ti,j721e-c71-dsp
- ti,j721s2-c71-dsp
description: description:
Use "ti,j721e-c66-dsp" for C66x DSPs on K3 J721E SoCs Use "ti,j721e-c66-dsp" for C66x DSPs on K3 J721E SoCs
Use "ti,j721e-c71-dsp" for C71x DSPs on K3 J721E SoCs Use "ti,j721e-c71-dsp" for C71x DSPs on K3 J721E SoCs
Use "ti,j721s2-c71-dsp" for C71x DSPs on K3 J721S2 SoCs
resets: resets:
description: | description: |
...@@ -106,6 +108,7 @@ else: ...@@ -106,6 +108,7 @@ else:
compatible: compatible:
enum: enum:
- ti,j721e-c71-dsp - ti,j721e-c71-dsp
- ti,j721s2-c71-dsp
then: then:
properties: properties:
reg: reg:
......
...@@ -38,6 +38,7 @@ properties: ...@@ -38,6 +38,7 @@ properties:
- ti,j721e-r5fss - ti,j721e-r5fss
- ti,j7200-r5fss - ti,j7200-r5fss
- ti,am64-r5fss - ti,am64-r5fss
- ti,j721s2-r5fss
power-domains: power-domains:
description: | description: |
...@@ -64,9 +65,9 @@ properties: ...@@ -64,9 +65,9 @@ properties:
description: | description: |
Configuration Mode for the Dual R5F cores within the R5F cluster. Configuration Mode for the Dual R5F cores within the R5F cluster.
Should be either a value of 1 (LockStep mode) or 0 (Split mode) on Should be either a value of 1 (LockStep mode) or 0 (Split mode) on
most SoCs (AM65x, J721E, J7200), default is LockStep mode if omitted; most SoCs (AM65x, J721E, J7200, J721s2), default is LockStep mode if
and should be either a value of 0 (Split mode) or 2 (Single-CPU mode) omitted; and should be either a value of 0 (Split mode) or 2
on AM64x SoCs, default is Split mode if omitted. (Single-CPU mode) on AM64x SoCs, default is Split mode if omitted.
# R5F Processor Child Nodes: # R5F Processor Child Nodes:
# ========================== # ==========================
...@@ -104,6 +105,7 @@ patternProperties: ...@@ -104,6 +105,7 @@ patternProperties:
- ti,j721e-r5f - ti,j721e-r5f
- ti,j7200-r5f - ti,j7200-r5f
- ti,am64-r5f - ti,am64-r5f
- ti,j721s2-r5f
reg: reg:
items: items:
......
...@@ -16400,7 +16400,6 @@ S: Supported ...@@ -16400,7 +16400,6 @@ S: Supported
F: fs/reiserfs/ F: fs/reiserfs/
REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM
M: Ohad Ben-Cohen <ohad@wizery.com>
M: Bjorn Andersson <bjorn.andersson@linaro.org> M: Bjorn Andersson <bjorn.andersson@linaro.org>
M: Mathieu Poirier <mathieu.poirier@linaro.org> M: Mathieu Poirier <mathieu.poirier@linaro.org>
L: linux-remoteproc@vger.kernel.org L: linux-remoteproc@vger.kernel.org
...@@ -16414,7 +16413,6 @@ F: include/linux/remoteproc.h ...@@ -16414,7 +16413,6 @@ F: include/linux/remoteproc.h
F: include/linux/remoteproc/ F: include/linux/remoteproc/
REMOTE PROCESSOR MESSAGING (RPMSG) SUBSYSTEM REMOTE PROCESSOR MESSAGING (RPMSG) SUBSYSTEM
M: Ohad Ben-Cohen <ohad@wizery.com>
M: Bjorn Andersson <bjorn.andersson@linaro.org> M: Bjorn Andersson <bjorn.andersson@linaro.org>
M: Mathieu Poirier <mathieu.poirier@linaro.org> M: Mathieu Poirier <mathieu.poirier@linaro.org>
L: linux-remoteproc@vger.kernel.org L: linux-remoteproc@vger.kernel.org
......
...@@ -283,6 +283,17 @@ config QCOM_WCNSS_PIL ...@@ -283,6 +283,17 @@ config QCOM_WCNSS_PIL
verified and booted with the help of the Peripheral Authentication verified and booted with the help of the Peripheral Authentication
System (PAS) in TrustZone. System (PAS) in TrustZone.
config RCAR_REMOTEPROC
tristate "Renesas R-Car Gen3 remoteproc support"
depends on ARCH_RENESAS || COMPILE_TEST
help
Say y here to support R-Car realtime processor via the
remote processor framework. An ELF firmware can be loaded
thanks to sysfs remoteproc entries. The remote processor
can be started and stopped.
This can be either built-in or a loadable module.
If compiled as module (M), the module name is rcar_rproc.
config ST_REMOTEPROC config ST_REMOTEPROC
tristate "ST remoteproc support" tristate "ST remoteproc support"
depends on ARCH_STI depends on ARCH_STI
......
...@@ -32,6 +32,7 @@ obj-$(CONFIG_QCOM_SYSMON) += qcom_sysmon.o ...@@ -32,6 +32,7 @@ obj-$(CONFIG_QCOM_SYSMON) += qcom_sysmon.o
obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o
qcom_wcnss_pil-y += qcom_wcnss.o qcom_wcnss_pil-y += qcom_wcnss.o
qcom_wcnss_pil-y += qcom_wcnss_iris.o qcom_wcnss_pil-y += qcom_wcnss_iris.o
obj-$(CONFIG_RCAR_REMOTEPROC) += rcar_rproc.o
obj-$(CONFIG_ST_REMOTEPROC) += st_remoteproc.o obj-$(CONFIG_ST_REMOTEPROC) += st_remoteproc.o
obj-$(CONFIG_ST_SLIM_REMOTEPROC) += st_slim_rproc.o obj-$(CONFIG_ST_SLIM_REMOTEPROC) += st_slim_rproc.o
obj-$(CONFIG_STM32_RPROC) += stm32_rproc.o obj-$(CONFIG_STM32_RPROC) += stm32_rproc.o
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
#define IMX7D_M4_START (IMX7D_ENABLE_M4 | IMX7D_SW_M4P_RST \ #define IMX7D_M4_START (IMX7D_ENABLE_M4 | IMX7D_SW_M4P_RST \
| IMX7D_SW_M4C_RST) | IMX7D_SW_M4C_RST)
#define IMX7D_M4_STOP IMX7D_SW_M4C_NON_SCLR_RST #define IMX7D_M4_STOP (IMX7D_ENABLE_M4 | IMX7D_SW_M4C_RST | \
IMX7D_SW_M4C_NON_SCLR_RST)
/* Address: 0x020D8000 */ /* Address: 0x020D8000 */
#define IMX6SX_SRC_SCR 0x00 #define IMX6SX_SRC_SCR 0x00
...@@ -45,7 +46,8 @@ ...@@ -45,7 +46,8 @@
#define IMX6SX_M4_START (IMX6SX_ENABLE_M4 | IMX6SX_SW_M4P_RST \ #define IMX6SX_M4_START (IMX6SX_ENABLE_M4 | IMX6SX_SW_M4P_RST \
| IMX6SX_SW_M4C_RST) | IMX6SX_SW_M4C_RST)
#define IMX6SX_M4_STOP IMX6SX_SW_M4C_NON_SCLR_RST #define IMX6SX_M4_STOP (IMX6SX_ENABLE_M4 | IMX6SX_SW_M4C_RST | \
IMX6SX_SW_M4C_NON_SCLR_RST)
#define IMX6SX_M4_RST_MASK (IMX6SX_ENABLE_M4 | IMX6SX_SW_M4P_RST \ #define IMX6SX_M4_RST_MASK (IMX6SX_ENABLE_M4 | IMX6SX_SW_M4P_RST \
| IMX6SX_SW_M4C_NON_SCLR_RST \ | IMX6SX_SW_M4C_NON_SCLR_RST \
| IMX6SX_SW_M4C_RST) | IMX6SX_SW_M4C_RST)
...@@ -684,7 +686,7 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv) ...@@ -684,7 +686,7 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv)
return ret; return ret;
} }
if (!(val & dcfg->src_stop)) if ((val & dcfg->src_mask) != dcfg->src_stop)
priv->rproc->state = RPROC_DETACHED; priv->rproc->state = RPROC_DETACHED;
return 0; return 0;
...@@ -804,6 +806,7 @@ static int imx_rproc_remove(struct platform_device *pdev) ...@@ -804,6 +806,7 @@ static int imx_rproc_remove(struct platform_device *pdev)
clk_disable_unprepare(priv->clk); clk_disable_unprepare(priv->clk);
rproc_del(rproc); rproc_del(rproc);
imx_rproc_free_mbox(rproc); imx_rproc_free_mbox(rproc);
destroy_workqueue(priv->workqueue);
rproc_free(rproc); rproc_free(rproc);
return 0; return 0;
......
...@@ -218,14 +218,13 @@ static int ingenic_rproc_probe(struct platform_device *pdev) ...@@ -218,14 +218,13 @@ static int ingenic_rproc_probe(struct platform_device *pdev)
if (vpu->irq < 0) if (vpu->irq < 0)
return vpu->irq; return vpu->irq;
ret = devm_request_irq(dev, vpu->irq, vpu_interrupt, 0, "VPU", rproc); ret = devm_request_irq(dev, vpu->irq, vpu_interrupt, IRQF_NO_AUTOEN,
"VPU", rproc);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Failed to request IRQ\n"); dev_err(dev, "Failed to request IRQ\n");
return ret; return ret;
} }
disable_irq(vpu->irq);
ret = devm_rproc_add(dev, rproc); ret = devm_rproc_add(dev, rproc);
if (ret) { if (ret) {
dev_err(dev, "Failed to register remote processor\n"); dev_err(dev, "Failed to register remote processor\n");
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* *
* Register an ipi function to receive ipi interrupt from SCP. * Register an ipi function to receive ipi interrupt from SCP.
* *
* Returns 0 if ipi registers successfully, -error on error. * Return: 0 if ipi registers successfully, -error on error.
*/ */
int scp_ipi_register(struct mtk_scp *scp, int scp_ipi_register(struct mtk_scp *scp,
u32 id, u32 id,
...@@ -150,7 +150,7 @@ EXPORT_SYMBOL_GPL(scp_ipi_unlock); ...@@ -150,7 +150,7 @@ EXPORT_SYMBOL_GPL(scp_ipi_unlock);
* When the processing completes, IPI handler registered * When the processing completes, IPI handler registered
* by scp_ipi_register will be called in interrupt context. * by scp_ipi_register will be called in interrupt context.
* *
* Returns 0 if sending data successfully, -error on error. * Return: 0 if sending data successfully, -error on error.
**/ **/
int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len, int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len,
unsigned int wait) unsigned int wait)
......
...@@ -104,7 +104,7 @@ int qcom_pil_info_store(const char *image, phys_addr_t base, size_t size) ...@@ -104,7 +104,7 @@ int qcom_pil_info_store(const char *image, phys_addr_t base, size_t size)
return -ENOMEM; return -ENOMEM;
found_unused: found_unused:
memcpy_toio(entry, image, PIL_RELOC_NAME_LEN); memcpy_toio(entry, image, strnlen(image, PIL_RELOC_NAME_LEN));
found_existing: found_existing:
/* Use two writel() as base is only aligned to 4 bytes on odd entries */ /* Use two writel() as base is only aligned to 4 bytes on odd entries */
writel(base, entry + PIL_RELOC_NAME_LEN); writel(base, entry + PIL_RELOC_NAME_LEN);
......
...@@ -524,6 +524,23 @@ static const struct adsp_data sdm845_adsp_resource_init = { ...@@ -524,6 +524,23 @@ static const struct adsp_data sdm845_adsp_resource_init = {
.ssctl_id = 0x14, .ssctl_id = 0x14,
}; };
static const struct adsp_data sm6350_adsp_resource = {
.crash_reason_smem = 423,
.firmware_name = "adsp.mdt",
.pas_id = 1,
.has_aggre2_clk = false,
.auto_boot = true,
.proxy_pd_names = (char*[]){
"lcx",
"lmx",
NULL
},
.load_state = "adsp",
.ssr_name = "lpass",
.sysmon_name = "adsp",
.ssctl_id = 0x14,
};
static const struct adsp_data sm8150_adsp_resource = { static const struct adsp_data sm8150_adsp_resource = {
.crash_reason_smem = 423, .crash_reason_smem = 423,
.firmware_name = "adsp.mdt", .firmware_name = "adsp.mdt",
...@@ -612,6 +629,23 @@ static const struct adsp_data sdm845_cdsp_resource_init = { ...@@ -612,6 +629,23 @@ static const struct adsp_data sdm845_cdsp_resource_init = {
.ssctl_id = 0x17, .ssctl_id = 0x17,
}; };
static const struct adsp_data sm6350_cdsp_resource = {
.crash_reason_smem = 601,
.firmware_name = "cdsp.mdt",
.pas_id = 18,
.has_aggre2_clk = false,
.auto_boot = true,
.proxy_pd_names = (char*[]){
"cx",
"mx",
NULL
},
.load_state = "cdsp",
.ssr_name = "cdsp",
.sysmon_name = "cdsp",
.ssctl_id = 0x17,
};
static const struct adsp_data sm8150_cdsp_resource = { static const struct adsp_data sm8150_cdsp_resource = {
.crash_reason_smem = 601, .crash_reason_smem = 601,
.firmware_name = "cdsp.mdt", .firmware_name = "cdsp.mdt",
...@@ -652,6 +686,7 @@ static const struct adsp_data sm8350_cdsp_resource = { ...@@ -652,6 +686,7 @@ static const struct adsp_data sm8350_cdsp_resource = {
.auto_boot = true, .auto_boot = true,
.proxy_pd_names = (char*[]){ .proxy_pd_names = (char*[]){
"cx", "cx",
"mxc",
NULL NULL
}, },
.load_state = "cdsp", .load_state = "cdsp",
...@@ -804,6 +839,9 @@ static const struct of_device_id adsp_of_match[] = { ...@@ -804,6 +839,9 @@ static const struct of_device_id adsp_of_match[] = {
{ .compatible = "qcom,sdm845-adsp-pas", .data = &sdm845_adsp_resource_init}, { .compatible = "qcom,sdm845-adsp-pas", .data = &sdm845_adsp_resource_init},
{ .compatible = "qcom,sdm845-cdsp-pas", .data = &sdm845_cdsp_resource_init}, { .compatible = "qcom,sdm845-cdsp-pas", .data = &sdm845_cdsp_resource_init},
{ .compatible = "qcom,sdx55-mpss-pas", .data = &sdx55_mpss_resource}, { .compatible = "qcom,sdx55-mpss-pas", .data = &sdx55_mpss_resource},
{ .compatible = "qcom,sm6350-adsp-pas", .data = &sm6350_adsp_resource},
{ .compatible = "qcom,sm6350-cdsp-pas", .data = &sm6350_cdsp_resource},
{ .compatible = "qcom,sm6350-mpss-pas", .data = &mpss_resource_init},
{ .compatible = "qcom,sm8150-adsp-pas", .data = &sm8150_adsp_resource}, { .compatible = "qcom,sm8150-adsp-pas", .data = &sm8150_adsp_resource},
{ .compatible = "qcom,sm8150-cdsp-pas", .data = &sm8150_cdsp_resource}, { .compatible = "qcom,sm8150-cdsp-pas", .data = &sm8150_cdsp_resource},
{ .compatible = "qcom,sm8150-mpss-pas", .data = &mpss_resource_init}, { .compatible = "qcom,sm8150-mpss-pas", .data = &mpss_resource_init},
......
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) IoT.bzh 2021
*/
#include <linux/limits.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of_reserved_mem.h>
#include <linux/pm_runtime.h>
#include <linux/remoteproc.h>
#include <linux/reset.h>
#include <linux/soc/renesas/rcar-rst.h>
#include "remoteproc_internal.h"
struct rcar_rproc {
struct reset_control *rst;
};
static int rcar_rproc_mem_alloc(struct rproc *rproc,
struct rproc_mem_entry *mem)
{
struct device *dev = &rproc->dev;
void *va;
dev_dbg(dev, "map memory: %pa+%zx\n", &mem->dma, mem->len);
va = ioremap_wc(mem->dma, mem->len);
if (!va) {
dev_err(dev, "Unable to map memory region: %pa+%zx\n",
&mem->dma, mem->len);
return -ENOMEM;
}
/* Update memory entry va */
mem->va = va;
return 0;
}
static int rcar_rproc_mem_release(struct rproc *rproc,
struct rproc_mem_entry *mem)
{
dev_dbg(&rproc->dev, "unmap memory: %pa\n", &mem->dma);
iounmap(mem->va);
return 0;
}
static int rcar_rproc_prepare(struct rproc *rproc)
{
struct device *dev = rproc->dev.parent;
struct device_node *np = dev->of_node;
struct of_phandle_iterator it;
struct rproc_mem_entry *mem;
struct reserved_mem *rmem;
u32 da;
/* Register associated reserved memory regions */
of_phandle_iterator_init(&it, np, "memory-region", NULL, 0);
while (of_phandle_iterator_next(&it) == 0) {
rmem = of_reserved_mem_lookup(it.node);
if (!rmem) {
dev_err(&rproc->dev,
"unable to acquire memory-region\n");
return -EINVAL;
}
if (rmem->base > U32_MAX)
return -EINVAL;
/* No need to translate pa to da, R-Car use same map */
da = rmem->base;
mem = rproc_mem_entry_init(dev, NULL,
rmem->base,
rmem->size, da,
rcar_rproc_mem_alloc,
rcar_rproc_mem_release,
it.node->name);
if (!mem)
return -ENOMEM;
rproc_add_carveout(rproc, mem);
}
return 0;
}
static int rcar_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw)
{
int ret;
ret = rproc_elf_load_rsc_table(rproc, fw);
if (ret)
dev_info(&rproc->dev, "No resource table in elf\n");
return 0;
}
static int rcar_rproc_start(struct rproc *rproc)
{
struct rcar_rproc *priv = rproc->priv;
int err;
if (!rproc->bootaddr)
return -EINVAL;
err = rcar_rst_set_rproc_boot_addr(rproc->bootaddr);
if (err) {
dev_err(&rproc->dev, "failed to set rproc boot addr\n");
return err;
}
err = reset_control_deassert(priv->rst);
if (err)
dev_err(&rproc->dev, "failed to deassert reset\n");
return err;
}
static int rcar_rproc_stop(struct rproc *rproc)
{
struct rcar_rproc *priv = rproc->priv;
int err;
err = reset_control_assert(priv->rst);
if (err)
dev_err(&rproc->dev, "failed to assert reset\n");
return err;
}
static struct rproc_ops rcar_rproc_ops = {
.prepare = rcar_rproc_prepare,
.start = rcar_rproc_start,
.stop = rcar_rproc_stop,
.load = rproc_elf_load_segments,
.parse_fw = rcar_rproc_parse_fw,
.find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table,
.sanity_check = rproc_elf_sanity_check,
.get_boot_addr = rproc_elf_get_boot_addr,
};
static int rcar_rproc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct rcar_rproc *priv;
struct rproc *rproc;
int ret;
rproc = devm_rproc_alloc(dev, np->name, &rcar_rproc_ops,
NULL, sizeof(*priv));
if (!rproc)
return -ENOMEM;
priv = rproc->priv;
priv->rst = devm_reset_control_get_exclusive(dev, NULL);
if (IS_ERR(priv->rst)) {
ret = PTR_ERR(priv->rst);
dev_err_probe(dev, ret, "fail to acquire rproc reset\n");
return ret;
}
pm_runtime_enable(dev);
ret = pm_runtime_resume_and_get(dev);
if (ret) {
dev_err(dev, "failed to power up\n");
return ret;
}
dev_set_drvdata(dev, rproc);
/* Manually start the rproc */
rproc->auto_boot = false;
ret = devm_rproc_add(dev, rproc);
if (ret) {
dev_err(dev, "rproc_add failed\n");
goto pm_disable;
}
return 0;
pm_disable:
pm_runtime_disable(dev);
return ret;
}
static int rcar_rproc_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
pm_runtime_disable(dev);
return 0;
}
static const struct of_device_id rcar_rproc_of_match[] = {
{ .compatible = "renesas,rcar-cr7" },
{},
};
MODULE_DEVICE_TABLE(of, rcar_rproc_of_match);
static struct platform_driver rcar_rproc_driver = {
.probe = rcar_rproc_probe,
.remove = rcar_rproc_remove,
.driver = {
.name = "rcar-rproc",
.of_match_table = rcar_rproc_of_match,
},
};
module_platform_driver(rcar_rproc_driver);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Renesas R-Car Gen3 remote processor control driver");
MODULE_AUTHOR("Julien Massot <julien.massot@iot.bzh>");
...@@ -577,8 +577,8 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr, ...@@ -577,8 +577,8 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,
dma_get_mask(rproc->dev.parent)); dma_get_mask(rproc->dev.parent));
if (ret) { if (ret) {
dev_warn(dev, dev_warn(dev,
"Failed to set DMA mask %llx. Trying to continue... %x\n", "Failed to set DMA mask %llx. Trying to continue... (%pe)\n",
dma_get_mask(rproc->dev.parent), ret); dma_get_mask(rproc->dev.parent), ERR_PTR(ret));
} }
/* parse the vrings */ /* parse the vrings */
......
...@@ -166,7 +166,7 @@ static void rproc_copy_segment(struct rproc *rproc, void *dest, ...@@ -166,7 +166,7 @@ static void rproc_copy_segment(struct rproc *rproc, void *dest,
memset(dest, 0xff, size); memset(dest, 0xff, size);
} else { } else {
if (is_iomem) if (is_iomem)
memcpy_fromio(dest, ptr, size); memcpy_fromio(dest, (void const __iomem *)ptr, size);
else else
memcpy(dest, ptr, size); memcpy(dest, ptr, size);
} }
......
...@@ -216,7 +216,7 @@ static const struct rproc_ops slim_rproc_ops = { ...@@ -216,7 +216,7 @@ static const struct rproc_ops slim_rproc_ops = {
* obtains and enables any clocks required by the SLIM core and also * obtains and enables any clocks required by the SLIM core and also
* ioremaps the various IO. * ioremaps the various IO.
* *
* Returns st_slim_rproc pointer or PTR_ERR() on error. * Return: st_slim_rproc pointer or PTR_ERR() on error.
*/ */
struct st_slim_rproc *st_slim_rproc_alloc(struct platform_device *pdev, struct st_slim_rproc *st_slim_rproc_alloc(struct platform_device *pdev,
......
...@@ -494,7 +494,7 @@ static int stm32_rproc_stop(struct rproc *rproc) ...@@ -494,7 +494,7 @@ static int stm32_rproc_stop(struct rproc *rproc)
int err, idx; int err, idx;
/* request shutdown of the remote processor */ /* request shutdown of the remote processor */
if (rproc->state != RPROC_OFFLINE) { if (rproc->state != RPROC_OFFLINE && rproc->state != RPROC_CRASHED) {
idx = stm32_rproc_mbox_idx(rproc, STM32_MBX_SHUTDOWN); idx = stm32_rproc_mbox_idx(rproc, STM32_MBX_SHUTDOWN);
if (idx >= 0 && ddata->mb[idx].chan) { if (idx >= 0 && ddata->mb[idx].chan) {
err = mbox_send_message(ddata->mb[idx].chan, "detach"); err = mbox_send_message(ddata->mb[idx].chan, "detach");
......
...@@ -767,6 +767,7 @@ static const struct k3_dsp_dev_data c71_data = { ...@@ -767,6 +767,7 @@ static const struct k3_dsp_dev_data c71_data = {
static const struct of_device_id k3_dsp_of_match[] = { static const struct of_device_id k3_dsp_of_match[] = {
{ .compatible = "ti,j721e-c66-dsp", .data = &c66_data, }, { .compatible = "ti,j721e-c66-dsp", .data = &c66_data, },
{ .compatible = "ti,j721e-c71-dsp", .data = &c71_data, }, { .compatible = "ti,j721e-c71-dsp", .data = &c71_data, },
{ .compatible = "ti,j721s2-c71-dsp", .data = &c71_data, },
{ /* sentinel */ }, { /* sentinel */ },
}; };
MODULE_DEVICE_TABLE(of, k3_dsp_of_match); MODULE_DEVICE_TABLE(of, k3_dsp_of_match);
......
...@@ -1535,7 +1535,7 @@ static const struct k3_r5_soc_data am65_j721e_soc_data = { ...@@ -1535,7 +1535,7 @@ static const struct k3_r5_soc_data am65_j721e_soc_data = {
.single_cpu_mode = false, .single_cpu_mode = false,
}; };
static const struct k3_r5_soc_data j7200_soc_data = { static const struct k3_r5_soc_data j7200_j721s2_soc_data = {
.tcm_is_double = true, .tcm_is_double = true,
.tcm_ecc_autoinit = true, .tcm_ecc_autoinit = true,
.single_cpu_mode = false, .single_cpu_mode = false,
...@@ -1550,8 +1550,9 @@ static const struct k3_r5_soc_data am64_soc_data = { ...@@ -1550,8 +1550,9 @@ static const struct k3_r5_soc_data am64_soc_data = {
static const struct of_device_id k3_r5_of_match[] = { static const struct of_device_id k3_r5_of_match[] = {
{ .compatible = "ti,am654-r5fss", .data = &am65_j721e_soc_data, }, { .compatible = "ti,am654-r5fss", .data = &am65_j721e_soc_data, },
{ .compatible = "ti,j721e-r5fss", .data = &am65_j721e_soc_data, }, { .compatible = "ti,j721e-r5fss", .data = &am65_j721e_soc_data, },
{ .compatible = "ti,j7200-r5fss", .data = &j7200_soc_data, }, { .compatible = "ti,j7200-r5fss", .data = &j7200_j721s2_soc_data, },
{ .compatible = "ti,am64-r5fss", .data = &am64_soc_data, }, { .compatible = "ti,am64-r5fss", .data = &am64_soc_data, },
{ .compatible = "ti,j721s2-r5fss", .data = &j7200_j721s2_soc_data, },
{ /* sentinel */ }, { /* sentinel */ },
}; };
MODULE_DEVICE_TABLE(of, k3_r5_of_match); MODULE_DEVICE_TABLE(of, k3_r5_of_match);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment