Skip to content

Commit

Permalink
Merge tag 'rproc-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/andersson/remoteproc

Pull remoteproc updates from Bjorn Andersson:
 "This adds remoteproc support for the audio, compute, sensor and modem
  remoteprocs on the Qualcomm SM8350 platform, it adds Qualcomm WCN3660b
  support, Mediatek MT8192 SCP driver support for MPU and L1TCM memory,
  STM32 driver adopts dev_err_probe() and the Qualcomm Kconfig help
  texts are revamped"

* tag 'rproc-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc:
  remoteproc: qcom: pas: Add SM8350 PAS remoteprocs
  dt-bindings: remoteproc: qcom: pas: Add SM8350 remoteprocs
  remoteproc: core: Fix rproc->firmware free in rproc_set_firmware()
  remoteproc/mediatek: support L1TCM
  dt-bindings: remoteproc: mediatek: add L1TCM memory region
  remoteproc/mediatek: enable MPU for all memory regions in MT8192 SCP
  remoteproc/mediatek: use devm_platform_ioremap_resource_byname
  remoteproc: ingenic: Add module parameter 'auto_boot'
  remoteproc/mediatek: acknowledge watchdog IRQ after handled
  remoteproc: qcom_wcnss: remove unneeded semicolon
  remoteproc: qcom: fix glink dependencies
  remoteproc: stm32: improve debug using dev_err_probe
  remoteproc: qcom: add more help text qcom options
  remoteproc: qcom_wcnss: Add qcom,wcn3660b compatible
  dt-bindings: remoteproc: qcom,wcnss: Add qcom,wcn3660b compatible
  • Loading branch information
Linus Torvalds committed Feb 24, 2021
2 parents e40242b + e8b4e9a commit 062c84f
Show file tree
Hide file tree
Showing 12 changed files with 198 additions and 35 deletions.
8 changes: 4 additions & 4 deletions Documentation/devicetree/bindings/remoteproc/mtk,scp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Mediatek SoCs.

Required properties:
- compatible Should be "mediatek,mt8183-scp"
- reg Should contain the address ranges for the two memory
regions, SRAM and CFG.
- reg-names Contains the corresponding names for the two memory
regions. These should be named "sram" & "cfg".
- reg Should contain the address ranges for memory regions:
SRAM, CFG, and L1TCM.
- reg-names Contains the corresponding names for the memory regions:
"sram", "cfg", and "l1tcm".
- clocks Clock for co-processor (See: ../clock/clock-bindings.txt)
- clock-names Contains the corresponding name for the clock. This
should be named "main".
Expand Down
12 changes: 12 additions & 0 deletions Documentation/devicetree/bindings/remoteproc/qcom,adsp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ on the Qualcomm ADSP Hexagon core.
"qcom,sm8250-adsp-pas"
"qcom,sm8250-cdsp-pas"
"qcom,sm8250-slpi-pas"
"qcom,sm8350-adsp-pas"
"qcom,sm8350-cdsp-pas"
"qcom,sm8350-slpi-pas"
"qcom,sm8350-mpss-pas"

- interrupts-extended:
Usage: required
Expand All @@ -51,10 +55,14 @@ on the Qualcomm ADSP Hexagon core.
qcom,sm8250-adsp-pas:
qcom,sm8250-cdsp-pas:
qcom,sm8250-slpi-pas:
qcom,sm8350-adsp-pas:
qcom,sm8350-cdsp-pas:
qcom,sm8350-slpi-pas:
must be "wdog", "fatal", "ready", "handover", "stop-ack"
qcom,qcs404-wcss-pas:
qcom,sc7180-mpss-pas:
qcom,sm8150-mpss-pas:
qcom,sm8350-mpss-pas:
must be "wdog", "fatal", "ready", "handover", "stop-ack",
"shutdown-ack"

