* [PATCH] imx93_frdm: clear and mask TCPC interrupts
@ 2026-01-03 21:22 Francesco Valla
2026-01-03 23:41 ` Fabio Estevam
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Francesco Valla @ 2026-01-03 21:22 UTC (permalink / raw)
To: NXP i.MX U-Boot Team, u-boot
Cc: Fabio Estevam, Stefano Babic, Tom Rini, Peng Fan,
Mathieu Dubois-Briand, Joseph Guo, Thomas Petazzoni, Fabian Pflug,
Francesco Valla
One of the two on-board PTN5110 TCPC USB Power Delivery controller on
the i.MX93 FRDM board shares its interrupt line whith the PCAL6524 power
controller (GPIO3-27). Since the PTN5110 starts after POR with the
interrupts enabled, this can lead to an interrupt storm on OS startup if
only the driver for the PCAL6524 is loaded, because none is servicing
(and clearing) the interrupt requests from the PTN5110.
Maks and clear all interrupts as part uring board initialization; they
can be re-enabled later by a proper OS driver if required.
Co-developed-by: Joseph Guo <qijian.guo@nxp.com>
Signed-off-by: Francesco Valla <francesco@valla.it>
---
Interrupt storms have been observed during the Linux kernel startup on
the i.MX93 FRDM [0], leading to the IRQ functionality being disabled for
the involved IRQ line. Even in case the IRQ line is not disabled,
several thousands of interrupts can be observed:
94: 55749 0 gpio-vf610 27 Level 1-0022, 2-0050
This has been traced to the interrupt sharing for one of the on-board
PTN5110 TCPC and the PCAL6524 I/O expander. The same behavior was
observed and fixed on the i.MX91 FRDM [1], so the proposed solution
is the same: to mask and clear all PTN5110 interrupts during board
configuration.
With this patch applied, the interrupt line is completely silent on
startup:
94: 0 0 gpio-vf610 27 Level 1-0022, 2-0050
I added the Co-developed-by tag giving credit to Joseph Guo since the
technical solution is theirs, as developed for the i.MX91 FRDM.
[0] https://lore.kernel.org/all/20251230171548.67289601@windsurf
[1] https://lore.kernel.org/all/aTDyW8Rm1u6hWUuc@lsvm11u0000395.swis.ap-northeast-2.aws.nxp.com
---
board/freescale/imx93_frdm/imx93_frdm.c | 59 +++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/board/freescale/imx93_frdm/imx93_frdm.c b/board/freescale/imx93_frdm/imx93_frdm.c
index c436ac6aa4791000c5eaee13f6190ad7d83bdc55..cfbcde2e1a579e9401a3df04011f567e218af6fa 100644
--- a/board/freescale/imx93_frdm/imx93_frdm.c
+++ b/board/freescale/imx93_frdm/imx93_frdm.c
@@ -5,6 +5,7 @@
#include <env.h>
#include <efi_loader.h>
+#include <i2c.h>
#include <init.h>
#include <asm/global_data.h>
#include <asm/arch/sys_proto.h>
@@ -36,6 +37,62 @@ struct efi_capsule_update_info update_info = {
};
#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+#define TCPC_ALERT 0x10
+#define TCPC_ALERT_MASK 0x12
+#define TCPC_FAULT_STATUS_MASK 0x15
+
+#define TCPC1_I2C_BUS 2
+#define TCPC1_I2C_ADDR 0x50
+
+/*
+ * Mask all interrupts and clear alert status for the PTN5110 TCPC USB Power
+ * Delivery controller. This is required to avoid an interrupt storm on OS
+ * startup, since the interrupt line for the PTN5110 is shared also by the
+ * PCAL6524 I/O expander.
+ */
+static int clear_pd_alert(void)
+{
+ struct udevice *bus;
+ struct udevice *i2c_dev = NULL;
+ int ret;
+ u8 buffer_0[2] = {0, 0};
+ u8 buffer_1[2] = {0xff, 0xff};
+
+ ret = uclass_get_device_by_seq(UCLASS_I2C, TCPC1_I2C_BUS, &bus);
+ if (ret) {
+ printf("Failed to get I2C bus %d\n", TCPC1_I2C_BUS);
+ return ret;
+ }
+
+ ret = dm_i2c_probe(bus, TCPC1_I2C_ADDR, 0, &i2c_dev);
+ if (ret) {
+ printf("Can't find USB PD device at 0x%02x\n", TCPC1_I2C_ADDR);
+ return ret;
+ }
+
+ /* Mask all alert status*/
+ ret = dm_i2c_write(i2c_dev, TCPC_ALERT_MASK, buffer_0, 2);
+ if (ret) {
+ printf("%s dm_i2c_write failed: %d\n", __func__, ret);
+ return ret;
+ }
+
+ ret = dm_i2c_write(i2c_dev, TCPC_FAULT_STATUS_MASK, buffer_0, 2);
+ if (ret) {
+ printf("%s dm_i2c_write failed: %d\n", __func__, ret);
+ return ret;
+ }
+
+ /* Clear active alerts */
+ ret = dm_i2c_write(i2c_dev, TCPC_ALERT, buffer_1, 2);
+ if (ret) {
+ printf("%s dm_i2c_write failed: %d\n", __func__, ret);
+ return ret;
+ }
+
+ return 0;
+}
+
int board_early_init_f(void)
{
return 0;
@@ -61,5 +118,7 @@ int board_late_init(void)
env_set_ulong("dofastboot", 1);
}
+ clear_pd_alert();
+
return 0;
}
---
base-commit: eb18217b63b79dfcec704d420fcc61e77397c88f
change-id: 20260102-imx93_frdm_tcpc_fix-53549c36b7d7
Best regards,
--
Francesco Valla <francesco@valla.it>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] imx93_frdm: clear and mask TCPC interrupts
2026-01-03 21:22 [PATCH] imx93_frdm: clear and mask TCPC interrupts Francesco Valla
@ 2026-01-03 23:41 ` Fabio Estevam
2026-01-06 14:40 ` Thomas Petazzoni
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2026-01-03 23:41 UTC (permalink / raw)
To: Francesco Valla
Cc: NXP i.MX U-Boot Team, u-boot, Stefano Babic, Tom Rini, Peng Fan,
Mathieu Dubois-Briand, Joseph Guo, Thomas Petazzoni, Fabian Pflug
Hi Francesco,
On Sat, Jan 3, 2026 at 6:22 PM Francesco Valla <francesco@valla.it> wrote:
>
> One of the two on-board PTN5110 TCPC USB Power Delivery controller on
> the i.MX93 FRDM board shares its interrupt line whith the PCAL6524 power
> controller (GPIO3-27). Since the PTN5110 starts after POR with the
> interrupts enabled, this can lead to an interrupt storm on OS startup if
> only the driver for the PCAL6524 is loaded, because none is servicing
> (and clearing) the interrupt requests from the PTN5110.
>
> Maks and clear all interrupts as part uring board initialization; they
> can be re-enabled later by a proper OS driver if required.
>
> Co-developed-by: Joseph Guo <qijian.guo@nxp.com>
> Signed-off-by: Francesco Valla <francesco@valla.it>
> ---
> Interrupt storms have been observed during the Linux kernel startup on
> the i.MX93 FRDM [0], leading to the IRQ functionality being disabled for
> the involved IRQ line. Even in case the IRQ line is not disabled,
> several thousands of interrupts can be observed:
>
> 94: 55749 0 gpio-vf610 27 Level 1-0022, 2-0050
>
> This has been traced to the interrupt sharing for one of the on-board
> PTN5110 TCPC and the PCAL6524 I/O expander. The same behavior was
> observed and fixed on the i.MX91 FRDM [1], so the proposed solution
> is the same: to mask and clear all PTN5110 interrupts during board
> configuration.
>
> With this patch applied, the interrupt line is completely silent on
> startup:
>
> 94: 0 0 gpio-vf610 27 Level 1-0022, 2-0050
>
> I added the Co-developed-by tag giving credit to Joseph Guo since the
> technical solution is theirs, as developed for the i.MX91 FRDM.
>
> [0] https://lore.kernel.org/all/20251230171548.67289601@windsurf
> [1] https://lore.kernel.org/all/aTDyW8Rm1u6hWUuc@lsvm11u0000395.swis.ap-northeast-2.aws.nxp.com
Thanks for your patch.
Reviewed-by: Fabio Estevam <festevam@gmail.com>
It would be nice if Thomas could confirm that this fixes the issue he reported.
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] imx93_frdm: clear and mask TCPC interrupts
2026-01-03 21:22 [PATCH] imx93_frdm: clear and mask TCPC interrupts Francesco Valla
2026-01-03 23:41 ` Fabio Estevam
@ 2026-01-06 14:40 ` Thomas Petazzoni
2026-01-07 1:39 ` Peng Fan
2026-01-18 1:45 ` Fabio Estevam
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2026-01-06 14:40 UTC (permalink / raw)
To: Francesco Valla
Cc: NXP i.MX U-Boot Team, u-boot, Fabio Estevam, Stefano Babic,
Tom Rini, Peng Fan, Mathieu Dubois-Briand, Joseph Guo,
Fabian Pflug
Hello Francesco,
On Sat, 03 Jan 2026 22:22:12 +0100
Francesco Valla <francesco@valla.it> wrote:
> One of the two on-board PTN5110 TCPC USB Power Delivery controller on
> the i.MX93 FRDM board shares its interrupt line whith the PCAL6524 power
> controller (GPIO3-27). Since the PTN5110 starts after POR with the
> interrupts enabled, this can lead to an interrupt storm on OS startup if
> only the driver for the PCAL6524 is loaded, because none is servicing
> (and clearing) the interrupt requests from the PTN5110.
>
> Maks and clear all interrupts as part uring board initialization; they
> can be re-enabled later by a proper OS driver if required.
>
> Co-developed-by: Joseph Guo <qijian.guo@nxp.com>
> Signed-off-by: Francesco Valla <francesco@valla.it>
Thanks a lot for this patch, I confirm it fixes the issue I was having
with the kernel experiencing spurious IRQs. I don't really have any
comments on the technical approach: it's never nice to poke into a
device registers directly from a board file and outside of the driver
for that specific device, but I don't know if there's a better approach
for this specific problem.
So in any case:
Tested-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Thanks again!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] imx93_frdm: clear and mask TCPC interrupts
2026-01-03 21:22 [PATCH] imx93_frdm: clear and mask TCPC interrupts Francesco Valla
2026-01-03 23:41 ` Fabio Estevam
2026-01-06 14:40 ` Thomas Petazzoni
@ 2026-01-07 1:39 ` Peng Fan
2026-01-18 1:45 ` Fabio Estevam
3 siblings, 0 replies; 5+ messages in thread
From: Peng Fan @ 2026-01-07 1:39 UTC (permalink / raw)
To: Francesco Valla
Cc: NXP i.MX U-Boot Team, u-boot, Fabio Estevam, Stefano Babic,
Tom Rini, Peng Fan, Mathieu Dubois-Briand, Joseph Guo,
Thomas Petazzoni, Fabian Pflug
On Sat, Jan 03, 2026 at 10:22:12PM +0100, Francesco Valla wrote:
>One of the two on-board PTN5110 TCPC USB Power Delivery controller on
>the i.MX93 FRDM board shares its interrupt line whith the PCAL6524 power
>controller (GPIO3-27). Since the PTN5110 starts after POR with the
>interrupts enabled, this can lead to an interrupt storm on OS startup if
>only the driver for the PCAL6524 is loaded, because none is servicing
>(and clearing) the interrupt requests from the PTN5110.
>
>Maks and clear all interrupts as part uring board initialization; they
>can be re-enabled later by a proper OS driver if required.
>
>Co-developed-by: Joseph Guo <qijian.guo@nxp.com>
>Signed-off-by: Francesco Valla <francesco@valla.it>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] imx93_frdm: clear and mask TCPC interrupts
2026-01-03 21:22 [PATCH] imx93_frdm: clear and mask TCPC interrupts Francesco Valla
` (2 preceding siblings ...)
2026-01-07 1:39 ` Peng Fan
@ 2026-01-18 1:45 ` Fabio Estevam
3 siblings, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2026-01-18 1:45 UTC (permalink / raw)
To: Francesco Valla
Cc: NXP i.MX U-Boot Team, u-boot, Stefano Babic, Tom Rini, Peng Fan,
Mathieu Dubois-Briand, Joseph Guo, Thomas Petazzoni, Fabian Pflug
On Sat, Jan 3, 2026 at 6:22 PM Francesco Valla <francesco@valla.it> wrote:
>
> One of the two on-board PTN5110 TCPC USB Power Delivery controller on
> the i.MX93 FRDM board shares its interrupt line whith the PCAL6524 power
> controller (GPIO3-27). Since the PTN5110 starts after POR with the
> interrupts enabled, this can lead to an interrupt storm on OS startup if
> only the driver for the PCAL6524 is loaded, because none is servicing
> (and clearing) the interrupt requests from the PTN5110.
>
> Maks and clear all interrupts as part uring board initialization; they
> can be re-enabled later by a proper OS driver if required.
>
> Co-developed-by: Joseph Guo <qijian.guo@nxp.com>
> Signed-off-by: Francesco Valla <francesco@valla.it>
Applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-18 1:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-03 21:22 [PATCH] imx93_frdm: clear and mask TCPC interrupts Francesco Valla
2026-01-03 23:41 ` Fabio Estevam
2026-01-06 14:40 ` Thomas Petazzoni
2026-01-07 1:39 ` Peng Fan
2026-01-18 1:45 ` Fabio Estevam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox