path: root/drivers/mailbox
AgeCommit message (Collapse)Author
2021-04-28Merge tag 'mailbox-v5.13' of ↵Linus Torvalds
git:// Pull mailbox updates from Jassi Brar: "qcom: - enable support for SM8350 and SC7280 sprd: - refcount channel usage - specify interrupt names in dt - support sc9863a arm: - drop redundant print ti: - convert dt-bindings to json schema and misc spelling fixes" * tag 'mailbox-v5.13' of git:// dt-bindings: mailbox: qcom-ipcc: Add compatible for SC7280 dt-bindings: mailbox: ti,secure-proxy: Convert to json schema mailbox: arm_mhu_db: Remove redundant dev_err call in mhu_db_probe() mailbox: sprd: Add supplementary inbox support dt-bindings: mailbox: Add interrupt-names to SPRD mailbox mailbox: sprd: Introduce refcnt when clients requests/free channels MAINTAINERS: Add DT bindings directory to mailbox mailbox: fix various typos in comments mailbox: pcc: fix platform_no_drv_owner.cocci warnings dt-bindings: mailbox: Add compatible for SM8350 IPCC
2021-04-13mailbox: arm_mhu_db: Remove redundant dev_err call in mhu_db_probe()Qiheng Lin
There is a error message within devm_ioremap_resource already, so remove the dev_err call to avoid redundant error message. Reported-by: Hulk Robot <> Signed-off-by: Qiheng Lin <> Signed-off-by: Jassi Brar <>
2021-04-13mailbox: sprd: Add supplementary inbox supportOrson Zhai
Some sensors connected to Unisoc mailbox will send data very frequently. This makes channel 0 very busy and the messages from other remote cores not able to be handled as soon as possible. It's a trick (un-documented) from Unisoc ASIC designers to resolve this special requirement that an inbox assigned to one of the remote cores before was modified to be exposed to host cpu core. Then from host side, a supplementary inbox is added for transferring mass but not emergency messages from the remote cores, such as step counting sensor, with an independent FIFO and interrupt which is as same as channel 0. Meanwihle, inbox part of this channel is still kept for original remote core to use. Signed-off-by: Orson Zhai <> Reviewed-by: Baolin Wang <> Signed-off-by: Jassi Brar <>
2021-04-13mailbox: sprd: Introduce refcnt when clients requests/free channelsOrson Zhai
Unisoc mailbox has no way to be enabled/disabled for any single channel. They can only be set to startup or shutdown as a whole device at same time. Add a variable to count references to avoid mailbox FIFO being reset unexpectedly when clients are requesting or freeing channels. Also add a lock to dismiss possible conflicts from register r/w in different startup or shutdown threads. And fix the crash problem when early interrupts come from channel which has not been requested by client yet. Fixes: ca27fc26cd22 ("mailbox: sprd: Add Spreadtrum mailbox driver") Signed-off-by: Orson Zhai <> Reviewed-by: Baolin Wang <> Signed-off-by: Jassi Brar <>
2021-04-13mailbox: fix various typos in commentsTom Saeger
Fix trivial typos in mailbox driver comments. s/Intergrated/Integrated/ s/extenstion/extension/ s/atleast/at least/ s/commnunication/communication/ s/assgined/assigned/ s/commnunication/communication/ s/recevied/received/ s/succeded/succeeded/ s/implmentation/implementation/ s/definiation/definition/ s/traget/target/ s/wont/won't/ Cc: Signed-off-by: Tom Saeger <> Reviewed-by: Randy Dunlap <> Signed-off-by: Jassi Brar <>
2021-04-13mailbox: pcc: fix platform_no_drv_owner.cocci warningsYang Li
./drivers/mailbox/pcc.c:580:3-8: No need to set .owner here. The core will do it. Remove .owner field if calls are used which set it automatically Reported-by: Abaci Robot <> Signed-off-by: Yang Li <> Signed-off-by: Jassi Brar <>
2021-04-09treewide: change my e-mail address, fix my nameMarek Behún
Change my e-mail address to, and fix my name in non-code parts (add diacritical mark). Link: Signed-off-by: Marek Behún <> Cc: Bartosz Golaszewski <> Cc: Greg Kroah-Hartman <> Cc: Jassi Brar <> Cc: Linus Walleij <> Cc: Pavel Machek <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
2021-02-22mailbox: arm_mhuv2: Skip calling kfree() with invalid pointerViresh Kumar
It is possible that 'data' passed to kfree() is set to a error value instead of allocated space. Make sure it doesn't get called with invalid pointer. Fixes: 5a6338cce9f4 ("mailbox: arm_mhuv2: Add driver") Cc: v5.11 <> # v5.11 Reported-by: kernel test robot <> Reported-by: Dan Carpenter <> Signed-off-by: Viresh Kumar <> Signed-off-by: Jassi Brar <>
2021-02-14mailbox: tegra-hsp: Set lockdep class dynamicallyMikko Perttunen
On Tegra194, due to both BPMP and TCU using mailboxes, we get a lockdep spew at boot. Both are using different instances of HSP, so this is harmless. As such give each HSP instance a different lockdep class. Signed-off-by: Mikko Perttunen <> Signed-off-by: Jassi Brar <>
2021-02-14mailbox: sprd: correct definition of SPRD_OUTBOX_FIFO_FULLMagnum Shan
According to the specification, bit[2] represents SPRD_OUTBOX_FIFO_FULL, not bit[0], so correct it. Fixes: ca27fc26cd22 ("mailbox: sprd: Add Spreadtrum mailbox driver") Signed-off-by: Magnum Shan <> Signed-off-by: Chunyan Zhang <> Reviewed-by: Baolin Wang <> Signed-off-by: Jassi Brar <>
2021-02-14mailbox: arm_mhuv2: make remove callback return voidUwe Kleine-König
My build tests failed to catch that amba driver that would have needed adaption in commit 3fd269e74f2f ("amba: Make the remove callback return void"). Change the remove function to make the driver build again. Reported-by: kernel test robot <> Fixes: 3fd269e74f2f ("amba: Make the remove callback return void") Signed-off-by: Uwe Kleine-König <> Acked-by: Viresh Kumar <> Signed-off-by: Jassi Brar <>
2021-02-14mailbox: arm_mhuv2: Fix sparse warningsViresh Kumar
This patch fixes a bunch of sparse warnings in the newly added arm_mhuv2 driver. drivers/mailbox/arm_mhuv2.c:506:24: warning: incorrect type in argument 1 (different address spaces) drivers/mailbox/arm_mhuv2.c:506:24: expected void const volatile [noderef] __iomem *addr drivers/mailbox/arm_mhuv2.c:506:24: got unsigned int [usertype] * drivers/mailbox/arm_mhuv2.c:547:42: warning: incorrect type in argument 2 (different address spaces) drivers/mailbox/arm_mhuv2.c:547:42: expected unsigned int [usertype] *reg drivers/mailbox/arm_mhuv2.c:547:42: got unsigned int [noderef] __iomem * drivers/mailbox/arm_mhuv2.c:625:42: warning: incorrect type in argument 2 (different address spaces) drivers/mailbox/arm_mhuv2.c:625:42: expected unsigned int [usertype] *reg drivers/mailbox/arm_mhuv2.c:625:42: got unsigned int [noderef] __iomem * drivers/mailbox/arm_mhuv2.c:972:24: warning: dereference of noderef expression drivers/mailbox/arm_mhuv2.c:973:22: warning: dereference of noderef expression drivers/mailbox/arm_mhuv2.c:993:25: warning: dereference of noderef expression drivers/mailbox/arm_mhuv2.c:1026:24: warning: dereference of noderef expression drivers/mailbox/arm_mhuv2.c:1027:22: warning: dereference of noderef expression drivers/mailbox/arm_mhuv2.c:1048:17: warning: dereference of noderef expression Reported-by: kernel test robot <> Signed-off-by: Viresh Kumar <> Signed-off-by: Jassi Brar <>
2021-02-14mailbox: qcom: Add support for SDX55 APCS IPCManivannan Sadhasivam
In SDX55, the IPC bits are located in the APCS GCC block. Also, this block can provide clock functionality. Hence, add support for IPC with correct offset and name of the clock provider. Signed-off-by: Manivannan Sadhasivam <> Signed-off-by: Jassi Brar <>
2021-02-14mailbox: omap: Add support for K3 AM64x SoCsSuman Anna
The AM64x SoC contains a Mailbox IP instance with multiple clusters in the MAIN domain, and is a variant of the IP on current AM65x and J721E SoCs. The AM64x SoC has only 8 clusters with no interrupts routed to the A53 core on the first 2 clusters. The interrupt outputs from the IP do not go through any Interrupt Routers and are hard-wired to each processor, with only couple of interrupts from each cluster reaching the A53 core. The IP is also not built with the K3 safety feature in hardware. Add the support for this IP through a new compatible. Signed-off-by: Suman Anna <> Signed-off-by: Jassi Brar <>
2021-02-14mailbox: qcom: Add SC8180X apcs compatibleBjorn Andersson
The Qualcomm SC8180X platform has a APSS block exposing the usual IPC bits, add a compatible for this. Signed-off-by: Bjorn Andersson <> Signed-off-by: Jassi Brar <>
2020-12-09mailbox: arm_mhuv2: Add driverViresh Kumar
This adds driver for the ARM MHUv2 (Message Handling Unit) mailbox controller. This is based on the accepted DT bindings of the controller and supports combination of both transport protocols, i.e. doorbell and data-transfer. Transmitting and receiving data through the mailbox framework is done through struct arm_mhuv2_mbox_msg. Based on the initial work done by Morten Borup Petersen from ARM. Co-developed-by: Tushar Khandelwal <> Signed-off-by: Tushar Khandelwal <> Tested-by: Usama Arif <> Signed-off-by: Viresh Kumar <> Signed-off-by: Jassi Brar <>
2020-12-01mailbox: stm32-ipcc: cast void pointers to unsigned longMartin Kaiser
Now that the driver can be enabled by COMPILE_TEST, we see warnings on 64bit platforms when void pointers are cast to unsigned int (and vice versa). warning: cast to smaller integer type 'unsigned int' from 'void *' unsigned int chan = (unsigned int)link->con_priv; ... warning: cast to 'void *' from smaller integer type 'unsigned int' ipcc->controller.chans[i].con_priv = (void *)i; Update these casts to use unsigned long variables, which are the same size as pointers on all platforms. Reported-by: kernel test robot <> Signed-off-by: Martin Kaiser <> Reviewed-by: Fabien Dessenne <> Signed-off-by: Jassi Brar <>
2020-12-01mailbox: stm32-ipcc: remove duplicate error messageMartin Kaiser
platform_get_irq_byname already prints an error message if the requested irq was not found. Don't print another message in the driver. Signed-off-by: Martin Kaiser <> Reviewed-by: Fabien Dessenne <> Signed-off-by: Jassi Brar <>
2020-12-01mailbox: stm32-ipcc: add COMPILE_TEST dependencyMartin Kaiser
This allows compiling the driver on architectures where the hardware is not available. Most other mailbox drivers support this as well. Signed-off-by: Martin Kaiser <> Reviewed-by: Fabien Dessenne <> Signed-off-by: Jassi Brar <>
2020-12-01mailbox: arm_mhu_db: Fix mhu_db_shutdown by replacing kfree with devm_kfreeSudeep Holla
The mhu_db_channel info is allocated per channel using devm_kzalloc from mhu_db_mbox_xlate which gets called from mbox_request_channel. However we are releasing the allocated mhu_db_channel info using plain kfree from mhu_db_shutdown which is called from mbox_free_channel. This leads to random crashes when the channel is freed like below one: Unable to handle kernel paging request at virtual address 0080000400000008 [0080000400000008] address between user and kernel address ranges Internal error: Oops: 96000044 [#1] PREEMPT SMP Modules linked in: scmi_module(-) CPU: 1 PID: 2212 Comm: rmmod Not tainted 5.10.0-rc5 #31 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Nov 19 2020 pstate: 20000085 (nzCv daIf -PAN -UAO -TCO BTYPE=--) pc : release_nodes+0x74/0x230 lr : devres_release_all+0x40/0x68 Call trace: release_nodes+0x74/0x230 devres_release_all+0x40/0x68 device_release_driver_internal+0x12c/0x1f8 driver_detach+0x58/0xe8 bus_remove_driver+0x64/0xe0 driver_unregister+0x38/0x68 platform_driver_unregister+0x1c/0x28 scmi_driver_exit+0x38/0x44 [scmi_module] __arm64_sys_delete_module+0x188/0x260 el0_svc_common.constprop.0+0x80/0x1a8 do_el0_svc+0x2c/0x98 el0_sync_handler+0x160/0x168 el0_sync+0x174/0x180 Code: 1400000d eb07009f 54000460 f9400486 (f90004a6) ---[ end trace c55ffd306c140233 ]--- Fix it by replacing kfree with devm_kfree as required. Fixes: 7002ca237b21 ("mailbox: arm_mhu: Add ARM MHU doorbell driver") Reported-by: Cristian Marussi <> Signed-off-by: Sudeep Holla <> Tested-by: Cristian Marussi <> Reviewed-by: Cristian Marussi <> Signed-off-by: Jassi Brar <>
2020-10-24Merge tag 'armsoc-drivers' of ↵Linus Torvalds
git:// Pull ARM SoC-related driver updates from Olof Johansson: "Various driver updates for platforms. A bulk of this is smaller fixes or cleanups, but some of the new material this time around is: - Support for Nvidia Tegra234 SoC - Ring accelerator support for TI AM65x - PRUSS driver for TI platforms - Renesas support for R-Car V3U SoC - Reset support for Cortex-M4 processor on i.MX8MQ There are also new socinfo entries for a handful of different SoCs and platforms" * tag 'armsoc-drivers' of git:// (131 commits) drm/mediatek: reduce clear event soc: mediatek: cmdq: add clear option in cmdq_pkt_wfe api soc: mediatek: cmdq: add jump function soc: mediatek: cmdq: add write_s_mask value function soc: mediatek: cmdq: add write_s value function soc: mediatek: cmdq: add read_s function soc: mediatek: cmdq: add write_s_mask function soc: mediatek: cmdq: add write_s function soc: mediatek: cmdq: add address shift in jump soc: mediatek: mtk-infracfg: Fix kerneldoc soc: amlogic: pm-domains: use always-on flag reset: sti: reset-syscfg: fix struct description warnings reset: imx7: add the cm4 reset for i.MX8MQ dt-bindings: reset: imx8mq: add m4 reset reset: Fix and extend kerneldoc reset: reset-zynqmp: Added support for Versal platform dt-bindings: reset: Updated binding for Versal reset driver reset: imx7: Support module build soc: fsl: qe: Remove unnessesary check in ucc_set_tdm_rxtx_clk soc: fsl: qman: convert to use be32_add_cpu() ...
2020-10-16mailbox: avoid timer start from callbackJassi Brar
If the txdone is done by polling, it is possible for msg_submit() to start the timer while txdone_hrtimer() callback is running. If the timer needs recheduling, it could already be enqueued by the time hrtimer_forward_now() is called, leading hrtimer to loudly complain. WARNING: CPU: 3 PID: 74 at kernel/time/hrtimer.c:932 hrtimer_forward+0xc4/0x110 CPU: 3 PID: 74 Comm: kworker/u8:1 Not tainted 5.9.0-rc2-00236-gd3520067d01c-dirty #5 Hardware name: Libre Computer AML-S805X-AC (DT) Workqueue: events_freezable_power_ thermal_zone_device_check pstate: 20000085 (nzCv daIf -PAN -UAO BTYPE=--) pc : hrtimer_forward+0xc4/0x110 lr : txdone_hrtimer+0xf8/0x118 [...] This can be fixed by not starting the timer from the callback path. Which requires the timer reloading as long as any message is queued on the channel, and not just when current tx is not done yet. Fixes: 0cc67945ea59 ("mailbox: switch to hrtimer for tx_complete polling") Reported-by: Da Xue <> Reviewed-by: Sudeep Holla <> Tested-by: Sudeep Holla <> Acked-by: Jerome Brunet <> Tested-by: Jerome Brunet <> Signed-off-by: Jassi Brar <>
2020-10-12maiblox: mediatek: Fix handling of platform_get_irq() errorKrzysztof Kozlowski
platform_get_irq() returns -ERRNO on error. In such case casting to u32 and comparing to 0 would pass the check. Fixes: 623a6143a845 ("mailbox: mediatek: Add Mediatek CMDQ driver") Signed-off-by: Krzysztof Kozlowski <> Signed-off-by: Jassi Brar <>
2020-10-12mailbox: arm_mhu: Add ARM MHU doorbell driverSudeep Holla
The MHU drives the signal using a 32-bit register, with all 32 bits logically ORed together. The MHU provides a set of registers to enable software to set, clear, and check the status of each of the bits of this register independently. The use of 32 bits for each interrupt line enables software to provide more information about the source of the interrupt. For example, each bit of the register can be associated with a type of event that can contribute to raising the interrupt. This patch adds a separate the MHU controller driver for doorbel mode of operation using the extended DT binding to add support the same. Signed-off-by: Sudeep Holla <> Signed-off-by: Jassi Brar <>
2020-10-12mailbox: arm_mhu: Match only if compatible is "arm,mhu"Sudeep Holla
Since we will be soon adding a separate driver based on this ARM MHU driver to support doorbell mode, let us add explicit check to match the default compatible for this driver. This is needed as the probe and match reuses the AMBA device ids currently and don't have any explicit compatible check. Signed-off-by: Sudeep Holla <> Signed-off-by: Jassi Brar <>
2020-10-12mailbox: bcm: convert tasklets to use new tasklet_setup() APIAllen Pais
In preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly. Signed-off-by: Romain Perier <> Signed-off-by: Allen Pais <> Signed-off-by: Jassi Brar <>
2020-09-18firmware: tegra: Enable BPMP support on Tegra234Thierry Reding
Enable support for the BPMP on Tegra234 to avoid relying on Tegra194 being enabled to pull in the needed OF device ID table entry. On simulation platforms the BPMP hasn't booted up yet by the time we probe the BPMP driver and the BPMP hasn't had a chance to mark the doorbell as ringable by the CCPLEX. This corresponding check in the BPMP driver will therefore fail. Work around this by disabling the check on simulation platforms. Reviewed-by: Jon Hunter <> Signed-off-by: Thierry Reding <>
2020-08-14iomap: constify ioreadX() iomem argument (as in generic implementation)Krzysztof Kozlowski
Patch series "iomap: Constify ioreadX() iomem argument", v3. The ioread8/16/32() and others have inconsistent interface among the architectures: some taking address as const, some not. It seems there is nothing really stopping all of them to take pointer to const. This patch (of 4): The ioreadX() and ioreadX_rep() helpers have inconsistent interface. On some architectures void *__iomem address argument is a pointer to const, on some not. Implementations of ioreadX() do not modify the memory under the address so they can be converted to a "const" version for const-safety and consistency among architectures. [ sh: clk: fix assignment from incompatible pointer type for ioreadX()] Link: [ fix drivers/mailbox/bcm-pdc-mailbox.c] Link: Suggested-by: Geert Uytterhoeven <> Signed-off-by: Krzysztof Kozlowski <> Signed-off-by: Andrew Morton <> Reviewed-by: Geert Uytterhoeven <> Reviewed-by: Arnd Bergmann <> Cc: Richard Henderson <> Cc: Ivan Kokshaysky <> Cc: Matt Turner <> Cc: "James E.J. Bottomley" <> Cc: Helge Deller <> Cc: Michael Ellerman <> Cc: Benjamin Herrenschmidt <> Cc: Paul Mackerras <> Cc: Yoshinori Sato <> Cc: Rich Felker <> Cc: Kalle Valo <> Cc: "David S. Miller" <> Cc: Jakub Kicinski <> Cc: Dave Jiang <> Cc: Jon Mason <> Cc: Allen Hubbe <> Cc: "Michael S. Tsirkin" <> Cc: Jason Wang <> Link: Link: Signed-off-by: Linus Torvalds <>
2020-08-03mailbox: mediatek: cmdq: clear task in channel before shutdownDennis YC Hsieh
Do success callback in channel when shutdown. For those task not finish, callback with error code thus client has chance to cleanup or reset. Signed-off-by: Dennis YC Hsieh <> Reviewed-by: CK Hu <> Reviewed-by: Bibby Hsieh <> Signed-off-by: Jassi Brar <>
2020-08-03mailbox: cmdq: support mt6779 gce platform definitionDennis YC Hsieh
Add gce v4 hardware support with different thread number and shift. Signed-off-by: Dennis YC Hsieh <> Reviewed-by: CK Hu <> Reviewed-by: Matthias Brugger <> Reviewed-by: Bibby Hsieh <> Signed-off-by: Jassi Brar <>
2020-08-03mailbox: cmdq: variablize address shift in platformDennis YC Hsieh
Some gce hardware shift pc and end address in register to support large dram addressing. Implement gce address shift when write or read pc and end register. And add shift bit in platform definition. Signed-off-by: Dennis YC Hsieh <> Signed-off-by: Jassi Brar <>
2020-08-03mailbox: qcom: Add msm8994 apcs compatibleKonrad Dybcio
MSM8994 has an APCS block similar to 8916, but with a different clock driver due to the former one having 2 clusters. Signed-off-by: Konrad Dybcio <> Acked-by: Rob Herring <> Reviewed-by: Bjorn Andersson <> Signed-off-by: Jassi Brar <>
2020-08-03mailbox: qcom: Add sdm660 hmss compatibleKonrad Dybcio
The Qualcomm SDM660 platform has a APCS HMSS GLOBAL block, add the compatible for this. Signed-off-by: Konrad Dybcio <> Reviewed-by: Bjorn Andersson <> Acked-by: Rob Herring <> Signed-off-by: Jassi Brar <>
2020-08-03mailbox: imx: Mark PM functions as __maybe_unusedNathan Chancellor
When CONFIG_PM and CONFIG_PM_SLEEP are unset, the following warnings occur: drivers/mailbox/imx-mailbox.c:638:12: warning: 'imx_mu_runtime_resume' defined but not used [-Wunused-function] 638 | static int imx_mu_runtime_resume(struct device *dev) | ^~~~~~~~~~~~~~~~~~~~~ drivers/mailbox/imx-mailbox.c:629:12: warning: 'imx_mu_runtime_suspend' defined but not used [-Wunused-function] 629 | static int imx_mu_runtime_suspend(struct device *dev) | ^~~~~~~~~~~~~~~~~~~~~~ drivers/mailbox/imx-mailbox.c:611:12: warning: 'imx_mu_resume_noirq' defined but not used [-Wunused-function] 611 | static int imx_mu_resume_noirq(struct device *dev) | ^~~~~~~~~~~~~~~~~~~ drivers/mailbox/imx-mailbox.c:601:12: warning: 'imx_mu_suspend_noirq' defined but not used [-Wunused-function] 601 | static int imx_mu_suspend_noirq(struct device *dev) | ^~~~~~~~~~~~~~~~~~~~ Mark these functions as __maybe_unused, which is the standard procedure for PM functions. Fixes: bb2b2624dbe2 ("mailbox: imx: Add runtime PM callback to handle MU clocks") Signed-off-by: Nathan Chancellor <> Reviewed-by: Dong Aisheng <> Signed-off-by: Jassi Brar <>
2020-08-03mailbox: pcc: Put the PCCT table for error pathHanjun Guo
The acpi_get_table() should be coupled with acpi_put_table() if the mapped table is not used at runtime to release the table mapping. In acpi_pcc_probe(), the PCCT table entries will be used as private data for communication chan at runtime, but the table should be put for error path. Signed-off-by: Hanjun Guo <> Signed-off-by: Jassi Brar <>
2020-08-03mailbox: Replace HTTP links with HTTPS onesAlexander A. Klimov
Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <> Signed-off-by: Jassi Brar <>
2020-06-10mailbox: qcom: Add ipq6018 apcs compatibleSivaprakash Murugesan
The Qualcomm ipq6018 has apcs block, add compatible for the same. Also, the ipq6018 apcs provides a clock functionality similar to msm8916 but the clock driver is different. Create a child device based on the apcs compatible for the clock controller functionality. Signed-off-by: Sivaprakash Murugesan <> Signed-off-by: Jassi Brar <>
2020-06-10mailbox: qcom: Add clock driver name in apcs mailbox driver dataSivaprakash Murugesan
Some apcs mailbox devices supports a clock driver, the compatible strings of devices supporting clock driver along with the clock driver name are maintained in a separate structure within the mailbox driver. And the clock driver is added based on device match. With increase in number of devices supporting the clock feature move the clock driver name inside the driver data. so that we can use a single API to get the register offset of mailbox driver and clock driver name together, and the clock driver will be added based on the driver data. Signed-off-by: Sivaprakash Murugesan <> Signed-off-by: Jassi Brar <>
2020-06-07mailbox: imx: ONLY IPC MU needs IRQF_NO_SUSPEND flagAnson Huang
IPC MU has no power domain assigned and there could be IPC during noirq suspend phase, so IRQF_NO_SUSPEND flag is needed for IPC MU. However, for other MUs, they have power domain assigned and their power will be turned off during noirq suspend phase, but with IRQF_NO_SUSPEND set, their interrupts are NOT disabled even after their power turned off, it will cause system crash when mailbox driver trys to handle pending interrupts but the MU power is already turned off. So, IRQF_NO_SUSPEND flag should ONLY be added to IPC MU which has power domain managed by SCU, then all other MUs' pending interrupts after noirq suspend phase will be handled after system resume. Signed-off-by: Anson Huang <> Signed-off-by: Jassi Brar <>
2020-06-07mailbox: imx: Add runtime PM callback to handle MU clocksAnson Huang
Some of i.MX8M SoCs have MU clock, they need to be managed in runtime to make sure the MU clock can be off in runtime, add runtime PM callback to handle MU clock. And on i.MX8MP, the MU clock is combined with power domain and runtime PM is enabled for the clock driver, during noirq suspend/resume phase, runtime PM is disabled by device suspend, but the MU context save/restore needs to enable MU clock for register access, calling clock prepare/enable will trigger runtime resume failure and lead to system suspend failed. Actually, the MU context save/restore is ONLY necessary for SCU IPC MU, other MUs especially on i.MX8MP platforms which have MU clock assigned, they need to runtime request/free mailbox channel in the consumer driver, so no need to save/restore MU context for them, hence it can avoid this issue, so the MU context save/restore is ONLY applied to i.MX platforms MU instance without clock present. Signed-off-by: Anson Huang <> Signed-off-by: Jassi Brar <>
2020-06-07mailbox: imx: Add context save/restore for suspend/resumeDong Aisheng
For "mem" mode suspend on i.MX8 SoCs, MU settings could be lost because its power is off, so save/restore is needed for MU settings during suspend/resume. However, the restore can ONLY be done when MU settings are actually lost, for the scenario of settings NOT lost in "freeze" mode suspend, since there could be still IPC going on multiple CPUs, restoring the MU settings could overwrite the TIE by mistake and cause system freeze, so need to make sure ONLY restore the MU settings when it is powered off, Anson fixes this by checking whether restore is actually needed when resume. Signed-off-by: Dong Aisheng <> Signed-off-by: Anson Huang <> Signed-off-by: Jassi Brar <>
2020-05-30mailbox: Add support for Qualcomm IPCCManivannan Sadhasivam
Add support for the Inter-Processor Communication Controller (IPCC) block from Qualcomm that coordinates the interrupts (inbound & outbound) for Multiprocessor (MPROC), COMPUTE-Level0 (COMPUTE-L0) & COMPUTE-Level1 (COMPUTE-L1) protocols for the Application Processor Subsystem (APSS). This driver is modeled as an irqchip+mailbox driver. The irqchip part helps in receiving the interrupts from the IPCC clients such as modems, DSPs, PCI-E etc... and forwards them to respective entities in APSS. On the other hand, the mailbox part is used to send interrupts to the IPCC clients from the entities of APSS. Reviewed-by: Bjorn Andersson <> Signed-off-by: Raghavendra Rao Ananta <> Signed-off-by: Venkata Narendra Kumar Gutta <> Signed-off-by: Bjorn Andersson <> [mani: moved to mailbox, added static mbox channels and cleanups] Signed-off-by: Manivannan Sadhasivam <> Signed-off-by: Jassi Brar <>
2020-05-30mailbox: zynqmp-ipi: Fix NULL vs IS_ERR() check in zynqmp_ipi_mbox_probe()Wei Yongjun
In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). So we should check whether the return value of devm_ioremap() is NULL instead of IS_ERR. Fixes: 4981b82ba2ff ("mailbox: ZynqMP IPI mailbox controller") Signed-off-by: Wei Yongjun <> Signed-off-by: Jassi Brar <>
2020-05-30mailbox: imx-mailbox: fix scu msg header size checkPeng Fan
The i.MX8 SCU message header size is the number of "u32" elements, not "u8", so fix the check. Reported-by: coverity-bot <> Addresses-Coverity-ID: 1461658 ("Memory - corruptions") Signed-off-by: Peng Fan <> Reviewed-by: Leonard Crestez <> Acked-by: Oleksij Rempel <> Signed-off-by: Jassi Brar <>
2020-05-30mailbox: sprd: Add Spreadtrum mailbox driverBaolin Wang
The Spreadtrum mailbox controller supports 8 channels to communicate with MCUs, and it contains 2 different parts: inbox and outbox, which are used to send and receive messages by IRQ mode. Signed-off-by: Baolin Wang <> Signed-off-by: Jassi Brar <>
2020-05-30mailbox: ZynqMP IPI: Delete an error message in zynqmp_ipi_probe()Markus Elfring
The function platform_get_irq can log an error already. Thus omit a redundant message for the exception handling in the calling function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <> Signed-off-by: Jassi Brar <>
2020-05-30mailbox: imx: Disable the clock on devm_mbox_controller_register() failureFabio Estevam
devm_mbox_controller_register() may fail, and in the case of failure the priv->clk clock that was previously enabled, should be disabled. Fixes: 2bb7005696e2 ("mailbox: Add support for i.MX messaging unit") Signed-off-by: Fabio Estevam <> Reviewed-by: Peng Fan <> Acked-by: Oleksij Rempel <> [Jassi: fixed merge/am conflict] Signed-off-by: Jassi Brar <>
2020-05-30mailbox: imx: Fix return in imx_mu_scu_xlate()Dan Carpenter
This called from mbox_request_channel(). The caller is expecting error pointers and not NULL so this "return NULL;" will lead to an Oops. Fixes: 0a67003b1985 ("mailbox: imx: add SCU MU support") Signed-off-by: Dan Carpenter <> Signed-off-by: Jassi Brar <>
2020-05-30mailbox: imx: Support runtime PMAnson Huang
Some power hungry sub-systems like VPU has its own MUs which also use mailbox driver, current mailbox driver uses platform driver model and MU's power will be ON after driver probed and left ON there, it may cause the whole sub-system can NOT enter lower power mode, take VPU driver for example, it has runtime PM support, but due to its MU always ON, the VPU sub-system will be always ON and consume many power during kernel idle. To save power in kernel idle, mailbox driver needs to support runtime PM in order to power off MU when it is unused. However, the runtime suspend/resume can ONLY be implemented in mailbox's .shutdown/.startup callback, so its consumer needs to call mbox_request_channel()/mbox_free_channel() in consumer driver's runtime PM callback, then the MU's power will be ON/OFF along with consumer's runtime PM status. Signed-off-by: Anson Huang <> Signed-off-by: Jassi Brar <>
2020-05-30mailbox: pcc: make pcc_mbox_driver staticJason Yan
Fix the following sparse warning: drivers/mailbox/pcc.c:571:24: warning: symbol 'pcc_mbox_driver' was not declared. Should it be static? Reported-by: Hulk Robot <> Signed-off-by: Jason Yan <> Signed-off-by: Jassi Brar <>