Skip to contentSkip to conversation

i2c: i2c-tiny-usb: Remove RobotFuzz USB vendor:product ID

PATCH RESEND In review Andrew Lunn 2 participants 13 messages Dec 17, 2013 – Jan 13, 2014 8 messages not in the archive

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

PATCH RESEND 1/2 i2c: i2c-tiny-usb: Remove RobotFuzz USB vendor:product ID

The RobotFuzz device is not compatible with i2c-tiny-usb. Remove its entry from the USB table so that the new correct driver can be used.

CC Emmanuel Deloget <[email protected]>
CC Barry Carter <[email protected]>
---
 drivers/i2c/busses/i2c-tiny-usb.c | 1 -
 1 file changed, 1 deletion(-)
drivers/i2c/busses/i2c-tiny-usb.c +0 -1
index e7d3b755af3b..0ed77eeff31e 100644
@@ -162,7 +162,6 @@ static const struct i2c_algorithm usb_algorithm = {
 static const struct usb_device_id i2c_tiny_usb_table[] = {
 	{ USB_DEVICE(0x0403, 0xc631) },   /* FTDI */
 	{ USB_DEVICE(0x1c40, 0x0534) },   /* EZPrototypes */
-	{ USB_DEVICE(0x1964, 0x0001) },   /* Robofuzz OSIF */
 	{ }                               /* Terminating entry */
 };
 
Signature · 1 line
1.8.5.1

A message that is not in the archive (sent off-list or not yet received): 1387312308-2222-1-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org

#2 lore raw

PATCH RESEND 2/2 i2c: Add bus driver for for OSIF USB i2c device.

OSIF, Open Source InterFace, is a USB based i2c bus master. The origional design was based on i2c-tiny-usb, but more modern versions of the firmware running on the MegaAVR microcontroller use a different protocol over the USB. This code is based on Barry Carter <[email protected]> driver.

CC Emmanuel Deloget <[email protected]>
CC Barry Carter <[email protected]>
---
 drivers/i2c/busses/Kconfig    |  10 ++
 drivers/i2c/busses/Makefile   |   1 +
 drivers/i2c/busses/i2c-osif.c | 267 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 278 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-osif.c
drivers/i2c/busses/Kconfig +10 -0
index cdcbd8368ed3..e7ed9edd79e2 100644
@@ -788,6 +788,16 @@ config I2C_DIOLAN_U2C
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-diolan-u2c.
 
+config I2C_OSIF
+	tristate "RobotFuzz Open Source InterFace USB adapter"
+	depends on USB
+	help
+	  If you say yes to this option, support will be included for the
+	  RobotFuzz Open Source InterFace USB to I2C interface.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-osif.
+
 config I2C_PARPORT
 	tristate "Parallel port adapter"
 	depends on PARPORT
drivers/i2c/busses/Makefile +1 -0
index d00997f3eb3b..4c147862b2a7 100644
@@ -79,6 +79,7 @@ obj-$(CONFIG_I2C_RCAR)		+= i2c-rcar.o
 
 # External I2C/SMBus adapter drivers
 obj-$(CONFIG_I2C_DIOLAN_U2C)	+= i2c-diolan-u2c.o
+obj-$(CONFIG_I2C_OSIF)		+= i2c-osif.o
 obj-$(CONFIG_I2C_PARPORT)	+= i2c-parport.o
 obj-$(CONFIG_I2C_PARPORT_LIGHT)	+= i2c-parport-light.o
 obj-$(CONFIG_I2C_TAOS_EVM)	+= i2c-taos-evm.o
drivers/i2c/busses/i2c-osif.c new file +267 -0

267 lines not on this page · raw message

Signature · 1 line
1.8.5.1

A message that is not in the archive (sent off-list or not yet received): 1387312308-2222-2-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org

#4 lore raw

Re: [RESEND PATCH v1 2/2] i2c: Add bus driver for for OSIF USB i2c device.

Hi, thanks for the submission...

drivers/i2c/busses/i2c-osif.c line 25

Quoted 3 lines
drivers/i2c/busses/i2c-osif.c new file +3 -0
+#define DRIVER_AUTHOR  "Barry Carter <[email protected]>,"	\
+	"Andrew Lunn <[email protected]>"
+#define DRIVER_DESC    "OSIF driver"

No defines, use directly.

drivers/i2c/busses/i2c-osif.c line 40

Quoted 5 lines
drivers/i2c/busses/i2c-osif.c new file +5 -0
+static int usb_read(struct i2c_adapter *adapter, int cmd,
+		    int value, int index, void *data, int len);
+
+static int usb_write(struct i2c_adapter *adapter, int cmd,
+		     int value, int index, void *data, int len);

With a bit of reshuffling, these can be skipped.

drivers/i2c/busses/i2c-osif.c line 51

Quoted 1 line
drivers/i2c/busses/i2c-osif.c new file +1 -0
+	dev_dbg(&adapter->dev, "master xfer %d messages:\n", num);

Skip. This info is available with I2C core debug messages.

drivers/i2c/busses/i2c-osif.c line 55

Quoted 3 lines
drivers/i2c/busses/i2c-osif.c new file +3 -0
+	pstatus = kmalloc(sizeof(*pstatus), GFP_KERNEL);
+	if (!pstatus)
+		return -ENOMEM;

Does it really make sense to allocate this every time?

drivers/i2c/busses/i2c-osif.c line 64

Quoted 4 lines
drivers/i2c/busses/i2c-osif.c new file +4 -0
+		dev_dbg(&adapter->dev,
+			"  %d: %s (flags %d) %d bytes to 0x%02x\n",
+			i, pmsg->flags & I2C_M_RD ? "read" : "write",
+			pmsg->flags, pmsg->len, pmsg->addr);

This is also available with i2c core debug messages.

drivers/i2c/busses/i2c-osif.c line 151

Quoted 6 lines
drivers/i2c/busses/i2c-osif.c new file +6 -0
+/* Structure to hold all of our device specific stuff */
+struct priv {
+	struct usb_device *usb_dev; /* the usb device for this device */
+	struct usb_interface *interface; /* the interface for this device */
+	struct i2c_adapter adapter; /* i2c related things */
+};

Remove comments, too obvious IMO.

drivers/i2c/busses/i2c-osif.c line 158

Quoted 6 lines
drivers/i2c/busses/i2c-osif.c new file +6 -0
+static int usb_read(struct i2c_adapter *adapter, int cmd,
+		    int value, int index, void *data, int len)
+{
+	struct priv *priv = (struct priv *)adapter->algo_data;
+
+	/* do control transfer */

ditto.

drivers/i2c/busses/i2c-osif.c line 170

Quoted 12 lines
drivers/i2c/busses/i2c-osif.c new file +12 -0
+	return usb_control_msg(priv->usb_dev, usb_rcvctrlpipe(priv->usb_dev, 0),
+			       cmd, USB_TYPE_VENDOR | USB_RECIP_INTERFACE |
+			       USB_DIR_IN, value, index, data, len, 2000);
+}
+
+static int usb_write(struct i2c_adapter *adapter, int cmd,
+		    int value, int index, void *data, int len)
+{
+
+	struct priv *priv = (struct priv *)adapter->algo_data;
+
+	/* do control transfer */

ditto.

drivers/i2c/busses/i2c-osif.c line 179

Quoted 9 lines
drivers/i2c/busses/i2c-osif.c new file +9 -0
+	return usb_control_msg(priv->usb_dev, usb_sndctrlpipe(priv->usb_dev, 0),
+			       cmd, USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+			       value, index, data, len, 2000);
+}
+
+static void osif_free(struct priv *priv)
+{
+	usb_put_dev(priv->usb_dev);
+}

Not sure if this is worth a seperate function, but well...

drivers/i2c/busses/i2c-osif.c line 184

Quoted 4 lines
drivers/i2c/busses/i2c-osif.c new file +4 -0
+static int osif_probe(struct usb_interface *interface,
+			     const struct usb_device_id *id)
+{
+	struct priv *priv = NULL;

Unneeded assignment.

drivers/i2c/busses/i2c-osif.c line 188

Quoted 4 lines
drivers/i2c/busses/i2c-osif.c new file +4 -0
+	int retval = -ENOMEM;
+	u16 version;
+
+	dev_dbg(&interface->dev, "probing usb device");

This is available via driver core debug messages.

drivers/i2c/busses/i2c-osif.c line 233

Quoted 2 lines
drivers/i2c/busses/i2c-osif.c new file +2 -0
+	/* inform user about successful attachment to i2c layer */
+	dev_info(&priv->adapter.dev, "connected OSIF device\n");

I think this message should be merged with the "version xx found" message above.

Quoted 1 line

+MODULE_LICENSE("GPL");

"GPL v2" according to header.

#5 lore raw

PATCH 1/2 i2c: i2c-tiny-usb: Remove RobotFuzz USB vendor:product ID

The RobotFuzz device is not compatible with i2c-tiny-usb. Remove its entry from the USB table so that the new correct driver can be used.

CC Emmanuel Deloget <[email protected]>
CC Barry Carter <[email protected]>
---
 drivers/i2c/busses/i2c-tiny-usb.c |    1 -
 1 file changed, 1 deletion(-)
drivers/i2c/busses/i2c-tiny-usb.c +0 -1
index e7d3b755af3b..0ed77eeff31e 100644
@@ -162,7 +162,6 @@ static const struct i2c_algorithm usb_algorithm = {
 static const struct usb_device_id i2c_tiny_usb_table[] = {
 	{ USB_DEVICE(0x0403, 0xc631) },   /* FTDI */
 	{ USB_DEVICE(0x1c40, 0x0534) },   /* EZPrototypes */
-	{ USB_DEVICE(0x1964, 0x0001) },   /* Robofuzz OSIF */
 	{ }                               /* Terminating entry */
 };
 
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 1388980536-7588-1-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org

#7 lore raw

PATCH 2/2 i2c: Add bus driver for for OSIF USB i2c device.

OSIF, Open Source InterFace, is a USB based i2c bus master. The origional design was based on i2c-tiny-usb, but more modern versions of the firmware running on the MegaAVR microcontroller use a different protocol over the USB. This code is based on Barry Carter <[email protected]> driver.

CC Emmanuel Deloget <[email protected]>
CC Barry Carter <[email protected]>

---
v2:

Rearranged order of functions to remove forward declarations Remove some obvious comments
Remove debug prints which the core also provides Remove defines for module authors.
Allocate status byte once in priv, rather than for each xfer. Fix MODULE_LICENSE()
Rename file and Kconfig entry for consistency and ordering. Inline osif_free()

---
 drivers/i2c/busses/Kconfig              |   10 ++
 drivers/i2c/busses/Makefile             |    1 +
 drivers/i2c/busses/i2c-robotfuzz-osif.c |  201 +++++++++++++++++++++++++++++++
 3 files changed, 212 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-robotfuzz-osif.c
drivers/i2c/busses/Kconfig +10 -0
index cdcbd8368ed3..ed1bd7a46c20 100644
@@ -837,6 +837,16 @@ config I2C_PARPORT_LIGHT
 	  This support is also available as a module.  If so, the module
 	  will be called i2c-parport-light.
 
+config I2C_ROBOTFUZZ_OSIF
+	tristate "RobotFuzz Open Source InterFace USB adapter"
+	depends on USB
+	help
+	  If you say yes to this option, support will be included for the
+	  RobotFuzz Open Source InterFace USB to I2C interface.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-osif.
+
 config I2C_TAOS_EVM
 	tristate "TAOS evaluation module"
 	depends on TTY
drivers/i2c/busses/Makefile +1 -0
index d00997f3eb3b..f171fa8b1a72 100644
@@ -81,6 +81,7 @@ obj-$(CONFIG_I2C_RCAR)		+= i2c-rcar.o
 obj-$(CONFIG_I2C_DIOLAN_U2C)	+= i2c-diolan-u2c.o
 obj-$(CONFIG_I2C_PARPORT)	+= i2c-parport.o
 obj-$(CONFIG_I2C_PARPORT_LIGHT)	+= i2c-parport-light.o
+obj-$(CONFIG_I2C_ROBOTFUZZ_OSIF)	+= i2c-robotfuzz-osif.o
 obj-$(CONFIG_I2C_TAOS_EVM)	+= i2c-taos-evm.o
 obj-$(CONFIG_I2C_TINY_USB)	+= i2c-tiny-usb.o
 obj-$(CONFIG_I2C_VIPERBOARD)	+= i2c-viperboard.o
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +201 -0

201 lines not on this page · raw message

Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 1388980536-7588-2-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org

#9 lore raw

Re: [PATCH 2/2] i2c: Add bus driver for for OSIF USB i2c device.

Quoted 7 lines · Andrew Lunn

OSIF, Open Source InterFace, is a USB based i2c bus master. The origional design was based on i2c-tiny-usb, but more modern versions of the firmware running on the MegaAVR microcontroller use a different protocol over the USB. This code is based on Barry Carter <[email protected]> driver.

We are getting close...

drivers/i2c/busses/i2c-robotfuzz-osif.c line 27

Quoted 5 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +5 -0
+#define OSIFI2C_READ		20 /* Read from i2c bus */
+#define OSIFI2C_WRITE		21 /* Write to i2c bus */
+#define OSIFI2C_STOP		22 /* Send stop condition */
+#define OSIFI2C_STATUS		23 /* Get status from i2c action */
+#define OSIFI2C_SET_BIT_RATE	24 /* Set the bit rate & prescaler */

Comments could be seen as obvious, too. I'll leave the decision to you.

Quoted 1 line

+struct priv {

Namespace: 'osif_priv' please.

drivers/i2c/busses/i2c-robotfuzz-osif.c line 39

Quoted 7 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +7 -0
+	struct usb_device *usb_dev;
+	struct usb_interface *interface;
+	struct i2c_adapter adapter;
+	unsigned char status;
+};
+
+static int usb_read(struct i2c_adapter *adapter, int cmd,

Namespace: 'osif_usb_read'.

drivers/i2c/busses/i2c-robotfuzz-osif.c line 42

Quoted 3 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +3 -0
+		    int value, int index, void *data, int len)
+{
+	struct priv *priv = (struct priv *)adapter->algo_data;

No need to cast a void*.

drivers/i2c/busses/i2c-robotfuzz-osif.c line 49

Quoted 7 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +7 -0
+
+	return usb_control_msg(priv->usb_dev, usb_rcvctrlpipe(priv->usb_dev, 0),
+			       cmd, USB_TYPE_VENDOR | USB_RECIP_INTERFACE |
+			       USB_DIR_IN, value, index, data, len, 2000);
+}
+
+static int usb_write(struct i2c_adapter *adapter, int cmd,

Namespace

drivers/i2c/busses/i2c-robotfuzz-osif.c line 53

Quoted 4 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +4 -0
+		    int value, int index, void *data, int len)
+{
+
+	struct priv *priv = (struct priv *)adapter->algo_data;

no cast.

drivers/i2c/busses/i2c-robotfuzz-osif.c line 60

Quoted 7 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +7 -0
+
+	return usb_control_msg(priv->usb_dev, usb_sndctrlpipe(priv->usb_dev, 0),
+			       cmd, USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+			       value, index, data, len, 2000);
+}
+
+static int usb_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)

namespace

Review

Quoted 2 lines
(quoted diff) +2 -0
+{
+	struct priv *priv = (struct priv *)adapter->algo_data;

no cast

Quoted 5 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +5 -0
+	struct i2c_msg *pmsg;
+	int ret = 0;
+	int i, cmd;
+
+	for (i = 0; ret >= 0 && i < num; i++) {

drivers/i2c/busses/i2c-robotfuzz-osif.c line 77

Quoted 10 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +10 -0
+		pmsg = &msgs[i];
+
+		if (pmsg->flags & I2C_M_RD) {
+			cmd = OSIFI2C_READ;
+
+			ret = usb_read(adapter, cmd, pmsg->flags, pmsg->addr,
+				       pmsg->buf, pmsg->len);
+			if (ret != pmsg->len) {
+				dev_err(&adapter->dev,
+					"failure reading data\n");

One line is more readable IMO. 80 chars is not a hard limit.

drivers/i2c/busses/i2c-robotfuzz-osif.c line 87

Quoted 10 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +10 -0
+				return -EREMOTEIO;
+			}
+		} else {
+			cmd = OSIFI2C_WRITE;
+
+			ret = usb_write(adapter, cmd, pmsg->flags, pmsg->addr,
+					pmsg->buf, pmsg->len);
+			if (ret != pmsg->len) {
+				dev_err(&adapter->dev,
+					"failure writing data\n");

ditto

drivers/i2c/busses/i2c-robotfuzz-osif.c line 93

Quoted 6 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +6 -0
+				return -EREMOTEIO;
+			}
+		}
+
+		ret = usb_read(adapter, OSIFI2C_STOP, 0, 0, NULL, 0);
+		if (ret != 0) {

'if (ret)' is enough

Quoted 13 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +13 -0
+			dev_err(&adapter->dev, "failure sending STOP\n");
+			return -EREMOTEIO;
+		}
+
+		/* read status */
+		ret = usb_read(adapter, OSIFI2C_STATUS, 0, 0, &priv->status, 1);
+		if (ret != 1) {
+			dev_err(&adapter->dev, "failure reading status\n");
+			return -EREMOTEIO;
+		}
+
+		if (priv->status != STATUS_ADDRESS_ACK) {
+			dev_dbg(&adapter->dev, "status = %d\n", priv->status);

drivers/i2c/busses/i2c-robotfuzz-osif.c line 116

Quoted 10 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +10 -0
+			return -EREMOTEIO;
+		}
+	}
+
+	return i;
+}
+
+static u32 usb_func(struct i2c_adapter *adapter)
+{
+	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;

Have you tried SMBUS_QUICK by the way?

Quoted 5 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +5 -0
+}
+
+static struct i2c_algorithm usb_algorithm = {
+	.master_xfer	= usb_xfer,
+	.functionality	= usb_func,

drivers/i2c/busses/i2c-robotfuzz-osif.c line 131

Quoted 10 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +10 -0
+};
+
+#define USB_OSIF_VENDOR_ID	0x1964
+#define USB_OSIF_PRODUCT_ID	0x0001
+
+static struct usb_device_id osif_table[] = {
+	{ USB_DEVICE(USB_OSIF_VENDOR_ID, USB_OSIF_PRODUCT_ID) },
+	{ }
+};
+

Empty line can go.

drivers/i2c/busses/i2c-robotfuzz-osif.c line 137

Quoted 6 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +6 -0
+MODULE_DEVICE_TABLE(usb, osif_table);
+
+static int osif_probe(struct usb_interface *interface,
+			     const struct usb_device_id *id)
+{
+	int retval;

maybe just 'ret' for consistency? Very minor nit, though...

drivers/i2c/busses/i2c-robotfuzz-osif.c line 139

Quoted 2 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +2 -0
+	struct priv *priv;
+	u16 version;

Rest looks ready to go!

#10 lore raw

Re: [PATCH 2/2] i2c: Add bus driver for for OSIF USB i2c device.

Hi Wolfgang

Quoted 5 lines

drivers/i2c/busses/i2c-robotfuzz-osif.c line 116

Quoted 3 lines
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +3 -0
+static u32 usb_func(struct i2c_adapter *adapter)
+{
+	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;

Have you tried SMBUS_QUICK by the way?

Nope, not tried it.

Documentation/i2c/smbus-protocol say:

SMBus Quick Command
===================

This sends a single bit to the device, at the place of the Rd/Wr bit.

A Addr Rd/Wr [A] P

Functionality flag: I2C_FUNC_SMBUS_QUICK

My first question is probably silly. Should the first A be an S?

So is this a zero byte transfer? Is that not what i2cdetect does? I've used i2cdetect on this hardware to find my devices.

Thanks
Andrew

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: [PATCH 2/2] i2c: Add bus driver for for OSIF USB i2c device.

Hi,

Quoted 1 line

Hi Wolfgang

Wolfram

Quoted 1 line

So is this a zero byte transfer? Is that not what i2cdetect does?

Yes, you can enforce it with -q. It will do it for some addresses automatically and complain if it is not available. So, seems to work, great!

#13 lore raw

Re: [PATCH 2/2] i2c: Add bus driver for for OSIF USB i2c device.

Hi Wolfram

Quoted 3 lines
Quoted 1 line

Hi Wolfgang

Wolfram

Upps, Sorry.

Quoted 5 lines
Quoted 1 line

So is this a zero byte transfer? Is that not what i2cdetect does?

Yes, you can enforce it with -q. It will do it for some addresses automatically and complain if it is not available. So, seems to work, great!

O.K, i will double check and then add this to functions.

Andrew

A message that is not in the archive (sent off-list or not yet received): [email protected]

#15 lore raw

Re: [PATCH 2/2] i2c: Add bus driver for for OSIF USB i2c device.

Quoted 1 line

O.K, i will double check and then add this to functions.

It's default on :)

#16 lore raw

PATCH v3 1/2 i2c: i2c-tiny-usb: Remove RobotFuzz USB vendor:product ID

In reply to Wolfram Sang

The RobotFuzz device is not compatible with i2c-tiny-usb. Remove its entry from the USB table so that the new correct driver can be used.

CC Emmanuel Deloget <[email protected]>
CC Barry Carter <[email protected]>
---
 drivers/i2c/busses/i2c-tiny-usb.c | 1 -
 1 file changed, 1 deletion(-)
drivers/i2c/busses/i2c-tiny-usb.c +0 -1
index e7d3b755af3b..0ed77eeff31e 100644
@@ -162,7 +162,6 @@ static const struct i2c_algorithm usb_algorithm = {
 static const struct usb_device_id i2c_tiny_usb_table[] = {
 	{ USB_DEVICE(0x0403, 0xc631) },   /* FTDI */
 	{ USB_DEVICE(0x1c40, 0x0534) },   /* EZPrototypes */
-	{ USB_DEVICE(0x1964, 0x0001) },   /* Robofuzz OSIF */
 	{ }                               /* Terminating entry */
 };
 
Signature · 1 line
1.8.5.1

A message that is not in the archive (sent off-list or not yet received): 1389396239-21026-1-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org

#18 lore raw

PATCH v3 2/2 i2c: Add bus driver for for OSIF USB i2c device.

OSIF, Open Source InterFace, is a USB based i2c bus master. The origional design was based on i2c-tiny-usb, but more modern versions of the firmware running on the MegaAVR microcontroller use a different protocol over the USB. This code is based on Barry Carter <[email protected]> driver.

CC Emmanuel Deloget <[email protected]>
CC Barry Carter <[email protected]>

---
v2:

Rearranged order of functions to remove forward declarations Remove some obvious comments
Remove debug prints which the core also provides Remove defines for module authors.
Allocate status byte once in priv, rather than for each xfer. Fix MODULE_LICENSE()
Rename file and Kconfig entry for consistency and ordering. Inline osif_free()

v3:

Fix name space issues
Remove more obvious comments
Remove unneeded casts
dev_err() on one line
SMBUS_QUICK has been tested with i2dectect -q
Empty line remove
s/retval/ret/g

---
 drivers/i2c/busses/Kconfig              |  10 ++
 drivers/i2c/busses/Makefile             |   1 +
 drivers/i2c/busses/i2c-robotfuzz-osif.c | 202 ++++++++++++++++++++++++++++++++
 3 files changed, 213 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-robotfuzz-osif.c
drivers/i2c/busses/Kconfig +10 -0
index cdcbd8368ed3..ed1bd7a46c20 100644
@@ -837,6 +837,16 @@ config I2C_PARPORT_LIGHT
 	  This support is also available as a module.  If so, the module
 	  will be called i2c-parport-light.
 
+config I2C_ROBOTFUZZ_OSIF
+	tristate "RobotFuzz Open Source InterFace USB adapter"
+	depends on USB
+	help
+	  If you say yes to this option, support will be included for the
+	  RobotFuzz Open Source InterFace USB to I2C interface.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-osif.
+
 config I2C_TAOS_EVM
 	tristate "TAOS evaluation module"
 	depends on TTY
drivers/i2c/busses/Makefile +1 -0
index d00997f3eb3b..f171fa8b1a72 100644
@@ -81,6 +81,7 @@ obj-$(CONFIG_I2C_RCAR)		+= i2c-rcar.o
 obj-$(CONFIG_I2C_DIOLAN_U2C)	+= i2c-diolan-u2c.o
 obj-$(CONFIG_I2C_PARPORT)	+= i2c-parport.o
 obj-$(CONFIG_I2C_PARPORT_LIGHT)	+= i2c-parport-light.o
+obj-$(CONFIG_I2C_ROBOTFUZZ_OSIF)	+= i2c-robotfuzz-osif.o
 obj-$(CONFIG_I2C_TAOS_EVM)	+= i2c-taos-evm.o
 obj-$(CONFIG_I2C_TINY_USB)	+= i2c-tiny-usb.o
 obj-$(CONFIG_I2C_VIPERBOARD)	+= i2c-viperboard.o
drivers/i2c/busses/i2c-robotfuzz-osif.c new file +202 -0

202 lines not on this page · raw message

Signature · 1 line
1.8.5.1

A message that is not in the archive (sent off-list or not yet received): 1389396239-21026-2-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org

Applied
#20 lore raw

Re: [PATCH v3 2/2] i2c: Add bus driver for for OSIF USB i2c device.

Quoted 7 lines · Andrew Lunn

OSIF, Open Source InterFace, is a USB based i2c bus master. The origional design was based on i2c-tiny-usb, but more modern versions of the firmware running on the MegaAVR microcontroller use a different protocol over the USB. This code is based on Barry Carter <[email protected]> driver.

Applied both to for-next, thanks!