Skip to contentSkip to conversation

m68k: move CONFIG_SYS_I2C to CFG_ namespace

PATCH In review Angelo Dureghello 2 participants 15 messages Apr 4, 2023 – Apr 11, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 m68k: move CONFIG_SYS_I2C to CFG_ namespace

Move CONFIG_SYS_I2C_X to CFG_ namespace.
This is a preliminary step to move to dm i2c.

---
 arch/m68k/cpu/mcf5445x/cpu_init.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/m68k/cpu/mcf5445x/cpu_init.c +3 -3
index 1ce244872f..bc3a2f3aed 100644
@@ -159,14 +159,14 @@ void cpu_init_f(void)
 	/* NAND */
 	out_8(&pm->pmcr0, 63);
 
-#ifdef CONFIG_SYS_I2C_0
+#ifdef CFG_SYS_I2C_0
 	out_8(&gpio->par_cani2c, 0xF0);
 	/* I2C0 pull up */
 	out_be16(&gpio->pcr_b, 0x003C);
 	/* I2C0 max speed */
 	out_8(&gpio->srcr_cani2c, 0x03);
 #endif
-#ifdef CONFIG_SYS_I2C_2
+#ifdef CFG_SYS_I2C_2
 	/* I2C2 */
 	out_8(&gpio->par_ssi0h, 0xA0);
 	/* I2C2, UART7 */
@@ -184,7 +184,7 @@ void cpu_init_f(void)
 	/* I2C2 pull up */
 	out_be16(&gpio->pcr_h, 0xF000);
 #endif
-#ifdef CONFIG_SYS_I2C_5
+#ifdef CFG_SYS_I2C_5
 	/* I2C5 */
 	out_8(&gpio->par_uart1, 0x0A);
 	/* I2C5 pull up */
Signature · 1 line
2.40.0
#1 lore raw

PATCH 2/6 board: stmark2: add i2c0 pinmux pad configuration

Add CFG option to enable proper pinmux pad setting for i2c0.

---
 include/configs/stmark2.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/stmark2.h +2 -0
index ffc47c8076..af5da096b7 100644
@@ -96,4 +96,6 @@
 					CFG_SYS_INIT_RAM_SIZE - 12)
 
 
+#define CFG_SYS_I2C_0
+
 #endif /* __STMARK2_CONFIG_H */
Signature · 1 line
2.40.0
#5 lore raw

PATCH 4/6 i2c: fsl_i2c: fix m68k transferts

In reply to Angelo Dureghello

This driver is actually used for powerpc and m68k/ColdFire.

On ColdFire SoC's, interrupt flag get not set if IIEN flag (mbcr bit6, interrupt enabled) is not set appropriately before each transfert. As a result, the transfert hangs forever waiting for IIEN. This patch set IIEN before each transfert, while considering this fix as not harming powerpc arch.

---
 arch/m68k/include/asm/fsl_i2c.h | 10 ++++++++++
 drivers/i2c/fsl_i2c.c           | 16 +++++++++-------
 2 files changed, 19 insertions(+), 7 deletions(-)
arch/m68k/include/asm/fsl_i2c.h +10 -0
index 9c54fdea77..dc6b37a575 100644
@@ -57,4 +57,14 @@ typedef struct fsl_i2c_base {
 #define I2C_DR_RES	~(I2C_DR)
 } fsl_i2c_t;
 
+#if CONFIG_IS_ENABLED(DM_I2C)
+struct fsl_i2c_dev {
+	struct fsl_i2c_base __iomem *base;      /* register base */
+	u32 i2c_clk;
+	u32 index;
+	u8 slaveadd;
+	uint speed;
+};
+#endif
+
 #endif	/* _ASM_I2C_H_ */
drivers/i2c/fsl_i2c.c +9 -7
index d312f35f04..d9d8ee81d2 100644
@@ -278,7 +278,8 @@ static void __i2c_init(const struct fsl_i2c_base *base, int speed, int
 	set_i2c_bus_speed(base, i2c_clk, speed);
 	writeb(slaveadd << 1, &base->adr);/* write slave address */
 	writeb(0x0, &base->sr);		/* clear status register */
-	writeb(I2C_CR_MEN, &base->cr);	/* start I2C controller */
+	/* start I2C controller */
+	writeb(I2C_CR_MEN | I2C_CR_MIEN, &base->cr);
 
 	timeval = get_ticks();
 	while (readb(&base->sr) & I2C_SR_MBB) {
@@ -346,7 +347,7 @@ static int i2c_wait(const struct fsl_i2c_base *base, int write)
 static int i2c_write_addr(const struct fsl_i2c_base *base, u8 dev,
 			  u8 dir, int rsta)
 {
-	writeb(I2C_CR_MEN | I2C_CR_MSTA | I2C_CR_MTX
+	writeb(I2C_CR_MEN | I2C_CR_MIEN | I2C_CR_MSTA | I2C_CR_MTX
 	       | (rsta ? I2C_CR_RSTA : 0),
 	       &base->cr);
 
@@ -378,7 +379,8 @@ static int __i2c_read_data(const struct fsl_i2c_base *base, u8 *data,
 {
 	int i;
 
-	writeb(I2C_CR_MEN | I2C_CR_MSTA | ((length == 1) ? I2C_CR_TXAK : 0),
+	writeb(I2C_CR_MEN | I2C_CR_MIEN |
+	       I2C_CR_MSTA | ((length == 1) ? I2C_CR_TXAK : 0),
 	       &base->cr);
 
 	/* dummy read */
@@ -390,13 +392,13 @@ static int __i2c_read_data(const struct fsl_i2c_base *base, u8 *data,
 
 		/* Generate ack on last next to last byte */
 		if (i == length - 2)
-			writeb(I2C_CR_MEN | I2C_CR_MSTA | I2C_CR_TXAK,
-			       &base->cr);
+			writeb(I2C_CR_MEN | I2C_CR_MIEN | I2C_CR_MSTA |
+			       I2C_CR_TXAK, &base->cr);
 
 		/* Do not generate stop on last byte */
 		if (i == length - 1)
-			writeb(I2C_CR_MEN | I2C_CR_MSTA | I2C_CR_MTX,
-			       &base->cr);
+			writeb(I2C_CR_MEN | I2C_CR_MIEN | I2C_CR_MSTA |
+			       I2C_CR_MTX, &base->cr);
 
 		data[i] = readb(&base->dr);
 	}
Signature · 1 line
2.40.0
#3 lore raw

PATCH 3/6 m68k: mcf5441x: fix CONFIG_SYS_FSL_I2C definition

In reply to Angelo Dureghello

Fix CONFIG_SYS_FSL_I2C to correct name CONFIG_SYS_I2C_FSL.

---
 arch/m68k/cpu/mcf5445x/speed.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/m68k/cpu/mcf5445x/speed.c +2 -3
index eb73da68c6..5c78eb9834 100644
@@ -129,9 +129,8 @@ int get_clocks(void)
 	setup_5441x_clocks();
 #endif
 
-#ifdef CONFIG_SYS_FSL_I2C
-	gd->arch.i2c1_clk = gd->bus_clk;
-#endif
+	if (IS_ENABLED(CONFIG_SYS_I2C_FSL))
+		gd->arch.i2c1_clk = gd->bus_clk;
 
 	return (0);
 }
Signature · 1 line
2.40.0
#7 lore raw

PATCH 5/6 m68k: dts: add i2c nodes

In reply to Angelo Dureghello

Add all the i2c nodes for each family, and add specific i2c overwrites in the related board-specific dts.

---
 arch/m68k/dts/M5208EVBE.dts           |  6 +++
 arch/m68k/dts/M5253DEMO.dts           |  5 +++
 arch/m68k/dts/M5275EVB.dts            |  6 +++
 arch/m68k/dts/M53017EVB.dts           |  6 +++
 arch/m68k/dts/M5329AFEE.dts           |  6 +++
 arch/m68k/dts/M5329BFEE.dts           |  6 +++
 arch/m68k/dts/M5373EVB.dts            |  4 ++
 arch/m68k/dts/astro_mcf5373l.dts      |  6 +++
 arch/m68k/dts/eb_cpu5282.dts          |  9 ++++
 arch/m68k/dts/eb_cpu5282_internal.dts |  9 ++++
 arch/m68k/dts/mcf5208.dtsi            | 10 +++++
 arch/m68k/dts/mcf523x.dtsi            | 10 +++++
 arch/m68k/dts/mcf5249.dtsi            | 28 +++++++++++++
 arch/m68k/dts/mcf5253.dtsi            | 28 +++++++++++++
 arch/m68k/dts/mcf5271.dtsi            | 10 +++++
 arch/m68k/dts/mcf5275.dtsi            | 10 +++++
 arch/m68k/dts/mcf5282.dtsi            | 10 +++++
 arch/m68k/dts/mcf5301x.dtsi           | 10 +++++
 arch/m68k/dts/mcf5307.dtsi            | 10 +++++
 arch/m68k/dts/mcf5329.dtsi            | 10 +++++
 arch/m68k/dts/mcf537x.dtsi            | 10 +++++
 arch/m68k/dts/mcf5441x.dtsi           | 60 +++++++++++++++++++++++++++
 arch/m68k/dts/stmark2.dts             |  4 ++
 23 files changed, 273 insertions(+)
arch/m68k/dts/M5208EVBE.dts +6 -0
index 78973fca57..1c32718af4 100644
@@ -23,3 +23,9 @@
 &fec0 {
 	status = "okay";
 };
+
+&i2c0 {
+	clock-frequency = <80000>;
+	u-boot,i2c-slave-addr = <0x7f>;
+	status = "okay";
+};
arch/m68k/dts/M5253DEMO.dts +5 -0
index 515484ae93..a3f070661e 100644
@@ -20,3 +20,8 @@
 	status = "okay";
 };
 
+&i2c0 {
+	clock-frequency = <80000>;
+	u-boot,i2c-slave-addr = <0x7f>;
+	status = "okay";
+};
arch/m68k/dts/M5275EVB.dts +6 -0
index 4737f927db..d79f8a7885 100644
@@ -27,3 +27,9 @@
 &fec1 {
 	status = "okay";
 };
+
+&i2c0 {
+	clock-frequency = <80000>;
+	u-boot,i2c-slave-addr = <0x7f>;
+	status = "okay";
+};
arch/m68k/dts/M53017EVB.dts +6 -0
index 31c50b65c2..90851dd0af 100644
@@ -27,3 +27,9 @@
 &fec1 {
 	status = "okay";
 };
+
+&i2c0 {
+	clock-frequency = <80000>;
+	u-boot,i2c-slave-addr = <0x7f>;
+	status = "okay";
+};
arch/m68k/dts/M5329AFEE.dts +6 -0
index de4af4743d..c1cd2845a3 100644
@@ -23,3 +23,9 @@
 &fec0 {
 	status = "okay";
 };
+
+&i2c0 {
+	clock-frequency = <80000>;
+	u-boot,i2c-slave-addr = <0x7f>;
+	status = "okay";
+};
arch/m68k/dts/M5329BFEE.dts +6 -0
index 2b2aae2cf9..51ec4b5d1a 100644
@@ -23,3 +23,9 @@
 &fec0 {
 	status = "okay";
 };
+
+&i2c0 {
+	clock-frequency = <80000>;
+	u-boot,i2c-slave-addr = <0x7f>;
+	status = "okay";
+};
arch/m68k/dts/M5373EVB.dts +4 -0
index 7df8206d63..27ce800cae 100644
@@ -23,3 +23,7 @@
 &fec0 {
 	status = "okay";
 };
+
+&i2c0 {
+	status = "okay";
+};
arch/m68k/dts/astro_mcf5373l.dts +6 -0
index d3caf12db1..baa2f1466d 100644
@@ -20,3 +20,9 @@
 	status = "okay";
 };
 
+&i2c0 {
+	clock-frequency = <80000>;
+	u-boot,i2c-slave-addr = <0x7f>;
+	status = "okay";
+};
+
arch/m68k/dts/eb_cpu5282.dts +9 -0
index 925f9af3a8..27f33b9f90 100644
@@ -23,3 +23,12 @@
 &fec0 {
 	status = "okay";
 };
+
+&i2c0 {
+	status = "okay";
+
+	rtc@68 {
+		compatible = "dallas,ds1338";
+		reg = <0x68>;
+	};
+};
arch/m68k/dts/eb_cpu5282_internal.dts +9 -0
index ae6a8157cf..53a94ea7f7 100644
@@ -23,3 +23,12 @@
 &fec0 {
 	status = "okay";
 };
+
+&i2c0 {
+	status = "okay";
+
+	rtc@68 {
+		compatible = "dallas,ds1338";
+		reg = <0x68>;
+	};
+};
arch/m68k/dts/mcf5208.dtsi +10 -0
index 4802dd3074..9392facfa8 100644
@@ -42,5 +42,15 @@
 			timeout-loop = <50000>;
 			status = "disabled";
 		};
+
+		i2c0: i2c@fc058000 {
+			compatible = "fsl-i2c";
+			#address-cells=<1>;
+			#size-cells=<0>;
+			cell-index = <0>;
+			reg = <0xfc058000 0x14>;
+			clock-frequency = <100000>;
+			status = "disabled";
+		};
 	};
 };
arch/m68k/dts/mcf523x.dtsi +10 -0
index 550e824cb1..41c7b9b2d1 100644
@@ -51,6 +51,16 @@
 				timeout-loop = <50000>;
 				status = "disabled";
 			};
+
+			i2c0: i2c@300 {
+				compatible = "fsl-i2c";
+				#address-cells=<1>;
+				#size-cells=<0>;
+				cell-index = <0>;
+				reg = <0x300 0x14>;
+				clock-frequency = <100000>;
+				status = "disabled";
+			};
 		};
 	};
 };
arch/m68k/dts/mcf5249.dtsi +28 -0
index 248b3dc68b..d45d5532ca 100644
@@ -33,6 +33,34 @@
 				reg = <0x200 0x40>;
 				status = "disabled";
 			};
+
+			i2c0: i2c@280 {
+				compatible = "fsl-i2c";
+				#address-cells=<1>;
+				#size-cells=<0>;
+				cell-index = <0>;
+				reg = <0x280 0x14>;
+				clock-frequency = <100000>;
+				status = "disabled";
+			};
+		};
+
+		mbar2: mbar2@80000000 {
+			compatible = "simple-bus";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0x00000000 0x80000000 0x10000>;
+			reg = <0x80000000 0x10000>;
+
+			i2c1: i2c@440 {
+				compatible = "fsl-i2c";
+				#address-cells=<1>;
+				#size-cells=<0>;
+				cell-index = <0>;
+				reg = <0x440 0x14>;
+				clock-frequency = <100000>;
+				status = "disabled";
+			};
 		};
 	};
 };
arch/m68k/dts/mcf5253.dtsi +28 -0
index 3bde2d6202..b9816f4754 100644
@@ -39,6 +39,34 @@
 				reg = <0xc00 0x40>;
 				status = "disabled";
 			};
