freebsd-dev/sys/dev/iicbus
Ian Lepore 844aff82a6 Allow i2c bus speed to be configured via hints, FDT data, and sysctl.
The current support for controlling i2c bus speed is an inconsistant mess.
There are 4 symbolic speed values defined, UNKNOWN, SLOW, FAST, FASTEST.
It seems to be universally assumed that SLOW means the standard 100KHz
rate from the original spec.  Nothing ever calls iicbus_reset() with a
speed of FAST, although some drivers would treat it as the 400KHz standard
speed.  Mostly iicbus_reset() is called with the speed set to UNKNOWN or
FASTEST, and there's really no telling what any individual driver will do
with those.

The speed of an i2c bus is limited by the speed of the slowest device on
the bus.  This means that generally the bus speed needs to be configured
based on the board/system and the components within it.  Historically for
i2c we've configured with device hints.  Newer systems use FDT data and it
documents a clock-frequency property for i2c busses.  Hobbyists and
developers are likely to want on the fly changes.  These changes provide
all 3 methods, but do not require any existing drivers to change to use
the new facilities.

This adds an iicbus method, iicbus_get_frequency(dev, speed) that gets the
frequency for the requested symbolic speed.  If the symbolic speed is SLOW
or if there is no speed configured for the bus, the returned value is
100KHz, always.  Otherwise, if bus speed is configured by hints, fdt,
tunable, or sysctl, that speed is returned.  It also adds a helper
function, iicbus_init_frequency() that any bus driver subclassed from
iicbus can initialize the frequency from some other source of info.

Initial driver implementations are provided for Freescale and TI.

Differential Revision:        https://reviews.freebsd.org/D1174
PR:		195009
2014-11-18 01:54:31 +00:00
..
ad7417.c
ad7418.c
adm1030.c Move the adm1030 driver to the proper location, and rename it. 2014-10-16 01:32:22 +00:00
adt746x.c Add driver for the ADT7460/ADT7467 fan controller found in later PowerBooks 2014-02-03 01:22:50 +00:00
ds133x.c
ds1374.c
ds1631.c Make more unsigned ints signed. 2013-12-07 22:25:07 +00:00
ds1672.c
ds1775.c Make more unsigned ints signed. 2013-12-07 22:25:07 +00:00
icee.c
if_ic.c Mechanically convert to if_inc_counter(). 2014-09-19 03:51:26 +00:00
iic.c Revert r268543. 2014-07-12 06:23:42 +00:00
iic.h Revert r268543. 2014-07-12 06:23:42 +00:00
iicbb_if.m
iicbb.c Allow the use of OFW I2C bus together with iicbb(4) on OFW-based systems. 2014-02-13 18:22:49 +00:00
iicbus_if.m Allow i2c bus speed to be configured via hints, FDT data, and sysctl. 2014-11-18 01:54:31 +00:00
iicbus.c Allow i2c bus speed to be configured via hints, FDT data, and sysctl. 2014-11-18 01:54:31 +00:00
iicbus.h Allow i2c bus speed to be configured via hints, FDT data, and sysctl. 2014-11-18 01:54:31 +00:00
iicoc.c
iicoc.h
iiconf.c Add a method to iicbus to request IIC_M_NOSTOP behaviour for multibyte 2014-10-27 07:51:26 +00:00
iiconf.h Revert r268543. 2014-07-12 06:23:42 +00:00
iicsmb.c
lm75.c Add the lm75 i2c digital temperature sensor driver. 2014-05-10 12:19:02 +00:00
max6690.c Check error return from reading integer part of temperature. 2014-10-12 23:48:55 +00:00
pcf8563.c
pcf8563reg.h
s35390a.c