[U-Boot] [PATCH v4 3/4] dm: i2c: Add two more I2C init functions to the compatibility layer

Simon Glass sjg at chromium.org
Tue Jan 27 04:29:39 CET 2015


These functions are useful in case the board calls them. Also fix a missing
parameter caused by applying the wrong patch (actually I failed to send v2
and applied v1 by mistake).

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v4:
- Bring in the correct patch version

 drivers/i2c/i2c-uclass-compat.c | 16 +++++++++++++---
 include/i2c.h                   | 17 ++++++++++++++++-
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/i2c-uclass-compat.c b/drivers/i2c/i2c-uclass-compat.c
index 11239da..223f238 100644
--- a/drivers/i2c/i2c-uclass-compat.c
+++ b/drivers/i2c/i2c-uclass-compat.c
@@ -17,13 +17,13 @@ static int i2c_compat_get_device(uint chip_addr, int alen,
 	struct dm_i2c_chip *chip;
 	int ret;
 
-	ret = i2c_get_chip_for_busnum(cur_busnum, chip_addr, devp);
+	ret = i2c_get_chip_for_busnum(cur_busnum, chip_addr, alen, devp);
 	if (ret)
 		return ret;
 	chip = dev_get_parent_platdata(*devp);
 	if (chip->offset_len != alen) {
-		printf("Requested alen %d does not match chip offset_len %d\n",
-		       alen, chip->offset_len);
+		printf("I2C chip %x: requested alen %d does not match chip offset_len %d\n",
+		       chip_addr, alen, chip->offset_len);
 		return -EADDRNOTAVAIL;
 	}
 
@@ -96,3 +96,13 @@ int i2c_set_bus_num(unsigned int bus)
 
 	return 0;
 }
+
+void i2c_init(int speed, int slaveaddr)
+{
+	/* Nothing to do here - the init happens through driver model */
+}
+
+void board_i2c_init(const void *blob)
+{
+	/* Nothing to do here - the init happens through driver model */
+}
diff --git a/include/i2c.h b/include/i2c.h
index 95d6f28..27fe00f 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -225,7 +225,7 @@ int i2c_get_bus_num_fdt(int node);
 unsigned int i2c_get_bus_num(void);
 
 /**
- * i2c_set_bus_num(): Compatibility function for driver model
+ * i2c_set_bus_num() - Compatibility function for driver model
  *
  * Sets the 'current' bus
  */
@@ -241,6 +241,21 @@ static inline unsigned int I2C_GET_BUS(void)
 	return i2c_get_bus_num();
 }
 
+/**
+ * i2c_init() - Compatibility function for driver model
+ *
+ * This function does nothing.
+ */
+void i2c_init(int speed, int slaveaddr);
+
+/**
+ * board_i2c_init() - Compatibility function for driver model
+ *
+ * @param blob  Device tree blbo
+ * @return the number of I2C bus
+ */
+void board_i2c_init(const void *blob);
+
 #endif
 
 /*
-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list