opnsense-src/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 Do the ADC init only at startup and not during every sensor read call. 2012-08-19 19:31:36 +00:00
ad7418.c Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays 2013-01-30 18:01:20 +00:00
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 Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays 2013-01-30 18:01:20 +00:00
ds1374.c Don't include MIPS machine headers. There's no need for it. 2012-05-19 17:42:11 +00:00
ds1631.c Make more unsigned ints signed. 2013-12-07 22:25:07 +00:00
ds1672.c Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays 2013-01-30 18:01:20 +00:00
ds1775.c Make more unsigned ints signed. 2013-12-07 22:25:07 +00:00
icee.c Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays 2013-01-30 18:01:20 +00:00
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.c Allow the use of OFW I2C bus together with iicbb(4) on OFW-based systems. 2014-02-13 18:22:49 +00:00
iicbb_if.m Provide pre/post transfer method callbacks for icbbb 2012-03-01 20:58:20 +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
iicbus_if.m Allow i2c bus speed to be configured via hints, FDT data, and sysctl. 2014-11-18 01:54:31 +00:00
iicoc.c Driver for OpenCores I2C controller. 2012-03-27 10:44:32 +00:00
iicoc.h Driver for OpenCores I2C controller. 2012-03-27 10:44:32 +00:00
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 - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
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 It turns out that as documented, PCF8563_R_SECOND_VL (i.e. battery low) 2012-10-18 10:29:16 +00:00
pcf8563reg.h Add a driver for the NXP (Philips) PCF8563 RTC. 2012-04-13 23:07:32 +00:00
s35390a.c Remove unused variables. 2012-09-29 16:15:27 +00:00