aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
Commit message (Collapse)AuthorAge
* i2c-ibm_iic: Enable driver for all PPC4xx variants in arch/powerpcStefan Roese2008-07-14
| | | | | | | | | | | | | | | | Enable the IBM I2C driver for all PPC4xx variants by adding "ibm,iic" to the compatible list. This way all currently available arch/powerpc 4xx ports can make use of this driver without any changes. Additionally all "other" compatible entries are removed since they are not needed anymore. Currently all 4xx PPC's have the same compatible I2C macro. If at some time an incompatibility is detected we can take care of this with an additional property. Signed-off-by: Stefan Roese <sr@denx.de> Acked-by: Josh Boyer <jwboyer@linux.vnet.ibm.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-ibm_iic: Remove deprecated OCP style partStefan Roese2008-07-14
| | | | | | | | | The deprecated OCP style driver part is used by the "old" arch/ppc platform. This platform is scheduled for removal in June/July this year. This patch now removes the OCP driver part from the IBM I2C driver. Signed-off-by: Stefan Roese <sr@denx.de> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Simplify i2c_device_probeJean Delvare2008-07-14
| | | | | | | i2c_driver.id_table is mandatory now, so we can simplify i2c_device_probe() a bit. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c/eeprom: Fall back to SMBus read word transactionsJean Delvare2008-07-14
| | | | | | | | | | | | | | | | | | | | | | When I2C block reads are not supported by the underlying adapter, use SMBus read word transactions instead of consecutive byte reads. Reasons for this change are: * The consecutive byte read approach is not safe on multi-master buses. * While consecutive byte reads have less overhead if you only count the bytes on the bus, it takes more than twice as many transactions as with SMBus read word transactions, and each transaction has a cost: taking and releasing the adapter mutex, and for polling drivers, waiting for the transaction to complete. This change yields a significant performance boost at HZ=250 with EEPROMs on an Intel 82801 bus (basically twice as fast.) SMBus read word transactions are widely supported so I don't expect compatibility issues. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c/eeprom: Only probe buses with DDC or SPD classJean Delvare2008-07-14
| | | | | | | The eeprom driver shouldn't probe i2c buses which don't want to be probed. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Let bus drivers add SPD to their classJean Delvare2008-07-14
| | | | | | | | | | | | | | | | | | Let general purpose I2C/SMBus bus drivers add SPD to their class. Once this is done, we will be able to tell the eeprom driver to only probe for SPD EEPROMs and similar on these buses. Note that I took a conservative approach here, adding I2C_CLASS_SPD to many drivers that have no idea whether they can host SPD EEPROMs or not. This is to make sure that the eeprom driver doesn't stop probing buses where SPD EEPROMs or equivalent live. So, bus driver maintainers and users should feel free to remove the SPD class from drivers those buses never have SPD EEPROMs or they don't want the eeprom driver to bind to them. Likewise, feel free to add the SPD class to any bus driver I might have missed. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-cpm: BugfixesWolfram Sang2008-07-14
| | | | | | | | | | | | Bugfixes to the i2c-cpm driver - enable correct interrupts (I2CER_TXE instead of I2CER_BUSY) - replace forgotten iic with i2c - prefix debug-output on init with 0x and add frequency Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Jochen Friedrich <jochen@scram.de> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Add support for I2C bus on Freescale CPM1/CPM2 controllersJochen Friedrich2008-07-14
| | | | | | | | | | | | | This driver uses the port of 2.4 code from Vitaly Bordug <vitb@kernel.crashing.org> and the actual algorithm used by the i2c driver of the DBox code on cvs.tuxboc.org from Felix Domke (tmbinc@gmx.net) and Gillem (htoa@gmx.net) converted to an of_platform_driver. Tested on CPM1 (MPC823 on dbox2 hardware) and CPM2 (MPC8272). Signed-off-by: Jochen Friedrich <jochen@scram.de> Tested-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Push ioctl BKL down into the i2c codeAlan Cox2008-07-14
| | | | | | | | | | This is part of the effort to get rid of the BKL. [JD: In fact i2c-dev doesn't need more locking than is already done for the other i2c drivers, so we can simply switch to unlocked_ioctl.] Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Add Intel SCH SMBus supportAlek Du2008-07-14
| | | | | | | | New i2c bus driver for the Intel SCH chipsets (AF82US15W, AF82US15L, AF82UL11L). Signed-off-by: Alek Du <alek.du@intel.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Simplify i2c_del_driver()Jean Delvare2008-07-14
| | | | | | i2c_del_driver() can be simplified a bit. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Use list_for_each_entry_safeMatthias Kaehlcke2008-07-14
| | | | | | | Use list_for_each_entry_safe() in i2c_del_adapter() and i2c_del_driver(). Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-pca-platform: Fix error codeWolfram Sang2008-07-14
| | | | | | | Fix errorcode to be more descriptive when ioremap fails. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-pca-algo: Fix error codeWolfram Sang2008-07-14
| | | | | | | Give a more concrete error code, when the bus is not idle. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Consistently reject unsupported transactionsJean Delvare2008-07-14
| | | | | | | | | Many PC SMBus host controller drivers don't properly handle the case where they are requested to achieve a transaction they do not support. Update them so that the consistently print a warning message and return a single error value in this case. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-piix4: Various cleanups and minor fixesJean Delvare2008-07-14
| | | | | | | | | | | | | | | | | | | | | | The i2c-piix4 driver was used recently as a model to write a new SMBus host controller driver and this made me realize that the code of this old driver wasn't exactly good. So, here are many cleanups and minor fixes to this driver, so that these minor mistakes aren't duplicated again: * Delete unused structure. * Delete needless forward function declaration. * Properly announce the SMBus host controller as we find it. * Spell it SMBus not SMB. * Return -EBUSY instead of -ENODEV when the I/O region is already in use. * Drop useless masks on the 7-bit address and the R/W bit. * Reject block transaction requests with an invalid block length. * Check and report block transaction replies with an invalid block length. * Delete a useless comment. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Bus drivers return -Errno not -1David Brownell2008-07-14
| | | | | | | | | | | | | | | Tighten error paths used by various i2c adapters (mostly x86) so they return real fault/errno codes instead of a "-1" (which is most often interpreted as "-EPERM"). Build tested, with eyeball review. One minor initial goal is to have adapters consistently return the code "-ENXIO" when addressing a device doesn't get an ACK response, at least in the probe paths where they are already good at stifling related logspam. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: i2c_use_client() defends against NULLDavid Brownell2008-07-14
| | | | | | | | | | | Defend the i2c refcount calls against NULL pointers, as is important (and conventional) for such calls. Note that none of the current callers of i2c_use_client() use its return value. [JD: I hate this but apparently all the other subsystems do it so...] Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Kerneldoc for most I/O callsDavid Brownell2008-07-14
| | | | | | | | | | Provide kerneldoc for most of the I2C and SMBus I/O calls. Add a comment summarizing some fault reporting issues which affect the ability to provide clean fault reports through I2C master transfer calls. (Making it hard to precisely specify their return values...) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Delete unused function i2c_smbus_write_quickJean Delvare2008-07-14
| | | | | | | | | Function i2c_smbus_write_quick has no users left, so we can delete it. Also update the list of these helper functions which are gone but could be added back if needed. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Group bus drivers by typeJean Delvare2008-07-14
| | | | | | | | The list of I2C/SMBus bus drivers is growing and it is sometimes difficult for the users to figure out what drivers they should enable. By grouping the drivers by type, I hope to make the selection easier. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-core: Return -Errno, not -1David Brownell2008-07-14
| | | | | | | | | | | More updates to the I2C stack's fault reporting: make the core stop returning "-1" (usually "-EPERM") for all faults. Instead, pass lower level fault code up the stack, or return some appropriate errno. This patch happens to touch almost exclusively SMBus calls. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-core: Remove needless includeJean Delvare2008-07-14
| | | | | | | i2c-core doesn't use seq files, so doesn't need to include <linux/seq_file.h>. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-bfin-twi: Update the dependenciesMike Frysinger2008-07-14
| | | | | | | | | Since only a few Blackfins lack TWI, just list them in a depends statement. Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Remove 3 deprecated bus driversAdrian Bunk2008-07-14
| | | | | | | | This patch contains the scheduled removal of i2c-i810, i2c-prosavage and i2c-savage4. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-nforce2: Add support for multiplexing on the Tyan S4985Jean Delvare2008-07-14
| | | | | | | | | | | | | | Just like the Tyan S4882, the S4985 uses a multiplexer to give access to all 16 memory module SPD EEPROMs. This specific i2c-nforce2-s4985 driver adds support for this. It is heavily based on the older i2c-amd756-s4882 driver. As more mainboards will use multiplexer chips, we will have to find a way to support them without having to write a new specfic driver for each. The recent changes to the i2c subsystem should help us, and the new gpio subsystem might help, too. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-davinci: Initialize cmd_complete soonerTroy Kisky2008-07-14
| | | | | | | | | If an interrupt happens before an I2c master read/write, complete is called on uninitialized structure. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Signed-off-by: Kevin Hilman <khilman@mvista.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-davinci: Fix signal handling bugTroy Kisky2008-07-14
| | | | | | | | | If wait_for_completion_interruptible_timeout exits due to a signal, the i2c bus was locking up. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Signed-off-by: Kevin Hilman <khilman@mvista.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-davinci: Remove useless IVR readTroy Kisky2008-07-14
| | | | | | | | | | | | Interrupts are enabled at the point where the DAVINCI_I2C_IVR_REG is read, so unless an interrupt happened just at that moment, no interrupt would be pending. Even though documentation implies you should do this, I see no reason. If slave support is added, this read would cause a hard to reproduce bug. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Signed-off-by: Kevin Hilman <khilman@mvista.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-davinci: Move dev_dbg statement for more outputTroy Kisky2008-07-14
| | | | | | | | | Previously the dev_dbg only printed if no error. Printing also on an error is more useful Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Signed-off-by: Kevin Hilman <khilman@mvista.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-davinci: Ensure clock between 7-12 MHzTroy Kisky2008-07-14
| | | | | | | | Ensure psc value gives a clock between 7-12 MHz Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Signed-off-by: Kevin Hilman <khilman@mvista.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Use class_for_each_deviceDave Young2008-07-14
| | | | | | | Use class_for_each_device for iteration. Signed-off-by: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* I2C: S3C2410: Add MODULE_ALIAS() for s3c2440 device.Ben Dooks2008-07-01
| | | | | | | | Add a MODULE_ALIAS() statement for the i2c-s3c2410 controller to ensure that it can be autoloaded on the S3C2440 systems that we support. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* I2C: S3C2410: Fixup error codes returned rom a transfer.Ben Dooks2008-07-01
| | | | | | | | | The driver should be returning -ENXIO for transfers that do not pass the initial address byte stage. Note, also small tidyups to the driver comments in the area. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* I2C: S3C2410: Check ACK on byte transmissionBen Dooks2008-07-01
| | | | | | | | | | | | We should check for the reception of an ACK after transmitting each data byte. The address send has been correctly checking this, but the data write byte state should have also been checking for these failures. As part of the same fix, we remove the ACK checking from the receive path where it should not have been checking for an ACK which our hardware was sending. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* i2c/max6875: Really prevent 24RF08 corruptionJean Delvare2008-05-18
| | | | | | | | | | | | i2c-core takes care of the possible corruption of 24RF08 chips for quite some times, so device devices no longer need to do it. And they really should not, as applying the prevention twice voids it. I thought that I had fixed all drivers long ago but apparently I had missed that one. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Ben Gardner <bgardner@wabtec.com>
* i2c-amd756: Fix functionality flagsJean Delvare2008-05-18
| | | | | | | The i2c-amd756 driver pretends to support SMBus process call transactions but actually does not. Fix it. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Kill the old driver matching schemeJean Delvare2008-05-18
| | | | | | | Remove the old driver_name/type scheme for i2c driver matching. Only the standard aliasing model will be used from now on. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-nforce2: Disable the second SMBus channel on the DFI Lanparty NF4 ExpertJean Delvare2008-05-18
| | | | | | | | | | | | | There is a strange chip at 0x2e on the second SMBus channel of the DFI Lanparty NF4 Expert motherboard. Accessing the chip reboots the system. As there's nothing interesting on this SMBus channel, the easiest and safest thing to do is to disable it on that board. This is a better fix to bug #5889 than the it87 driver update that was done originally: http://bugzilla.kernel.org/show_bug.cgi?id=5889 Signed-off-by: Jean Delvare <khali@linux-fr.org>
* [MIPS] Alchemy: SMBus resource fixSergei Shtylyov2008-05-12
| | | | | | | | | | | | The Alchemy platform code registers the SMBus device using the virtual address of its registers instead of the physical one -- fix this, taking into account that actually the whole megabyte is decoded by any of the programmable serial controllers (one of which is SMBus), and that all the Alchemy peripherals are directly mappable into KSEG1 kernel space and therefore ioremap() call would just boil down to CKSEG1ADDR() invocation. Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* i2c: Match dummy devices by typeJean Delvare2008-05-11
| | | | | | | | | | | | As the old driver_name/type matching scheme is going away soon, change the dummy device mechanism to use the new matching scheme. This has the downside that dummy i2c clients can no longer choose their name, they'll all appear as "dummy" in sysfs and in log messages. I don't think it is a problem in practice though, as there is little reason to use these i2c clients to log messages. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-sibyte: Mark i2c_sibyte_add_bus() as staticMaciej W. Rozycki2008-05-11
| | | | | | | | The i2c_sibyte_add_bus() function is not called, nor meant to, from outside, so mark it as static; fixing a sparse warning too. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-sibyte: Correct a comment about frequencyMaciej W. Rozycki2008-05-11
| | | | | | | | | | The frequency may have been once hardcoded to 100 kHz, but currently it is passed as an argument to i2c_sibyte_add_bus(), so update the comment to match code. While at it, reformat a nearby comment for consistency. No functional changes. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-piix4: Blacklist two mainboardsJean Delvare2008-05-11
| | | | | | | | | | We had a report that running sensors-detect on a Sapphire AM2RD790 motherbord killed the CPU. While the exact cause is still unknown, I'd rather play it safe and prevent any access to the SMBus on that machine by not letting the i2c-piix4 driver attach to the SMBus host device on that machine. Also blacklist a similar board made by DFI. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-piix4: Increase the intitial delay for the ServerWorks CSB5David Milburn2008-05-11
| | | | | | | | | | | | | | Per the PIIX4 errata, there maybe a delay between setting the start bit in the Smbus Host Controller Register and the transaction actually starting. If the driver doesn't delay long enough, it may appear that the transaction is complete when actually it hasn't started, this may lead to bus collisions. While 1 ms appears to be enough for most chips, the ServerWorks CSB5 wants 2 ms. Signed-off-by: David Milburn <dmilburn@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-mpc: Compare to NO_IRQ instead of zeroJon Smirl2008-05-11
| | | | | | | | | Alter the mpc i2c driver to use the NO_IRQ symbol instead of the constant zero when checking for valid interrupts. NO_IRQ=-1 on ppc and NO_IRQ=0 on powerpc so the checks against zero are not correct. Signed-off-by: Jon Smirl <jonsmirl@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Convert most new-style drivers to use module aliasingJean Delvare2008-04-29
| | | | | | | | | | | | | | Based on earlier work by Jon Smirl and Jochen Friedrich. Update most new-style i2c drivers to use standard module aliasing instead of the old driver_name/type driver matching scheme. I've left the video drivers apart (except for SoC camera drivers) as they're a bit more diffcult to deal with, they'll have their own patch later. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Jon Smirl <jonsmirl@gmail.com> Cc: Jochen Friedrich <jochen@scram.de>
* i2c: Add support for device alias namesJean Delvare2008-04-29
| | | | | | | | | | | | | | Based on earlier work by Jon Smirl and Jochen Friedrich. This patch allows new-style i2c chip drivers to have alias names using the official kernel aliasing system and MODULE_DEVICE_TABLE(). At this point, the old i2c driver binding scheme (driver_name/type) is still supported. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Jochen Friedrich <jochen@scram.de> Cc: Jon Smirl <jonsmirl@gmail.com> Cc: Kay Sievers <kay.sievers@vrfy.org>
* i2c-amd756-s4882: Fix an error pathJean Delvare2008-04-29
| | | | | | | If initialization fails, we want to restore the physical bus, not delete it again. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c/tps65010: Add missing intialization of client dataJean Delvare2008-04-29
| | | | | | | | | | | tps65010_remove() calls i2c_get_clientdata(client) but the client data is never set during initialization, so it gets a NULL pointer at best. I guess it was never spotted because the tps65010 driver is typically not built modular so this function is discarded. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: David Brownell <dbrownell@users.sourceforge.net>