Expand Down Expand Up @@ -114,13 +122,17 @@ on the Qualcomm ADSP Hexagon core.
qcom,sm8150-adsp-pas:
qcom,sm8150-cdsp-pas:
qcom,sm8250-cdsp-pas:
qcom,sm8350-cdsp-pas:
must be "cx", "load_state"
qcom,sc7180-mpss-pas:
qcom,sm8150-mpss-pas:
qcom,sm8350-mpss-pas:
must be "cx", "load_state", "mss"
qcom,sm8250-adsp-pas:
qcom,sm8350-adsp-pas:
qcom,sm8150-slpi-pas:
qcom,sm8250-slpi-pas:
qcom,sm8350-slpi-pas:
must be "lcx", "lmx", "load_state"

- memory-region:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ and its resource dependencies. It is described by the following properties:
Definition: must be one of:
"qcom,wcn3620",
"qcom,wcn3660",
"qcom,wcn3660b",
"qcom,wcn3680"

- clocks:
Expand Down
25 changes: 19 additions & 6 deletions drivers/remoteproc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,17 @@ config QCOM_Q6V5_ADSP
depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
depends on QCOM_SYSMON || QCOM_SYSMON=n
depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
select MFD_SYSCON
select QCOM_PIL_INFO
select QCOM_MDT_LOADER
select QCOM_Q6V5_COMMON
select QCOM_RPROC_COMMON
help
Say y here to support the Peripheral Image Loader
for the Qualcomm Technology Inc. ADSP remote processors.
for the non-TrustZone part of Qualcomm Technology Inc. ADSP and CDSP
remote processors. The TrustZone part is handled by QCOM_Q6V5_PAS
driver.

config QCOM_Q6V5_MSS
tristate "Qualcomm Hexagon V5 self-authenticating modem subsystem support"
Expand All @@ -171,6 +174,7 @@ config QCOM_Q6V5_MSS
depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
depends on QCOM_SYSMON || QCOM_SYSMON=n
depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
select MFD_SYSCON
select QCOM_MDT_LOADER
select QCOM_PIL_INFO
Expand All @@ -179,7 +183,8 @@ config QCOM_Q6V5_MSS
select QCOM_SCM
help
Say y here to support the Qualcomm self-authenticating modem
subsystem based on Hexagon V5.
subsystem based on Hexagon V5. The TrustZone based system is
handled by QCOM_Q6V5_PAS driver.

config QCOM_Q6V5_PAS
tristate "Qualcomm Hexagon v5 Peripheral Authentication Service support"
Expand All @@ -188,6 +193,7 @@ config QCOM_Q6V5_PAS
depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
depends on QCOM_SYSMON || QCOM_SYSMON=n
depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
select MFD_SYSCON
select QCOM_PIL_INFO
select QCOM_MDT_LOADER
Expand All @@ -197,7 +203,9 @@ config QCOM_Q6V5_PAS
help
Say y here to support the TrustZone based Peripheral Image Loader
for the Qualcomm Hexagon v5 based remote processors. This is commonly
used to control subsystems such as ADSP, Compute and Sensor.
used to control subsystems such as ADSP (Audio DSP),
CDSP (Compute DSP), MPSS (Modem Peripheral SubSystem), and
SLPI (Sensor Low Power Island).

config QCOM_Q6V5_WCSS
tristate "Qualcomm Hexagon based WCSS Peripheral Image Loader"
Expand All @@ -206,6 +214,7 @@ config QCOM_Q6V5_WCSS
depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
depends on QCOM_SYSMON || QCOM_SYSMON=n
depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
select MFD_SYSCON
select QCOM_MDT_LOADER
select QCOM_PIL_INFO
Expand All @@ -214,7 +223,8 @@ config QCOM_Q6V5_WCSS
select QCOM_SCM
help
Say y here to support the Qualcomm Peripheral Image Loader for the
Hexagon V5 based WCSS remote processors.
Hexagon V5 based WCSS remote processors on e.g. IPQ8074. This is
a non-TrustZone wireless subsystem.

