aboutsummaryrefslogtreecommitdiff
path: root/drivers/remoteproc/imx_rproc.c
AgeCommit message (Collapse)AuthorFilesLines
2024-08-26remoteproc: imx_rproc: Add support for poweroff and rebootPeng Fan1-0/+42
On some NXP platforms (e.g i.MX7ULP) the poweroff and reboot operations are done via a separate remote core. Typically Linux needs to send a message to the remote core and requests for poweroff or reboot. By default the communication between Linux core and the remote core is is done via a blocking mailbox mechanism but Linux doesn't allow blocking operations in the system off (reboot, power off) handlers. So, we need to make sure the mailbox message send operations do not block for this specific operations. Fortunately, Linux allows us to register handlers that are called in preparation of the system off operations. Thus, before carrying the power off or reboot preparations, just destroy the existing mailboxes and create them as non-blocking. Note that power off and restart are totally different operations and are not complementary. We introduce a new flag in the imx remoteproc per device data which tells us when a device needs this special setup. For now, only imx7ulp needs it. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2024-08-26remoteproc: imx_rproc: Allow setting of the mailbox transmit modePeng Fan1-6/+6
Current mailbox is blocking by default, but there are cases where we don't need to wait for a response. Linux just needs to send data to the remote processor, so let's allow tx_block mode to be set (true/false) depending on usecase. No functional changes. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2024-08-13remoteproc: Use of_property_present()Rob Herring (Arm)1-1/+1
Use of_property_present() to test for property presence rather than of_(find|get)_property(). This is part of a larger effort to remove callers of of_find_property() and similar functions. of_find_property() leaks the DT struct property and data pointers which is a problem for dynamically allocated nodes which may be freed. Signed-off-by: Rob Herring (Arm) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2024-07-29remoteproc: imx_rproc: Merge TCML/UPeng Fan1-12/+6
Merge contiguous TCML/U regions into one to avoid load elf files which has large sections failure. Reviewed-by: Iuliana Prodan <[email protected]> Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2024-07-29remoteproc: imx_rproc: Initialize workqueue earlierPeng Fan1-2/+2
Initialize workqueue before requesting mailbox channel, otherwise if mailbox interrupt comes before workqueue ready, the imx_rproc_rx_callback will trigger issue. Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox") Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2024-07-29remoteproc: imx_rproc: Use imx specific hook for find_loaded_rsc_tablePeng Fan1-1/+12
If there is a resource table device tree node, use the address as the resource table address, otherwise use the address(where .resource_table section loaded) inside the Cortex-M elf file. And there is an update in NXP SDK that Resource Domain Control(RDC) enabled to protect TCM, linux not able to write the TCM space when updating resource table status and cause kernel dump. So use the address from device tree could avoid kernel dump. Note: NXP M4 SDK not check resource table update, so it does not matter use whether resource table address specified in elf file or in device tree. But to reflect the fact that if people specific resource table address in device tree, it means people are aware and going to use it, not the address specified in elf file. Reviewed-by: Iuliana Prodan <[email protected]> Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2024-07-29remoteproc: imx_rproc: Correct ddr alias for i.MX8MPeng Fan1-1/+1
The DDR Alias address should be 0x40000000 according to RM, so correct it. Fixes: 4ab8f9607aad ("remoteproc: imx_rproc: support i.MX8MQ/M") Reported-by: Terry Lv <[email protected]> Reviewed-by: Iuliana Prodan <[email protected]> Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2024-06-17remoteproc: imx_rproc: Fix refcount mistake in imx_rproc_addr_initAleksandr Mishin1-2/+6
In imx_rproc_addr_init() strcmp() is performed over the node after the of_node_put() is performed over it. Fix this error by moving of_node_put() calls. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 5e4c1243071d ("remoteproc: imx_rproc: support remote cores booted before Linux Kernel") Cc: [email protected] Signed-off-by: Aleksandr Mishin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2024-06-11remoteproc: imx_rproc: Skip over memory region when node value is NULLAleksandr Mishin1-0/+2
In imx_rproc_addr_init() "nph = of_count_phandle_with_args()" just counts number of phandles. But phandles may be empty. So of_parse_phandle() in the parsing loop (0 < a < nph) may return NULL which is later dereferenced. Adjust this issue by adding NULL-return check. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: a0ff4aa6f010 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver") Signed-off-by: Aleksandr Mishin <[email protected]> Reviewed-by: Peng Fan <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] [Fixed title to fit within the prescribed 70-75 charcters] Signed-off-by: Mathieu Poirier <[email protected]>
2024-03-21Merge tag 'rproc-v6.9' of ↵Linus Torvalds1-11/+5
git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux Pull remoteproc updates from Bjorn Andersson: "Qualcomm SM8650 audio, compute and modem remoteproc are added. Qualcomm X1 Elite audio and compute remoteprocs are added, after support for shutting down the bootloader-loaded firmware loaded into the audio DSP.. A dozen drivers in the subsystem are transitioned to use devres helpers for remoteproc and memory allocations - this makes it possible to acquire in-kernel handle to individual remoteproc instances in a cluster. The release of DMA memory for remoteproc virtio is corrected to ensure that restarting due to a watchdog bite doesn't attempt to allocate the memory again without first freeing it. Last, but not least, a couple of DeviceTree binding cleanups" * tag 'rproc-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux: (30 commits) remoteproc: qcom_q6v5_pas: Unload lite firmware on ADSP remoteproc: qcom_q6v5_pas: Add support for X1E80100 ADSP/CDSP dt-bindings: remoteproc: qcom,sm8550-pas: document the X1E80100 aDSP & cDSP remoteproc: qcom_wcnss: Use devm_rproc_alloc() helper remoteproc: qcom_q6v5_wcss: Use devm_rproc_alloc() helper remoteproc: qcom_q6v5_pas: Use devm_rproc_alloc() helper remoteproc: qcom_q6v5_mss: Use devm_rproc_alloc() helper remoteproc: qcom_q6v5_adsp: Use devm_rproc_alloc() helper dt-bindings: remoteproc: do not override firmware-name $ref dt-bindings: remoteproc: qcom,glink-rpm-edge: drop redundant type from label remoteproc: qcom: pas: correct data indentation remoteproc: Make rproc_get_by_phandle() work for clusters remoteproc: qcom: pas: Add SM8650 remoteproc support remoteproc: qcom: pas: make region assign more generic dt-bindings: remoteproc: qcom,sm8550-pas: document the SM8650 PAS remoteproc: k3-dsp: Use devm_rproc_add() helper remoteproc: k3-dsp: Use devm_ioremap_wc() helper remoteproc: k3-dsp: Add devm action to release tsp remoteproc: k3-dsp: Use devm_kzalloc() helper remoteproc: k3-dsp: Use devm_ti_sci_get_by_phandle() helper ...
2024-02-14remoteproc: imx_rproc: Convert to dev_pm_domain_attach|detach_list()Ulf Hansson1-64/+9
Let's avoid the boilerplate code to manage the multiple PM domain case, by converting into using dev_pm_domain_attach|detach_list(). Cc: Bjorn Andersson <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: Daniel Baluta <[email protected]> Cc: <[email protected]> Tested-by: Iuliana Prodan <[email protected]> Reviewed-by: Iuliana Prodan <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2024-02-02remoteproc: imx_rproc: Use devm_rproc_alloc() helperAndrew Davis1-11/+5
Use the device lifecycle managed allocation function. This helps prevent mistakes like freeing out of order in cleanup functions and forgetting to free on error paths. Signed-off-by: Andrew Davis <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2023-07-27remoteproc: imx_rproc: Switch iMX8MN/MP from SMCCC to MMIOMarek Vasut1-2/+56
The MX8M CM7 boot via SMC call is problematic, since not all versions of ATF support this interface. Extend the MMIO support so it can boot the CM7 on MX8MN/MP instead and discern the two alternatives using DT compatible strings. Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2023-07-15remoteproc: imx_rproc: iterate all notifiyids in rx callbackPeng Fan1-2/+11
The current code only supports one vdev and a single callback, but there are cases need more vdevs. So iterate all notifyids to support more vdevs with the single callback. Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2023-07-15remoteproc: Explicitly include correct DT includesRob Herring1-1/+1
The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2023-05-09remoteproc: imx: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <[email protected]> Reviewed-by: Iuliana Prodan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2023-04-03remoteproc: imx_rproc: Call of_node_put() on iteration errorMathieu Poirier1-2/+5
Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly. Fixes: b29b4249f8f0 ("remoteproc: imx_rproc: add i.MX specific parse fw hook") Cc: [email protected] Signed-off-by: Mathieu Poirier <[email protected]> Reviewed-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2022-11-15remoteproc: imx_rproc: Correct i.MX93 DRAM mappingPeng Fan1-2/+2
According to updated reference mannual, the M33 DRAM view of 0x[C,D]0000000 maps to A55 0xC0000000, so correct it. Fixes: 9222fabf0e39 ("remoteproc: imx_rproc: Support i.MX93") Signed-off-by: Peng Fan <[email protected]> Cc: stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2022-10-24remoteproc: imx_rproc: Enable attach recovery for i.MX8QM/QXPPeng Fan1-1/+2
i.MX8QM/QXP M4 could recover without help from Linux, so to support it: - enable feature RPROC_FEAT_ATTACH_ON_RECOVERY - set recovery_disabled as false Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2022-10-24remoteproc: imx_rproc: Request mbox channel laterPeng Fan1-2/+46
It is possible that when remote processor crash, the communication channel will be broken with garbage value in mailbox, such as when Linux is issuing a message through mailbox, remote processor crashes, we need free & rebuild the mailbox channels to make sure no garbage value in mailbox channels. So move the request/free to start/stop for managing remote procesosr in Linux, move to attach/detach for remote processor is out of control of Linux. Previous, we just request mbox when attach for CM4 boot early before Linux, but if mbox defer probe, remoteproc core will do resource cleanup and corrupt resource table for later probe. So move request mbox ealier and still keep mbox request when attach for self recovery case, but keep a check when request/free mbox. Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2022-10-24remoteproc: imx_rproc: Support i.MX8QMPeng Fan1-3/+44
Most logic are same as i.MX8QXP, but i.MX8QM has two general purpose M4 cores, the two cores runs independently and they have different resource id, different start address from SCFW view. Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2022-10-24remoteproc: imx_rproc: Support kicking Mcore from Linux for i.MX8QXPPeng Fan1-3/+93
When M4 is in the same hardware partition with Cortex-A, it could be start/stop by Linux. Added power domain to make sure M4 could run, it requires several power domains to work. Make clock always optional for i.MX8QXP, because SCFW handles it when power up M4 core. Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2022-10-24remoteproc: imx_rproc: Support attaching to i.MX8QXP M4Peng Fan1-1/+107
When M4 is kicked by SCFW, M4 runs in its own hardware partition, Linux could only do IPC with M4, it could not start, stop, update image. We disable recovery reboot when M4 is managed by SCFW, because remoteproc core still not support M4 auto-recovery without loading image. Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2022-08-23remoteproc: imx_rproc: Simplify some error messageChristophe JAILLET1-9/+5
dev_err_probe() already prints the error code in a human readable way, so there is no need to duplicate it as a numerical value at the end of the message. While at it, remove 'ret' that is mostly useless. Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox") Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/6b9343c2688117a340661d8ee491c2962c54a09a.1659736936.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mathieu Poirier <[email protected]>
2022-06-22remoteproc: imx_rproc: Fix refcount leak in imx_rproc_addr_initMiaoqian Lin1-3/+4
of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not needed anymore. This function has two paths missing of_node_put(). Fixes: 6e962bfe56b9 ("remoteproc: imx_rproc: add missing of_node_put") Fixes: a0ff4aa6f010 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver") Signed-off-by: Miaoqian Lin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2022-05-09remoteproc: imx_rproc: Support i.MX93Peng Fan1-0/+33
i.MX93 features a Cortex-M33 core which could be kicked by ROM/Bootloader /Linux. Similar with i.MX8MN/P, we use SMC to trap into Arm Trusted Firmware to start/stop the M33 core. Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2022-04-18remoteproc: imx_rproc: Ignore create mem entry for resource tablePeng Fan1-0/+3
Resource table is used by Linux to get information published by remote processor. It should be not be used for memory allocation, so not create rproc mem entry. Fixes: b29b4249f8f0 ("remoteproc: imx_rproc: add i.MX specific parse fw hook") Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2021-12-13remoteproc: imx_rproc: correct firmware reloadPeng Fan1-3/+5
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. Besides ENABLE_M4, we still need set SW_M4C_RST, because this bit will be automatically set with SW_M4C_NON_SCLR_RST set. Reviewed-by: Mathieu Poirier <[email protected]> Signed-off-by: Peng Fan <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-11-17remoteproc: imx_rproc: Fix a resource leak in the remove functionChristophe JAILLET1-0/+1
'priv->workqueue' is destroyed in the error handling path of the probe but not in the remove function. Add the missing call to release some resources. Cc: stable <[email protected]> Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox") Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Peng Fan <[email protected]> Tested-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/d28ca94a4031bd7297d47c2164e18885a5a6ec19.1634366546.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mathieu Poirier <[email protected]>
2021-10-12remoteproc: imx_rproc: Move common structure to header fileShengjiu Wang1-27/+1
Move common structure imx_rproc_att, imx_rproc_method and imx_rproc_dcfg to header file which can be shared with imx_dsp_rproc driver. Signed-off-by: Shengjiu Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
2021-09-27remoteproc: imx_rproc: Change to ioremap_wc for dramDong Aisheng1-1/+1
DRAM is not io memory, so changed to ioremap_wc. This is also aligned with core io accessories. e.g. memcpy/memset and cpu direct access. Cc: Bjorn Andersson <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Peng Fan <[email protected]> Reviewed-and-tested-by: Peng Fan <[email protected]> Signed-off-by: Dong Aisheng <[email protected]> Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]>
2021-09-27remoteproc: imx_rproc: Fix rsc-table nameDong Aisheng1-1/+1
Usually the dash '-' is preferred in node name. So far, not dts in upstream kernel, so we just update node name in driver. Cc: Bjorn Andersson <[email protected]> Cc: Mathieu Poirier <[email protected]> Fixes: 5e4c1243071d ("remoteproc: imx_rproc: support remote cores booted before Linux Kernel") Reviewed-and-tested-by: Peng Fan <[email protected]> Signed-off-by: Dong Aisheng <[email protected]> Signed-off-by: Peng Fan <[email protected]> Cc: stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]>
2021-09-27remoteproc: imx_rproc: Fix ignoring mapping vdev regionsDong Aisheng1-2/+2
vdev regions are typically named vdev0buffer, vdev0ring0, vdev0ring1 and etc. Change to strncmp to cover them all. Fixes: 8f2d8961640f ("remoteproc: imx_rproc: ignore mapping vdev regions") Reviewed-and-tested-by: Peng Fan <[email protected]> Signed-off-by: Dong Aisheng <[email protected]> Signed-off-by: Peng Fan <[email protected]> Cc: stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]>
2021-09-27remoteproc: imx_rproc: Fix TCM io memory typeDong Aisheng1-14/+21
is_iomem was introduced in the commit 40df0a91b2a5 ("remoteproc: add is_iomem to da_to_va"), but the driver seemed missed to provide the io type correctly. This patch updates remoteproc driver to indicate the TCM on IMX are io memories. Without the change, remoteproc kick will fail. Cc: Bjorn Andersson <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Peng Fan <[email protected]> Reviewed-and-tested-by: Peng Fan <[email protected]> Fixes: 79806d32d5aa ("remoteproc: imx_rproc: support i.MX8MN/P") Signed-off-by: Dong Aisheng <[email protected]> Signed-off-by: Peng Fan <[email protected]> stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]>
2021-06-23remoteproc: imx_rproc: support i.MX8ULPPeng Fan1-0/+13
i.MX8ULP is a new SoC with Ultra low power support, it has a Cortex-M33 core and two Cortex-A35 cores. We need to add new configuration because it could not reuse the previous i.MX7/8 configuration. i.MX8ULP M33 core is kicked by ROM, it is not under control of A35 core. So need to mark the method is IMX_RPROC_NONE. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-06-01remoteproc: imx_rproc: support i.MX8MN/PPeng Fan1-7/+80
Add i.MX8MN/P remote processor(Cortex-M7) support, we are using ARM SMCCC to start/stop M core, not using regmap interface. Reviewed-by: Mathieu Poirier <[email protected]> Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-06-01remoteproc: imx_rproc: support i.MX7ULPPeng Fan1-11/+38
i.MX7ULP A7 core runs under control of M4 core, M4 core starts by ROM and powers most services used by A7 core, so A7 core has no power to start and stop M4 core. And the M4 core's state is default RPROC_DETACHED and remoteproc framework not able to stop the M4 core. Reviewed-by: Mathieu Poirier <[email protected]> Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-06-01remoteproc: imx_rproc: make clk optionalPeng Fan1-15/+31
To i.MX7ULP, M4 is the master to control everything, no need to provide clk from Linux side. So make clk optional when method is IMX_RPROC_NONE. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-06-01remoteproc: imx_rproc: initial support for mutilple start/stop methodPeng Fan1-0/+13
Add three methods IMX_RPROC_NONE(no need start/stop), IMX_RPROC_MMIO (start/stop through mmio) and IMX_RPROC_SMC(start/stop through ARM SMCCC). The current SoCs supported are all using IMX_RPROC_MMIO. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-06-01remoteproc: imx_rproc: parse fsl,auto-bootPeng Fan1-0/+3
Parse fsl,auto-boot to indicate whether need remoteproc framework auto boot or not. When remote processor is booted before Linux Kernel up, do not parse fsl,auto-boot, so only need to parse the property when rproc state is RPROC_DETACHED. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-04-13remoteproc: imx_rproc: support remote cores booted before Linux KernelPeng Fan1-0/+45
- When remote cores are kicked before Linux Kernel, we are not able to get resource table from the firmware elf file, so we need to add rsc_table to hold the resource table published by remote cores and imx_rproc_get_loaded_rsc_table is to get the resource table. - Per remoteproc framework, add attach hook for processor in a detached state. - Add imx_rproc_detect_mode to detect remote cores' working mode to set the state which is required by remoteproc framework. Reviewed-by: Mathieu Poirier <[email protected]> Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-04-13remoteproc: imx_rproc: move memory parsing to rproc_opsPeng Fan1-5/+3
Use the rproc_ops::prepare() hook for doing memory resources reallocation when reattaching a remote procesor. Suggested-by: Mathieu Poirier <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-04-13remoteproc: imx_rproc: enlarge IMX7D_RPROC_MEM_MAXPeng Fan1-5/+5
8 is not enough when we need more, such as resource table for remote cores that booted before Linux Kernel, so enlarge IMX7D_RPROC_MEM_MAX to 32. And also rename it to IMX_RPROC_MEM_MAX which make more sense. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-04-13remoteproc: imx_rproc: add missing of_node_putPeng Fan1-0/+2
After of_parse_phandle, we need of_node_put to decrease the refcount of the device_node. Reported-by: Mathieu Poirier <[email protected]> Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-03-12remoteproc: imx_rproc: fix return value check in imx_rproc_addr_init()Wei Yongjun1-3/+2
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. Fixes: ecadcc47492c ("remoteproc: imx_rproc: use devm_ioremap") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Wei Yongjun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-03-11remoteproc: imx_proc: enable virtio/mailboxPeng Fan1-3/+113
Use virtio/mailbox to build connection between Remote Proccessors and Linux. Add work queue to handle incoming messages. Reviewed-by: Richard Zhu <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-03-11remoteproc: imx_rproc: ignore mapping vdev regionsPeng Fan1-0/+3
vdev regions are vdev0vring0, vdev0vring1, vdevbuffer and similar. They are handled by remoteproc common code, no need to map in imx rproc driver. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-03-11remoteproc: imx_rproc: support i.MX8MQ/MPeng Fan1-1/+40
Add i.MX8MQ dev/sys addr map and configuration data structure i.MX8MM share i.MX8MQ settings. Reviewed-by: Richard Zhu <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-03-11remoteproc: imx_rproc: add i.MX specific parse fw hookPeng Fan1-0/+93
The hook is used to parse memory-regions and load resource table from the address the remote processor published. Reviewed-by: Richard Zhu <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
2021-03-11remoteproc: imx_rproc: use devm_ioremapPeng Fan1-1/+2
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: Oleksij Rempel <[email protected]> Reviewed-by: Richard Zhu <[email protected]> Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>