Skip to contentSkip to conversation

i2c-imx: change log level for No ACK

PATCH In review Eric Bénard 1 participant 4 messages May 24, 2010

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

PATCH 1/3 i2c-imx: change log level for No ACK

---
 drivers/i2c/i2c-imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/i2c-imx.c +1 -1
index 03e3785..cc64d94 100644
@@ -214,7 +214,7 @@ static int i2c_imx_acked(struct i2c_adapter *adapter)
 			break;
 
 		if (is_timeout(start, MSECOND)) {
-			dev_err(adapter->dev, "<%s> No ACK\n", __func__);
+			dev_dbg(adapter->dev, "<%s> No ACK\n", __func__);
 			return -EIO;
 		}
 	}
Signature · 7 lines
1.6.3.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/3 commands: add i2c commands

theses commands allow low level access to i2c bus and can be useful to setup an i2c device without having to add code, compile and flash barebox.

---
 commands/Kconfig  |    8 ++
 commands/Makefile |    1 +
 commands/i2c.c    |  218 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 227 insertions(+), 0 deletions(-)
 create mode 100644 commands/i2c.c
commands/Kconfig +8 -0
index 0c09f91..0ea32d9 100644
@@ -314,4 +314,12 @@ config CMD_UNLZO
 	  Say yes here to get the unlzo command. lzo is a fast compression
 	  algorithm by Markus Franz Xaver Johannes Oberhumer.
 
+config CMD_I2C
+	bool
+	depends on I2C
+	prompt "i2c commands"
+	help
+	  include i2c_probe, i2c_read and i2c_write commands to communicate
+	  on i2c bus.
+
 endmenu
commands/Makefile +1 -0
index 74b0994..3eef5de 100644
@@ -48,3 +48,4 @@ obj-$(CONFIG_CMD_BMP)		+= bmp.o
 obj-$(CONFIG_USB_GADGET_DFU)	+= dfu.o
 obj-$(CONFIG_CMD_GPIO)		+= gpio.o
 obj-$(CONFIG_CMD_UNLZO)		+= unlzo.o
+obj-$(CONFIG_CMD_I2C)		+= i2c.o
commands/i2c.c new file +218 -0

218 lines not on this page · raw message

Signature · 7 lines
1.6.3.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 3/3 i2c: implement i2c_get_adapter()

From: Sascha Hauer <[email protected]>

---
 drivers/i2c/i2c.c |   24 +++++++++++++++++++++++-
 include/i2c/i2c.h |    1 +
 2 files changed, 24 insertions(+), 1 deletions(-)
drivers/i2c/i2c.c +23 -1
index 32fd026..1fa114a 100644
@@ -39,7 +39,7 @@ struct boardinfo {
 };
 
 static LIST_HEAD(board_list);
-
+static LIST_HEAD(adapter_list);
 
 /**
  * i2c_transfer - execute a single or combined I2C message
@@ -327,6 +327,23 @@ static void scan_boardinfo(struct i2c_adapter *adapter)
 }
 
 /**
+ *
+ * i2c_get_adapter - get an i2c adapter from its busnum
+ *
+ * @param	busnum	the desired bus number
+ *
+ */
+struct i2c_adapter *i2c_get_adapter(int busnum)
+{
+	struct i2c_adapter *adap;
+
+	list_for_each_entry(adap, &adapter_list, list)
+		if (adap->nr == busnum)
+			return adap;
+	return NULL;
+}
+
+/**
  * i2c_register_master - register I2C master controller
  *
  * @param	master	initialized master, originally from i2c_alloc_master()
@@ -345,6 +362,11 @@ static void scan_boardinfo(struct i2c_adapter *adapter)
  */
 int i2c_add_numbered_adapter(struct i2c_adapter *adapter)
 {
+	if (i2c_get_adapter(adapter->nr))
+		return -EBUSY;
+
+	list_add_tail(&adapter_list, &adapter->list);
+
 	/* populate children from any i2c device tables */
 	scan_boardinfo(adapter);
 
include/i2c/i2c.h +1 -0
index 0760fdc..802f553 100644
@@ -66,6 +66,7 @@ struct i2c_adapter {
 	struct device_d		*dev;	/* ptr to device */
 	int			nr;	/* bus number */
 	int (*master_xfer)(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
+	struct list_head	list;
 };
 
 
Signature · 7 lines
1.6.3.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

Re: [PATCH 2/3] commands: add i2c commands

In reply to Eric Bénard
Quoted 5 lines · Eric Bénard

theses commands allow low level access to i2c bus and can be useful to setup an i2c device without having to add code, compile and flash barebox.

forget it, v3 will be the right one !

Eric

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox