summaryrefslogtreecommitdiffstats
path: root/sys/dev/iicbus
Commit message (Collapse)AuthorAgeFilesLines
* Fix iicbus_intr, iicbus_write and device_read_ivar prototypes...imp2009-02-104-9/+9
|
* Teach iic(4) the 'repeated start' I2C condition. This will be used by theraj2009-01-262-0/+6
| | | | | | | upcoming i2c(8) diag utility. Reviewed by: bms, stas Obtained from: Semihalf
* Change the probe priority for PCI and I2C generic bus modules fromnwhitehorn2009-01-201-1/+1
| | | | | | numerical constants to BUS_PROBE_GENERIC. Suggested by: jhb
* 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
* Import an Open Firmware I2C bus module. This attaches firmware device treenwhitehorn2009-01-151-0/+2
| | | | | | | | 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
* Change the way I2C bus attachment works to allow firmware-assisted busnwhitehorn2009-01-067-8/+10
| | | | | | | | | 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
* Streamline #include sections in ds133x and ds1672 drivers. This unbreaks theraj2008-09-082-14/+0
| | | | LINT build.
* ds133x: Introduce device_identify method; update NOTES.raj2008-09-081-1/+13
| | | | Obtained from: Semihalf
* Handle errors from device_get_chidlren.imp2008-08-231-2/+5
| | | | Free child list when there's more children than we expected.
* Fix compilation of arm's AVILA.ed2008-08-131-1/+1
| | | | | | | | | | | | | | | Compilation of the AVILA kernel failed because of two reasons: - It needed curthread, which is defined through <sys/pcpu.h>. - It still referred the softc's sc_mtx field, which has been replaced by sc_lock three weeks ago. To solve the first problem, I decided to include <sys/pcpu.h> in <sys/sx.h>, which also seems to be done by <sys/mutex.h> and <sys/rwlock.h>. Those header files also require curthread. Approved by: jhb
* Rework Dallas Semiconductor RTC support.raj2008-08-111-103/+229
| | | | | | | | | - Extend the DS1339 driver to recognize more chips in the family: DS1337, DS1338, DS1339 are now supported - Provide run-time chip detection Reviewed, tested by: stas Obtained from: Piotr Ziecik kosmo ! semihalf dot com
* Rename ds1339 -> ds133x to better fit the upcoming driver extensions.raj2008-08-111-0/+0
|
* - Reflect the iicbus infrastructure changes.stas2008-08-051-1/+1
| | | | Approved by: raj
* - Reflect changes in iic infrastructure.stas2008-08-051-1/+1
|
* Lock the consumers of the iicbus(4) infrastructure:jhb2008-08-043-103/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | - ad7418(4) uses an sx lock instead of a mtx since the iicbus(4) stuff it calls can sleep (request_bus()). Also, I expanded the locking slightly to serialize writes to data stored in the softc. - Similarly, the icee(4) driver now uses an sx lock instead of a mutex. I also removed the pointless OPENED flag and flags field from the softc. - The locking for the ic(4) driver was a bit trickier: - Add a mutex to the softc to protect softc data. - The driver uses malloc'd buffers that are the size of the interface MTU to send and receive packets. Previously, these were allocated every time the interface was brought up and anytime the MTU was changed, with various races that could result in memory leaks. I changed this to be a bit simpler and more like other NIC drivers in that we allocate buffers during attach for the default MTU size and only reallocate them on MTU changes. The reallocation procedure goes to some lengths with various flags to not replace either the the receive or transmit buffers while the driver is busy receiving or transmitting a packet. - Store the device_t of the driver in the softc instead of detours into new-bus using if_dunit from the ifnet and an even more bizarre detour to get the softc instead of using if_softc. - Drop the driver mutex when invoking netisr_dispatch() to pass the packet up to IP. - Use if_printf().
* Add locking to the core iicbus(4) drivers:jhb2008-08-045-106/+128
| | | | | | | | | | | | | | | | | | - 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.
* Add locking to the various iicbus(4) bridge drivers:jhb2008-08-041-10/+1
| | | | | | | | | | | | | | | | | | | | | - 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)
* - Add driver for Dallas Semiconductor DS1339 RTC sittingstas2008-07-251-0/+232
| | | | | | | | on I2C bus. Reviewed by: raj Approved by: imp MFC after: 2 week
* Explicitly lock Giant in smbus_if methods in the bktr_i2c and iicsmbjhb2008-06-061-8/+41
| | | | | drivers for now. This can be replaced with driver locks when these drivers are locked.
* Don't use spinlocks here. The iicbus transactions can take a longimp2007-04-171-3/+3
| | | | | time, and this prevents interrupts (say for Hz/hardclock) from happening. Time stands still during the transfers...
* New device: icee. Generic i2c eeprom driver.imp2007-03-231-0/+291
|
* MFp4: Make the iicbus fully hinted. We no longer automatically addimp2007-03-232-51/+123
| | | | | | | | | | | 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.
* MFp4: Make iicbus_trasnfer_gen suitable for bridge drivers. Use it in theimp2007-03-232-6/+12
| | | | bitbang bridge.
* MFp4: Create an ivar for each iic device on the iicbus. This ivarimp2007-03-231-1/+24
| | | | holds the device's address.
* const poisonimp2006-12-053-3/+3
| | | | submitted by: john wehle
* More properly cleanup the iicbus child when deleting it.imp2006-12-051-6/+27
| | | | | | | These are from patches by John Wehle, but the commentary has been updated by me. Obtained from: ports/multimedia/pvr250, indirectly
* Reference Hauppage's cxm_iic bit-bang device here.imp2006-12-051-0/+5
| | | | | | | | 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.
* Add a fake flag for write. Many drivers have started to use it and itimp2006-11-281-1/+2
| | | | | | seems like a good idea. Submitted by: sam
* Remove unused leftovers.imp2006-11-281-9/+0
|
* MFp4: Add ixpiic bit-bang driver.imp2006-11-221-0/+1
| | | | Submitted by: sam@
* <blush> copyout on read, not write.imp2006-11-221-2/+2
| | | | Tweak a comment while I'm here.
* o define transfer methodsam2006-11-191-0/+4
| | | | | | o attach ds1672 and ad7418, to be cleaned up MFC after: 1 month
* i2c and clock driver for Dallas Semiconductor DS1672 RTCsam2006-11-191-0/+142
| | | | MFC after: 1 month
* i2c driver for Analog Devices AD7418sam2006-11-191-0/+234
| | | | MFC after: 1 month
* Minor overhaul of SMBus support:jhb2006-09-111-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Change smbus_callback() to pass a void * rather than caddr_t. - Change smbus_bread() to pass a pointer to the count and have it be an in/out parameter. The input is the size of the buffer (same as before), but on return it will contain the actual amount of data read back from the bus. Note that this value may be larger than the input value. It is up to the caller to treat this as an error if desired. - Change the SMB_BREAD ioctl to write out the updated struct smbcmd which will contain the actual number of bytes read in the 'count' field. To preserve the previous ABI, the old ioctl value is mapped to SMB_OLD_BREAD which doesn't copy the updated smbcmd back out to userland. I doubt anyone actually used the old BREAD anyway as it was rediculous to do a bulk-read but not tell the using program how much data was actually read. - Make the smbus driver and devclass public in the smbus module and push all the DRIVER_MODULE()'s for attaching the smbus driver to various foosmb drivers out into the foosmb modules. This makes all the foosmb logic centralized and allows new foosmb modules to be self-contained w/o having to hack smbus.c everytime a new smbus driver is added. - Add a new SMB_EINVAL error bit and use it in place of EINVAL to return an error for bad arguments (such as invalid counts for bread and bwrite). - Map SMB bus error bits to EIO in smbus_error(). - Make the smbus driver call bus_generic_probe() and require child drivers such as smb(4) to create device_t's via identify routines. Previously, smbus just created one anonymous device during attach, and if you had multiple drivers that could attach it was just random chance as to which driver got to probe for the sole device_t first. - Add a mutex to the smbus(4) softc and use it in place of dummy splhigh() to protect the 'owner' field and perform necessary synchronization for smbus_request_bus() and smbus_release_bus(). - Change the bread() and bwrite() methods of alpm(4), amdpm(4), and viapm(4) to only perform a single transaction and not try to use a loop of multiple transactions for a large request. The framing and commands to use for a large transaction depend on the upper-layer protocol (such as SSIF for IPMI over SMBus) from what I can tell, and the smb(4) driver never allowed bulk read/writes of more than 32-bytes anyway. The other smb drivers only performed single transactions. - Fix buffer overflows in the bread() methods of ichsmb(4), alpm(4), amdpm(4), amdsmb(4), intpm(4), and nfsmb(4). - Use SMB_xxx errors in viapm(4). - Destroy ichsmb(4)'s mutex after bus_generic_detach() to avoid problems from child devices making smb upcalls that would use the mutex during their detach methods. MFC after: 1 week Reviewed by: jmg (mostly)
* 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
|
* Minor style(9) treatment to make things a little more consistantimp2006-08-212-20/+33
| | | | within iicbus code.
* Allow iic bridges to support a generalized transfer, rather thanimp2006-07-147-12/+117
| | | | | | | | | 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.
* remove DRIVER_MODULE lines that are useless... pcf doesn't exist (onlyjmg2006-04-171-2/+0
| | | | | | | 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
* newbus will zero softc, so no need to duplicate the zeroing here.imp2006-04-043-13/+1
| | | | Plus a minor formatting nit in nearby code.
* Turn a file that was mostly style(9) compliant to a file that's really closeimp2006-04-041-141/+115
| | | | | to being completely style(9). The odd-ball indentation in a few places was really distracting.
* Replace hard coded '0' with symbolic constant IIC_UNKNOWN to reflect whatimp2006-04-041-1/+1
| | | | we're actually doing.
* Remove public declarations of variables that were forgotten when they wereobrien2005-08-101-2/+0
| | | | made static.
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-5/+7
| | | | | | | | | | | | | | IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days
* Fix some long standing bugs in writing to the BPF device attached todwmalone2005-06-261-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | a DLT_NULL interface. In particular: 1) Consistently use type u_int32_t for the header of a DLT_NULL device - it continues to represent the address family as always. 2) In the DLT_NULL case get bpf_movein to store the u_int32_t in a sockaddr rather than in the mbuf, to be consistent with all the DLT types. 3) Consequently fix a bug in bpf_movein/bpfwrite which only permitted packets up to 4 bytes less than the MTU to be written. 4) Fix all DLT_NULL devices to have the code required to allow writing to their bpf devices. 5) Move the code to allow writing to if_lo from if_simloop to looutput, because it only applies to DLT_NULL devices but was being applied to other devices that use if_simloop possibly incorrectly. PR: 82157 Submitted by: Matthew Luckie <mjl@luckie.org.nz> Approved by: re (scottl)
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-101-14/+18
| | | | | | | | | | | | | | | | | | | | struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-062-2/+2
|
* Since if_ic doesn't contain locking or run with INTR_MPSAFE, markrwatson2004-08-131-1/+2
| | | | the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-6/+6
| | | | Bump __FreeBSD_version accordingly.
OpenPOWER on IntegriCloud