summaryrefslogtreecommitdiffstats
path: root/sys/dev/iicbus/iic.c
Commit message (Collapse)AuthorAgeFilesLines
* Teach iic(4) the 'repeated start' I2C condition. This will be used by theraj2009-01-261-0/+5
| | | | | | | upcoming i2c(8) diag utility. Reviewed by: bms, stas Obtained from: Semihalf
* Revert revision 186833 and try a different strategy to allow this device tonwhitehorn2009-01-151-2/+6
| | | | | | | | | | | work when the bus attaches its own children. Instead of hardcoding a unit number and returning BUS_PROBE_NOWILDCARD, which will break multiple iicbus systems, check in the probe routine whether the device address is 0. Real I2C devices will never have this address, but devices added with BUS_ADD_CHILD() will. Requested by: jhb Reviewed by: jhb
* Change the way I2C bus attachment works to allow firmware-assisted busnwhitehorn2009-01-061-2/+2
| | | | | | | | | 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
* Add locking to the core iicbus(4) drivers:jhb2008-08-041-40/+81
| | | | | | | | | | | | | | | | | | - 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.
* MFp4: Make the iicbus fully hinted. We no longer automatically addimp2007-03-231-5/+4
| | | | | | | | | | | 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.
* <blush> copyout on read, not write.imp2006-11-221-2/+2
| | | | Tweak a comment while I'm here.
* jhb points out that these mallocs don't need to be checked becauseimp2006-09-061-16/+0
| | | | of M_WAITOK.
* MFp4: check the return value of malloc and report an error when invalid.imp2006-09-061-0/+16
|
* Allow iic bridges to support a generalized transfer, rather thanimp2006-07-141-1/+28
| | | | | | | | | 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.
* newbus will zero softc, so no need to duplicate the zeroing here.imp2006-04-041-7/+1
| | | | Plus a minor formatting nit in nearby code.
* Replace hard coded '0' with symbolic constant IIC_UNKNOWN to reflect whatimp2006-04-041-1/+1
| | | | we're actually doing.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-6/+6
| | | | Bump __FreeBSD_version accordingly.
* Another candidate that didn't use copyin/copyout for user<->kerneljoerg2004-05-161-3/+23
| | | | | | transfers. MFC after: 1 month
* Device megapatch 4/6:phk2004-02-211-0/+2
| | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
* Device megapatch 1/6:phk2004-02-211-2/+0
| | | | | | | Free approx 86 major numbers with a mostly automatically generated patch. A number of strategic drivers have been left behind by caution, and a few because they still (ab)use their major number.
* Don't hardcode unit numer '0'.ticso2003-08-101-1/+1
| | | | We can have multiple instances.
* Gigacommit to improve device-driver source compatibility betweenphk2003-03-031-13/+7
| | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl)
* move <machine/iic.h> and <machine/smb.h> to <dev/iicbus/iic.h> andpeter2002-09-191-3/+1
| | | | <dev/smbus/smb.h> - there is nothing MD about these ioctl definitions.
* Major rework of the iicbus/smbus framework:nsouch2002-03-231-19/+50
| | | | | | | | - VIA chipset SMBus controllers added - alpm driver updated - Support for dynamic modules added - bktr FreeBSD smbus updated but not tested - cleanup
* Update to C99, s/__FUNCTION__/__func__/,obrien2001-12-101-2/+2
| | | | also don't use ANSI string concatenation.
* KSE Milestone 2julian2001-09-121-3/+3
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Send the remains (such as I have located) of "block major numbers" tophk2001-03-261-1/+0
| | | | the bit-bucket.
* Remove unneeded #include <machine/clock.h>phk2000-10-151-1/+0
|
* Remove ~25 unneeded #include <sys/conf.h>phk2000-04-191-1/+0
| | | | Remove ~60 unneeded #include <sys/malloc.h>
* Remove unneeded <sys/buf.h> includes.phk2000-04-181-1/+0
| | | | | Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks by 924 bytes.
* Convert iic to use make_dev() rather than cdevsw_add(). This stops thepeter1999-11-181-1/+3
| | | | | annoying 'iic is usurping iic's cdevsw' type messages. (Yes, there are other ways to fix cdevsw_add(), but that is a doomed api)
* Use cdevsw_add() explicitly and DRIVER_MODULE().peter1999-11-081-1/+2
|
* Fix: WARNING: "iic" is usurping "iic"'s cdevsw[] - the DEV_DRIVER_MODULE()peter1999-10-041-4/+0
| | | | takes care of the cdevsw_add() - it doesn't need to be done twice.
* Remove five now unused fields from struct cdevsw. They should neverphk1999-09-251-5/+0
| | | | | | | | have been there in the first place. A GENERIC kernel shrinks almost 1k. Add a slightly different safetybelt under nostop for tty drivers. Add some missing FreeBSD tags
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Remove cmaj and bmaj args from DEV_DRIVER_MODULE.phk1999-07-041-3/+2
|
* Simplify cdevsw registration.phk1999-05-311-17/+5
| | | | | | | | | | | | | | | | | | | | | | | | | The cdevsw_add() function now finds the major number(s) in the struct cdevsw passed to it. cdevsw_add_generic() is no longer needed, cdevsw_add() does the same thing. cdevsw_add() will print an message if the d_maj field looks bogus. Remove nblkdev and nchrdev variables. Most places they were used bogusly. Instead check a dev_t for validity by seeing if devsw() or bdevsw() returns NULL. Move bdevsw() and devsw() functions to kern/kern_conf.c Bump __FreeBSD_version to 400006 This commit removes: 72 bogus makedev() calls 26 bogus SYSINIT functions if_xe.c bogusly accessed cdevsw[], author/maintainer please fix. I4b and vinum not changed. Patches emailed to authors. LINT probably broken until they catch up.
* This commit should be a extensive NO-OP:phk1999-05-301-5/+22
| | | | | | | | | | | | | Reformat and initialize correctly all "struct cdevsw". Initialize the d_maj and d_bmaj fields. The d_reset field was not removed, although it is never used. I used a program to do most of this, so all the files now use the same consistent format. Please keep it that way. Vinum and i4b not modified, patches emailed to respective authors.
* Unconfuse DEV_MODULE() and DEV_DRIVER_MODULE() about the difference betweenphk1999-05-091-2/+2
| | | | a major number for a dev_t.
* Move the declaration of the interrupt type from the driver structuredfr1999-05-081-2/+1
| | | | to the BUS_SETUP_INTR call.
* Continue where Julian left off in July 1998:phk1999-05-071-3/+3
| | | | | | | | | | | | | | Virtualize bdevsw[] from cdevsw. bdevsw() is now an (inline) function. Join CDEV_MODULE and BDEV_MODULE to DEV_MODULE (please pay attention to the order of the cmaj/bmaj arguments!) Join CDEV_DRIVER_MODULE and BDEV_DRIVER_MODULE to DEV_DRIVER_MODULE (ditto!) (Next step will be to convert all bdev dev_t's to cdev dev_t's before they get to do any damage^H^H^H^H^H^Hwork in the kernel.)
* Handle correctly iicbus request/release mechanism. Add iicbus allocationnsouch1999-02-131-1/+19
| | | | to the general purpose i/o iic(4) driver.
* Change /dev/smb and /dev/iic interface to allow user programs to interact withnsouch1999-01-091-3/+13
| | | | | | | | | | 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)
* The "easy" fixes for compiling the kernel -Wunused: remove unreferenced staticarchie1998-12-071-3/+1
| | | | and local variables, goto labels, and functions declared but not defined.
* iicbb is generic support for I2C bit-banging.nsouch1998-10-311-3/+3
| | | | Other files: timeout management added to the I2C framework.
* Major number allocated for generic I2C i/o -> 105nsouch1998-09-091-5/+4
|
* Device registration temporaly removed until major number allocation ok.nsouch1998-09-041-4/+5
|
* Submitted by: nsouchnsouch1998-09-031-0/+257
Philips I2C bus generic support other new bus architecture.
OpenPOWER on IntegriCloud