From a0f0ca0df6e85362f4b4088da228730828631416 Mon Sep 17 00:00:00 2001
From: Guenter Roeck <linux@roeck-us.net>
Date: Thu, 3 Apr 2025 23:25:41 -0700
Subject: [PATCH 3/3] Instantiate pca9450 and pca9555 for imx8mp-evk

pca9555 is compatible to TI TCA6416.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 hw/arm/Kconfig      |  1 +
 hw/arm/imx8mp-evk.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index 3d40a51abe..28d354bd0f 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -612,6 +612,7 @@ config FSL_IMX8MP_EVK
     depends on TCG && AARCH64
     select FSL_IMX8MP
     select PCA9450
+    select PCA9555
 
 config ARM_SMMUV3
     bool
diff --git a/hw/arm/imx8mp-evk.c b/hw/arm/imx8mp-evk.c
index 9d6fedc651..1412333c8f 100644
--- a/hw/arm/imx8mp-evk.c
+++ b/hw/arm/imx8mp-evk.c
@@ -11,6 +11,7 @@
 #include "hw/arm/boot.h"
 #include "hw/arm/fsl-imx8mp.h"
 #include "hw/boards.h"
+#include "hw/i2c/i2c.h"
 #include "hw/qdev-properties.h"
 #include "system/device_tree.h"
 #include "system/qtest.h"
@@ -18,6 +19,17 @@
 #include "qapi/error.h"
 #include <libfdt.h>
 
+static void imx8mp_evk_i2c_init(FslImx8mpState *s)
+{
+    I2CBus *i2c;
+
+    i2c = imx_i2c_get_bus(&s->i2c[0]);
+    i2c_slave_create_simple(i2c, "pca9450c", 0x25);
+
+    i2c = imx_i2c_get_bus(&s->i2c[2]);
+    i2c_slave_create_simple(i2c, "pca9555", 0x20);
+}
+
 static void imx8mp_evk_modify_dtb(const struct arm_boot_info *info, void *fdt)
 {
     int i, offset;
@@ -72,6 +84,8 @@ static void imx8mp_evk_init(MachineState *machine)
     memory_region_add_subregion(get_system_memory(), FSL_IMX8MP_RAM_START,
                                 machine->ram);
 
+    imx8mp_evk_i2c_init(s);
+
     for (int i = 0; i < FSL_IMX8MP_NUM_USDHCS; i++) {
         BusState *bus;
         DeviceState *carddev;
-- 
2.45.2

