History log of /freebsd-10.3-release/sys/dev/iicbus/iicbus.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 296373 04-Mar-2016 marius

- Copy stable/10@296371 to releng/10.3 in preparation for 10.3-RC1
builds.
- Update newvers.sh to reflect RC1.
- Update __FreeBSD_version to reflect 10.3.
- Update default pkg(8) configuration to use the quarterly branch.

Approved by: re (implicit)

# 294490 21-Jan-2016 dumbbell

iicbus: Use device_delete_children() instead of explicit child removal

If the bus is detached and deleted by a call to device_delete_child() or
device_delete_children() on a device higher in the tree, I²C children
were already detached and deleted. So the device_t pointer stored in sc
points to freed memory: we must not try to delete it again.

By using device_delete_children(), we let subr_bus.c figure out if there
are children to take care of.

While here, make sure iicbus_detach() and iicoc_detach() call
device_delete_children() too, to be safe.

Reviewed by: jhb, imp
Approved by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D3926


# 294489 21-Jan-2016 dumbbell

iicbus: Remove trailing whitespaces

MFC of: r289656


# 276278 27-Dec-2014 ian

MFC r274641, r274644, r274822, r276049:

Allow i2c bus speed to be configured via hints, FDT data, and sysctl.

Implement bus speed setting for OMAP4, AM335x, and imx5/6.

Fix the i2c bus speed divisors for TI OMAP4 and AM335x to give the
advertised 100, 400, and 1000 KHz speeds.

PR: 195009


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 228257 04-Dec-2011 adrian

Allow the i2c node requirements to be slightly relaxed.

These realtek switch PHYs speak a variant of i2c with some slightly
modified handling.

From the submitter, slightly modified now that some further digging
has been done:

The I2C framework makes a assumption that the read/not-write bit of the first
byte (the address) indicates whether reads or writes are to follow.

The RTL8366 family uses the bus: after sending the address+read/not-write byte,
two register address bytes are sent, then the 16-bit register value is sent
or received. While the register write access can be performed as a 4-byte
write, the read access requires the read bit to be set, but the first two bytes
for the register address then need to be transmitted.

This patch maintains the i2c protocol behaviour but allows it to be relaxed
(for these kinds of switch PHYs, and whatever else Realtek may do with this
almost-but-not-quite i2c bus) - by setting the "strict" hint to 0.
The "strict" hint defaults to 1.

Submitted by: Stefan Bethke <stb@lassitu.de>


# 227843 22-Nov-2011 marius

- There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
(bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
since r52045) but even recently added device drivers do this unnecessarily.
Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
Discussed with: jhb
- Also while at it, use __FBSDID.


# 212413 10-Sep-2010 avg

bus_add_child: change type of order parameter to u_int

This reflects actual type used to store and compare child device orders.
Change is mostly done via a Coccinelle (soon to be devel/coccinelle)
semantic patch.
Verified by LINT+modules kernel builds.

Followup to: r212213
MFC after: 10 days


# 209800 08-Jul-2010 nwhitehorn

Fix iicbus_get_addr() on 64-bit big-endian systems. The bus accessor
passes a uintptr_t, not a uint32_t.


# 188461 10-Feb-2009 imp

Fix iicbus_intr, iicbus_write and device_read_ivar prototypes...


# 187457 20-Jan-2009 nwhitehorn

Change the probe priority for PCI and I2C generic bus modules from
numerical constants to BUS_PROBE_GENERIC.

Suggested by: jhb


# 187261 15-Jan-2009 nwhitehorn

Import an Open Firmware I2C bus module. This attaches firmware device tree
indicated I2C devices, and provides an ofw_bus interface for driver probing.
This should be MI, but is currently provided only on PowerPC due to lack of
sparc64 hardware with an I2C controller.

Discussed on: freebsd-arch


# 186833 06-Jan-2009 nwhitehorn

Change the way I2C bus attachment works to allow firmware-assisted bus
subclasses as are available with PCI. Changes I2C device drivers without
real probe logic to return BUS_PROBE_NOWILDWARD to avoid interference with
firmware bus enumeration, and reduces the probe priority of the iicbus
base driver to allow subclass attachment at higher priority.

Discussed on: freebsd-arch


# 181304 04-Aug-2008 jhb

Add locking to the core iicbus(4) drivers:
- Add an sx lock to the iic(4) driver to serialize open(), close(), read(),
and write and to protect sc_addr and sc_count in the softc.
- Use cdev->si_drv1 instead of using the minor number of the cdev to
lookup the softc via newbus in iic(4).
- Store the device_t in the softc to avoid a similar detour via minor
numbers in iic(4).
- Only add at most one instance of iic(4) and iicsmb(4) to each iicbus(4)
instance, and do it in the child driver.
- Add a mutex to the iicbus(4) softc to synchronize the request/release bus
stuff.
- Use __BUS_ACCESSOR() for IICBUS_ACCESSOR() instead of rolling our own.
- Add a mutex to the iicsmb(4) softc to protect softc state updated in the
interrupt handler.
- Remove Giant from all the smbus methods in iicsmb(4) now that all the
iicbus(4) backend is locked.


# 167856 23-Mar-2007 imp

MFp4: Make the iicbus fully hinted. We no longer automatically add
some devices (and not others). To get instances onto the iicbus, one
now needs hints or an identify routine. We also do not probe the bus
for devices because many iic devices cannot be safely probed (and when
they can, the probe order turns out to be somewhat difficult to get
right).

# I'm not 100% sure that the iicsmb removal is right. Please contact me if
# this causes difficulty.


# 164421 19-Nov-2006 sam

o define transfer method
o attach ds1672 and ad7418, to be cleaned up

MFC after: 1 month


# 160372 14-Jul-2006 imp

Allow iic bridges to support a generalized transfer, rather than
forcing all transfers to do the start read/write stop by hand. Some
smart bridges prefer this sort of operation, and this allows us to
support their features more easily. When bridges don't support it, we
fall back to using the old-style opertaions. Expand the ioctl
interface to expose this function. Unlike the old-style interface,
this interface is thread safe, even on old bridges.


# 157827 17-Apr-2006 jmg

remove DRIVER_MODULE lines that are useless... pcf doesn't exist (only
as pcf_ebus and pcf_isa, they should probably be fixed back to pcf),
and bti2c doesn't exist, bktr has smbus or iicbb as children..

Brought to you by: http://people.FreeBSD.org/~jmg/driver.pdf


# 129778 27-May-2004 joerg

Make "envctrl" a known master driver for iicbus.


# 129289 16-May-2004 joerg

After successfully attaching an iicbus instance, instead of using a
NULL name in device_add_child(), explicitly name all of our known
child drivers in order to give them a chance to attach to us.
Otherwise, only the first one present would be probed and attached.

Reviewed by: nsouch
MFC after: 1 month


# 129152 12-May-2004 joerg

Convert the #if 0 magic to #if SCAN_IICBUS, and make it actually compile
again. While it's not generally recommended anymore, it might still prove
useful for debugging purposes.


# 119418 24-Aug-2003 obrien

Use __FBSDID().
Also some minor style cleanups.


# 93023 23-Mar-2002 nsouch

Major rework of the iicbus/smbus framework:

- VIA chipset SMBus controllers added
- alpm driver updated
- Support for dynamic modules added
- bktr FreeBSD smbus updated but not tested
- cleanup


# 87599 10-Dec-2001 obrien

Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.


# 67164 15-Oct-2000 phk

Remove unneeded #include <machine/clock.h>


# 54073 03-Dec-1999 mdodd

Remove the 'ivars' arguement to device_add_child() and
device_add_child_ordered(). 'ivars' may now be set using the
device_set_ivars() function.

This makes it easier for us to change how arbitrary data structures are
associated with a device_t. Eventually we won't be modifying device_t
to add additional pointers for ivars, softc data etc.

Despite my best efforts I've probably forgotten something so let me know
if this breaks anything. I've been running with this change for months
and its been quite involved actually isolating all the changes from
the rest of the local changes in my tree.

Reviewed by: peter, dfr


# 52776 01-Nov-1999 nsouch

Sync with RELENG_3.


# 50477 28-Aug-1999 peter

$Id$ -> $FreeBSD$


# 49195 29-Jul-1999 mdodd

Alter the behavior of sys/kern/subr_bus.c:device_print_child()

- device_print_child() either lets the BUS_PRINT_CHILD
method produce the entire device announcement message or
it prints "foo0: not found\n"

Alter sys/kern/subr_bus.c:bus_generic_print_child() to take on
the previous behavior of device_print_child() (printing the
"foo0: <FooDevice 1.1>" bit of the announce message.)

Provide bus_print_child_header() and bus_print_child_footer()
to actually print the output for bus_generic_print_child().
These functions should be used whenever possible (unless you can
just use bus_generic_print_child())

The BUS_PRINT_CHILD method now returns int instead of void.

Modify everything else that defines or uses a BUS_PRINT_CHILD
method to comply with the above changes.

- Devices are 'on' a bus, not 'at' it.
- If a custom BUS_PRINT_CHILD method does the same thing
as bus_generic_print_child(), use bus_generic_print_child()
- Use device_get_nameunit() instead of both
device_get_name() and device_get_unit()
- All BUS_PRINT_CHILD methods return the number of
characters output.

Reviewed by: dfr, peter


# 46743 08-May-1999 dfr

Move the declaration of the interrupt type from the driver structure
to the BUS_SETUP_INTR call.


# 45575 11-Apr-1999 eivind

Staticize.


# 42442 09-Jan-1999 nsouch

Change /dev/smb and /dev/iic interface to allow user programs to interact with
devices dynamically. That means,

+ only one /dev/iic or /dev/smb device for each smb/iic bus to access
+ I2C/SMB device address must be given to any ioctl
+ new devices may be plugged and accessed after boot, which was
impossible previously (device addresses were hardcoded into
the kernel)


# 41591 07-Dec-1998 archie

The "easy" fixes for compiling the kernel -Wunused: remove unreferenced static
and local variables, goto labels, and functions declared but not defined.


# 41296 22-Nov-1998 nsouch

Remove broken and useless intr interface.

Submitted by: Doug Rabson <dfr@nlsystems.com>
Amancio Hasty <hasty@rah.star-gate.com>

Avoid compile warnings.


# 41015 08-Nov-1998 nsouch

Check if devclass exists for probed devices before
declaring the device 'alive'.


# 40992 07-Nov-1998 nsouch

Add iic driver iff the corresponding devclass exists.


# 40782 31-Oct-1998 nsouch

iicbb is generic support for I2C bit-banging.

Other files: timeout management added to the I2C framework.


# 38775 03-Sep-1998 nsouch

This commit was generated by cvs2svn to compensate for changes in r38774,
which included commits to RCS files with non-trunk default branches.


# 38774 03-Sep-1998 nsouch

Submitted by: nsouch
Philips I2C bus generic support other new bus architecture.