+
+			i2c0: i2c@280 {
+				compatible = "fsl-i2c";
+				#address-cells=<1>;
+				#size-cells=<0>;
+				cell-index = <0>;
+				reg = <0x280 0x14>;
+				clock-frequency = <100000>;
+				status = "disabled";
+			};
+		};
+
+		mbar2: mbar2@80000000 {
+			compatible = "simple-bus";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0x00000000 0x80000000 0x10000>;
+			reg = <0x80000000 0x10000>;
+
+			i2c1: i2c@440 {
+				compatible = "fsl-i2c";
+				#address-cells=<1>;
+				#size-cells=<0>;
+				cell-index = <0>;
+				reg = <0x440 0x14>;
+				clock-frequency = <100000>;
+				status = "disabled";
+			};
 		};
 	};
 };
arch/m68k/dts/mcf5271.dtsi +10 -0
index b3484c2c84..fc82bd3c24 100644
@@ -49,6 +49,16 @@
 				timeout-loop = <50000>;
 				status = "disabled";
 			};
+
+			i2c0: i2c@300 {
+				compatible = "fsl-i2c";
+				#address-cells=<1>;
+				#size-cells=<0>;
+				cell-index = <0>;
+				reg = <0x300 0x14>;
+				clock-frequency = <100000>;
+				status = "disabled";
+			};
 		};
 	};
 };
arch/m68k/dts/mcf5275.dtsi +10 -0
index 99dd7d3924..402517cdec 100644
@@ -59,6 +59,16 @@
 				timeout-loop = <50000>;
 				status = "disabled";
 			};
+
+			i2c0: i2c@300 {
+				compatible = "fsl-i2c";
+				#address-cells=<1>;
+				#size-cells=<0>;
+				cell-index = <0>;
+				reg = <0x300 0x14>;
+				clock-frequency = <100000>;
+				status = "disabled";
+			};
 		};
 	};
 };
arch/m68k/dts/mcf5282.dtsi +10 -0
index d9916b1cd9..883c0d0324 100644
@@ -49,6 +49,16 @@
 				timeout-loop = <50000>;
 				status = "disabled";
 			};
+
+			i2c0: i2c@300 {
+				compatible = "fsl-i2c";
+				#address-cells=<1>;
+				#size-cells=<0>;
+				cell-index = <0>;
+				reg = <0x300 0x14>;
+				clock-frequency = <100000>;
+				status = "disabled";
+			};
 		};
 	};
 };
arch/m68k/dts/mcf5301x.dtsi +10 -0
index f60898aa4a..a13afad093 100644
@@ -65,5 +65,15 @@
 			timeout-loop = <50000>;
 			status = "disabled";
 		};
+
+		i2c0: i2c@0xfc058000 {
+			compatible = "fsl-i2c";
+			#address-cells=<1>;
+			#size-cells=<0>;
+			cell-index = <0>;
+			reg = <0xfc058000 0x100>;
+			clock-frequency = <100000>;
+			status = "disabled";
+		};
 	};
 };
arch/m68k/dts/mcf5307.dtsi +10 -0
index e199cf9991..d6d386b22e 100644
@@ -34,6 +34,16 @@
 				reg = <0x200 0x40>;
 				status = "disabled";
 			};
+
+			i2c0: i2c@280 {
+				compatible = "fsl-i2c";
+				#address-cells=<1>;
+				#size-cells=<0>;
+				cell-index = <0>;
+				reg = <0x280 0x14>;
+				clock-frequency = <100000>;
+				status = "disabled";
+			};
 		};
 	};
 };
arch/m68k/dts/mcf5329.dtsi +10 -0
index de348968b5..7501cc4b01 100644
@@ -42,5 +42,15 @@
 			timeout-loop = <50000>;
 			status = "disabled";
 		};
+
+		i2c0: i2c@0xfc058000 {
+			compatible = "fsl-i2c";
+			#address-cells=<1>;
+			#size-cells=<0>;
+			cell-index = <0>;
+			reg = <0xfc058000 0x100>;
+			clock-frequency = <100000>;
+			status = "disabled";
+		};
 	};
 };
arch/m68k/dts/mcf537x.dtsi +10 -0
index 2a2a32a59b..338b8b4583 100644
@@ -42,5 +42,15 @@
 			timeout-loop = <50000>;
 			status = "disabled";
 		};
+
+		i2c0: i2c@0xfc058000 {
+			compatible = "fsl-i2c";
+			#address-cells=<1>;
+			#size-cells=<0>;
+			cell-index = <0>;
+			reg = <0xfc058000 0x100>;
+			clock-frequency = <100000>;
+			status = "disabled";
+		};
 	};
 };
arch/m68k/dts/mcf5441x.dtsi +60 -0

65 lines not on this page · raw message

arch/m68k/dts/stmark2.dts +4 -0
index ebe8580a0a..3ba68b77d6 100644
@@ -41,3 +41,7 @@
 	status = "okay";
 	mii-base = <0>;
 };
+
+&i2c0 {
+	status = "okay";
+};
Signature · 1 line
2.40.0
#9 lore raw

PATCH 6/6 m68k: upgrading all boards to dm i2c

In reply to Angelo Dureghello

Upgrading all board configs where i2c is involved to DM i2c.

---
 configs/M5208EVBE_defconfig           | 5 +----
 configs/M5235EVB_Flash32_defconfig    | 1 +
 configs/M5235EVB_defconfig            | 1 +
 configs/M5253DEMO_defconfig           | 5 +----
 configs/M5275EVB_defconfig            | 5 +----
 configs/M53017EVB_defconfig           | 6 ++----
 configs/M5329AFEE_defconfig           | 6 ++----
 configs/M5329BFEE_defconfig           | 6 ++----
 configs/M5373EVB_defconfig            | 3 ++-
 configs/astro_mcf5373l_defconfig      | 6 ++----
 configs/eb_cpu5282_defconfig          | 5 ++---
 configs/eb_cpu5282_internal_defconfig | 5 ++---
 configs/stmark2_defconfig             | 4 ++++
 13 files changed, 23 insertions(+), 35 deletions(-)
configs/M5208EVBE_defconfig +1 -4
index 3263414d1c..72c0560d11 100644
@@ -38,11 +38,8 @@ CONFIG_NETMASK="255.255.255.0"
 CONFIG_USE_SERVERIP=y
 CONFIG_SERVERIP="192.162.1.1"
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x58000
-CONFIG_SYS_I2C_SLAVE=0x7F
-CONFIG_SYS_I2C_SPEED=80000
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
configs/M5235EVB_Flash32_defconfig +1 -0
index 0b924563d2..f96a2f290b 100644
@@ -61,3 +61,4 @@ CONFIG_MCFFEC=y
 CONFIG_MII=y
 CONFIG_MCFUART=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=5000
+CONFIG_DM_I2C=y
configs/M5235EVB_defconfig +1 -0
index fbd3e086ec..64f8a133e1 100644
@@ -61,3 +61,4 @@ CONFIG_MCFFEC=y
 CONFIG_MII=y
 CONFIG_MCFUART=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=5000
+CONFIG_DM_I2C=y
configs/M5253DEMO_defconfig +1 -4
index e6ab998f29..99bf18f963 100644
@@ -37,11 +37,8 @@ CONFIG_SYS_ATA_ALT_OFFSET=0xC0
 CONFIG_SYS_ATA_IDE0_OFFSET=0
 CONFIG_ATAPI=y
 CONFIG_IDE_RESET=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x280
-CONFIG_SYS_I2C_SLAVE=0x7F
-CONFIG_SYS_I2C_SPEED=80000
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_SYS_MAX_FLASH_SECT=2048
 CONFIG_USE_SYS_MAX_FLASH_BANKS=y
configs/M5275EVB_defconfig +1 -4
index ca1c18420f..5ce9b74f06 100644
@@ -34,11 +34,8 @@ CONFIG_OVERWRITE_ETHADDR_ONCE=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_FAULT_ECHO_LINK_DOWN=y
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x300
-CONFIG_SYS_I2C_SLAVE=0x7F
-CONFIG_SYS_I2C_SPEED=80000
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_FLASH_SHOW_PROGRESS=0
configs/M53017EVB_defconfig +2 -4
index c70964f7aa..7c31a68c3b 100644
@@ -40,11 +40,8 @@ CONFIG_NETMASK="255.255.255.0"
 CONFIG_USE_SERVERIP=y
 CONFIG_SERVERIP="192.162.1.1"
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x58000
-CONFIG_SYS_I2C_SLAVE=0x7F
-CONFIG_SYS_I2C_SPEED=80000
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
@@ -57,6 +54,7 @@ CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_MCFFEC=y
 CONFIG_SYS_UNIFY_CACHE=y
 CONFIG_MII=y
+CONFIG_DM_RTC=y
 CONFIG_MCFRTC=y
 CONFIG_SYS_MCFRTC_BASE=0xFC0A8000
 CONFIG_MCFUART=y
configs/M5329AFEE_defconfig +2 -4
index 455eea255a..a5ee08207a 100644
@@ -39,11 +39,8 @@ CONFIG_NETMASK="255.255.255.0"
 CONFIG_USE_SERVERIP=y
 CONFIG_SERVERIP="192.162.1.1"
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x58000
-CONFIG_SYS_I2C_SLAVE=0x7F
-CONFIG_SYS_I2C_SPEED=80000
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
@@ -55,6 +52,7 @@ CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_MCFFEC=y
 CONFIG_SYS_UNIFY_CACHE=y
 CONFIG_MII=y
+CONFIG_DM_RTC=y
 CONFIG_MCFRTC=y
 CONFIG_SYS_MCFRTC_BASE=0xFC0A8000
 CONFIG_MCFUART=y
configs/M5329BFEE_defconfig +2 -4
index 0251444b3b..c5abed9dfd 100644
@@ -40,11 +40,8 @@ CONFIG_NETMASK="255.255.255.0"
 CONFIG_USE_SERVERIP=y
 CONFIG_SERVERIP="192.162.1.1"
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x58000
-CONFIG_SYS_I2C_SLAVE=0x7F
-CONFIG_SYS_I2C_SPEED=80000
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
@@ -57,6 +54,7 @@ CONFIG_MTD_RAW_NAND=y
 CONFIG_MCFFEC=y
 CONFIG_SYS_UNIFY_CACHE=y
 CONFIG_MII=y
+CONFIG_DM_RTC=y
 CONFIG_MCFRTC=y
 CONFIG_SYS_MCFRTC_BASE=0xFC0A8000
 CONFIG_MCFUART=y
configs/M5373EVB_defconfig +2 -1
index eec95da857..cbc91a58a8 100644
@@ -40,7 +40,8 @@ CONFIG_NETMASK="255.255.255.0"
 CONFIG_USE_SERVERIP=y
 CONFIG_SERVERIP="192.162.1.1"
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
+CONFIG_DM_RTC=y
 CONFIG_SYS_I2C_FSL=y
 CONFIG_SYS_FSL_I2C_OFFSET=0x58000
 CONFIG_SYS_I2C_SLAVE=0x7F
configs/astro_mcf5373l_defconfig +2 -4
index 827ebfe742..f12859b75c 100644
@@ -34,11 +34,8 @@ CONFIG_FPGA_CYCLON2=y
 CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_SPARTAN3=y
 CONFIG_SYS_FPGA_PROG_FEEDBACK=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x58000
-CONFIG_SYS_I2C_SLAVE=0x7F
-CONFIG_SYS_I2C_SPEED=80000
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_FLASH_SHOW_PROGRESS=0
@@ -46,6 +43,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_SYS_MAX_FLASH_SECT=259
+CONFIG_DM_RTC=y
 CONFIG_MCFRTC=y
 CONFIG_SYS_MCFRTC_BASE=0xFC0A8000
 CONFIG_MCFUART=y
configs/eb_cpu5282_defconfig +2 -3
index 6f0882fccf..f86635d30d 100644
@@ -34,10 +34,9 @@ CONFIG_CMD_DATE=y
 CONFIG_OVERWRITE_ETHADDR_ONCE=y
 CONFIG_SYS_FAULT_ECHO_LINK_DOWN=y
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x300
-CONFIG_SYS_I2C_SLAVE=0
+CONFIG_DM_I2C=y
+CONFIG_DM_RTC=y
 CONFIG_LED_STATUS=y
 CONFIG_LED_STATUS0=y
 CONFIG_LED_STATUS_BIT=8
configs/eb_cpu5282_internal_defconfig +2 -3
index 5f4ec93401..1982fea66d 100644
@@ -32,10 +32,8 @@ CONFIG_CMD_DATE=y
 CONFIG_OVERWRITE_ETHADDR_ONCE=y
 CONFIG_SYS_FAULT_ECHO_LINK_DOWN=y
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x300
-CONFIG_SYS_I2C_SLAVE=0
 CONFIG_LED_STATUS=y
 CONFIG_LED_STATUS0=y
 CONFIG_LED_STATUS_BIT=8
@@ -50,5 +48,6 @@ CONFIG_SYS_FLASH_CFI=y
 CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_MCFFEC=y
 CONFIG_MII=y
+CONFIG_DM_RTC=y
 CONFIG_RTC_DS1338=y
 CONFIG_MCFUART=y
configs/stmark2_defconfig +4 -0
index ee757099ff..b8d354f4b5 100644
@@ -49,3 +49,7 @@ CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CF_SPI=y
 CONFIG_REGEX=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_DM_I2C=y
+CONFIG_CMD_I2C=y
+CONFIG_SYS_I2C_FSL=y
Signature · 1 line
2.40.0
#10 lore raw

Re: [PATCH 6/6] m68k: upgrading all boards to dm i2c

Hello Angelo,

Quoted 18 lines · Angelo Dureghello

Upgrading all board configs where i2c is involved to DM i2c.

---
 configs/M5208EVBE_defconfig           | 5 +----
 configs/M5235EVB_Flash32_defconfig    | 1 +
 configs/M5235EVB_defconfig            | 1 +
 configs/M5253DEMO_defconfig           | 5 +----
 configs/M5275EVB_defconfig            | 5 +----
 configs/M53017EVB_defconfig           | 6 ++----
 configs/M5329AFEE_defconfig           | 6 ++----
 configs/M5329BFEE_defconfig           | 6 ++----
 configs/M5373EVB_defconfig            | 3 ++-
 configs/astro_mcf5373l_defconfig      | 6 ++----
 configs/eb_cpu5282_defconfig          | 5 ++---
 configs/eb_cpu5282_internal_defconfig | 5 ++---
 configs/stmark2_defconfig             | 4 ++++
 13 files changed, 23 insertions(+), 35 deletions(-)

Thanks for this series, I did not find a cover letter Email, so I have here a common question:

You rename in patch 1/6

CONFIG_SYS_I2C_0 -> CFG_SYS_I2C_0

but only add in patch 2/6 for the stmark2 this renamed define, and add DTS nodes for other boards in patch 5/6 and here the defconfig changes... may I oversee something obvious, but do the other boards not also need some CFG_SYS_I2C_0 define?

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#11 lore raw

Re: [PATCH 6/6] m68k: upgrading all boards to dm i2c

Hi Helko,

Quoted 25 lines · Heiko Schocher

Hello Angelo,

Quoted 18 lines · Angelo Dureghello

Upgrading all board configs where i2c is involved to DM i2c.

---
  configs/M5208EVBE_defconfig           | 5 +----
  configs/M5235EVB_Flash32_defconfig    | 1 +
  configs/M5235EVB_defconfig            | 1 +
  configs/M5253DEMO_defconfig           | 5 +----
  configs/M5275EVB_defconfig            | 5 +----
  configs/M53017EVB_defconfig           | 6 ++----
  configs/M5329AFEE_defconfig           | 6 ++----
  configs/M5329BFEE_defconfig           | 6 ++----
  configs/M5373EVB_defconfig            | 3 ++-
  configs/astro_mcf5373l_defconfig      | 6 ++----
  configs/eb_cpu5282_defconfig          | 5 ++---
  configs/eb_cpu5282_internal_defconfig | 5 ++---
  configs/stmark2_defconfig             | 4 ++++
  13 files changed, 23 insertions(+), 35 deletions(-)

Thanks for this series, I did not find a cover letter Email, so I have here a common question:

Quoted 9 lines

You rename in patch 1/6

CONFIG_SYS_I2C_0 -> CFG_SYS_I2C_0

but only add in patch 2/6 for the stmark2 this renamed define, and add DTS nodes for other boards in patch 5/6 and here the defconfig changes... may I oversee something obvious, but do the other boards not also need some CFG_SYS_I2C_0 define?

CFG_SYS_I2C_0 (0 to 5) it's a define to setup pads pinmux to i2c, but only for coldfire mcf5441x family that requires this.

m68k/cpu/mcf5445x/cpu_init.c:#ifdef CFG_SYS_I2C_0

Involved board is only stmark2, that is the board i am using here for test. I found this define to be set because i2c was not working, so i moved in the more proper CFG_ namespace.

I cannot test other boards actually, but i don't find any similar define/need in their start code, so i am supposing other cpu families are not needing it, or using other definitions for pinmux.

I would like one day to add pinmux setup from fdt, but not trivial, linux does not have fdt implementation for coldfire, so need to invent it from scratch.

Quoted 4 lines

Thanks!

bye,
Heiko

Thanks,
Regards,
angelo

#12 lore raw

Re: [PATCH 6/6] m68k: upgrading all boards to dm i2c

Hello Angelo,

Quoted 32 lines · Angelo Dureghello

Hi Helko,

Quoted 29 lines · Heiko Schocher

Hello Angelo,

Quoted 12 lines · Angelo Dureghello

Upgrading all board configs where i2c is involved to DM i2c.

---
  configs/M5208EVBE_defconfig           | 5 +----
  configs/M5235EVB_Flash32_defconfig    | 1 +
  configs/M5235EVB_defconfig            | 1 +
  configs/M5253DEMO_defconfig           | 5 +----
  configs/M5275EVB_defconfig            | 5 +----

  configs/M53017EVB_defconfig           | 6 ++----
  configs/M5329AFEE_defconfig           | 6 ++----
  configs/M5329BFEE_defconfig           | 6 ++----
Quoted 6 lines

  configs/M5373EVB_defconfig            | 3 ++- configs/astro_mcf5373l_defconfig      | 6 ++---- configs/eb_cpu5282_defconfig          | 5 ++--- configs/eb_cpu5282_internal_defconfig | 5 ++--- configs/stmark2_defconfig             | 4 ++++

  13 files changed, 23 insertions(+), 35 deletions(-)

Thanks for this series, I did not find a cover letter Email, so I have here a common question:

You rename in patch 1/6

CONFIG_SYS_I2C_0 -> CFG_SYS_I2C_0

Quoted 8 lines
Quoted 5 lines

but only add in patch 2/6 for the stmark2 this renamed define, and add DTS nodes for other boards in patch 5/6 and here the defconfig changes... may I oversee something obvious, but do the other boards not also need some CFG_SYS_I2C_0 define?

CFG_SYS_I2C_0 (0 to 5) it's a define to setup pads pinmux to i2c, but only for coldfire mcf5441x family that requires this.

Ah!

Quoted 6 lines

m68k/cpu/mcf5445x/cpu_init.c:#ifdef CFG_SYS_I2C_0

Involved board is only stmark2, that is the board i am using here for test. I found this define to be set because i2c was not working, so i moved in the more proper CFG_ namespace.

Fine.

Quoted 6 lines

I cannot test other boards actually, but i don't find any similar define/need in their start code, so i am supposing other cpu families are not needing it, or using other definitions for pinmux.

I would like one day to add pinmux setup from fdt,

Nice to hear!

Quoted 2 lines

but not trivial, linux does not have fdt implementation for coldfire, so need to invent it from scratch.

Yes, that would be preferred solution!

So, for me, your series is fine to me, Thanks!

bye,
Heiko

Quoted 11 lines
Quoted 6 lines

Thanks!

bye,
Heiko

Thanks,
Regards,
angelo

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#14 lore raw
In reply to Angelo Dureghello

Hello Angelo,

Quoted 7 lines · Angelo Dureghello

Move CONFIG_SYS_I2C_X to CFG_ namespace.
This is a preliminary step to move to dm i2c.

---
 arch/m68k/cpu/mcf5445x/cpu_init.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#2 lore raw

Re: [PATCH 2/6] board: stmark2: add i2c0 pinmux pad configuration

In reply to Angelo Dureghello

Hello Angelo,

Quoted 6 lines · Angelo Dureghello

Add CFG option to enable proper pinmux pad setting for i2c0.

---
 include/configs/stmark2.h | 2 ++
 1 file changed, 2 insertions(+)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#4 lore raw

Re: [PATCH 3/6] m68k: mcf5441x: fix CONFIG_SYS_FSL_I2C definition

In reply to Angelo Dureghello

Hello Angelo,

Quoted 6 lines · Angelo Dureghello

Fix CONFIG_SYS_FSL_I2C to correct name CONFIG_SYS_I2C_FSL.

---
 arch/m68k/cpu/mcf5445x/speed.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#6 lore raw

Re: [PATCH 4/6] i2c: fsl_i2c: fix m68k transferts

In reply to Angelo Dureghello

Hello Angelo,

Quoted 8 lines · Angelo Dureghello

This driver is actually used for powerpc and m68k/ColdFire.

On ColdFire SoC's, interrupt flag get not set if IIEN flag (mbcr bit6, interrupt enabled) is not set appropriately before each transfert. As a result, the transfert hangs forever waiting for IIEN. This patch set IIEN before each transfert, while considering this fix as not harming powerpc arch.

Quoted 5 lines
---
 arch/m68k/include/asm/fsl_i2c.h | 10 ++++++++++
 drivers/i2c/fsl_i2c.c           | 16 +++++++++-------
 2 files changed, 19 insertions(+), 7 deletions(-)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#8 lore raw

Re: [PATCH 5/6] m68k: dts: add i2c nodes

In reply to Angelo Dureghello

Hello Angelo,

Quoted 21 lines · Angelo Dureghello

Add all the i2c nodes for each family, and add specific i2c overwrites in the related board-specific dts.

---
 arch/m68k/dts/M5208EVBE.dts           |  6 +++
 arch/m68k/dts/M5253DEMO.dts           |  5 +++
 arch/m68k/dts/M5275EVB.dts            |  6 +++
 arch/m68k/dts/M53017EVB.dts           |  6 +++
 arch/m68k/dts/M5329AFEE.dts           |  6 +++
 arch/m68k/dts/M5329BFEE.dts           |  6 +++
 arch/m68k/dts/M5373EVB.dts            |  4 ++
 arch/m68k/dts/astro_mcf5373l.dts      |  6 +++
 arch/m68k/dts/eb_cpu5282.dts          |  9 ++++
 arch/m68k/dts/eb_cpu5282_internal.dts |  9 ++++
 arch/m68k/dts/mcf5208.dtsi            | 10 +++++
 arch/m68k/dts/mcf523x.dtsi            | 10 +++++
 arch/m68k/dts/mcf5249.dtsi            | 28 +++++++++++++
 arch/m68k/dts/mcf5253.dtsi            | 28 +++++++++++++
 arch/m68k/dts/mcf5271.dtsi            | 10 +++++
 arch/m68k/dts/mcf5275.dtsi            | 10 +++++
Quoted 8 lines
 arch/m68k/dts/mcf5282.dtsi            | 10 +++++
 arch/m68k/dts/mcf5301x.dtsi           | 10 +++++
 arch/m68k/dts/mcf5307.dtsi            | 10 +++++
 arch/m68k/dts/mcf5329.dtsi            | 10 +++++
 arch/m68k/dts/mcf537x.dtsi            | 10 +++++
 arch/m68k/dts/mcf5441x.dtsi           | 60 +++++++++++++++++++++++++++
 arch/m68k/dts/stmark2.dts             |  4 ++
 23 files changed, 273 insertions(+)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#13 lore raw

Re: [PATCH 6/6] m68k: upgrading all boards to dm i2c

In reply to Angelo Dureghello

Hello Angelo,

Quoted 18 lines · Angelo Dureghello

Upgrading all board configs where i2c is involved to DM i2c.

---
 configs/M5208EVBE_defconfig           | 5 +----
 configs/M5235EVB_Flash32_defconfig    | 1 +
 configs/M5235EVB_defconfig            | 1 +
 configs/M5253DEMO_defconfig           | 5 +----
 configs/M5275EVB_defconfig            | 5 +----
 configs/M53017EVB_defconfig           | 6 ++----
 configs/M5329AFEE_defconfig           | 6 ++----
 configs/M5329BFEE_defconfig           | 6 ++----
 configs/M5373EVB_defconfig            | 3 ++-
 configs/astro_mcf5373l_defconfig      | 6 ++----
 configs/eb_cpu5282_defconfig          | 5 ++---
 configs/eb_cpu5282_internal_defconfig | 5 ++---
 configs/stmark2_defconfig             | 4 ++++
 13 files changed, 23 insertions(+), 35 deletions(-)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]