Skip to contentSkip to conversation

i2c: Instantiate I2C controllers when selected

PATCH New Michal Simek 2 participants 4 messages Oct 27, 2015 – Oct 28, 2015

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

PATCH 1/1 i2c: Instantiate I2C controllers when selected

Do not enable both I2C controllers by default. Enable them only when they are selected.

---

 drivers/i2c/zynq_i2c.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/i2c/zynq_i2c.c +4 -0
index b3264af4526e..380863bde148 100644
@@ -297,11 +297,15 @@ static unsigned int zynq_i2c_set_bus_speed(struct i2c_adapter *adap,
 	return 0;
 }
 
+#ifdef CONFIG_ZYNQ_I2C0
 U_BOOT_I2C_ADAP_COMPLETE(zynq_0, zynq_i2c_init, zynq_i2c_probe, zynq_i2c_read,
 			 zynq_i2c_write, zynq_i2c_set_bus_speed,
 			 CONFIG_SYS_I2C_ZYNQ_SPEED, CONFIG_SYS_I2C_ZYNQ_SLAVE,
 			 0)
+#endif
+#ifdef CONFIG_ZYNQ_I2C1
 U_BOOT_I2C_ADAP_COMPLETE(zynq_1, zynq_i2c_init, zynq_i2c_probe, zynq_i2c_read,
 			 zynq_i2c_write, zynq_i2c_set_bus_speed,
 			 CONFIG_SYS_I2C_ZYNQ_SPEED, CONFIG_SYS_I2C_ZYNQ_SLAVE,
 			 1)
+#endif
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/1 i2c: Instantiate I2C controllers when selected

Hello Michal,

Am 27.10.2015 um 16:02 schrieb Michal Simek:

Quoted 8 lines

Do not enable both I2C controllers by default. Enable them only when they are selected.

---

  drivers/i2c/zynq_i2c.c | 4 ++++
  1 file changed, 4 insertions(+)

Thanks!

I will accept this patch, but it is a fix for the old style I2C driver. I would prefer a patch, which converts this driver to DM ;-)

What do you mean with "enabled"? The old style i2c driver, does not initialize (call zynq_i2c_init()) the i2c driver, until it is used ... nevertheless, you save some bytes, which is always good.

bye,
Heiko

Quoted 22 lines
drivers/i2c/zynq_i2c.c +4 -0
index b3264af4526e..380863bde148 100644
@@ -297,11 +297,15 @@ static unsigned int zynq_i2c_set_bus_speed(struct i2c_adapter *adap,
  	return 0;
  }
 
+#ifdef CONFIG_ZYNQ_I2C0
  U_BOOT_I2C_ADAP_COMPLETE(zynq_0, zynq_i2c_init, zynq_i2c_probe, zynq_i2c_read,
  			 zynq_i2c_write, zynq_i2c_set_bus_speed,
  			 CONFIG_SYS_I2C_ZYNQ_SPEED, CONFIG_SYS_I2C_ZYNQ_SLAVE,
  			 0)
+#endif
+#ifdef CONFIG_ZYNQ_I2C1
  U_BOOT_I2C_ADAP_COMPLETE(zynq_1, zynq_i2c_init, zynq_i2c_probe, zynq_i2c_read,
  			 zynq_i2c_write, zynq_i2c_set_bus_speed,
  			 CONFIG_SYS_I2C_ZYNQ_SPEED, CONFIG_SYS_I2C_ZYNQ_SLAVE,
  			 1)
+#endif
Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#2 lore raw

PATCH 1/1 i2c: Instantiate I2C controllers when selected

Hi Heiko,

Quoted 9 lines · Heiko Schocher

Hello Michal,

Am 27.10.2015 um 16:02 schrieb Michal Simek:

Quoted 6 lines

Do not enable both I2C controllers by default. Enable them only when they are selected.

---

Quoted 8 lines
Quoted 2 lines
  drivers/i2c/zynq_i2c.c | 4 ++++
  1 file changed, 4 insertions(+)

Thanks!

I will accept this patch, but it is a fix for the old style I2C driver. I would prefer a patch, which converts this driver to DM ;-)

We will do it soon.

Quoted 5 lines

What do you mean with "enabled"? The old style i2c driver, does not initialize (call zynq_i2c_init()) the i2c driver, until it is used ... nevertheless, you save some bytes, which is always good.

All zynq devices have 2 I2C core inside but not all of them are connected to the board from chip. I don't know why but both of them were enabled by default. Configuration should be done based on real connection on the board. It means only certain I2C controller (or both) should be enabled via board file.
This will be solved by moving driver to DM.

Quoted 1 line

Are you going to queue this? Or do you want me to take it via arm zynq repo?

Thanks,
Michal

#3 lore raw

PATCH 1/1 i2c: Instantiate I2C controllers when selected

Hello Michal,

Am 28.10.2015 um 08:08 schrieb Michal Simek:

Quoted 15 lines

Hi Heiko,

Quoted 12 lines · Heiko Schocher

Hello Michal,

Am 27.10.2015 um 16:02 schrieb Michal Simek:

Quoted 8 lines

Do not enable both I2C controllers by default. Enable them only when they are selected.

---

   drivers/i2c/zynq_i2c.c | 4 ++++
   1 file changed, 4 insertions(+)
Quoted 7 lines
Quoted 5 lines

Thanks!

I will accept this patch, but it is a fix for the old style I2C driver. I would prefer a patch, which converts this driver to DM ;-)

We will do it soon.

Nice!

Quoted 11 lines
Quoted 4 lines

What do you mean with "enabled"? The old style i2c driver, does not initialize (call zynq_i2c_init()) the i2c driver, until it is used ... nevertheless, you save some bytes, which is always good.

All zynq devices have 2 I2C core inside but not all of them are connected to the board from chip. I don't know why but both of them were enabled by default. Configuration should be done based on real connection on the board. It means only certain I2C controller (or both) should be enabled via board file.
This will be solved by moving driver to DM.

Ok.

Quoted 3 lines
Quoted 1 line

Are you going to queue this? Or do you want me to take it via arm zynq repo?

Applied to u-boot-i2c.git

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany