From 7041fc96942acca920699b354e956bc4966c9b00 Mon Sep 17 00:00:00 2001
From: Pawel Dembicki <paweldembicki@gmail.com>
Date: Wed, 19 Nov 2025 11:58:10 +0100
Subject: [PATCH] Revert "fsl: mxc: Drop legacy I2c"

This reverts commit 98dfa70f84f036c7423f1eddf00af8ea555fed8f.

It broke SDCARD boot in T4240RDB.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
---
 drivers/ddr/fsl/main.c | 3 ++-
 drivers/i2c/mxc_i2c.c  | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/ddr/fsl/main.c
+++ b/drivers/ddr/fsl/main.c
@@ -111,7 +111,7 @@ static int ddr_i2c_read(DEV_TYPE *dev, u
 #if CONFIG_IS_ENABLED(DM_I2C)
 	ret = dm_i2c_read(dev, 0, buf, len);
 #else
-	ret = 0;
+	ret = i2c_read(dev->chip, addr, alen, buf, len);
 #endif
 
 	return ret;
@@ -162,6 +162,7 @@ static void __get_spd(generic_spd_eeprom
 	};
 	dev = &ldev;
 
+	i2c_set_bus_num(CONFIG_SYS_SPD_BUS_NUM);
 #endif
 
 #ifdef CONFIG_SYS_FSL_DDR4
--- a/drivers/i2c/mxc_i2c.c
+++ b/drivers/i2c/mxc_i2c.c
@@ -619,7 +619,6 @@ int enable_i2c_clk(unsigned char enable,
 	__attribute__((weak, alias("__enable_i2c_clk")));
 
 #if !CONFIG_IS_ENABLED(DM_I2C)
-
 /*
  * Read data from I2C device
  *
