summaryrefslogtreecommitdiffstats
path: root/sys/dev/iicbus
Commit message (Collapse)AuthorAgeFilesLines
* There are PowerMacs which do not have a hwsensor-location propertyandreast2011-01-181-7/+12
| | | | | | | | for this sensor. Instead of leaving this location empty we use here the default name 'sensor'. Submitted by: Justin Hibbits <chmeeedalf at gmail dot com> Approved by: nwhitehorn (mentor)
* Remove unused variable. Spotted by a cppcheckandreast2011-01-151-3/+0
| | | | | | (devel/cppcheck, http://sourceforge.net/projects/cppcheck) run. Approved by: nwhitehorn (mentor)
* On the Xserve G5 we find the LM75 instead of the DS1775. The coreandreast2010-12-101-2/+3
| | | | | | | | | | | | functionality is the same, a difference is that the DS1775 has a better precision than the LM75. But we do not use it in our setup. Make the LM75 work the same as the DS1775. Fix a typo in device_set_desc. Tested by: Paul Mather <paul at gromit dlib vt edu> Approved by: nwhitehorn (mentor)
* Provide support for IIC_M_NOSTOP/IIC_M_NOSTART for bit-banging andnwhitehorn2010-11-081-5/+29
| | | | | | otherwise low-level controllers. Reviewed by: thompsa
* Add three new drivers for fan control and temperature reading on theandreast2010-10-152-0/+590
| | | | | | | | | | | | | | | | PowerMac7,2. - The fcu driver lets us read and write the fan RPMs for all fans in the PowerMac7,2. This driver is PowerMac specific. - The ds1775 is a driver to read the temperature for the drive bay sensor. - The max6690 is another driver to read temperatures. Here it is used to read the inlet, the backside and the U3 heatsink temperature. An additional driver, the ad7417, will follow later. Thanks to nwhitehorn for guiding me through this driver development. Approved by: nwhitehorn (mentor)
* bus_add_child: change type of order parameter to u_intavg2010-09-101-1/+1
| | | | | | | | | | 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
* Fix typo in comment.joel2010-08-071-1/+1
|
* Fix iicbus_get_addr() on 64-bit big-endian systems. The bus accessornwhitehorn2010-07-081-1/+1
| | | | passes a uintptr_t, not a uint32_t.
* Revert changes accidentally committed as part of r209298.nwhitehorn2010-06-181-29/+5
|
* Provide for multiple, cascaded PICs on PowerPC systems, and extend thenwhitehorn2010-06-181-5/+29
| | | | | | OFW interrupt map interface to also return the device's interrupt parent. MFC after: 8.1-RELEASE
* Add two new flags (IIC_M_NOSTOP and IIC_M_NOSTART) to struct iic_msg tonwhitehorn2010-06-051-0/+2
| | | | | | allow consumers of iicbus_transfer() to send messages with repeated starts. Reviewed by: imp
* Add new tunable 'net.link.ifqmaxlen' to set default send interfacesobomax2010-05-031-1/+1
| | | | | | | | | | 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. MFC after: 1 month
* - Rename ds1672 and ds133x devices to "ds1672_rtc" and "ds133x_rtc"stas2009-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
* - Give a warning and start the oscillator if it was not previouslystas2009-04-201-19/+66
| | | | | | | | runned. - Rename ds1672 -> rtc to follow the other drivers. - Refactor/simplify the code a bit. MFC after: 2 weeks
* Change if_output to take a struct route as its fourth argument in orderkmacy2009-04-161-2/+2
| | | | | | to allow passing a cached struct llentry * down to L2 Reviewed by: rwatson
* 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)
OpenPOWER on IntegriCloud