0

Sorry if this has been solved, but I would like to connect some drivers on Linux over I2C, but I only have USB available.

I was going to use a FT4232 or FT260 USB to I2C; however, is there is a way to put a FT260 node in the device tree and associate I2C devices/drivers on Linux under it?

horsey_guy
8388 silver badges32 bronze badges
asked Dec 1 at 23:53

1 Answer 1

1

The FT260 driver is part of the upstream Linux kernel (look for drivers/hid/hid-ft260.c), but organized under HID drivers (because it "abuses" the simplest USB class, HID, otherwise used for mice and keyboards, to run I2C commands, encapsulated in HID messages and reports). For FT4232, there seem to be some out-of-tree Linux kernel modules that you can find on github; haven't tried to assess their quality.

With udev (i.e., with a running typical userland), the hid-ft260 driver should be automatically loaded; in the devicetree use case, you'd probably want it to be compiled into your kernel instead. The devicetree would contain the usual USB-device bindings, i.e, some device usb@$(portnumber) { compatible = "usb403,6030" }. (Because the VID of FTDI is 0x0403 and the PID of the FT260 is 0x6030).

But.

To cite the official linux devicetree USB binding documentation:

Usually, we only use device tree for hard wired USB device.

and that makes sense. For anything else, it's easier to just let userland (udev) see that USB device, load that module, and (udev rule) automatedly load the I2C device driver you want. Now, while that's much easier, flexible, much more possible to debug and harder to get wrong, I understand that's probably not possible in your use case – you're likely asking this because you need that I2C device attached to your USB adapter during early boot, before you have a userland.

If that's not the case, please don't put USB devices in the devicetree unless strictly necessary. A bloated, complicated devicetree doesn't do you any favors. If this is something "useful, but not necessary", userland is the place to control when what attaches how to it. Can still use kernel mode drivers (though you don't have to).

answered Dec 2 at 10:16
1
  • Thank you! The FTDI chips are hardwired on the board. This is what i was looking for! Commented Dec 2 at 14:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.