-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Imx943 change irqsteer driver as native driver #99187
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
base: main
Are you sure you want to change the base?
Imx943 change irqsteer driver as native driver #99187
Conversation
LaurentiuM1234
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments below.
Most importantly: please don't change anything in the driver unless it's related to the fact that you're dropping the HAL API. This is an important change and by doing so you're making the review harder and easier to miss out the important stuff.
If you really want to make some unrelated changes then please do so in a separate commit with the appropriate justification.
Also, please make sure you don't break bisectability (see comment from binding). Make sure that after you apply each commit, the affected boards will still compile.
| reg: | ||
| required: true | ||
|
|
||
| irq_offset: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this?
CC: @yongxu-wang15
sure, np. |
900da9d to
4268eb0
Compare
121c460 to
c1686ee
Compare
|
The following west manifest projects have changed revision in this Pull Request: Additional metadata changed:
⛔ DNM label due to: 1 project with metadata changes and 4 blob changes Note: This message is automatically posted and updated by the Manifest GitHub Action. |
Add irqsteer node for m7_0. Signed-off-by: Biwen Li <[email protected]>
Add irqsteer node for m7_1. Signed-off-by: Biwen Li <[email protected]>
Add edma2 node for lpuart3. Signed-off-by: Biwen Li <[email protected]>
Enable edma2 defaultly. Signed-off-by: Biwen Li <[email protected]>
Add more irqsteer masters. Signed-off-by: Biwen Li <[email protected]>
Add disp_irqsteer node(this is another irqsteer instance). Signed-off-by: Biwen Li <[email protected]>
Sync hal_nxp to fix below build issue, zephyr/modules/hal/nxp/mcux/mcux-sdk-ng/ drivers/common/fsl_common_arm.h:697: undefined reference to IRQSTEER_EnableInterrupt Signed-off-by: Biwen Li <[email protected]>
dbbdc36 to
9195599
Compare
|
|
This change breaks Sound Open Firmware running on HIFI4 from imx8mp. Will try to do some investigation. Do you have an imx8mp board on your side? |
|
|
||
| cpu0:cpu@0 { | ||
| cpu0: cpu@0 { | ||
| device_type = "cpu"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't add random cleanup fixes in the middle of a patch. If you want to do cleanups please add them at the beginning of the PR or create a totally new PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't add random cleanup fixes in the middle of a patch. If you want to do cleanups please add them at the beginning of the PR or create a totally new PR.
Okay, I will add them at the begginning of the PR.
|
|
||
| flexio1: flexio@425c0000 { | ||
| compatible = "nxp,flexio"; | ||
| reg = <0x425c0000 DT_SIZE_K(4)>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit description says that you enable edma4 but the code does more than that. E.g enable flexio1 etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit description says that you enable edma4 but the code does more than that. E.g enable flexio1 etc
The flexio is from nxp_imx943_m33.dts, so i move them from nxp_imx943_m33.dts into the common file nxp_imx94x.dtsi
| zephyr,memory-attr = <(DT_MEM_ARM(ATTR_MPU_RAM_NOCACHE))>; | ||
| zephyr,memory-region = "DRAM_M33S_M71_IPC0"; | ||
| zephyr,memory-attr = <DT_MEM_ARM(ATTR_MPU_RAM_NOCACHE)>; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't match patch description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't match patch description.
Some issues are reported by compliance checks(./scripts/ci/check_compliance.py). So i fix them here.
| &gpio5{ | ||
| &gpio5 { | ||
| pinmux = <&iomuxc_eth0_txd0_gpio_io_gpio5_io0>, | ||
| <&iomuxc_eth0_txd1_gpio_io_gpio5_io1>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't randomly fix whitespaces in the middle of a patch. You can create a separate cleanup PR if you want .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't randomly fix whitespaces in the middle of a patch. You can create a separate cleanup PR if you want .
Fix compliance checks issues.
| compatible = "nxp,irqsteer-master"; | ||
| reg = <0>; | ||
| interrupt-controller; | ||
| #interrupt-cells = <2>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the commit message with a proper explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the commit message with a proper explanation.
sure, np.
| /* Register access macros */ | ||
| #define IRQSTEER_READ32(base, offset) sys_read32((base) + (offset)) | ||
| #define IRQSTEER_WRITE32(base, offset, val) sys_write32((val), (base) + (offset)) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would get read read of this macros because capital letter make code harder to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would get read read of this macros because capital letter make code harder to read.
Sure, np. I will update it(irqsteer_read_reg32).
|
|
||
| /* used for driver binding */ | ||
| /* Driver compatibility */ | ||
| #define DT_DRV_COMPAT nxp_irqsteer_intc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original comment is OK! Why do you need to change it? Driver compatibility means something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original comment is OK! Why do you need to change it?
Driver compatibilitymeans something else.
Ok, let's keep the original comment.
| * @file | ||
| * @brief Driver for NXP's IRQ_STEER IP. | ||
| * @brief Native driver for NXP's IRQ_STEER IP (without HAL dependency) | ||
| * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just leave this comment alone, do not modify it. Readers will be confused about this comment and they'll think there is another driver using HAL dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just leave this comment alone, do not modify it. Readers will be confused about this comment and they'll think there is another driver using HAL dependency.
Ok.
|
|
||
| LOG_MODULE_REGISTER(nxp_irqstr); | ||
| LOG_MODULE_REGISTER(nxp_irqsteer); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for this change? All the prefixes in this file are still nxp_irqster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for this change? All the prefixes in this file are still
nxp_irqster
No special reason. It's okay to keep the original string.
| compatible = "nxp,irqsteer-intc"; | ||
| reg = <0x44680000 DT_SIZE_K(64)>; | ||
|
|
||
| #size-cells = <0>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please dont randomly delete new lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please dont randomly delete new lines.
sure. np.
| @@ -1,12 +1,12 @@ | |||
| /* | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry but I don't understand the commit message.
What does this mean mcux-sdk-ng/drivers/irqsteer_1 just likes a native irqsteer driver?
From my understanding the commit message should look like this:
drivers: intc: irqsteer: Drop calling into NXP HAL
Supporting irqsteer using NXP HAL becomes increasingly harder with new
boards.
For example now there are two incompatible HAL drivers for IRQ steer
(mcux-sdk-ng/drivers/irqsteer and mcux-sdk-ng/drivers/irqsteer_1).
In order to avoid overcomplicating code and better scaling code for newer
boards just drop using the NXP HAL and implement an IRQ Steer native
Zephyr driver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry but I don't understand the commit message.
What does this mean
mcux-sdk-ng/drivers/irqsteer_1 just likes a native irqsteer driver?From my understanding the commit message should look like this:
drivers: intc: irqsteer: Drop calling into NXP HAL Supporting irqsteer using NXP HAL becomes increasingly harder with new boards. For example now there are two incompatible HAL drivers for IRQ steer (mcux-sdk-ng/drivers/irqsteer and mcux-sdk-ng/drivers/irqsteer_1). In order to avoid overcomplicating code and better scaling code for newer boards just drop using the NXP HAL and implement an IRQ Steer native Zephyr driver
That means that the mcux-sdk-ng/drivers/irqsteer_1 looks like a native irqsteer driver.
Sure, will follow the message.
| /* There is one output irq for each group of 64 inputs. */ | ||
| int num_masters; | ||
| /* One register bit map can represent 32 input interrupts. */ | ||
| int reg_num; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK IRQSTEER is an configurable IP at hardware integration time so are you sure the groups are always 64? Not clear what is reg_num.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| static int to_zephyr_irq(uint32_t regmap, uint32_t irq, | ||
| /* Native register operations (replacing HAL functions) */ | ||
|
|
||
| /** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would drop any reference to HAL in this driver as we are no longer using it. The only references about HAL should be in the commit message that would justify the removal of NXP API HAL calls.
| mask = IRQSTEER_READ32(base, CHAN_MASK(reg_index, reg_num)); | ||
| mask |= BIT(bit); | ||
| LOG_DBG("base = 0x%x, reg_index = %d, CHAN_MASK(%d, %d) = 0x%x, bit = %d, mask = 0x%x", | ||
| base, reg_index, reg_index, reg_num, CHAN_MASK(reg_index, reg_num), bit, mask); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would drop the LOG_DBG it just makes code harder to read. When debugging this the reader can add its own debug prints.
Also, this is not symmetric with the irqsteer_disable_interrupt. So you either add the LOGS to both functions or to none.
|
|
||
| /* Read status from relevant register index */ | ||
| for (i = 0; i < 2; i++) { | ||
| if (reg_index == reg_num) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to avoid using magic number as much as possible. What is this 2 representing here?
| type: int | ||
| description: | | ||
| How many second level interrupt numbers are supported by an irqsteer instance. | ||
| e.g. In i.MX943, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would reprhase this as:
description: |
Total number of second level interrupts supported by an irqsteer instance.
Also typo -> conncted -> connected.
|
|
||
| dtcm: dtcm@20000000 { | ||
| compatible = "nxp,imx-dtcm"; | ||
| reg = <0x20000000 DT_SIZE_K(256)>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the commit the message to offer an overview of the irqsteer integration into imx943.
Take this chance to better explain what is irq-offset and num-irqs.
| set_variable_ifdef(CONFIG_MCUX_SDIF CONFIG_MCUX_COMPONENT_driver.sdif) | ||
| set_variable_ifdef(CONFIG_MCUX_XBARA CONFIG_MCUX_COMPONENT_driver.xbara) | ||
| set_variable_ifdef(CONFIG_MCUX_XBARB CONFIG_MCUX_COMPONENT_driver.xbarb) | ||
| set_variable_ifdef(CONFIG_QDEC_MCUX CONFIG_MCUX_COMPONENT_driver.enc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could and should be integrated in the commit that drops the HAL NXP calls.
|
@biwenli changes are starting to look good. The split per patch starts to be OK.
|
Yes, i have. But i never touch SOF. So need your help to debug the issue. |




Change irqsteer driver as a zephyr native driver.
There are two irqsteer drivers in mcux sdk(mcux-sdk-ng/drivers/irqsteer and mcux-sdk-ng/drivers/irqsteer_1) and the APIs are not compatible. mcux-sdk-ng/drivers/irqsteer_1 just likes a native irqsteer driver(Refer to the linux irqsteer driver: drivers/irqchip/irq-imx-irqsteer.c). So change it as a native driver directly.