summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Valla <[email protected]>2026-01-03 22:22:12 +0100
committerFabio Estevam <[email protected]>2026-01-17 14:59:54 -0300
commit1f0106c38ae43b2e64dc2db44d2571494e305b9c (patch)
tree9e4b7e6e57d3d119f1e826a5525645cf37d9a8a4
parentff498a3c5efb424accc1d825cc45cede2540ca13 (diff)
imx93_frdm: clear and mask TCPC interrupts
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 <[email protected]> Signed-off-by: Francesco Valla <[email protected]> Reviewed-by: Fabio Estevam <[email protected]> Tested-by: Thomas Petazzoni <[email protected]> Reviewed-by: Peng Fan <[email protected]>
-rw-r--r--board/freescale/imx93_frdm/imx93_frdm.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/board/freescale/imx93_frdm/imx93_frdm.c b/board/freescale/imx93_frdm/imx93_frdm.c
index c436ac6aa47..cfbcde2e1a5 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;
}