Skip to content

Commit 062c84f

Browse files
committed
Merge tag 'rproc-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/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
2 parents e40242b + e8b4e9a commit 062c84f

File tree

12 files changed

+198
-35
lines changed

12 files changed

+198
-35
lines changed

Documentation/devicetree/bindings/remoteproc/mtk,scp.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Mediatek SoCs.
66

77
Required properties:
88
- compatible Should be "mediatek,mt8183-scp"
9-
- reg Should contain the address ranges for the two memory
10-
regions, SRAM and CFG.
11-
- reg-names Contains the corresponding names for the two memory
12-
regions. These should be named "sram" & "cfg".
9+
- reg Should contain the address ranges for memory regions:
10+
SRAM, CFG, and L1TCM.
11+
- reg-names Contains the corresponding names for the memory regions:
12+
"sram", "cfg", and "l1tcm".
1313
- clocks Clock for co-processor (See: ../clock/clock-bindings.txt)
1414
- clock-names Contains the corresponding name for the clock. This
1515
should be named "main".

Documentation/devicetree/bindings/remoteproc/qcom,adsp.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ on the Qualcomm ADSP Hexagon core.
2525
"qcom,sm8250-adsp-pas"
2626
"qcom,sm8250-cdsp-pas"
2727
"qcom,sm8250-slpi-pas"
28+
"qcom,sm8350-adsp-pas"
29+
"qcom,sm8350-cdsp-pas"
30+
"qcom,sm8350-slpi-pas"
31+
"qcom,sm8350-mpss-pas"
2832

2933
- interrupts-extended:
3034
Usage: required
@@ -51,10 +55,14 @@ on the Qualcomm ADSP Hexagon core.
5155
qcom,sm8250-adsp-pas:
5256
qcom,sm8250-cdsp-pas:
5357
qcom,sm8250-slpi-pas:
58+
qcom,sm8350-adsp-pas:
59+
qcom,sm8350-cdsp-pas:
60+
qcom,sm8350-slpi-pas:
5461
must be "wdog", "fatal", "ready", "handover", "stop-ack"
5562
qcom,qcs404-wcss-pas:
5663
qcom,sc7180-mpss-pas:
5764
qcom,sm8150-mpss-pas:
65+
qcom,sm8350-mpss-pas:
5866
must be "wdog", "fatal", "ready", "handover", "stop-ack",
5967
"shutdown-ack"
6068

@@ -114,13 +122,17 @@ on the Qualcomm ADSP Hexagon core.
114122
qcom,sm8150-adsp-pas:
115123
qcom,sm8150-cdsp-pas:
116124
qcom,sm8250-cdsp-pas:
125+
qcom,sm8350-cdsp-pas:
117126
must be "cx", "load_state"
118127
qcom,sc7180-mpss-pas:
119128
qcom,sm8150-mpss-pas:
129+
qcom,sm8350-mpss-pas:
120130
must be "cx", "load_state", "mss"
121131
qcom,sm8250-adsp-pas:
132+
qcom,sm8350-adsp-pas:
122133
qcom,sm8150-slpi-pas:
123134
qcom,sm8250-slpi-pas:
135+
qcom,sm8350-slpi-pas:
124136
must be "lcx", "lmx", "load_state"
125137

126138
- memory-region:

Documentation/devicetree/bindings/remoteproc/qcom,wcnss-pil.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ and its resource dependencies. It is described by the following properties:
8080
Definition: must be one of:
8181
"qcom,wcn3620",
8282
"qcom,wcn3660",
83+
"qcom,wcn3660b",
8384
"qcom,wcn3680"
8485

8586
- clocks:

drivers/remoteproc/Kconfig

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,17 @@ config QCOM_Q6V5_ADSP
155155
depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
156156
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
157157
depends on QCOM_SYSMON || QCOM_SYSMON=n
158+
depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
158159
select MFD_SYSCON
159160
select QCOM_PIL_INFO
160161
select QCOM_MDT_LOADER
161162
select QCOM_Q6V5_COMMON
162163
select QCOM_RPROC_COMMON
163164
help
164165
Say y here to support the Peripheral Image Loader
165-
for the Qualcomm Technology Inc. ADSP remote processors.
166+
for the non-TrustZone part of Qualcomm Technology Inc. ADSP and CDSP
167+
remote processors. The TrustZone part is handled by QCOM_Q6V5_PAS
168+
driver.
166169

167170
config QCOM_Q6V5_MSS
168171
tristate "Qualcomm Hexagon V5 self-authenticating modem subsystem support"
@@ -171,6 +174,7 @@ config QCOM_Q6V5_MSS
171174
depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
172175
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
173176
depends on QCOM_SYSMON || QCOM_SYSMON=n
177+
depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
174178
select MFD_SYSCON
175179
select QCOM_MDT_LOADER
176180
select QCOM_PIL_INFO
@@ -179,7 +183,8 @@ config QCOM_Q6V5_MSS
179183
select QCOM_SCM
180184
help
181185
Say y here to support the Qualcomm self-authenticating modem
182-
subsystem based on Hexagon V5.
186+
subsystem based on Hexagon V5. The TrustZone based system is
187+
handled by QCOM_Q6V5_PAS driver.
183188

184189
config QCOM_Q6V5_PAS
185190
tristate "Qualcomm Hexagon v5 Peripheral Authentication Service support"
@@ -188,6 +193,7 @@ config QCOM_Q6V5_PAS
188193
depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
189194
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
190195
depends on QCOM_SYSMON || QCOM_SYSMON=n
196+
depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
191197
select MFD_SYSCON
192198
select QCOM_PIL_INFO
193199
select QCOM_MDT_LOADER
@@ -197,7 +203,9 @@ config QCOM_Q6V5_PAS
197203
help
198204
Say y here to support the TrustZone based Peripheral Image Loader
199205
for the Qualcomm Hexagon v5 based remote processors. This is commonly
200-
used to control subsystems such as ADSP, Compute and Sensor.
206+
used to control subsystems such as ADSP (Audio DSP),
207+
CDSP (Compute DSP), MPSS (Modem Peripheral SubSystem), and
208+
SLPI (Sensor Low Power Island).
201209

202210
config QCOM_Q6V5_WCSS
203211
tristate "Qualcomm Hexagon based WCSS Peripheral Image Loader"
@@ -206,6 +214,7 @@ config QCOM_Q6V5_WCSS
206214
depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
207215
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
208216
depends on QCOM_SYSMON || QCOM_SYSMON=n
217+
depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
209218
select MFD_SYSCON
210219
select QCOM_MDT_LOADER
211220
select QCOM_PIL_INFO
@@ -214,7 +223,8 @@ config QCOM_Q6V5_WCSS
214223
select QCOM_SCM
215224
help
216225
Say y here to support the Qualcomm Peripheral Image Loader for the
217-
Hexagon V5 based WCSS remote processors.
226+
Hexagon V5 based WCSS remote processors on e.g. IPQ8074. This is
227+
a non-TrustZone wireless subsystem.
218228

219229
config QCOM_SYSMON
220230
tristate "Qualcomm sysmon driver"
@@ -238,13 +248,16 @@ config QCOM_WCNSS_PIL
238248
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
239249
depends on QCOM_SMEM
240250
depends on QCOM_SYSMON || QCOM_SYSMON=n
251+
depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n
241252
select QCOM_MDT_LOADER
242253
select QCOM_PIL_INFO
243254
select QCOM_RPROC_COMMON
244255
select QCOM_SCM
245256
help
246-
Say y here to support the Peripheral Image Loader for the Qualcomm
247-
Wireless Connectivity Subsystem.
257+
Say y here to support the Peripheral Image Loader for loading WCNSS
258+
firmware and boot the core on e.g. MSM8974, MSM8916. The firmware is
259+
verified and booted with the help of the Peripheral Authentication
260+
System (PAS) in TrustZone.
248261

249262
config ST_REMOTEPROC
250263
tristate "ST remoteproc support"

drivers/remoteproc/ingenic_rproc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
#define AUX_CTRL_NMI BIT(1)
2828
#define AUX_CTRL_SW_RESET BIT(0)
2929

30+
static bool auto_boot;
31+
module_param(auto_boot, bool, 0400);
32+
MODULE_PARM_DESC(auto_boot,
33+
"Auto-boot the remote processor [default=false]");
34+
3035
struct vpu_mem_map {
3136
const char *name;
3237
unsigned int da;
@@ -172,6 +177,8 @@ static int ingenic_rproc_probe(struct platform_device *pdev)
172177
if (!rproc)
173178
return -ENOMEM;
174179

180+
rproc->auto_boot = auto_boot;
181+
175182
vpu = rproc->priv;
176183
vpu->dev = &pdev->dev;
177184
platform_set_drvdata(pdev, vpu);

drivers/remoteproc/mtk_common.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747

4848
#define MT8192_CORE0_SW_RSTN_CLR 0x10000
4949
#define MT8192_CORE0_SW_RSTN_SET 0x10004
50+
#define MT8192_CORE0_MEM_ATT_PREDEF 0x10008
51+
#define MT8192_CORE0_WDT_IRQ 0x10030
5052
#define MT8192_CORE0_WDT_CFG 0x10034
5153

5254
#define SCP_FW_VER_LEN 32
@@ -75,6 +77,7 @@ struct mtk_scp_of_data {
7577
void (*scp_reset_assert)(struct mtk_scp *scp);
7678
void (*scp_reset_deassert)(struct mtk_scp *scp);
7779
void (*scp_stop)(struct mtk_scp *scp);
80+
void *(*scp_da_to_va)(struct mtk_scp *scp, u64 da, size_t len);
7881

7982
u32 host_to_scp_reg;
8083
u32 host_to_scp_int_bit;
@@ -89,6 +92,10 @@ struct mtk_scp {
8992
void __iomem *reg_base;
9093
void __iomem *sram_base;
9194
size_t sram_size;
95+
phys_addr_t sram_phys;
96+
void __iomem *l1tcm_base;
97+
size_t l1tcm_size;
98+
phys_addr_t l1tcm_phys;
9299

93100
const struct mtk_scp_of_data *data;
94101

drivers/remoteproc/mtk_scp.c

Lines changed: 69 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,19 @@ static void mt8192_scp_irq_handler(struct mtk_scp *scp)
197197

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

200-
if (scp_to_host & MT8192_SCP_IPC_INT_BIT)
200+
if (scp_to_host & MT8192_SCP_IPC_INT_BIT) {
201201
scp_ipi_handler(scp);
202-
else
203-
scp_wdt_handler(scp, scp_to_host);
204202

205-
/*
206-
* SCP won't send another interrupt until we clear
207-
* MT8192_SCP2APMCU_IPC.
208-
*/
209-
writel(MT8192_SCP_IPC_INT_BIT,
210-
scp->reg_base + MT8192_SCP2APMCU_IPC_CLR);
203+
/*
204+
* SCP won't send another interrupt until we clear
205+
* MT8192_SCP2APMCU_IPC.
206+
*/
207+
writel(MT8192_SCP_IPC_INT_BIT,
208+
scp->reg_base + MT8192_SCP2APMCU_IPC_CLR);
209+
} else {
210+
scp_wdt_handler(scp, scp_to_host);
211+
writel(1, scp->reg_base + MT8192_CORE0_WDT_IRQ);
212+
}
211213
}
212214

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

374+
/* enable MPU for all memory regions */
375+
writel(0xff, scp->reg_base + MT8192_CORE0_MEM_ATT_PREDEF);
376+
372377
return 0;
373378
}
374379

@@ -458,9 +463,8 @@ static int scp_start(struct rproc *rproc)
458463
return ret;
459464
}
460465

461-
static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len)
466+
static void *mt8183_scp_da_to_va(struct mtk_scp *scp, u64 da, size_t len)
462467
{
463-
struct mtk_scp *scp = (struct mtk_scp *)rproc->priv;
464468
int offset;
465469

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

483+
static void *mt8192_scp_da_to_va(struct mtk_scp *scp, u64 da, size_t len)
484+
{
485+
int offset;
486+
487+
if (da >= scp->sram_phys &&
488+
(da + len) <= scp->sram_phys + scp->sram_size) {
489+
offset = da - scp->sram_phys;
490+
return (void __force *)scp->sram_base + offset;
491+
}
492+
493+
/* optional memory region */
494+
if (scp->l1tcm_size &&
495+
da >= scp->l1tcm_phys &&
496+
(da + len) <= scp->l1tcm_phys + scp->l1tcm_size) {
497+
offset = da - scp->l1tcm_phys;
498+
return (void __force *)scp->l1tcm_base + offset;
499+
}
500+
501+
/* optional memory region */
502+
if (scp->dram_size &&
503+
da >= scp->dma_addr &&
504+
(da + len) <= scp->dma_addr + scp->dram_size) {
505+
offset = da - scp->dma_addr;
506+
return scp->cpu_addr + offset;
507+
}
508+
509+
return NULL;
510+
}
511+
512+
static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len)
513+
{
514+
struct mtk_scp *scp = (struct mtk_scp *)rproc->priv;
515+
516+
return scp->data->scp_da_to_va(scp, da, len);
517+
}
518+
479519
static void mt8183_scp_stop(struct mtk_scp *scp)
480520
{
481521
/* Disable SCP watchdog */
@@ -714,13 +754,27 @@ static int scp_probe(struct platform_device *pdev)
714754
goto free_rproc;
715755
}
716756
scp->sram_size = resource_size(res);
757+
scp->sram_phys = res->start;
758+
759+
/* l1tcm is an optional memory region */
760+
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
761+
scp->l1tcm_base = devm_ioremap_resource(dev, res);
762+
if (IS_ERR((__force void *)scp->l1tcm_base)) {
763+
ret = PTR_ERR((__force void *)scp->l1tcm_base);
764+
if (ret != -EINVAL) {
765+
dev_err(dev, "Failed to map l1tcm memory\n");
766+
goto free_rproc;
767+
}
768+
} else {
769+
scp->l1tcm_size = resource_size(res);
770+
scp->l1tcm_phys = res->start;
771+
}
717772

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

722-
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
723-
scp->reg_base = devm_ioremap_resource(dev, res);
777+
scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
724778
if (IS_ERR((__force void *)scp->reg_base)) {
725779
dev_err(dev, "Failed to parse and map cfg memory\n");
726780
ret = PTR_ERR((__force void *)scp->reg_base);
@@ -803,6 +857,7 @@ static const struct mtk_scp_of_data mt8183_of_data = {
803857
.scp_reset_assert = mt8183_scp_reset_assert,
804858
.scp_reset_deassert = mt8183_scp_reset_deassert,
805859
.scp_stop = mt8183_scp_stop,
860+
.scp_da_to_va = mt8183_scp_da_to_va,
806861
.host_to_scp_reg = MT8183_HOST_TO_SCP,
807862
.host_to_scp_int_bit = MT8183_HOST_IPC_INT_BIT,
808863
.ipi_buf_offset = 0x7bdb0,
@@ -814,6 +869,7 @@ static const struct mtk_scp_of_data mt8192_of_data = {
814869
.scp_reset_assert = mt8192_scp_reset_assert,
815870
.scp_reset_deassert = mt8192_scp_reset_deassert,
816871
.scp_stop = mt8192_scp_stop,
872+
.scp_da_to_va = mt8192_scp_da_to_va,
817873
.host_to_scp_reg = MT8192_GIPC_IN_SET,
818874
.host_to_scp_int_bit = MT8192_HOST_IPC_INT_BIT,
819875
};

0 commit comments

Comments
 (0)