Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: interrupt_controller: Add driver for NXP's irqsteer #62776

Merged
merged 2 commits into from
Dec 4, 2023

Conversation

LaurentiuM1234
Copy link
Collaborator

This patch series adds a new interrupt controller driver used for NXP's irqsteer IP.
This patch series also includes the switch to using the new IRQ_STEER driver for NXP_ADSP_IMX8M SoC.

@LaurentiuM1234
Copy link
Collaborator Author

Will keep this as a draft until MIMX8QM6 support is added + HAL changes are merged.
Tagging @dbaluta and @iuliana-prodan for initial comments.

@zephyrbot
Copy link
Collaborator

zephyrbot commented Sep 20, 2023

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
hal_nxp zephyrproject-rtos/hal_nxp@2796169 zephyrproject-rtos/hal_nxp@d0c424e (master) zephyrproject-rtos/hal_nxp@2796169e..d0c424e1

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@LaurentiuM1234
Copy link
Collaborator Author

LaurentiuM1234 commented Sep 20, 2023

Since forcing all of the i.MX8 DSP-based boards to use the IRQ_STEER driver would break SOF (Sound Open Firmware) (because of the fact that XTOS is yet to be deprecated on these boards), I can't make the switch to it yet. To better understand how the driver can be used, you may find an example of a DTS + the necessary configurations (for i.MX8MP) below:

soc {
    irqsteer: interrupt-controller@30a80000 {
        compatible = "nxp,irqsteer-intc";
        reg = <0x30a80000 DT_SIZE_K(64)>;
        
        #size-cells = <0>;
        #address-cells = <1>;

        master0: interrupt-controller@0 {
            compatible = "nxp,irqsteer-master";
            reg = <0>;
            interrupt-controller;
            #interrupt-cells = <1>;
            interrupts-extended = <&clic 19 0 0>;
        };

        master1: interrupt-controller@1 {
            /* some properties go here */
            interrupts-extended = <&clic 20 0 0>;
        };

          master2: interrupt-controller@1 {
            /* some properties go here */
            interrupts-extended = <&clic 21 0 0>;
        };
    };

    /* assuming our DUMMY IP uses system interrupt 34 */
    dummy_ip: my_dummy_ip@deadbeef {
        /* some more properties go here */
        interrupt-parent = <&master1>;
        interrupts = <2>;
    };
};
CONFIG_MULTI_LEVEL_INTERRUPTS=y
CONFIG_2ND_LEVEL_INTERRUPTS=y
CONFIG_2ND_LVL_ISR_TBL_OFFSET=32
CONFIG_MAX_IRQ_PER_AGGREGATOR=64
CONFIG_NUM_2ND_LEVEL_AGGREGATORS=3
CONFIG_2ND_LVL_INTR_00_OFFSET=19
CONFIG_2ND_LVL_INTR_01_OFFSET=20
CONFIG_2ND_LVL_INTR_02_OFFSET=21

EDIT: SOF with Zephyr on i.MX8 boards uses the internal irqsteer driver + the internal arch interface. As such, enabling support for IRQ_STEER on i.MX8MP doesn't affect SOF.

@LaurentiuM1234
Copy link
Collaborator Author

LaurentiuM1234 commented Nov 20, 2023

V2 changes:

  • various documentation improvements/fixes pointed out by @dbaluta and @iuliana-prodan.
  • fixed issue with z_soc_irq_enable_disable() not disabling LEVEL 1 interrupts.
  • dispatcher ISR now queries the status of all interrupts for its master and then iterates over the status register to find the asserted relative interrupts.
  • added UINT_TO_IRQSTEER() macro used to cast a variable to IRQSTEER_Type *.
  • driver now includes sw_isr_common.h for z_get_sw_isr_table_idx()'s definition.

dbaluta
dbaluta previously approved these changes Nov 20, 2023
@dbaluta
Copy link
Collaborator

dbaluta commented Nov 20, 2023

@LaurentiuM1234 thanks this looks good to me! We need to sort out nxp hal dependencies and we are good to merge!

@dbaluta
Copy link
Collaborator

dbaluta commented Nov 20, 2023

Also please sort out twister run failures:

 -- Found BOARD.dts: /__w/zephyr/zephyr/boards/xtensa/nxp_adsp_imx8m/nxp_adsp_imx8m.dts
devicetree error: <Node /soc/uart@30a60000 in '/__w/zephyr/zephyr/misc/empty_file.c'> has an 'interrupts' property, but neither the node nor any of its parents has an 'interrupt-parent' property
-- In: /__w/zephyr/zephyr/module_tests/nxp_adsp_imx8m/sample.audio.sof/zephyr, command: /usr/bin/python;/__w/zephyr/zephyr/scripts/dts/gen_defines.py;--dts;/__w/zephyr/zephyr/module_tests/nxp_adsp_imx8m/sample.audio.sof/zephyr/zephyr.dts.pre;--dtc-flags;'';--bindings-dirs;/__w/zephyr/zephyr/dts/bindings;--header-out;/__w/zephyr/zephyr/module_tests/nxp_adsp_imx8m/sample.audio.sof/zephyr/include/generated/devicetree_generated.h.new;--dts-out;/__w/zephyr/zephyr/module_tests/nxp_adsp_imx8m/sample.audio.sof/zephyr/zephyr.dts.new;--edt-pickle-out;/__w/zephyr/zephyr/module_tests/nxp_adsp_imx8m/sample.audio.sof/zephyr/edt.pickle;--edtlib-Werror;--vendor-prefixes;/__w/zephyr/zephyr/dts/bindings/vendor-prefixes.txt
CMake Error at /__w/zephyr/zephyr/cmake/modules/dts.cmake:268 (message):
  gen_defines.py failed with return code: 1
