aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/iicbus
Commit message (Collapse)AuthorAgeFilesLines
* MFC r223741:Bjoern A. Zeeb2012-02-101-0/+1
| | | | | | | | | | | | Tag mbufs of all incoming frames or packets with the interface's FIB setting (either default or if supported as set by SIOCSIFFIB, e.g. from ifconfig). Submitted by: Alexander V. Chernikov (melifaro ipfw.ru) Reviewed by: julian Notes: svn path=/stable/8/; revision=231380
* MFC: r227843 (partial)Marius Strobl2012-01-292-11/+6
| | | | | | | | | | | | | | - 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. Notes: svn path=/stable/8/; revision=230714
* MFC: r226398, r226442Christian Brueffer2011-10-231-1/+1
| | | | | | | | Move the allocation of usrbufs down a few lines to avoid leaking it in case of an error. Notes: svn path=/stable/8/; revision=226668
* MFC r208839,214999:Nathan Whitehorn2010-11-232-5/+31
| | | | | | | | | | Add two new flags (IIC_M_NOSTOP and IIC_M_NOSTART) to struct iic_msg to allow consumers of iicbus_transfer() to send messages with repeated starts. Reviewed by: imp, thompsa Notes: svn path=/stable/8/; revision=215749
* MFC r207554:Maxim Sobolev2010-11-151-1/+1
| | | | | | | | | | | | Add new tunable 'net.link.ifqmaxlen' to set default send interface queue length. The default value for this parameter is 50, which is quite low for many of today's uses and the only way to modify this parameter right now is to edit if_var.h file. Also add read-only sysctl with the same name, so that it's possible to retrieve the current value. Notes: svn path=/stable/8/; revision=215342
* MFC r212413: bus_add_child: change type of order parameter to u_intAndriy Gapon2010-09-201-1/+1
| | | | Notes: svn path=/stable/8/; revision=212892
* - Rename ds1672 and ds133x devices to "ds1672_rtc" and "ds133x_rtc"Stanislav Sedov2009-04-212-2/+2
| | | | | | | | | | | respectivly. This will allow one to have a kernel with both devices present and use it for multiple boards with different types of RTC sitting on a bus. Discussed with: imp Notes: svn path=/head/; revision=191369
* - Give a warning and start the oscillator if it was not previouslyStanislav Sedov2009-04-201-19/+66
| | | | | | | | | | | runned. - Rename ds1672 -> rtc to follow the other drivers. - Refactor/simplify the code a bit. MFC after: 2 weeks Notes: svn path=/head/; revision=191322
* Change if_output to take a struct route as its fourth argument in orderKip Macy2009-04-161-2/+2
| | | | | | | | | to allow passing a cached struct llentry * down to L2 Reviewed by: rwatson Notes: svn path=/head/; revision=191148
* Fix iicbus_intr, iicbus_write and device_read_ivar prototypes...Warner Losh2009-02-104-9/+9
| | | | Notes: svn path=/head/; revision=188461
* Teach iic(4) the 'repeated start' I2C condition. This will be used by theRafal Jaworowski2009-01-262-0/+6
| | | | | | | | | | upcoming i2c(8) diag utility. Reviewed by: bms, stas Obtained from: Semihalf Notes: svn path=/head/; revision=187709
* Change the probe priority for PCI and I2C generic bus modules fromNathan Whitehorn2009-01-201-1/+1
| | | | | | | | | numerical constants to BUS_PROBE_GENERIC. Suggested by: jhb Notes: svn path=/head/; revision=187457
* Revert revision 186833 and try a different strategy to allow this device toNathan Whitehorn2009-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 Notes: svn path=/head/; revision=187321
* Import an Open Firmware I2C bus module. This attaches firmware device treeNathan Whitehorn2009-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 Notes: svn path=/head/; revision=187261
* Change the way I2C bus attachment works to allow firmware-assisted busNathan Whitehorn2009-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 Notes: svn path=/head/; revision=186833
* Streamline #include sections in ds133x and ds1672 drivers. This unbreaks theRafal Jaworowski2008-09-082-14/+0
| | | | | | | LINT build. Notes: svn path=/head/; revision=182872
* ds133x: Introduce device_identify method; update NOTES.Rafal Jaworowski2008-09-081-1/+13
| | | | | | | Obtained from: Semihalf Notes: svn path=/head/; revision=182870
* Handle errors from device_get_chidlren.Warner Losh2008-08-231-2/+5
| | | | | | | Free child list when there's more children than we expected. Notes: svn path=/head/; revision=182034
* Fix compilation of arm's AVILA.Ed Schouten2008-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 Notes: svn path=/head/; revision=181682
* Rework Dallas Semiconductor RTC support.Rafal Jaworowski2008-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 Notes: svn path=/head/; revision=181602
* Rename ds1339 -> ds133x to better fit the upcoming driver extensions.Rafal Jaworowski2008-08-111-0/+0
| | | | Notes: svn path=/head/; revision=181601
* - Reflect the iicbus infrastructure changes.Stanislav Sedov2008-08-051-1/+1
| | | | | | | Approved by: raj Notes: svn path=/head/; revision=181325
* - Reflect changes in iic infrastructure.Stanislav Sedov2008-08-051-1/+1
| | | | Notes: svn path=/head/; revision=181324
* Lock the consumers of the iicbus(4) infrastructure:John Baldwin2008-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(). Notes: svn path=/head/; revision=181305
* Add locking to the core iicbus(4) drivers:John Baldwin2008-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. Notes: svn path=/head/; revision=181304
* Add locking to the various iicbus(4) bridge drivers:John Baldwin2008-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) Notes: svn path=/head/; revision=181303
* - Add driver for Dallas Semiconductor DS1339 RTC sittingStanislav Sedov2008-07-251-0/+232
| | | | | | | | | | | on I2C bus. Reviewed by: raj Approved by: imp MFC after: 2 week Notes: svn path=/head/; revision=180811
* Explicitly lock Giant in smbus_if methods in the bktr_i2c and iicsmbJohn Baldwin2008-06-061-8/+41
| | | | | | | | drivers for now. This can be replaced with driver locks when these drivers are locked. Notes: svn path=/head/; revision=179624
* Don't use spinlocks here. The iicbus transactions can take a longWarner Losh2007-04-171-3/+3
| | | | | | | | time, and this prevents interrupts (say for Hz/hardclock) from happening. Time stands still during the transfers... Notes: svn path=/head/; revision=168806
* New device: icee. Generic i2c eeprom driver.Warner Losh2007-03-231-0/+291
| | | | Notes: svn path=/head/; revision=167857
* MFp4: Make the iicbus fully hinted. We no longer automatically addWarner Losh2007-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. Notes: svn path=/head/; revision=167856
* MFp4: Make iicbus_trasnfer_gen suitable for bridge drivers. Use it in theWarner Losh2007-03-232-5/+11
| | | | | | | bitbang bridge. Notes: svn path=/head/; revision=167855
* MFp4: Create an ivar for each iic device on the iicbus. This ivarWarner Losh2007-03-231-1/+24
| | | | | | | holds the device's address. Notes: svn path=/head/; revision=167854
* const poisonWarner Losh2006-12-053-3/+3
| | | | | | | submitted by: john wehle Notes: svn path=/head/; revision=164901
* More properly cleanup the iicbus child when deleting it.Warner Losh2006-12-051-5/+26
| | | | | | | | | | These are from patches by John Wehle, but the commentary has been updated by me. Obtained from: ports/multimedia/pvr250, indirectly Notes: svn path=/head/; revision=164900
* Reference Hauppage's cxm_iic bit-bang device here.Warner Losh2006-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. Notes: svn path=/head/; revision=164897
* Add a fake flag for write. Many drivers have started to use it and itWarner Losh2006-11-281-1/+2
| | | | | | | | | seems like a good idea. Submitted by: sam Notes: svn path=/head/; revision=164714
* Remove unused leftovers.Warner Losh2006-11-281-9/+0
| | | | Notes: svn path=/head/; revision=164704
* MFp4: Add ixpiic bit-bang driver.Warner Losh2006-11-221-0/+1
| | | | | | | Submitted by: sam@ Notes: svn path=/head/; revision=164502
* <blush> copyout on read, not write.Warner Losh2006-11-221-2/+2
| | | | | | | Tweak a comment while I'm here. Notes: svn path=/head/; revision=164501
* o define transfer methodSam Leffler2006-11-191-0/+4
| | | | | | | | | o attach ds1672 and ad7418, to be cleaned up MFC after: 1 month Notes: svn path=/head/; revision=164421
* i2c and clock driver for Dallas Semiconductor DS1672 RTCSam Leffler2006-11-191-0/+142
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=164420
* i2c driver for Analog Devices AD7418Sam Leffler2006-11-191-0/+234
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=164419
* Minor overhaul of SMBus support:John Baldwin2006-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) Notes: svn path=/head/; revision=162234
* jhb points out that these mallocs don't need to be checked becauseWarner Losh2006-09-061-16/+0
| | | | | | | of M_WAITOK. Notes: svn path=/head/; revision=162074
* MFp4: check the return value of malloc and report an error when invalid.Warner Losh2006-09-061-0/+16
| | | | Notes: svn path=/head/; revision=162072
* Minor style(9) treatment to make things a little more consistantWarner Losh2006-08-212-20/+33
| | | | | | | within iicbus code. Notes: svn path=/head/; revision=161516
* Allow iic bridges to support a generalized transfer, rather thanWarner Losh2006-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. Notes: svn path=/head/; revision=160372
* remove DRIVER_MODULE lines that are useless... pcf doesn't exist (onlyJohn-Mark Gurney2006-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 Notes: svn path=/head/; revision=157827
* newbus will zero softc, so no need to duplicate the zeroing here.Warner Losh2006-04-043-13/+1
| | | | | | | Plus a minor formatting nit in nearby code. Notes: svn path=/head/; revision=157523