Skip to content

Commit

Permalink
MFC r362042: iicbb: rebuild the bit-banging algorithms using differen…
Browse files Browse the repository at this point in the history
…t primitives

I2C_SET was quite inflexible, it used too long delays as well as some
unnecessary delays.  The new building blocks are iicbb_clockin and
iicbb_clockout.  The former sets SDA and starts the high period of SCL,
the latter executes the low period of SCL.  What happens during the high
phase depends on the operation.  For writes we just hold both lines, for
reads we poll SDA.  S, Sr and P change SDA in the middle of the high
period.

Also, the calculation of udelay has been updated, so that the resulting
period more closely corresponds the requested bus frequency.  There is a
new knob, io_delay, that allows to further adjust udelay based on the
estimated latency of pin toggling operations.

Finally, I slightly changed debug tracing and added error indicators to
it.  The debug prints are compiled in but disabled by default.  This can
be of use if there is any fallout from this change.
  • Loading branch information
avg-I committed Aug 6, 2020
1 parent a5816e6 commit 72bfae3
Showing 1 changed file with 225 additions and 137 deletions.

0 comments on commit 72bfae3

Please sign in to comment.