Bug 198783 - I2C driver for AM335X enhancement
Summary: I2C driver for AM335X enhancement
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm Any
: --- Affects Only Me
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-22 04:43 UTC by Emmanuel Vadot
Modified: 2016-01-13 09:54 UTC (History)
1 user (show)

See Also:


Attachments
patch i2c am335X (11.00 KB, patch)
2015-03-22 04:43 UTC, Emmanuel Vadot
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Emmanuel Vadot 2015-03-22 04:43:33 UTC
Created attachment 154646 [details]
patch i2c am335X

Hello,

This patch enhanced the i2c driver for AM335X.
This add support for read(2), write(2) and the required ioctl by i2c(8) (I2CSTART, I2CSTOP, I2CRPTSTART).
Now it is possible to dump the on-board eeprom with i2c :
i2c -a 0x50 -d r -w 16 -c 4096 -o 0 -b > eeprom.bin

Note:

The write syscall use an internal buffer of 1024 because in sys/dev/iicbus/iic.c it's limited to 1024.

Cheers,
Comment 1 Luiz Otavio O Souza,+55 (14) 99772-1255 freebsd_committer freebsd_triage 2015-03-24 18:59:59 UTC
I've explained to the OP on IRC that this change, as implemented here, has a few drawbacks:

- We would need to copy the same code to all i2c controllers;

- It does not do what an i2c user would expect.  An I2CSTART call, for example, will not generate a start condition on i2c bus.

I recommended that this logic (of using I2CRDWR instead of individual I2C events) could be moved to i2c(8), which in turn should support both methods for read, write and bus scan.
Comment 2 Emmanuel Vadot 2016-01-13 09:54:22 UTC
Closing this bug as https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198817 implement I2C_RDRW in i2c(8)