Commit Graph

37 Commits

Author SHA1 Message Date
Shenwei Wang fee1ade052 MPSDK-172 remoteproc: imx_rproc: Re-building communication channels when a remote crashes
When the crash of a remote proc is detected, the physical communication
channels may get corrupted or reset, and it will impact the subsequent
transfers of rpmsg message. So the communication channels should be
re-built when a remote crash is detected.

Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
Reviewed-by: Frank Li <frank.li@nxp.com>
2021-07-13 14:41:45 +03:00
Peng Fan 0937099521 MLK-25426 remoteproc: imx_rproc: fix firmware reload
ENABLE_M4 should be set to 1 when loading code to TCM, otherwise
you will not able to replace the firmware after you stop m4.

Reviewed-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2021-07-13 14:41:30 +03:00
Ji Luo 489ac06340 MA-18425 remoteproc: init rproc_work before mbox init
Interrupts may happen right after imx_rproc_xtr_mbox_init(),
init the priv->rproc_work before imx_rproc_xtr_mbox_init() to
avoid panic in such case.

Test: Trigger panic via sysrq-trigger.

Change-Id: Idab25a9e97acf9649f9d570ad6bea511a8a94b67
Suggested-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit e2bb921dad25488dc37a3ac1d74f5f18840c509d)
Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
2021-04-27 10:41:50 +00:00
Peng Fan d00feb1274 MLK-24997 remoteproc: imx_rproc: merge TCML/U
Merge contiguous TCML/U regions into one to avoid load elf files which
has large sections failure.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-11-16 11:57:38 +08:00
Peng Fan 86cee110c5 MLK-24892 remoteproc: imx_rproc: correct ddr alias for i.MX8M
The DDR Alias address should be 0x40000000 according to RM, so correct

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Reported-by: Terry Lv <terry.lv@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-11-11 11:20:55 +08:00
Alice Guo b1a763a71e MLK-24326: remoteproc: imx_rproc: fix "Dereference after null check" problem
Before dereferencing fw, need to judge whether fw is a null pointer.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
2020-06-16 22:47:19 +08:00
Alice Guo 6341874ef7 MLK-24320: remoteproc: imx_rproc: fix "Explicit null dereferenced" problem
Before calling regmap_read in imx_rproc_configure_mode, need to determine
whether priv->regmap is NULL because dereferencing null pointer is not
allowed.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
2020-06-14 01:20:15 +08:00
Peng Fan d85cedb6d0 MLK-23882 remoteproc: imx_rproc: check resource table header
Before using resource table, check whether this is a valid header.
M4 image might not publish a valid header, so let's catch it to avoid
kernel panic.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-30 16:05:48 +08:00
Peng Fan fe92d9f8f3 LF-1360 remoteproc: imx: enlarge the mbox timeout delay
Enlarge timeout delay to 50ms, 20ms seems not enough. it is easy
to timeout using 20ms when m4 enter VLLS mode.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-29 15:03:06 +08:00
Peng Fan 05662cdc85 MLK-23778 remoteproc: imx: parse auto boot from dtb
Parse auto boot from dtb. Currently auto boot is default
set. This will make non-m4 image suspend dump if the firmware loading
workqueue not finished. So only enable auto boot for userspace loading
when fsl,rproc-auto-boot available.

Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Reported-by: Anson Huang <anson.huang@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-13 17:33:46 +08:00
Peng Fan 4c5ba9ce6e MLK-23754-37 remoteproc: imx_rproc: add txdb and check stop return
Add txdb support.
Check stop return params.
If MCore is not in wfi mode, we will still force stop, but report
a message.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:43 +08:00
Peng Fan 84e8e52b60 MLK-23754-33 remoteproc: imx: add i.MX7ULP support
Add i.MX7ULP support

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:43 +08:00
Peng Fan f3784cde05 MLK-23754-30 remoteproc: imx: add i.MX8QM support
i.MX8QM has two M4 cores, so we need introduce a core-index
to differentiate them.

Add ATT_CORE to differentiate M40 and M41.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:42 +08:00
Peng Fan b7c56dc046 MLK-23754-29 arm64: dts: imx8mn: add remoteproc node for i.MX8MN
Add remoteproc node for i.MX8MN

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:42 +08:00
Peng Fan 00f33502b6 MLK-23754-25 remoteproc: imx: use devm_ioremap
We might need to map an region multiple times, becaue the region might
be shared between remote processors, such i.MX8QM with dual M4 cores.
So use devm_ioremap, not devm_ioremap_resource.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:41 +08:00
Peng Fan e966403850 MLK-23754-24 remoteproc: imx: add i.MX8MN/P support
i.MX8MN/P M4 start/stop is controlled by TF-A, so use SIP call
to control.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:41 +08:00
Peng Fan f960ed8a9f MLK-23754-22 remoteproc: imx_rproc: add i.MX8QXP CM4 start/stop with power domain support
When CM4 image needs to be loaded from Linux userspace, we need
power on CM4 CORE, MU_1A and etc. Then start CM4 CORE.

Because we need to add multilple power domains, default power
domain attach probe only support one power domain,
we get the power domain in probe and mark on.

We are lucky that the TCML space could be accessed even without
power on the resources, so it is ok power on in probe. If not,
elf load will not be able to load segments to TCML.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:41 +08:00
Peng Fan 9a3b975180 MLK-23754-21 remoteproc: imx_rproc: add imx memcpy functions
Add i.MX memcpy functions for remoteproc, because linux memcpy
would trigger abort when copying elf data to TCML space using
64bit copy, but start with not 64bit aligned TCML address.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:41 +08:00
Peng Fan 357a08460c MLK-23754-18 remoteproc: imx_rproc: add rx doorbell
Add RX doorbell support, but currently M4 side not support
this feature, so just follow what imx_rpmsg did, add this
function.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:40 +08:00
Peng Fan 2dea08e8ce MLK-23754-17 remoteproc: imx_rproc: add i.MX8QXP
i.MX8QXP support hardware partition feature, the M4
could be controlled by System Control Unit(SCU). The M4 is out
of control of Linux with hardware partition used which is the normal
case for production in automotive space.

When M4 reboot, SCU will issue interrupt to Linux side, and Linux side
will recovery the connection. To use related functions, guard code
with CONFIG_IMX_SCU which is enabled for all i.MX SoCs with SCU inside.

Currently we only support IPC only case for i.MX8QXP.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:40 +08:00
Peng Fan c2c679f3bd MLK-23754-16 remoteproc: imx_rproc: support get firmware name from dts
Add fsl,rproc-fw-name property to support get firmware name
from device tree.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:40 +08:00
Peng Fan 1f76a0696d MLK-23754-15 remoteproc: imx_rproc: support i.MX8MQ/M
Support i.MX8MQ/M

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:40 +08:00
Peng Fan 865a9688c1 MLK-23754-13 remoteproc: imx_proc: enable virtio/mailbox
Use virtio/mailbox to build connection between Remote Proccessors
and Linux. Add delayed work to handle incoming messages.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:40 +08:00
Peng Fan c99efe4d56 MLK-23754-12 remoteproc: imx_proc: add ipc-only support
ipc-only is different from early-booted. You could still stop/start
the early-booted remote processors, but you could not stop/start
the remote processor that only support IPC.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:39 +08:00
Peng Fan a2fac0fbd3 MLK-23754-11 remoteproc: imx_rproc: support early booted remote processor
When remote processor is booted by bootloader, Linux need to
ignore firmware loading, but need to parse firmware resource table.

With early booted processor, also support stop/start it again.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:39 +08:00
Peng Fan 189e62437d MLK-23754-8 remoteproc: imx: using reset api
Support using reset API to start/stop remote processors.
Currently to i.MX7/8MQ, there are four bits in SRC M4RCR relating
to M4.

 SW_M4C_NON_SCLR_RST BIT(0)
 SW_M4C_RST          BIT(1)
 SW_M4P_RST          BIT(2)
 ENABLE_M4           BIT(3)

We are using BIT(0) and BIT(3) to start/stop M4 in driver.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:39 +08:00
Peng Fan d91238cf8c MLK-23754-7 remoteproc: imx_rproc: make clk optional
To i.MX7ULP, M4 is the master to control everything, so it not need
clk from A7.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:39 +08:00
Peng Fan 6d3a01497f MLK-23754-6 remoteproc: imx_rproc: make syscon optional
Make syscon optional, since i.MX8QM/QXP/7ULP not have SRC to control M4.
But currently i.MX8QM/QXP/7ULP not added, so still check regmap
when start/stop to avoid unhappy things.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-09 10:35:38 +08:00
Linus Torvalds fdcec00405 remoteproc updates for v5.3
This adds support for the STM32 remoteproc, additional i.MX platforms
 with Cortex M4 remoteprocs and Qualcomm's QCS404 Compute DSP. Initial
 support for vendor specific resource table entries and support for
 unprocessed Qualcomm firmware files.
 -----BEGIN PGP SIGNATURE-----
 
 iQJPBAABCAA5FiEEBd4DzF816k8JZtUlCx85Pw2ZrcUFAl0uGwsbHGJqb3JuLmFu
 ZGVyc3NvbkBsaW5hcm8ub3JnAAoJEAsfOT8Nma3FVhcQALBcuPOo2nBQEiOvgS79
 0kVBSdUxw6+mI4EFLfQPeSTtGGrSK5/oZBmYhdv+HEDu6CLG1DS+6PZyCjhqdDsU
 xjeTIkfe4RDAwnqlGxqK7OyeslAUe91kr0FDaS0XyajhQ+urI8N9Ou/JQDEZKArl
 lpuxGmjWASeIbO3TC/p4OhyOU6yqqlyxlv9x/kJnF+PhDfdK1tezvgmLvCDtnD9y
 gtYMzSz9txQCXMJmUaDFeUrMph6/Eo2Zn9rYyen5fDzqAXBys7nfH2fbDcbNK1fy
 qgjWDjUxENeoZEuohIFn2Dg3egr6rF9TQQvM4uoAoKlS6+yEvTiE8g122BJxVGd3
 BOmWK44hTpV1qAGfTivGOH3g/Q9pxI22a17t1BTxcHIYcmMBxERHAVRQ/wbwXRDp
 qEv4HUuvciMSjonf8pW3GuuOny9jeTird5q8e3gTNA/s6aESm/YoynwWF3LmNZBo
 XePc5sP4oz9HGJKS/SUu0/H6d1/YqOXOwVBmlTl4L0ErWOpaeGMinJQvSRHb0rL2
 BgL8bADxFJGM0ITeIA5CpzZzbbbZSmPqxOBhcU+a/PnRL8zVWJOpSCMLe04vrQNT
 9lVXAxmcRZjq80fbfyjqomyaT5N5Yvvv6dIz2AtCnAOEynHLnJq/dd5eX840l3RC
 1wXvNF4l0rzYm0yYHr0+oQXQ
 =iqXq
 -----END PGP SIGNATURE-----

Merge tag 'rproc-v5.3' of git://github.com/andersson/remoteproc

Pull remoteproc updates from Bjorn Andersson:
 "This adds support for the STM32 remoteproc, additional i.MX platforms
  with Cortex M4 remoteprocs and Qualcomm's QCS404 Compute DSP.

  Also initial support for vendor specific resource table entries and
  support for unprocessed Qualcomm firmware files"

* tag 'rproc-v5.3' of git://github.com/andersson/remoteproc:
  remoteproc: stm32: fix building without ARM SMCC
  remoteproc: qcom: q6v5-mss: Fix build error without QCOM_MDT_LOADER
  remoteproc: copy parent dma_pfn_offset for vdev
  remoteproc: qcom: q6v5-mss: Support loading non-split images
  soc: qcom: mdt_loader: Support loading non-split images
  remoteproc: stm32: add an ST stm32_rproc driver
  dt-bindings: remoteproc: add bindings for stm32 remote processor driver
  dt-bindings: stm32: add bindings for ML-AHB interconnect
  remoteproc: Use struct_size() helper
  remoteproc: add vendor resources handling
  remoteproc: imx: Fix typo in "failed"
  remoteproc: imx: Broaden the Kconfig selection logic
  remoteproc,rpmsg: add missing MAINTAINERS file entries
  remoteproc: qcom: qdsp6-adsp: Add support for QCS404 CDSP
  dt-bindings: remoteproc: Rename and amend Hexagon v56 binding
2019-07-17 11:44:41 -07:00
Thomas Gleixner d2912cb15b treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500
Based on 2 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license version 2 as
  published by the free software foundation

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license version 2 as
  published by the free software foundation #

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4122 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-19 17:09:55 +02:00
Fabio Estevam 16a3c637f0 remoteproc: imx: Fix typo in "failed"
There are several places where "failed" is spelled incorrectly.

Fix them all.

Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-06-03 21:58:48 -07:00
Christophe JAILLET 99a31adfb2 remoteproc: imx_rproc: Slightly simplify code in 'imx_rproc_probe()'
We can return directly at the beginning of the function and save the 'err'
label.
We can also explicitly return 0 when the probe succeed.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-03-18 15:43:46 -07:00
Christophe JAILLET 96a30d7f91 remoteproc: imx_rproc: Re-use existing error handling path in 'imx_rproc_probe()'
Avoid some code ducplication and be more future-proof.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-03-18 15:43:46 -07:00
Christophe JAILLET de6f83f85b remoteproc: imx_rproc: Fix an error handling path in 'imx_rproc_probe()'
If 'of_device_get_match_data()' fails, we must undo the previous
'rproc_alloc()' call.

Fixes: a0ff4aa6f0 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-03-18 15:43:46 -07:00
Wei Yongjun 68a39a3e9f remoteproc: imx_rproc: fix return value check in imx_rproc_addr_init()
In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test.

Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-11 10:47:47 -07:00
Dan Carpenter 68c2d645eb remoteproc: imx_rproc: fix a couple off by one bugs
The priv->mem[] array has IMX7D_RPROC_MEM_MAX elements so the > should
be >= to avoid writing one element beyond the end of the array.

Fixes: a0ff4aa6f0 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-10 11:22:55 -07:00
Oleksij Rempel a0ff4aa6f0 remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver
Provide a basic driver to control Cortex M4 co-processor found
on NXP i.MX7D and i.MX6SX.
Currently it is able to resolve addresses between M4 and main CPU,
start and stop the co-processor. Other functionality is not provided
or test.

This driver was tested on NXP i.MX7D and expected to work on
i.MX6SX as well.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-30 16:07:41 -07:00