Skip to contentSkip to conversation

HID: ft260: add usb hid to i2c host bridge driver

PATCH In review Michael Zaidman 3 participants 5 messages Feb 19, 2021 – Mar 16, 2021

Subsystems (3)
lore
Share & tools
lore

Michael Zaidman

author maintainer
#0 lore raw

v2 cover HID: ft260: add usb hid to i2c host bridge driver

The FTDI FT260 chip implements USB to I2C/UART bridges through two USB HID class interfaces [1]. The first - for I2C, and the second for UART. Each interface is independent, and the kernel detects it as a separate USB hidraw device.

There is no I2C master/host driver for this chip to date, and FTDI suggests using hidraw and libusb userspace libraries to operate the FT260 I2C host controller via hidraw Linux kernel driver. But this approach makes the standard Linux I2C tools useless, and it does not allow the I2C sysfs tree instantiation required by I2C multiplexers and switches.

This commit adds the I2C host adapter support, enabling a wide range of the standard userspace I2C tools and applications that do not implement HID protocol, accessing the I2C client devices via FT260 USB to I2C controller.

The driver was tested with various I2C client devices like PCA9548, PCAL6524, 24C0x, different QSFP-DD and OSFP transceivers, and Linux userspace I2C tools (i2cdetect, i2cdump, i2cget and i2cset).

HID commands and responses are FT260 specific and documented in the AN_394_User_Guide_for_FT260.pdf [2].

[1] - https://ftdichip.com/wp-content/uploads/2020/07/DS_FT260.pdf
[2] - https://www.ftdichip.com/Support/Documents/AppNotes/AN_394_User_Guide_for_FT260.pdf

Changes since v1:
- Refined the cover letter content.
- Reduced number of debugging messages.
- Removed unused ft260_request_report structure.
- Relocated module build rule in the Makefile according to alphabetic order.

Michael Zaidman (1):
HID: ft260: add usb hid to i2c host bridge driver

 MAINTAINERS             |    7 +
 drivers/hid/Kconfig     |   11 +
 drivers/hid/Makefile    |    1 +
 drivers/hid/hid-ft260.c | 1053 +++++++++++++++++++++++++++++++++++++++
 drivers/hid/hid-ids.h   |    1 +
 5 files changed, 1073 insertions(+)
 create mode 100644 drivers/hid/hid-ft260.c

base-commit: abaf6f60176f1ae9d946d63e4db63164600b7b1a

Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH v2 1/1 HID: ft260: add usb hid to i2c host bridge driver

The FTDI FT260 chip implements USB to I2C/UART bridges through two USB HID class interfaces. The first - for I2C, and the second for UART. Each interface is independent, and the kernel detects it as a separate USB hidraw device.

This commit adds I2C host adapter support.

---
 MAINTAINERS             |    7 +
 drivers/hid/Kconfig     |   11 +
 drivers/hid/Makefile    |    1 +
 drivers/hid/hid-ft260.c | 1053 +++++++++++++++++++++++++++++++++++++++
 drivers/hid/hid-ids.h   |    1 +
 5 files changed, 1073 insertions(+)
 create mode 100644 drivers/hid/hid-ft260.c
MAINTAINERS +7 -0
index 8a6fe5389d7d..30526cfd4994 100644
@@ -7328,6 +7328,13 @@ F:	fs/verity/
 F:	include/linux/fsverity.h
 F:	include/uapi/linux/fsverity.h
 
+FT260 FTDI USB-HID TO I2C BRIDGE DRIVER
+M:	Michael Zaidman <[email protected]>
+L:	[email protected]
+L:	[email protected]
+S:	Maintained
+F:	drivers/hid/hid-ft260.c
+
 FUJITSU LAPTOP EXTRAS
 M:	Jonathan Woithe <[email protected]>
 L:	[email protected]
drivers/hid/Kconfig +11 -0
index 786b71ef7738..b279c6130bc2 100644
@@ -351,6 +351,17 @@ config HID_EZKEY
 	help
 	Support for Ezkey BTC 8193 keyboard.
 
+config HID_FT260
+	tristate "FTDI FT260 USB HID to I2C host support"
+	depends on USB_HID && HIDRAW && I2C
+	help
+	  Provides I2C host adapter functionality over USB-HID through FT260
+	  device. The customizable USB descriptor fields are exposed as sysfs
+	  attributes.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called hid-ft260.
+
 config HID_GEMBIRD
 	tristate "Gembird Joypad"
 	depends on HID
drivers/hid/Makefile +1 -0
index c4f6d5c613dc..6e24c37132ec 100644
@@ -46,6 +46,7 @@ obj-$(CONFIG_HID_ELAN)		+= hid-elan.o
 obj-$(CONFIG_HID_ELECOM)	+= hid-elecom.o
 obj-$(CONFIG_HID_ELO)		+= hid-elo.o
 obj-$(CONFIG_HID_EZKEY)		+= hid-ezkey.o
+obj-$(CONFIG_HID_FT260)		+= hid-ft260.o
 obj-$(CONFIG_HID_GEMBIRD)	+= hid-gembird.o
 obj-$(CONFIG_HID_GFRM)		+= hid-gfrm.o
 obj-$(CONFIG_HID_GLORIOUS)  += hid-glorious.o
drivers/hid/hid-ft260.c new file +1053 -0

1,053 lines not on this page · raw message

drivers/hid/hid-ids.h +1 -0
index e42aaae3138f..daa4c0318cbc 100644
@@ -430,6 +430,7 @@
 
 #define USB_VENDOR_ID_FUTURE_TECHNOLOGY	0x0403
 #define USB_DEVICE_ID_RETRODE2		0x97c1
+#define USB_DEVICE_ID_FT260             0x6030
 
 #define USB_VENDOR_ID_ESSENTIAL_REALITY	0x0d7f
 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
Signature · 1 line
2.25.1
Tested-by on v2 1/1
#2 lore raw

From: Aaron Jones(FTDI-UK) <[email protected]>

Quoted 8 lines · Michael Zaidman

The FTDI FT260 chip implements USB to I2C/UART bridges through two USB HID class interfaces. The first - for I2C, and the second for UART. Each interface is independent, and the kernel detects it as a separate USB hidraw device.

This commitadds I2C host adapter support.

I've applied the patch, ran some tests with a UMFT260EV1A evaluation board, and found no issues with the functionality it provides.

Registered in Scotland No 136640
This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, lost, destroyed, arrive late or incomplete. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. Future Technology Devices International Ltd has taken every reasonable precaution to ensure that any attachment to this e-mail has been swept for viruses. However, we cannot accept liability for any damage sustained as a result of software viruses and would advise that you carry out your own virus checks before opening any attachment.

Please note FTDI have updated their Privacy Policy.

Please click on the following link to access and review.

FTDI Privacy Policy<http://www.ftdichip.com/Corporate/PrivacyPolicy.htm>

Signature · 2 lines
This email has been checked for viruses by AVG.
https://www.avg.com
author maintainer
#3 lore raw
Quoted 8 lines · Aaron Jones

From: Aaron Jones(FTDI-UK) <[email protected]>

Quoted 5 lines · Michael Zaidman

The FTDI FT260 chip implements USB to I2C/UART bridges through two USB HID class interfaces. The first - for I2C, and the second for UART. Each interface is independent, and the kernel detects it as a separate USB hidraw device.

Quoted 8 lines
Quoted 3 lines

This commit adds I2C host adapter support.

I've applied the patch, ran some tests with a UMFT260EV1A evaluation board, and found no issues with the functionality it provides.

Aaron, thanks for giving it a try - much appreciated!

I will add your "Tested-by:" to the next version of the patch once I receive any feedback.

maintainer
#4 lore raw
Quoted 7 lines · Michael Zaidman
Quoted 7 lines
Quoted 7 lines

The FTDI FT260 chip implements USB to I2C/UART bridges through two USB HID class interfaces. The first - for I2C, and the second for UART. Each interface is independent, and the kernel detects it as a separate USB hidraw device.

This commit adds I2C host adapter support.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

I've applied the patch, ran some tests with a UMFT260EV1A evaluation board, and found no issues with the functionality it provides.

Aaron, thanks for giving it a try - much appreciated!

I have now queued the driver in hid.git#for-5.13/ft260. Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs