summaryrefslogtreecommitdiff
path: root/drivers/firmware/imx
AgeCommit message (Collapse)AuthorFilesLines
2022-02-20firmware: imx: scu-pd: imx8q: add vpu mu resourcesMing Qian1-0/+4
the vpu core depends on the mu resources. if they're missed, the vpu can't work. Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Shijie Qin <shijie.qin@nxp.com> Signed-off-by: Zhou Peng <eagle.zhou@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2022-02-12firmware: imx: add get resource owner apiPeng Fan1-0/+45
Add resource owner management API, this API could be used to check whether M4 is under control of Linux. Signed-off-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2021-03-29firmware: imx: scu-pd: add missed ADC1 pdFrank Li1-1/+1
ADC1 is not defined in pd driver on 8QM. Signed-off-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2021-03-29firmware: imx: scu-pd: Update comments for single global power domainUlf Hansson1-2/+9
Since the introduction of the PM domain support for the scu-pd, the genpd framework has been continuously improved. More preciously, using a single global power domain can quite easily be deployed for imx platforms. To avoid confusions, let's therefore make an update to the comments about the missing pieces. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2021-03-15firmware: imx: scu-pd: do not power off console domainDong Aisheng1-1/+27
Do not power off console domain in runtime pm. Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2021-01-18firmware: imx: select SOC_BUS to fix firmware buildRandy Dunlap1-0/+1
Fix build error in firmware/imx/ selecting SOC_BUS. riscv32-linux-ld: drivers/firmware/imx/imx-scu-soc.o: in function `.L9': imx-scu-soc.c:(.text+0x1b0): undefined reference to `soc_device_register' Fixes: edbee095fafb ("firmware: imx: add SCU firmware driver support") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: kernel test robot <lkp@intel.com> Cc: Atish Patra <atish.patra@wdc.com> Cc: Palmer Dabbelt <palmerdabbelt@google.com> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Anson Huang <Anson.Huang@nxp.com> Cc: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-11-30firmware: imx: scu-pd: Add some power domains support for i.MX8qxp MIPI1 ↵Liu Ying1-0/+4
subsystem This patch adds the main power domain, pwm0 power domain and i2c0/1 power domains support for i.MX8qxp MIPI1 subsystem. Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Pengutronix Kernel Team <kernel@pengutronix.de> Cc: Fabio Estevam <festevam@gmail.com> Cc: NXP Linux Team <linux-imx@nxp.com> Signed-off-by: Liu Ying <victor.liu@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-11-30firmware: imx: scu-pd: Add main power domain support for i.MX8qxp LVDS1 ↵Liu Ying1-0/+1
subsystem This patch adds the main power domain support for i.MX8qxp LVDS1 subsystem. Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Pengutronix Kernel Team <kernel@pengutronix.de> Cc: Fabio Estevam <festevam@gmail.com> Cc: NXP Linux Team <linux-imx@nxp.com> Signed-off-by: Liu Ying <victor.liu@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-11-30firmware: imx: scu-pd: Add video0/1 power domains support for i.MX8qxp DC0 ↵Liu Ying1-0/+1
subsystem This patch adds video0/1 power domains support for i.MX8qxp DC0 subsystem. Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Pengutronix Kernel Team <kernel@pengutronix.de> Cc: Fabio Estevam <festevam@gmail.com> Cc: NXP Linux Team <linux-imx@nxp.com> Signed-off-by: Liu Ying <victor.liu@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-11-16firmware: imx-dsp: Export functions to request/free channelsDaniel Baluta1-0/+25
In order to save power, we only need to request a channel when the communication with the DSP active. For this we export the following functions: - imx_dsp_request_channel, gets a channel with a given index - imx_dsp_free_channel, frees a channel with a given index Notice that we still request channels at probe to support devices that do not have PM callbacks implemented. More explanations about why requesting a channel has an effect on power savings: - requesting an mailbox channel will call mailbox's startup function. - startup function calls pm_runtime_get_sync which increments device usage count and will keep the device active. Specifically, mailbox clock will be always ON when a mailbox channel is requested. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Paul Olaru <paul.olaru@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-11-16firmware: imx: Save channel name for further useDaniel Baluta1-3/+3
We want to request / free channels on demand later in order to save power. For this for each channel we save the name and use it to reference the channel later. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Paul Olaru <paul.olaru@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-11-16firmware: imx: Introduce imx_dsp_setup_channelsDaniel Baluta1-15/+26
Create a separate function that sets up DSP mailbox channels so that imx_dsp_probe function will be easier to read. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Paul Olaru <paul.olaru@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-11-16firmware: imx: scu-pd: Add power domains for imx-jpegMirela Rabulea1-0/+6
The power domains are for imx8qxp/imx8qm JPEG encoder & decoder. Each has 4 slots and a wrapper. Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-09-13firmware: imx: scu-pd: ignore power domain not ownedPeng Fan1-0/+4
Should not register power domain that not owned by current partition. Alought power domains will not be registered when power on failure, we have to let CPU waste more cycles. Whether power on or owned check, both need communicate with SCU, but with owned check, we no need to run more code path to save CPU cycles. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-07-13firmware: imx: Move i.MX SCU soc driver into imx firmware folderAnson Huang3-1/+143
The i.MX SCU soc driver depends on SCU firmware driver, so it has to use platform driver model for proper defer probe operation, since it has no device binding in DT file, a simple platform device is created together inside the platform driver. To make it more clean, we can just move the entire SCU soc driver into imx firmware folder and initialized by i.MX SCU firmware driver. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-06-23firmware: imx: scu-pd: add more cm4 resourcesPeng Fan1-2/+12
Add more cm4 resources, then linux could use cm4's i2c/lpuart and could kick cm4 core. 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>
2020-06-23firmware: imx: add resource management apiPeng Fan2-1/+46
Add resource management API, when we have multiple partition running together, resources not owned to current partition should not be used. Reviewed-by: Leonard Crestez <leonard.crestez@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>
2020-06-23firmware: imx: scu-pd: fix cm40 power domainPeng Fan1-2/+2
The postfix needs to be false. Alought compiler use 0 for postfix now, and take start_from as 0, it is better we add explicit false to postfix. Fixes: 705dcca91d0a("firmware: imx: scu-pd: add power domain for I2C and INTMUX in CM40 SS") Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-06-17firmware: imx: make sure MU irq can wake up system from suspend modeAnson Huang1-0/+2
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>
2020-05-26Merge tag 'imx-drivers-5.8' of ↵Arnd Bergmann1-16/+48
git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into arm/drivers i.MX drivers update for 5.8: - Optimize imx-scu driver to use one TX and one RX instead of four for talking to SCU. - Fix one possible message header corruption where the response is longer than the request. - Move System Control defines into dt-bindings header, so that DT can use them as well. - A couple of small fixups. * tag 'imx-drivers-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux: firmware: imx: scu: Fix possible memory leak in imx_scu_probe() dt-bindings: firmware: imx: Add more system controls and PM clock types dt-bindings: firmware: imx: Move system control into dt-binding headfile firmware: imx: scu: Fix corruption of header firmware: imx-scu: Support one TX and one RX soc: imx8m: No need to put node when of_find_compatible_node() failed Link: https://lore.kernel.org/r/20200523032516.11016-1-shawnguo@kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2020-05-20firmware: imx: scu: Fix possible memory leak in imx_scu_probe()Wei Yongjun1-0/+1
'chan_name' is malloced in imx_scu_probe() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Fixes: edbee095fafb ("firmware: imx: add SCU firmware driver support") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-05-13dt-bindings: firmware: imx: Move system control into dt-binding headfileDong Aisheng1-1/+0
i.MX8 SoCs DTS file needs system control macro definitions, so move them into dt-binding headfile, then include/linux/firmware/imx/types.h can be removed and those drivers using it should be changed accordingly. Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Jacky Bai <ping.bai@nxp.com> Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-04-23firmware: imx: scu: Fix corruption of headerFranck LENORMAND1-5/+5
The header of the message to send can be changed if the response is longer than the request: - 1st word, the header is sent - the remaining words of the message are sent - the response is received asynchronously during the execution of the loop, changing the size field in the header - the for loop test the termination condition using the corrupted header It is the case for the API build_info which has just a header as request but 3 words in response. This issue is fixed storing the header locally instead of using a pointer on it. Fixes: edbee095fafb (firmware: imx: add SCU firmware driver support) Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com> Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Cc: stable@vger.kernel.org Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-04-20firmware: imx-scu: Support one TX and one RXPeng Fan1-11/+43
Current imx-scu requires four TX and four RX to communicate with SCU. This is low efficient and causes lots of mailbox interrupts. With imx-mailbox driver could support one TX to use all four transmit registers and one RX to use all four receive registers, imx-scu could use one TX and one RX. Signed-off-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-04-17firmware: imx: fix compile-testingArnd Bergmann1-2/+2
It is nice to allow compile-testing the firmware drivers, but this fails when the dependency is a loadable module: aarch64-linux-ld: drivers/firmware/imx/scu-pd.o: in function `imx_sc_pd_power': scu-pd.c:(.text+0xd8): undefined reference to `imx_scu_call_rpc' aarch64-linux-ld: scu-pd.c:(.text+0x108): undefined reference to `imx_scu_call_rpc' aarch64-linux-ld: drivers/firmware/imx/scu-pd.o: in function `imx_sc_pd_probe': Change the dependencies to ensure that any driver we depend on is either reachable or we are compile-testing and it is disabled, effectively reverting most of the previous changes that turned out to be incorrect. Fixes: a9f85f93ed73 ("firmware: imx: add COMPILE_TEST support") Fixes: 5b00b8375416 ("firmware: imx: add COMPILE_TEST for IMX_SCU driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20200408190314.695067-1-arnd@arndb.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-04Merge tag 'arm-drivers-5.7' of ↵Linus Torvalds1-1/+12
git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc Pull ARM driver updates from Arnd Bergmann: "These are the usual updates for SoC specific device drivers and related subsystems that don't have their own top-level maintainers: - ARM SCMI/SCPI updates to allow pluggable transport layers - TEE subsystem cleanups - A new driver for the Amlogic secure power domain controller - Various driver updates for the NXP Layerscape DPAA2, NXP i.MX SCU and TI OMAP2+ sysc drivers. - Qualcomm SoC driver updates, including a new library module for "protection domain" notifications - Lots of smaller bugfixes and cleanups in other drivers" * tag 'arm-drivers-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (70 commits) soc: fsl: qe: fix sparse warnings for ucc_slow.c soc: fsl: qe: ucc_slow: remove 0 assignment for kzalloc'ed structure soc: fsl: qe: fix sparse warnings for ucc_fast.c soc: fsl: qe: fix sparse warnings for qe_ic.c soc: fsl: qe: fix sparse warnings for ucc.c soc: fsl: qe: fix sparse warning for qe_common.c soc: fsl: qe: fix sparse warnings for qe.c soc: qcom: Fix QCOM_APR dependencies soc: qcom: pdr: Avoid uninitialized use of found in pdr_indication_cb soc: imx: drop COMPILE_TEST for IMX_SCU_SOC firmware: imx: add COMPILE_TEST for IMX_SCU driver soc: imx: gpc: fix power up sequencing soc: imx: increase build coverage for imx8m soc driver soc: qcom: apr: Add avs/audio tracking functionality dt-bindings: soc: qcom: apr: Add protection domain bindings soc: qcom: Introduce Protection Domain Restart helpers devicetree: bindings: firmware: add ipq806x to qcom_scm memory: tegra: Correct debugfs clk rate-range on Tegra124 memory: tegra: Correct debugfs clk rate-range on Tegra30 memory: tegra: Correct debugfs clk rate-range on Tegra20 ...
2020-03-18firmware: imx: add COMPILE_TEST supportAnson Huang1-2/+2
Add COMPILE_TEST support to i.MX SCU drivers for better compile testing coverage. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Link: https://lore.kernel.org/r/1583509356-8265-1-git-send-email-Anson.Huang@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-16firmware: imx: add COMPILE_TEST for IMX_SCU driverAnson Huang1-1/+1
Add COMPILE_TEST support to IMX_SCU driver for better compile testing coverage. Any driver depending on IMX_SCU shouldn't have COMPILE_TEST though. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-03-10firmware: imx: scu-pd: add power domain for I2C and INTMUX in CM40 SSJoakim Zhang1-0/+4
Add power domain for I2C and INTMUX in CM40 SS. Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-02-24firmware: imx: Align imx_sc_msg_req_cpu_start to 4Leonard Crestez1-1/+1
The imx SC api strongly assumes that messages are composed out of 4-bytes words but some of our message structs have odd sizeofs. This produces many oopses with CONFIG_KASAN=y. Fix by marking with __aligned(4). Fixes: d90bf296ae18 ("firmware: imx: Add support to start/stop a CPU") Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-02-24firmware: imx: scu-pd: Align imx sc msg structs to 4Leonard Crestez1-1/+1
The imx SC api strongly assumes that messages are composed out of 4-bytes words but some of our message structs have odd sizeofs. This produces many oopses with CONFIG_KASAN=y. Fix by marking with __aligned(4). Fixes: c800cd7824bd ("firmware: imx: add SCU power domain driver") Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-02-24firmware: imx: misc: Align imx sc msg structs to 4Leonard Crestez1-3/+3
The imx SC api strongly assumes that messages are composed out of 4-bytes words but some of our message structs have odd sizeofs. This produces many oopses with CONFIG_KASAN=y: BUG: KASAN: stack-out-of-bounds in imx_mu_send_data+0x108/0x1f0 It shouldn't cause an issues in normal use because these structs are always allocated on the stack. Fixes: 15e1f2bc8b3b ("firmware: imx: add misc svc support") Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-02-24firmware: imx: scu: Ensure sequential TXLeonard Crestez1-0/+27
SCU requires that all messages words are written sequentially but linux MU driver implements multiple independent channels for each register so ordering between different channels must be ensured by SCU API interface. Wait for tx_done before every send to ensure that no queueing happens at the mailbox channel level. Fixes: edbee095fafb ("firmware: imx: add SCU firmware driver support") Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Cc: <stable@vger.kernel.org> Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by:: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-02-18firmware: imx: scu-pd: enlarge PD range for mu_bSebastien Fagard1-1/+1
The range of resources for Messaging Units side B needs to contain all the possible MUB resource available: starting from MU_5B up to MU_13B. This patch is needed to enable MU_8B for the 'imx-shmem-net' driver which allows two OS partitions communicating via MUs without Hypervisor. Signed-off-by: Sebastien Fagard <sebastien.fagard@nxp.com> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-02-18firmware: imx: scu-pd: Add missing audio PD rangesDaniel Baluta1-0/+7
imx8qxp_scu_pd_ranges keeps PD ranges for both i.MX8QM and i.MX8QXP. The following PD are missing: audio-clk1/ spdif1 / sai3..7. Add them now. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2020-01-09firmware: imx: Allow IMX DSP to be selected as moduleDaniel Baluta1-1/+1
IMX DSP is only needed by SOF or any other module that wants to communicate with the DSP. When SOF is build as a module IMX DSP is forced to be built inside the kernel image. This is not optimal, so allow IMX DSP to be built as a module. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-10-28firmware: imx: add missing include of <linux/firmware/imx/sci.h>Ben Dooks (Codethink)1-0/+1
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>
2019-10-28firmware: imx: Remove call to devm_of_platform_populateDaniel Baluta1-1/+1
IMX DSP device is created by SOF layer. The current call to devm_of_platform_populate is not needed and it doesn't produce any effects. Fixes: ffbf23d50353915d ("firmware: imx: Add DSP IPC protocol interface) Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-10-14firmware: imx: Skip return value check for some special SCU firmware APIsAnson Huang1-1/+15
The SCU firmware does NOT always have return value stored in message header's function element even the API has response data, those special APIs are defined as void function in SCU firmware, so they should be treated as return success always. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-10-06firmware: imx: warn on unexpected RXLeonard Crestez1-1/+9
The imx_scu_call_rpc function returns the result inside the same "msg" struct containing the transmitted message. This is implemented by holding a pointer to msg (which is usually on the stack) in sc_imx_rpc and writing to it from imx_scu_rx_callback. This means that if the have_resp parameter is incorrect or SCU sends an unexpected response for any reason the most likely result is kernel stack corruption. Fix this by only setting sc_imx_rpc.msg for the duration of the imx_scu_call_rpc call and warning in imx_scu_rx_callback if unset. Print the unexpected response data to help debugging. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Acked-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-08-12firmware: imx: Add DSP IPC protocol interfaceDaniel Baluta3-0/+167
Some of i.MX8 processors (e.g i.MX8QM, i.MX8QXP) contain the Tensilica HiFi4 DSP for advanced pre- and post-audio processing. The communication between Host CPU and DSP firmware is taking place using a shared memory area for message passing and a dedicated Messaging Unit for notifications. DSP IPC protocol offers a doorbell interface using imx-mailbox API. We use 4 MU channels (2 x TXDB, 2 x RXDB) to implement a request-reply protocol. Connection 0 (txdb0, rxdb0): - Host writes messasge to shared memory [SHMEM] - Host sends a request [MU] - DSP handles request [SHMEM] - DSP sends reply [MU] Connection 1 (txdb1, rxdb1): - DSP writes a message to shared memory [SHMEM] - DSP sends a request [MU] - Host handles request [SHMEM] - Host sends reply [MU] The protocol interface will be used by a Host client to communicate with the DSP. First client will be the i.MX8 part from Sound Open Firmware infrastructure. The protocol offers the following interface: On Tx: - imx_dsp_ring_doorbell, will be called to notify the DSP that it needs to handle a request. On Rx: - clients need to provide two callbacks: .handle_reply .handle_request - the callbacks will be used by the protocol on notification arrival from DSP. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-07-23firmware: imx: scu-pd: Add IRQSTR_DSP PD rangeDaniel Baluta1-0/+1
The DSP interrupt steer gathers interrupts from the system and can be used to steer them to DSP. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-07-23firmware: imx: scu-pd: Add mu13 b side PD rangeDaniel Baluta1-0/+1
LSIO subsystem contains 14 MU instances. 5 MUs to communicate between AP <-> SCU - side-A PD range managed by AP - side-B PD range managed by SCU 9 MUs to communicate between all cores (AP/M4/DSP). - side-A PD range managed by core-A (AP/M4/DSP) - side-B PD range managed by core-B (AP/M4/DSP). Communication between AP <-> DSP is done through the assigned MU number 13. So, we power up side-A by the AP and we decide to power up side-B also from AP. This is because powering it up from DSP would be painful. Powering up side B from DSP would require the DSP to communicate with SCU and to keep things simple we don't want that now. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-07-23firmware: imx: scu-pd: Rename mu PD range to mu_aDaniel Baluta1-1/+1
The Messaging Unit module enables two processors within the SoC to communicate and coordinate by passing messages through the MU interface. MUs have 2 “sides” with independent programming interfaces. Rename mu PD range to mu_a because it's actually side A of MUs. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-06-16Merge tag 'imx-fixes-5.2' of ↵Olof Johansson1-0/+3
git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into fixes i.MX fixes for 5.2: - A build fix for soc-imx8 driver which needs SOC_BUS support. To avoid dealing with the dependency for every single i.MX SoC bus driver, we selects at from architecture level. - A fix on i.MX SCU firmware driver to ensure SCU irq is enabled only after IPC is ready. - A regression fix on cpuidle-imx6sx driver, which causes some characters loss on serial communication. * tag 'imx-fixes-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux: ARM: imx: cpuidle-imx6sx: Restrict the SW2ISO increase to i.MX6SX firmware: imx: SCU irq should ONLY be enabled after SCU IPC is ready arm64: imx: Fix build error without CONFIG_SOC_BUS Signed-off-by: Olof Johansson <olof@lixom.net>
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner1-0/+1
Add SPDX license identifiers to all Make/Kconfig files which: - Have no license information of any form These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20firmware: imx: SCU irq should ONLY be enabled after SCU IPC is readyAnson Huang1-0/+3
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>
2019-04-11firmware: imx: enable imx scu general irq functionAnson Huang3-1/+175
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>
2019-03-19firmware: imx: scu-pd: decouple the SS information from domain namesAisheng Dong1-44/+48
As resource power domain service is provided by SCU firmware, no SS information required. So we can remove the SS indicator from the domain names, then the domains defined can be better shared among different SCU based platforms. Cc: Ulf Hansson <ulf.hansson@linaro.org> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <kernel@pengutronix.de> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Kevin Hilman <khilman@kernel.org> Cc: linux-pm@vger.kernel.org Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-03-19firmware: imx: scu-pd: add specifying the base of domain name index supportAisheng Dong1-52/+55
As the domain resource id in the same type may not be continuous, so it's hard to describe all such power domains with current struct imx_sc_pd_range. Adding the optional base for domain name index to address this issue. Then we can add the discrete domains easily later. Cc: Ulf Hansson <ulf.hansson@linaro.org> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <kernel@pengutronix.de> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Kevin Hilman <khilman@kernel.org> Cc: linux-pm@vger.kernel.org Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>