History log of /linux-master/drivers/firmware/imx/imx-scu-irq.c
Revision Date Author Comments
# 5b45759c 03-Aug-2023 Rob Herring <robh@kernel.org>

firmware: Explicitly include correct DT includes

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.

Acked-by: Dinh Nguyen <dinguyen@kernel.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Link: https://lore.kernel.org/r/20230803-dt-header-cleanups-for-soc-v2-17-d8de2cc88bff@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>


# c081197a 07-Aug-2023 Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>

firmware: imx: scu-irq: support identifying SCU wakeup source from sysfs

Record SCU wakeup interrupt in /sys/power/pm_wakeup_irq
The user can further identify the exact wakeup source by using the
following interface:
cat /sys/firmware/scu_wakeup_source/wakeup_src

The above will print the wake groups and the irqs that could have
contributed to waking up the kernel. For example if ON/OFF button was the
wakeup source:
cat /sys/firmware/scu_wakeup_source/wakeup_src
Wakeup source group = 3, irq = 0x1

The user can refer to the SCFW API documentation to identify all the
wake groups and irqs.

Signed-off-by: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>


# 6c59ce48 07-Aug-2023 Peng Fan <peng.fan@nxp.com>

firmware: imx: scu-irq: enlarge the IMX_SC_IRQ_NUM_GROUP

Per SCFW update, update the IMX_SC_IRQ_NUM_GROUP to 9.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>


# d2bd250c 07-Aug-2023 Peng Fan <peng.fan@nxp.com>

firmware: imx: scu-irq: add imx_scu_irq_get_status

Extract the scu irq get status code from imx_scu_irq_work_handler and
make into a new function imx_scu_irq_get_status which could be used
by others, such as SECO.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>


# 19a72e0c 07-Aug-2023 Robin Gong <yibin.gong@nxp.com>

firmware: imx: scu-irq: fix RCU complaint after M4 partition reset

Use blocking_notifier_chain instead of atomic_notifier_chain, otherwise
there will be RCU complaint, because unregister/register_virtio_device()
will issue mbox message.

mbox_send_message() is blocking again after received M4 partition reset.

Actually, no need atomic notifier for scu irq notification since this
notifier is called in worker instead of interrupt handler.

[ 389.706645] i2c-rpmsg virtio0.rpmsg-i2c-channel.-1.2: i2c rpmsg driver is removed
[ 389.767362] Wait for remote ready timeout, use first_notify.
[ 389.774084] ------------[ cut here ]------------
[ 389.778729] WARNING: CPU: 0 PID: 397 at kernel/rcu/tree_plugin.h:293 rcu_note_context_switch+0x34/0x338
[ 389.788131] Modules linked in:
[ 389.791195] CPU: 0 PID: 397 Comm: kworker/0:13 Not tainted 5.4.0-rc5-02977-g08f78722f07b #26
[ 389.799633] Hardware name: Freescale i.MX8DXL MEK (DT)
[ 389.805481] Workqueue: events imx_scu_irq_work_handler

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>


# 0caf8479 23-Apr-2020 Anson Huang <Anson.Huang@nxp.com>

firmware: imx: make sure MU irq can wake up system from suspend mode

IRQF_NO_SUSPEND flag is set for MU IRQ of IPC work, but with this
flag set, IRQD_WAKEUP_ARMED flag will NOT be set during
suspend_device_irq() phase, then when MU IRQ arrives, it will NOT
wake up system from suspend.

To fix this issue, pm_system_wakeup() is called in general MU IRQ
handler to make sure system can be waked up when MU IRQ arrives.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>


# e4f9eefb 22-Oct-2019 Ben Dooks (Codethink) <ben.dooks@codethink.co.uk>

firmware: imx: add missing include of <linux/firmware/imx/sci.h>

Include <linux/firmware/imx/sci.h> for the declarations of the
functions exported from this driver. This fixes the following
sparse warnings:

drivers/firmware/imx/imx-scu-irq.c:45:5: warning: symbol 'imx_scu_irq_register_notifier' was not declared. Should it be static?
drivers/firmware/imx/imx-scu-irq.c:52:5: warning: symbol 'imx_scu_irq_unregister_notifier' was not declared. Should it be static?
drivers/firmware/imx/imx-scu-irq.c:97:5: warning: symbol 'imx_scu_irq_group_enable' was not declared. Should it be static?
drivers/firmware/imx/imx-scu-irq.c:130:5: warning: symbol 'imx_scu_enable_general_irq_channel' was not declared. Should it be static?

Signed-off-by: Ben Dooks (Codethink) <ben.dooks@codethink.co.uk>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>


# a0b14e65 12-May-2019 Anson Huang <anson.huang@nxp.com>

firmware: imx: SCU irq should ONLY be enabled after SCU IPC is ready

The imx_scu_irq_group_enable() is normally called during module driver
probe phase to enable SCU group irq, if SCU IPC is NOT ready, below
dump will show out:

[ 0.933001] Hardware name: Freescale i.MX8QXP MEK (DT)
[ 0.938129] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 0.942907] pc : imx_scu_call_rpc+0x114/0x158
[ 0.947251] lr : imx_scu_irq_group_enable+0x74/0xc4
[ 0.952113] sp : ffff00001005bae0
[ 0.955415] x29: ffff00001005bae0 x28: ffff0000111bb0a0
[ 0.960712] x27: ffff00001140b000 x26: ffff00001111068c
[ 0.966011] x25: ffff0000111bb100 x24: 0000000000000000
[ 0.971311] x23: ffff0000113d9cd8 x22: 0000000000000001
[ 0.976610] x21: 0000000000000001 x20: ffff80083b51a410
[ 0.981909] x19: ffff000011259000 x18: 0000000000000480
[ 0.987209] x17: 000000000023ffb8 x16: 0000000000000010
[ 0.992508] x15: 000000000000023f x14: ffffffffffffffff
[ 0.997807] x13: 0000000000000018 x12: 0000000000000030
[ 1.003107] x11: 0000000000000003 x10: 0101010101010101
[ 1.008406] x9 : ffffffffffffffff x8 : 7f7f7f7f7f7f7f7f
[ 1.013706] x7 : fefefeff646c606d x6 : 0000000000000000
[ 1.019005] x5 : ffff0000112596c8 x4 : 0000000000000008
[ 1.024304] x3 : 0000000000000003 x2 : 0000000000000001
[ 1.029604] x1 : ffff00001005bb58 x0 : 0000000000000000
[ 1.034905] Call trace:
[ 1.037341] imx_scu_call_rpc+0x114/0x158
[ 1.041334] imx_scu_irq_group_enable+0x74/0xc4
[ 1.045856] imx_sc_wdt_probe+0x24/0x150
[ 1.049766] platform_drv_probe+0x4c/0xb0
[ 1.053762] really_probe+0x1f8/0x2c8
[ 1.057407] driver_probe_device+0x58/0xfc
[ 1.061490] device_driver_attach+0x68/0x70
[ 1.065660] __driver_attach+0x94/0xdc
[ 1.069397] bus_for_each_dev+0x64/0xc0
[ 1.073220] driver_attach+0x20/0x28
[ 1.076782] bus_add_driver+0x148/0x1fc
[ 1.080601] driver_register+0x68/0x120
[ 1.084424] __platform_driver_register+0x4c/0x54
[ 1.089120] imx_sc_wdt_driver_init+0x18/0x20
[ 1.093463] do_one_initcall+0x58/0x1b8
[ 1.097287] kernel_init_freeable+0x1cc/0x288
[ 1.101630] kernel_init+0x10/0x100
[ 1.105101] ret_from_fork+0x10/0x18
[ 1.108669] ---[ end trace 9e03302114457de9 ]---
[ 1.113296] enable irq failed, group 1, mask 1, ret -22

To avoid such scenario, return -EPROBE_DEFER in imx_scu_irq_group_enable()
API if SCU IPC is NOT ready, then module driver which calls this API
in probe phase will defer probe after SCU IPC ready.

Fixes: 851826c7566e ("firmware: imx: enable imx scu general irq function")
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>


# 851826c7 08-Apr-2019 Anson Huang <anson.huang@nxp.com>

firmware: imx: enable imx scu general irq function

The System Controller Firmware (SCFW) controls RTC, thermal
and WDOG etc., these resources' interrupt function are managed
by SCU. When any IRQ pending, SCU will notify Linux via MU general
interrupt channel #3, and Linux kernel needs to call SCU APIs
to get IRQ status and notify each module to handle the interrupt.

Since there is no data transmission for SCU IRQ notification, so
doorbell mode is used for this MU channel, and SCU driver will
use notifier mechanism to broadcast to every module which registers
the SCU block notifier.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>