Call Stack (most recent call first):

https://github.com/zephyrproject-rtos/zephyr/actions/runs/6929546819/job/18847501991?pr=62776

@LaurentiuM1234
Copy link
Collaborator Author

Also please sort out twister run failures:

 -- Found BOARD.dts: /__w/zephyr/zephyr/boards/xtensa/nxp_adsp_imx8m/nxp_adsp_imx8m.dts
devicetree error: <Node /soc/uart@30a60000 in '/__w/zephyr/zephyr/misc/empty_file.c'> has an 'interrupts' property, but neither the node nor any of its parents has an 'interrupt-parent' property
-- In: /__w/zephyr/zephyr/module_tests/nxp_adsp_imx8m/sample.audio.sof/zephyr, command: /usr/bin/python;/__w/zephyr/zephyr/scripts/dts/gen_defines.py;--dts;/__w/zephyr/zephyr/module_tests/nxp_adsp_imx8m/sample.audio.sof/zephyr/zephyr.dts.pre;--dtc-flags;'';--bindings-dirs;/__w/zephyr/zephyr/dts/bindings;--header-out;/__w/zephyr/zephyr/module_tests/nxp_adsp_imx8m/sample.audio.sof/zephyr/include/generated/devicetree_generated.h.new;--dts-out;/__w/zephyr/zephyr/module_tests/nxp_adsp_imx8m/sample.audio.sof/zephyr/zephyr.dts.new;--edt-pickle-out;/__w/zephyr/zephyr/module_tests/nxp_adsp_imx8m/sample.audio.sof/zephyr/edt.pickle;--edtlib-Werror;--vendor-prefixes;/__w/zephyr/zephyr/dts/bindings/vendor-prefixes.txt
CMake Error at /__w/zephyr/zephyr/cmake/modules/dts.cmake:268 (message):
  gen_defines.py failed with return code: 1
Call Stack (most recent call first):

https://github.com/zephyrproject-rtos/zephyr/actions/runs/6929546819/job/18847501991?pr=62776

Sorry for the slip-up. This should be fixed now.

dbaluta
dbaluta previously approved these changes Nov 20, 2023
iuliana-prodan
iuliana-prodan previously approved these changes Nov 21, 2023
@@ -0,0 +1,15 @@
description: i.MX IRQ_STEER master

compatible: "nxp,irqsteer-master"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this new binding being used.

#size-cells = <0>;

clic: interrupt-controller@0 {
compatible = "cdns,xtensa-core-intc";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like no SoC is using nxp,irqsteer-intc compatible, can you clarify who will use the new interrupt controller driver

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.MX8QM, QXP and MP. We can't enable it at the moment as it would break SOF. See example above of how enabling it would look like on MP.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I don't see the example. I am trying to understand why this driver is needed if no one is using it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's going to become a requirement later on when we switch SOF to using Zephyr native drivers on QM, QXP, and MP. I've decided to introduce the driver right now (despite knowing we can't enable it on any of said platforms ATM) instead of later on as it has no dependencies and it would ease the review process and save us some time.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmahadevan108 there was also a discussion here, about enabling UART interrupts on i.MX8MP, which will use irq-steer.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iuliana-prodan , thank you for pointing this PR. Can we add the UART work you mentioned as a separate commit as part of this PR?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmahadevan108, not yet.
@LaurentiuM1234 checked this and "We can't enable the IRQ_STEER driver on any of the i.MX8 boards w/o fully switching to the Zephyr native drivers as this will lead to some awkward scenarios on SOF side."
See all his answer here.

@dleach02 dleach02 assigned dbaluta and unassigned dleach02 Nov 30, 2023
@mmahadevan108
Copy link
Collaborator

Please update west.yml

@zephyrbot zephyrbot removed the DNM This PR should not be merged (Do Not Merge) label Dec 4, 2023
Bump up hal_nxp revision to contain the IRQ_STEER-related
changes.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
This commit introduces a new interrupt controller driver used
for NXP's IRQ_STEER IP.

Apart from introducing the driver itself, this commit contains
the following changes:
	1) Switch i.MX8MP to using the XTENSA core interrupt
	controller instead of the dummy irqsteer one.
		* this is required because the binding for the
		irqsteer driver is no longer a dummy one
		(since it's being used by the irqsteer driver).
		As such, to avoid having problems, switch to
		using another dummy binding.
	2) Modify the irqsteer dummy binding such that it
	serves the IRQ_STEER driver's needs.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
@mmahadevan108 mmahadevan108 merged commit fd8ac9e into zephyrproject-rtos:main Dec 4, 2023
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants