History log of /freebsd-10.3-release/sys/dev/iicbus/iicbb.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


# 266105 15-May-2014 loos

MFC r258046, r258047, r258050, r259035, r259036, r259037, r261842, r261843,
r261844, r261845, r261846, r262194, r262522, r262559

r258046:
Fix a typo on a comment in ofw_bus_if.m, the default method will return -1
when a node doesn't exist.

r258047:
Move the KASSERT() check to the point before the increase of number of pins.

r258050:
Fix gpiobus to return BUS_PROBE_GENERIC insted of BUS_PROBE_SPECIFIC (0) so
it can be overriden by its OFW/FDT version.

Give a chance for GPIO devices that implement the device_identify method to
attach.

r259035:
Remove unnecessary includes and an unused softc variable. While here apply
two minor style(9) fixes.

r259036:
Move the GPIOBUS_SET_PINFLAGS(..., ..., pin, GPIO_PIN_OUTPUT) to led(4)
control callback function. This makes gpioled(4) works even if the pin
is accidentally set to an input.

r259037:
Fix the pin value reading on AM335x. Because of the inverted logic it was
always returning '0' for all the reads, even for the outputs. It is now
known to work with gpioiic(4) and gpioled(4).

r261842:
Add an OFW GPIO compatible bus. This allows the use of the DTS files to
describe GPIO bindings in the system.

Move the GPIOBUS lock macros to gpiobusvar.h as they are now shared between
the OFW and the non OFW versions of GPIO bus.

Export gpiobus_print_pins() so it can also be used on the OFW GPIO bus.

r261843:
Add OFW support to the in tree gpio compatible devices: gpioiic(4) and
gpioled(4).

Tested on RPi and BBB (using the hardware I2C controller and gpioiic(4) for
the I2C tests). It was also verified for regressions on RSPRO (MIPS/ar71xx)
used as reference for a non OFW-based system.

Update the gpioled(4) and gpioiic(4) man pages with some details and
examples about the FDT/OFW support.

Some compatibility details pointed out by imp@ will follow in subsequent
commits.

r261844:
Allow the use of OFW I2C bus together with iicbb(4) on OFW-based systems.

This change makes ofw_iicbus attach to iicbb(4) controllers in addition to
the already supported i2c host bridges (iichb).

On iicbb(4) allow the direct access of the OFW parent node by its children,
so they can be directly attached to iicbb(4) node on the DTS without the
need of describing the i2c bus.

r261845:
Allow the use of the OFW GPIO bus for ti_gpio and bcm2835_gpio. With this
change the gpio children can be described as directly connected to the GPIO
controller without the need of describing the OFW GPIO bus itself on the
DTS file.

With this commit the OFW GPIO bus is fully functional on BBB and RPi.

GPIO controllers which want to use the OFW GPIO bus will need similar
changes.

r261846:
Make the gpioled(4) work out of the box on BBB.

Add gpioled(4) to BEAGLEBONE kernel and add the description of the four
on-board leds of beaglebone-black to its DTS file.

r262194:
Remove an unnecessary header.

r262522:
Fix make depend for iicbus.

r262559:
Inspired by r262522, fix make depend. This fixes the build of gpio modules.


# 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


# 232365 01-Mar-2012 kan

Provide pre/post transfer method callbacks for icbbb
clients.

These are helful when making certain drivers work on both Linux
and FreeBSD without changing the code flow too much.

Reviewed by: kib, wlosh
MFC after: 1 month


# 228728 20-Dec-2011 adrian

IIC bitbang changes - prepare to make the bit delay configurable; debug print changes.

* Right now the delay is hard coded at 10uS. This is a bit long when doing lots
of periodic i2c transactions. So create a 'udelay' parameter and initialise it
to 10. This can be tuned later.

* Add a newline after a transaction finishes, so the debugging output isn't so
horrible.


# 188461 10-Feb-2009 imp

Fix iicbus_intr, iicbus_write and device_read_ivar prototypes...


# 181303 04-Aug-2008 jhb

Add locking to the various iicbus(4) bridge drivers:
- Just grab Giant in the ixp425_iic(4) driver since this driver uses
a shared address/data register window pair to access the actual
I2C registers. None of the other ixp425 drivers lock access to these
shared address/data registers yet and that would need to be done before
this could use any meaningful locking.
- Add locking to the interrupt handler and 'iicbus_reset' methods of the
at91_twi(4) driver.
- Add locking to the pcf(4) driver. Other pcf(4) fixes include:
- Don't needlessly zero the softc.
- Use bus_foo rather than bus_space_foo and remove bus space tag and
handle from softc.
- The lpbb(4) driver just grabs Giant for now. This will be refined later
when ppbus(4) is locked.
- As was done with smbus earlier, move the DRIVER_MODULE() lines to match
the bus driver (either iicbus or iicbb) to the bridge driver into the
bridge drivers.

Tested by: sam (arm/ixp425)


# 167855 23-Mar-2007 imp

MFp4: Make iicbus_trasnfer_gen suitable for bridge drivers. Use it in the
bitbang bridge.


# 164900 05-Dec-2006 imp

More properly cleanup the iicbus child when deleting it.

These are from patches by John Wehle, but the commentary has been
updated by me.

Obtained from: ports/multimedia/pvr250, indirectly


# 164897 05-Dec-2006 imp

Reference Hauppage's cxm_iic bit-bang device here.
Add a note that suggests a cleanup.

Note: This patch was derived based on looking at the pvrxxx/pvr250
ports' Makefiles only, and may be incomplete. It is not derived from
anything I saw from Hauppage.


# 164502 22-Nov-2006 imp

MFp4: Add ixpiic bit-bang driver.

Submitted by: sam@


# 161516 21-Aug-2006 imp

Minor style(9) treatment to make things a little more consistant
within iicbus code.


# 157523 04-Apr-2006 imp

newbus will zero softc, so no need to duplicate the zeroing here.
Plus a minor formatting nit in nearby code.


# 119418 24-Aug-2003 obrien

Use __FBSDID().
Also some minor style cleanups.


# 116559 19-Jun-2003 jmg

make iicbb_devclass and iicbb_driver globally visible. This will let
drivers that implemnt the i2c bit banging bus interface not have to
recompile iicbb in order to add an attachment for it.

This will mean the bktr and other definitions can go back to their
respective drivers.


# 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


# 67164 15-Oct-2000 phk

Remove unneeded #include <machine/clock.h>


# 61722 16-Jun-2000 jake

Allow these drivers to be detached.

Reviewed by: mdodd


# 59391 19-Apr-2000 phk

Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>


# 59368 18-Apr-2000 phk

Remove unneeded <sys/buf.h> includes.

Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks
by 924 bytes.


# 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.


# 43345 28-Jan-1999 roger

Submitted by: Nicolas Souchu <nsouch@freebsd.org>

Added support required by bt848 driver for MSP34xx audio chip


# 40914 04-Nov-1998 nsouch

Properly reset parent to get interface addr.


# 40782 31-Oct-1998 nsouch

iicbb is generic support for I2C bit-banging.

Other files: timeout management added to the I2C framework.