diff mbox

[U-Boot,7/7] i2c: lpc32xx: Force consistent bus numbering

Message ID 20170314152445.29516-8-slemieux.tyco@gmail.com
State Accepted
Commit 0f5b461b9bf028c5ce8fd22e8bd45d8c1234e2fd
Delegated to: Heiko Schocher
Headers show

Commit Message

Sylvain Lemieux March 14, 2017, 3:24 p.m. UTC
From: Liam Beguin <lbeguin@tycoint.com>

Normally, this would probably be done by adding devicetree aliases
to the main dtsi file for the lpc32xx and using bus->req_seq instead.

Since we want to have consistent i2c numbering, we cannot force the
bus->req_seq because. If for instance we have 3 buses numbered
from 0 to 2 with i2c0 enabled, i2c1 disabled and i2c2 enabled;
i2c2 can be selected using 'i2c dev 1' and 'i2c dev 2' commands
because a bus can be probed using req_seq or seq interchangeably.

Signed-off-by: Liam Beguin <lbeguin@tycoint.com>
Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
 drivers/i2c/lpc32xx_i2c.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/drivers/i2c/lpc32xx_i2c.c b/drivers/i2c/lpc32xx_i2c.c
index 8dc568d0e5..e78b74625e 100644
--- a/drivers/i2c/lpc32xx_i2c.c
+++ b/drivers/i2c/lpc32xx_i2c.c
@@ -282,6 +282,7 @@  U_BOOT_I2C_ADAP_COMPLETE(lpc32xx_2, lpc32xx_i2c_init, NULL,
 static int lpc32xx_i2c_probe(struct udevice *bus)
 {
 	struct lpc32xx_i2c_dev *dev = dev_get_platdata(bus);
+	bus->seq = dev->index;
 
 	__i2c_init(dev->base, dev->speed, 0, dev->index);
 	return 0;