[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.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org --- arch/m68k/cpu/mcf5445x/cpu_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/m68k/cpu/mcf5445x/cpu_init.c b/arch/m68k/cpu/mcf5445x/cpu_init.c index 1ce244872f..bc3a2f3aed 100644 --- a/arch/m68k/cpu/mcf5445x/cpu_init.c +++ b/arch/m68k/cpu/mcf5445x/cpu_init.c @@ -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 */

Add CFG option to enable proper pinmux pad setting for i2c0.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org --- include/configs/stmark2.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/configs/stmark2.h b/include/configs/stmark2.h index ffc47c8076..af5da096b7 100644 --- a/include/configs/stmark2.h +++ b/include/configs/stmark2.h @@ -96,4 +96,6 @@ CFG_SYS_INIT_RAM_SIZE - 12)
+#define CFG_SYS_I2C_0 + #endif /* __STMARK2_CONFIG_H */

Hello Angelo,
On 05.04.23 00:59, Angelo Dureghello wrote:
Add CFG option to enable proper pinmux pad setting for i2c0.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org
include/configs/stmark2.h | 2 ++ 1 file changed, 2 insertions(+)
Applied to u-boot-i2c.git master
Thanks!
bye, Heiko

Fix CONFIG_SYS_FSL_I2C to correct name CONFIG_SYS_I2C_FSL.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org --- arch/m68k/cpu/mcf5445x/speed.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/m68k/cpu/mcf5445x/speed.c b/arch/m68k/cpu/mcf5445x/speed.c index eb73da68c6..5c78eb9834 100644 --- a/arch/m68k/cpu/mcf5445x/speed.c +++ b/arch/m68k/cpu/mcf5445x/speed.c @@ -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); }

Hello Angelo,
On 05.04.23 00:59, Angelo Dureghello wrote:
Fix CONFIG_SYS_FSL_I2C to correct name CONFIG_SYS_I2C_FSL.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org
arch/m68k/cpu/mcf5445x/speed.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Applied to u-boot-i2c.git master
Thanks!
bye, Heiko

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.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org --- arch/m68k/include/asm/fsl_i2c.h | 10 ++++++++++ drivers/i2c/fsl_i2c.c | 16 +++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/arch/m68k/include/asm/fsl_i2c.h b/arch/m68k/include/asm/fsl_i2c.h index 9c54fdea77..dc6b37a575 100644 --- a/arch/m68k/include/asm/fsl_i2c.h +++ b/arch/m68k/include/asm/fsl_i2c.h @@ -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_ */ diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c index d312f35f04..d9d8ee81d2 100644 --- a/drivers/i2c/fsl_i2c.c +++ b/drivers/i2c/fsl_i2c.c @@ -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); }

Hello Angelo,
On 05.04.23 00:59, Angelo Dureghello wrote:
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.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org
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

Add all the i2c nodes for each family, and add specific i2c overwrites in the related board-specific dts.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org --- 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(+)
diff --git a/arch/m68k/dts/M5208EVBE.dts b/arch/m68k/dts/M5208EVBE.dts index 78973fca57..1c32718af4 100644 --- a/arch/m68k/dts/M5208EVBE.dts +++ b/arch/m68k/dts/M5208EVBE.dts @@ -23,3 +23,9 @@ &fec0 { status = "okay"; }; + +&i2c0 { + clock-frequency = <80000>; + u-boot,i2c-slave-addr = <0x7f>; + status = "okay"; +}; diff --git a/arch/m68k/dts/M5253DEMO.dts b/arch/m68k/dts/M5253DEMO.dts index 515484ae93..a3f070661e 100644 --- a/arch/m68k/dts/M5253DEMO.dts +++ b/arch/m68k/dts/M5253DEMO.dts @@ -20,3 +20,8 @@ status = "okay"; };
+&i2c0 { + clock-frequency = <80000>; + u-boot,i2c-slave-addr = <0x7f>; + status = "okay"; +}; diff --git a/arch/m68k/dts/M5275EVB.dts b/arch/m68k/dts/M5275EVB.dts index 4737f927db..d79f8a7885 100644 --- a/arch/m68k/dts/M5275EVB.dts +++ b/arch/m68k/dts/M5275EVB.dts @@ -27,3 +27,9 @@ &fec1 { status = "okay"; }; + +&i2c0 { + clock-frequency = <80000>; + u-boot,i2c-slave-addr = <0x7f>; + status = "okay"; +}; diff --git a/arch/m68k/dts/M53017EVB.dts b/arch/m68k/dts/M53017EVB.dts index 31c50b65c2..90851dd0af 100644 --- a/arch/m68k/dts/M53017EVB.dts +++ b/arch/m68k/dts/M53017EVB.dts @@ -27,3 +27,9 @@ &fec1 { status = "okay"; }; + +&i2c0 { + clock-frequency = <80000>; + u-boot,i2c-slave-addr = <0x7f>; + status = "okay"; +}; diff --git a/arch/m68k/dts/M5329AFEE.dts b/arch/m68k/dts/M5329AFEE.dts index de4af4743d..c1cd2845a3 100644 --- a/arch/m68k/dts/M5329AFEE.dts +++ b/arch/m68k/dts/M5329AFEE.dts @@ -23,3 +23,9 @@ &fec0 { status = "okay"; }; + +&i2c0 { + clock-frequency = <80000>; + u-boot,i2c-slave-addr = <0x7f>; + status = "okay"; +}; diff --git a/arch/m68k/dts/M5329BFEE.dts b/arch/m68k/dts/M5329BFEE.dts index 2b2aae2cf9..51ec4b5d1a 100644 --- a/arch/m68k/dts/M5329BFEE.dts +++ b/arch/m68k/dts/M5329BFEE.dts @@ -23,3 +23,9 @@ &fec0 { status = "okay"; }; + +&i2c0 { + clock-frequency = <80000>; + u-boot,i2c-slave-addr = <0x7f>; + status = "okay"; +}; diff --git a/arch/m68k/dts/M5373EVB.dts b/arch/m68k/dts/M5373EVB.dts index 7df8206d63..27ce800cae 100644 --- a/arch/m68k/dts/M5373EVB.dts +++ b/arch/m68k/dts/M5373EVB.dts @@ -23,3 +23,7 @@ &fec0 { status = "okay"; }; + +&i2c0 { + status = "okay"; +}; diff --git a/arch/m68k/dts/astro_mcf5373l.dts b/arch/m68k/dts/astro_mcf5373l.dts index d3caf12db1..baa2f1466d 100644 --- a/arch/m68k/dts/astro_mcf5373l.dts +++ b/arch/m68k/dts/astro_mcf5373l.dts @@ -20,3 +20,9 @@ status = "okay"; };
+&i2c0 { + clock-frequency = <80000>; + u-boot,i2c-slave-addr = <0x7f>; + status = "okay"; +}; + diff --git a/arch/m68k/dts/eb_cpu5282.dts b/arch/m68k/dts/eb_cpu5282.dts index 925f9af3a8..27f33b9f90 100644 --- a/arch/m68k/dts/eb_cpu5282.dts +++ b/arch/m68k/dts/eb_cpu5282.dts @@ -23,3 +23,12 @@ &fec0 { status = "okay"; }; + +&i2c0 { + status = "okay"; + + rtc@68 { + compatible = "dallas,ds1338"; + reg = <0x68>; + }; +}; diff --git a/arch/m68k/dts/eb_cpu5282_internal.dts b/arch/m68k/dts/eb_cpu5282_internal.dts index ae6a8157cf..53a94ea7f7 100644 --- a/arch/m68k/dts/eb_cpu5282_internal.dts +++ b/arch/m68k/dts/eb_cpu5282_internal.dts @@ -23,3 +23,12 @@ &fec0 { status = "okay"; }; + +&i2c0 { + status = "okay"; + + rtc@68 { + compatible = "dallas,ds1338"; + reg = <0x68>; + }; +}; diff --git a/arch/m68k/dts/mcf5208.dtsi b/arch/m68k/dts/mcf5208.dtsi index 4802dd3074..9392facfa8 100644 --- a/arch/m68k/dts/mcf5208.dtsi +++ b/arch/m68k/dts/mcf5208.dtsi @@ -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"; + }; }; }; diff --git a/arch/m68k/dts/mcf523x.dtsi b/arch/m68k/dts/mcf523x.dtsi index 550e824cb1..41c7b9b2d1 100644 --- a/arch/m68k/dts/mcf523x.dtsi +++ b/arch/m68k/dts/mcf523x.dtsi @@ -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"; + }; }; }; }; diff --git a/arch/m68k/dts/mcf5249.dtsi b/arch/m68k/dts/mcf5249.dtsi index 248b3dc68b..d45d5532ca 100644 --- a/arch/m68k/dts/mcf5249.dtsi +++ b/arch/m68k/dts/mcf5249.dtsi @@ -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"; + }; }; }; }; diff --git a/arch/m68k/dts/mcf5253.dtsi b/arch/m68k/dts/mcf5253.dtsi index 3bde2d6202..b9816f4754 100644 --- a/arch/m68k/dts/mcf5253.dtsi +++ b/arch/m68k/dts/mcf5253.dtsi @@ -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"; + }; }; }; }; diff --git a/arch/m68k/dts/mcf5271.dtsi b/arch/m68k/dts/mcf5271.dtsi index b3484c2c84..fc82bd3c24 100644 --- a/arch/m68k/dts/mcf5271.dtsi +++ b/arch/m68k/dts/mcf5271.dtsi @@ -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"; + }; }; }; }; diff --git a/arch/m68k/dts/mcf5275.dtsi b/arch/m68k/dts/mcf5275.dtsi index 99dd7d3924..402517cdec 100644 --- a/arch/m68k/dts/mcf5275.dtsi +++ b/arch/m68k/dts/mcf5275.dtsi @@ -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"; + }; }; }; }; diff --git a/arch/m68k/dts/mcf5282.dtsi b/arch/m68k/dts/mcf5282.dtsi index d9916b1cd9..883c0d0324 100644 --- a/arch/m68k/dts/mcf5282.dtsi +++ b/arch/m68k/dts/mcf5282.dtsi @@ -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"; + }; }; }; }; diff --git a/arch/m68k/dts/mcf5301x.dtsi b/arch/m68k/dts/mcf5301x.dtsi index f60898aa4a..a13afad093 100644 --- a/arch/m68k/dts/mcf5301x.dtsi +++ b/arch/m68k/dts/mcf5301x.dtsi @@ -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"; + }; }; }; diff --git a/arch/m68k/dts/mcf5307.dtsi b/arch/m68k/dts/mcf5307.dtsi index e199cf9991..d6d386b22e 100644 --- a/arch/m68k/dts/mcf5307.dtsi +++ b/arch/m68k/dts/mcf5307.dtsi @@ -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"; + }; }; }; }; diff --git a/arch/m68k/dts/mcf5329.dtsi b/arch/m68k/dts/mcf5329.dtsi index de348968b5..7501cc4b01 100644 --- a/arch/m68k/dts/mcf5329.dtsi +++ b/arch/m68k/dts/mcf5329.dtsi @@ -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"; + }; }; }; diff --git a/arch/m68k/dts/mcf537x.dtsi b/arch/m68k/dts/mcf537x.dtsi index 2a2a32a59b..338b8b4583 100644 --- a/arch/m68k/dts/mcf537x.dtsi +++ b/arch/m68k/dts/mcf537x.dtsi @@ -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"; + }; }; }; diff --git a/arch/m68k/dts/mcf5441x.dtsi b/arch/m68k/dts/mcf5441x.dtsi index 6769bdc270..dcca36312f 100644 --- a/arch/m68k/dts/mcf5441x.dtsi +++ b/arch/m68k/dts/mcf5441x.dtsi @@ -103,5 +103,65 @@ 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"; + }; + + i2c1: i2c@0xfc038000 { + compatible = "fsl-i2c"; + #address-cells=<1>; + #size-cells=<0>; + cell-index = <1>; + reg = <0xfc038000 0x100>; + clock-frequency = <100000>; + status = "disabled"; + }; + + i2c2: i2c@0xfc010000 { + compatible = "fsl-i2c"; + #address-cells=<1>; + #size-cells=<0>; + cell-index = <2>; + reg = <0xfc010000 0x100>; + clock-frequency = <100000>; + status = "disabled"; + }; + + i2c3: i2c@0xfc014000 { + compatible = "fsl-i2c"; + #address-cells=<1>; + #size-cells=<0>; + cell-index = <3>; + reg = <0xfc014000 0x100>; + clock-frequency = <100000>; + status = "disabled"; + }; + + i2c4: i2c@0xfc018000 { + compatible = "fsl-i2c"; + #address-cells=<1>; + #size-cells=<0>; + cell-index = <4>; + reg = <0xfc018000 0x100>; + clock-frequency = <100000>; + status = "disabled"; + }; + + i2c5: i2c@0xfc01c000 { + compatible = "fsl-i2c"; + #address-cells=<1>; + #size-cells=<0>; + cell-index = <5>; + reg = <0xfc01c000 0x100>; + clock-frequency = <100000>; + status = "disabled"; + }; }; }; diff --git a/arch/m68k/dts/stmark2.dts b/arch/m68k/dts/stmark2.dts index ebe8580a0a..3ba68b77d6 100644 --- a/arch/m68k/dts/stmark2.dts +++ b/arch/m68k/dts/stmark2.dts @@ -41,3 +41,7 @@ status = "okay"; mii-base = <0>; }; + +&i2c0 { + status = "okay"; +};

Hello Angelo,
On 05.04.23 00:59, Angelo Dureghello wrote:
Add all the i2c nodes for each family, and add specific i2c overwrites in the related board-specific dts.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org
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(+)
Applied to u-boot-i2c.git master
Thanks!
bye, Heiko

Upgrading all board configs where i2c is involved to DM i2c.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org --- 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(-)
diff --git a/configs/M5208EVBE_defconfig b/configs/M5208EVBE_defconfig index 3263414d1c..72c0560d11 100644 --- a/configs/M5208EVBE_defconfig +++ b/configs/M5208EVBE_defconfig @@ -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 diff --git a/configs/M5235EVB_Flash32_defconfig b/configs/M5235EVB_Flash32_defconfig index 0b924563d2..f96a2f290b 100644 --- a/configs/M5235EVB_Flash32_defconfig +++ b/configs/M5235EVB_Flash32_defconfig @@ -61,3 +61,4 @@ CONFIG_MCFFEC=y CONFIG_MII=y CONFIG_MCFUART=y CONFIG_WATCHDOG_TIMEOUT_MSECS=5000 +CONFIG_DM_I2C=y diff --git a/configs/M5235EVB_defconfig b/configs/M5235EVB_defconfig index fbd3e086ec..64f8a133e1 100644 --- a/configs/M5235EVB_defconfig +++ b/configs/M5235EVB_defconfig @@ -61,3 +61,4 @@ CONFIG_MCFFEC=y CONFIG_MII=y CONFIG_MCFUART=y CONFIG_WATCHDOG_TIMEOUT_MSECS=5000 +CONFIG_DM_I2C=y diff --git a/configs/M5253DEMO_defconfig b/configs/M5253DEMO_defconfig index e6ab998f29..99bf18f963 100644 --- a/configs/M5253DEMO_defconfig +++ b/configs/M5253DEMO_defconfig @@ -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 diff --git a/configs/M5275EVB_defconfig b/configs/M5275EVB_defconfig index ca1c18420f..5ce9b74f06 100644 --- a/configs/M5275EVB_defconfig +++ b/configs/M5275EVB_defconfig @@ -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 diff --git a/configs/M53017EVB_defconfig b/configs/M53017EVB_defconfig index c70964f7aa..7c31a68c3b 100644 --- a/configs/M53017EVB_defconfig +++ b/configs/M53017EVB_defconfig @@ -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 diff --git a/configs/M5329AFEE_defconfig b/configs/M5329AFEE_defconfig index 455eea255a..a5ee08207a 100644 --- a/configs/M5329AFEE_defconfig +++ b/configs/M5329AFEE_defconfig @@ -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 diff --git a/configs/M5329BFEE_defconfig b/configs/M5329BFEE_defconfig index 0251444b3b..c5abed9dfd 100644 --- a/configs/M5329BFEE_defconfig +++ b/configs/M5329BFEE_defconfig @@ -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 diff --git a/configs/M5373EVB_defconfig b/configs/M5373EVB_defconfig index eec95da857..cbc91a58a8 100644 --- a/configs/M5373EVB_defconfig +++ b/configs/M5373EVB_defconfig @@ -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 diff --git a/configs/astro_mcf5373l_defconfig b/configs/astro_mcf5373l_defconfig index 827ebfe742..f12859b75c 100644 --- a/configs/astro_mcf5373l_defconfig +++ b/configs/astro_mcf5373l_defconfig @@ -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 diff --git a/configs/eb_cpu5282_defconfig b/configs/eb_cpu5282_defconfig index 6f0882fccf..f86635d30d 100644 --- a/configs/eb_cpu5282_defconfig +++ b/configs/eb_cpu5282_defconfig @@ -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 diff --git a/configs/eb_cpu5282_internal_defconfig b/configs/eb_cpu5282_internal_defconfig index 5f4ec93401..1982fea66d 100644 --- a/configs/eb_cpu5282_internal_defconfig +++ b/configs/eb_cpu5282_internal_defconfig @@ -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 diff --git a/configs/stmark2_defconfig b/configs/stmark2_defconfig index ee757099ff..b8d354f4b5 100644 --- a/configs/stmark2_defconfig +++ b/configs/stmark2_defconfig @@ -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

Hello Angelo,
On 05.04.23 00:59, Angelo Dureghello wrote:
Upgrading all board configs where i2c is involved to DM i2c.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org
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

Hi Helko,
On 11/04/23 6:41 AM, Heiko Schocher wrote:
Hello Angelo,
On 05.04.23 00:59, Angelo Dureghello wrote:
Upgrading all board configs where i2c is involved to DM i2c.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org
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?
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.
Thanks!
bye, Heiko
Thanks, Regards, angelo

Hello Angelo,
On 11.04.23 09:40, Angelo Dureghello wrote:
Hi Helko,
On 11/04/23 6:41 AM, Heiko Schocher wrote:
Hello Angelo,
On 05.04.23 00:59, Angelo Dureghello wrote:
Upgrading all board configs where i2c is involved to DM i2c.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org
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?
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!
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.
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!
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
Thanks!
bye, Heiko
Thanks, Regards, angelo

Hello Angelo,
On 05.04.23 00:59, Angelo Dureghello wrote:
Upgrading all board configs where i2c is involved to DM i2c.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org
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

Hello Angelo,
On 05.04.23 00:59, Angelo Dureghello wrote:
Move CONFIG_SYS_I2C_X to CFG_ namespace. This is a preliminary step to move to dm i2c.
Signed-off-by: Angelo Dureghello angelo@kernel-space.org
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
participants (2)
-
Angelo Dureghello
-
Heiko Schocher