config QCOM_SYSMON
tristate "Qualcomm sysmon driver"
Expand All @@ -238,13 +248,16 @@ config QCOM_WCNSS_PIL
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
depends on QCOM_SMEM
depends on QCOM_SYSMON || QCOM_SYSMON=n
depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
select QCOM_MDT_LOADER
select QCOM_PIL_INFO
select QCOM_RPROC_COMMON
select QCOM_SCM
help
Say y here to support the Peripheral Image Loader for the Qualcomm
Wireless Connectivity Subsystem.
Say y here to support the Peripheral Image Loader for loading WCNSS
firmware and boot the core on e.g. MSM8974, MSM8916. The firmware is
verified and booted with the help of the Peripheral Authentication
System (PAS) in TrustZone.

config ST_REMOTEPROC
tristate "ST remoteproc support"
Expand Down
7 changes: 7 additions & 0 deletions drivers/remoteproc/ingenic_rproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
#define AUX_CTRL_NMI BIT(1)
#define AUX_CTRL_SW_RESET BIT(0)

static bool auto_boot;
module_param(auto_boot, bool, 0400);
MODULE_PARM_DESC(auto_boot,
"Auto-boot the remote processor [default=false]");

struct vpu_mem_map {
const char *name;
unsigned int da;
Expand Down Expand Up @@ -172,6 +177,8 @@ static int ingenic_rproc_probe(struct platform_device *pdev)
if (!rproc)
return -ENOMEM;

rproc->auto_boot = auto_boot;

vpu = rproc->priv;
vpu->dev = &pdev->dev;
platform_set_drvdata(pdev, vpu);
Expand Down
7 changes: 7 additions & 0 deletions drivers/remoteproc/mtk_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@

#define MT8192_CORE0_SW_RSTN_CLR 0x10000
#define MT8192_CORE0_SW_RSTN_SET 0x10004
#define MT8192_CORE0_MEM_ATT_PREDEF 0x10008
#define MT8192_CORE0_WDT_IRQ 0x10030
#define MT8192_CORE0_WDT_CFG 0x10034

#define SCP_FW_VER_LEN 32
Expand Down Expand Up @@ -75,6 +77,7 @@ struct mtk_scp_of_data {
void (*scp_reset_assert)(struct mtk_scp *scp);
void (*scp_reset_deassert)(struct mtk_scp *scp);
void (*scp_stop)(struct mtk_scp *scp);
void *(*scp_da_to_va)(struct mtk_scp *scp, u64 da, size_t len);

u32 host_to_scp_reg;
u32 host_to_scp_int_bit;
Expand All @@ -89,6 +92,10 @@ struct mtk_scp {
void __iomem *reg_base;
void __iomem *sram_base;
size_t sram_size;
phys_addr_t sram_phys;
void __iomem *l1tcm_base;
size_t l1tcm_size;
phys_addr_t l1tcm_phys;

const struct mtk_scp_of_data *data;

Expand Down
82 changes: 69 additions & 13 deletions drivers/remoteproc/mtk_scp.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,19 @@ static void mt8192_scp_irq_handler(struct mtk_scp *scp)

scp_to_host = readl(scp->reg_base + MT8192_SCP2APMCU_IPC_SET);

if (scp_to_host & MT8192_SCP_IPC_INT_BIT)
if (scp_to_host & MT8192_SCP_IPC_INT_BIT) {
scp_ipi_handler(scp);
else
scp_wdt_handler(scp, scp_to_host);

/*
* SCP won't send another interrupt until we clear
* MT8192_SCP2APMCU_IPC.
*/
writel(MT8192_SCP_IPC_INT_BIT,
scp->reg_base + MT8192_SCP2APMCU_IPC_CLR);
/*
* SCP won't send another interrupt until we clear
* MT8192_SCP2APMCU_IPC.
*/
writel(MT8192_SCP_IPC_INT_BIT,
scp->reg_base + MT8192_SCP2APMCU_IPC_CLR);
} else {
scp_wdt_handler(scp, scp_to_host);
writel(1, scp->reg_base + MT8192_CORE0_WDT_IRQ);
}
}

static irqreturn_t scp_irq_handler(int irq, void *priv)
Expand Down Expand Up @@ -369,6 +371,9 @@ static int mt8192_scp_before_load(struct mtk_scp *scp)
mt8192_power_on_sram(scp->reg_base + MT8192_L1TCM_SRAM_PDN);
mt8192_power_on_sram(scp->reg_base + MT8192_CPU0_SRAM_PD);

/* enable MPU for all memory regions */
writel(0xff, scp->reg_base + MT8192_CORE0_MEM_ATT_PREDEF);

return 0;
}

Expand Down Expand Up @@ -458,9 +463,8 @@ static int scp_start(struct rproc *rproc)
return ret;
}

static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len)
static void *mt8183_scp_da_to_va(struct mtk_scp *scp, u64 da, size_t len)
{
struct mtk_scp *scp = (struct mtk_scp *)rproc->priv;
int offset;

if (da < scp->sram_size) {
Expand All @@ -476,6 +480,42 @@ static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len)
return NULL;
}

static void *mt8192_scp_da_to_va(struct mtk_scp *scp, u64 da, size_t len)
{
int offset;

if (da >= scp->sram_phys &&
(da + len) <= scp->sram_phys + scp->sram_size) {
offset = da - scp->sram_phys;
return (void __force *)scp->sram_base + offset;
}

/* optional memory region */
if (scp->l1tcm_size &&
da >= scp->l1tcm_phys &&
(da + len) <= scp->l1tcm_phys + scp->l1tcm_size) {
offset = da - scp->l1tcm_phys;
return (void __force *)scp->l1tcm_base + offset;
}

/* optional memory region */
if (scp->dram_size &&
da >= scp->dma_addr &&
(da + len) <= scp->dma_addr + scp->dram_size) {
offset = da - scp->dma_addr;
return scp->cpu_addr + offset;
}

return NULL;
}

static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len)
{
struct mtk_scp *scp = (struct mtk_scp *)rproc->priv;

return scp->data->scp_da_to_va(scp, da, len);
}

static void mt8183_scp_stop(struct mtk_scp *scp)
{
/* Disable SCP watchdog */
Expand Down Expand Up @@ -714,13 +754,27 @@ static int scp_probe(struct platform_device *pdev)
goto free_rproc;
}
scp->sram_size = resource_size(res);
scp->sram_phys = res->start;

/* l1tcm is an optional memory region */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
scp->l1tcm_base = devm_ioremap_resource(dev, res);
if (IS_ERR((__force void *)scp->l1tcm_base)) {
ret = PTR_ERR((__force void *)scp->l1tcm_base);
if (ret != -EINVAL) {
dev_err(dev, "Failed to map l1tcm memory\n");
goto free_rproc;
}
} else {
scp->l1tcm_size = resource_size(res);
scp->l1tcm_phys = res->start;
}

mutex_init(&scp->send_lock);
for (i = 0; i < SCP_IPI_MAX; i++)
mutex_init(&scp->ipi_desc[i].lock);

res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
scp->reg_base = devm_ioremap_resource(dev, res);
scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
if (IS_ERR((__force void *)scp->reg_base)) {
dev_err(dev, "Failed to parse and map cfg memory\n");
ret = PTR_ERR((__force void *)scp->reg_base);
Expand Down Expand Up @@ -803,6 +857,7 @@ static const struct mtk_scp_of_data mt8183_of_data = {
.scp_reset_assert = mt8183_scp_reset_assert,
.scp_reset_deassert = mt8183_scp_reset_deassert,
.scp_stop = mt8183_scp_stop,
.scp_da_to_va = mt8183_scp_da_to_va,
.host_to_scp_reg = MT8183_HOST_TO_SCP,
.host_to_scp_int_bit = MT8183_HOST_IPC_INT_BIT,
.ipi_buf_offset = 0x7bdb0,
Expand All @@ -814,6 +869,7 @@ static const struct mtk_scp_of_data mt8192_of_data = {
.scp_reset_assert = mt8192_scp_reset_assert,
.scp_reset_deassert = mt8192_scp_reset_deassert,
.scp_stop = mt8192_scp_stop,
.scp_da_to_va = mt8192_scp_da_to_va,
.host_to_scp_reg = MT8192_GIPC_IN_SET,
.host_to_scp_int_bit = MT8192_HOST_IPC_INT_BIT,
};
Expand Down
Loading

0 comments on commit 062c84f

Please sign in to comment.