Commit Graph

1191 Commits (c07fbfd17e614a76b194f371c5331e21e6cffb54)

Author SHA1 Message Date
Shinya Kuribayashi 21a89d4101 i2c-designware: Enable RX_FULL interrupt
Enable RX_FULL interrupt mask by default, and hook it in the interrupt
handler.  If requested amount of rx data (defined by IC_RX_TL) is not
available, we don't have to process i2c_dw_read().

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-12-09 00:19:11 +00:00
Shinya Kuribayashi 4cb6d1d6da i2c-designware: Set Tx/Rx FIFO threshold levels
As a hardware feature, DW I2C core generates a STOP condition whenever
the Tx FIFO becomes empty (strictly speaking, whenever the last byte in
the Tx FIFO is sent out), even if we have more bytes to be written.

In other words, we must never make "Tx FIFO underrun" happen during
a transaction, except for the last byte.  For the safety's sake, we'd
make TX_EMPTY interrupt get triggered every time one byte is processed.

The Rx FIFO threshold needs to be set as well.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-12-09 00:19:11 +00:00
Shinya Kuribayashi 0774539948 i2c-designware: Process i2c_msg messages in the interrupt handler
Symptom:
--------
When we're going to send/receive the longer size of data than the Tx
FIFO length, the I2C transaction will be divided into several separated
transactions, limited by the Tx FIFO length.

Details:
--------
As a hardware feature, DW I2C core generates a STOP condition whenever
the Tx FIFO becomes empty (strictly speaking, whenever the last byte in
the Tx FIFO is sent out), even if we have more bytes to be written.
Then, once a new transmit data is written to the Tx FIFO, DW I2C core
will initiate a new transaction, which leads to another START condition.

This explains how the transaction in question goes, and implies that
current tasklet-based dw_i2c_pump_msg() strategy couldn't meet the
timing constraint required for avoiding Tx FIFO underrun.

To avoid this scenario, we must keep providing new transmit data within
a given time period.  In case of Fast-mode + 32-byte Tx FIFO, for
instance, it takes about 22.5[us] to process single byte, and 720[us] in
total.

This patch removes the existing tasklet-based "pump" system, and move
its jobs into the interrupt handler.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-12-09 00:19:11 +00:00
Shinya Kuribayashi c70c5cd374 i2c-designware: i2c_dw_xfer_msg: Fix i2c_msg search bug
In case a work-in-progress i2c_msg has more bytes to be written, we
need to set STATUS_WRITE_IN_PROGRESS and exit from the msg_write_idx-
searching loop.  Otherwise, we will overtake the current msg_write_idx
without waiting for its transmission to be processed.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-12-09 00:19:10 +00:00
Shinya Kuribayashi d60c7e81dd i2c-designware: Improved _HCNT/_LCNT calculation
* Calculate with accurate conditional expressions from DW manuals.
* Round ic_clk by adding 0.5 as it's important at high ic_clk rate.
* Take into account "tHD;STA" issue for _HCNT calculation.
* Take into account "tf" for _LCNT calculation.
* Add "cond" and "offset" fot further correction requirements.

For _HCNT calculation, there's one issue needs to be carefully
considered; DesignWare I2C core doesn't seem to have solid strategy
to meet the tHD;STA timing spec.  If you configure _HCNT based on the
tHIGH timing spec, it easily results in violation of the tHD;STA spec.

After many trials, we came to the conclusion that the tHD;STA period
is proportional to (_HCNT + 3).  For the safety's sake, this should be
selected by default.

As for _LCNT calculation, DW I2C core has one characteristic behavior;
he starts counting the SCL CNTs for the LOW period of the SCL clock
(tLOW) as soon as it pulls the SCL line.  At that time, he doesn't take
into account the fall time of SCL signal (tf), IOW, he starts counting
CNTs without confirming the SCL input voltage has dropped to below VIL.

This characteristics becomes a problem on some platforms where tf is
considerably long, and results in violation of the tLOW timing spec.

To make the driver configurable as much as possible for various cases,
we'd have separated arguments "tf" and "offset", and for safety default
values should be 0.3 us and 0, respectively.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-12-09 00:19:10 +00:00
Shinya Kuribayashi 6d2ea4875f i2c-designware: Remove an useless local variable "num"
We couldn't know the original intent for this variable, but at this
point it's useless.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-12-09 00:19:10 +00:00
Shinya Kuribayashi e77cf23251 i2c-designware: i2c_dw_xfer_msg: Use "struct dw_i2c_dev" pointer
We don't have to use "struct i2c_adapter" pointer here.
Let's use a local "struct dw_i2c_dev" pointer, instead.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-12-09 00:19:10 +00:00
Shinya Kuribayashi 78839bd0f2 i2c-designware: i2c_dw_read: Use "struct dw_i2c_dev" pointer
We don't have to use "struct i2c_adapter" pointer here.
Let's use a local "struct dw_i2c_dev" pointer, instead.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-12-09 00:19:10 +00:00
Shinya Kuribayashi 91b52caec0 i2c-designware: Use platform_get_irq helper
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-12-09 00:19:10 +00:00
Shinya Kuribayashi e28000a38d i2c-designware: Don't use the IC_CLR_INTR register to clear interrupts
We're strongly discouraged from using the IC_CLR_INTR register because
it clears all software-clearable interrupts asserted at the moment.

  stat = readl(IC_INTR_STAT);
    :
    :  <=== Interrupts asserted during this period will be lost
    :
  readl(IC_CLR_INTR);

Instead, use the separately-prepared IC_CLR_* registers.

At the same time, this patch adds all remaining interrupt definitions
available in the DesignWare I2C hardware.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-12-09 00:19:09 +00:00
Shinya Kuribayashi ed5e1dd5f2 i2c-designware: Consolidate to use 32-bit word accesses
This driver looks originally meant for armel machines where readw()/
writew() works perfectly fine with this hardware.  But that doens't
work for big-endian systems.

This patch converts all 8/16-bit-aware usages to 32-bit variants.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-12-09 00:19:09 +00:00
Jean Delvare 38f41f282f i2c-stub: Allow user to disable some commands
Add a module parameter to override the functionality bitfield. This
lets the user disable some commands. This can be used to force a chip
driver to take different code paths.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:29 +01:00
Jean Delvare 4710317891 i2c-stub: Implement I2C block support
This is required to test some drivers, for example at24.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:28 +01:00
Jean Delvare 69b0089a67 i2c: Refactor for_each callbacks
Functions i2c_do_add_adapter() and __attach_adapter() do essentially
the same thing, differing only in how the parameters are passed. Same
for i2c_do_add_adapter() and __detach_adapter(). Introduce wrappers to
normalize the parameters, so that we do not have to duplicate the
code.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
2009-12-06 17:06:27 +01:00
Jean Delvare 7e2193a8f9 i2c-i801: Retry on lost arbitration
The Intel 82801 is sometimes used on systems with a BMC connected. The
BMC can access the SMBus, resulting in lost arbitration for the 82801.
We should let i2c-core retry transactions for us in this case.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:27 +01:00
Vincent Sanders 9669f54194 i2c: Remove big kernel lock from i2cdev_open
The BKL is held over a kmalloc so cannot protect anything beyond that.
The two calls before the kmalloc have their own locking.
Improve device open function by removing the now unnecessary ret variable

Signed-off-by: Vincent Sanders <vince@simtec.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:26 +01:00
Jean Delvare ccfbbd082a i2c: Simplify i2c_detect_address
The kind parameter of i2c_detect_address() always has value -1, so we
can get rid of it.

Next step is to update all i2c detect callback functions to get rid of
this now useless parameter.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:25 +01:00
Jean Delvare c7b25a9e96 i2c: Drop probe, ignore and force module parameters
The legacy probe and force module parameters are obsolete now, the
same can be achieved using the new_device sysfs interface, which is
both more flexible and cheaper (it is implemented by i2c-core rather
than replicated in every driver module.)

The legacy ignore module parameters can be dropped as well. Ignoring
can be done by instantiating a "dummy" device at the problematic
address.

This is the first step of a huge cleanup to i2c-core's i2c_detect
function, i2c.h's I2C_CLIENT_INSMOD* macros, and all drivers that made
use of them.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:24 +01:00
Jean Delvare abe38388e5 i2c: Add missing __devinit markers to old i2c adapter drivers
These _setup functions are called from _probe so they can be marked
__devinit.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:23 +01:00
Jean Delvare da44bdeb95 i2c: Bus drivers don't have to support I2C_M_REV_DIR_ADDR
I2C bus drivers don't have to support I2C_M_REV_DIR_ADDR. It is a
deviation from the I2C specification, which only makes sense to
implement when really needed.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Ben Dooks <ben-linux@fluff.org>
2009-12-06 17:06:22 +01:00
Mika Kuoppala 194684e596 i2c: Prevent priority inversion on top of bus lock
Low priority thread holding the i2c bus mutex could block higher
priority threads to access the bus resulting in unacceptable
latencies. Change the mutex type to rt_mutex preventing priority
inversion.

Tested-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@nokia.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:22 +01:00
Jean Delvare a0c11cdd6a i2c-voodoo3: Delete
Superseded by tdfxfb. I2C/DDC support used to live in a separate
driver but this caused driver conflicts.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Krzysztof Helt <krzysztof.h1@wp.pl>
2009-12-06 17:06:21 +01:00
Jean Delvare bc6286e50b i2c-powermac: Drop temporary name buffer
We no longer need to write the adapter name to a temporary buffer.
We can write it directly to the i2c_adapter's name field. This is
more efficient.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Michel Daenzer <michel@daenzer.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2009-12-06 17:06:20 +01:00
Jean Delvare 6dfa5ca3c9 i2c-powermac: Include the i2c_adapter in struct pmac_i2c_bus
Include the i2c_adapter in struct pmac_i2c_bus. This avoids memory
fragmentation and allows for several code cleanups.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Michel Daenzer <michel@daenzer.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2009-12-06 17:06:19 +01:00
Jean Delvare d7d838a6eb i2c-powermac: Log errors
Log errors when they happen, otherwise we have no idea what went
wrong.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Michel Daenzer <michel@daenzer.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
2009-12-06 17:06:18 +01:00
Jean Delvare 02864d58ce i2c-powermac: Refactor i2c_powermac_smbus_xfer
I wanted to add some error logging to the i2c-powermac driver, but
found that it was very difficult due to the way the
i2c_powermac_smbus_xfer function is organized. Refactor the code in
this function so that each low-level function is only called once.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Michel Daenzer <michel@daenzer.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
2009-12-06 17:06:17 +01:00
Jean Delvare 6f7e549f87 i2c-powermac: Reject unsupported I2C transactions
The i2c-powermac driver doesn't support arbitrary multi-message I2C
transactions, only SMBus ones. Make it clear by returning an error if
a multi-message I2C transaction is attempted. This is better than only
processing the first message, because most callers won't recover from
the short transaction. Anyone wishing to issue multi-message
transactions should use the SMBus API instead of the raw I2C API.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Michel Daenzer <michel@daenzer.net>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
2009-12-06 17:06:17 +01:00
Wolfram Sang dddc66ffa0 i2c/chips: Move ds1682 to drivers/misc
As i2c/chips is deprecated, move ds1682 to a more apropriate location.
Build tested.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:16 +01:00
Linus Torvalds af5fdf8064 Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  at24: Use timeout also for read
  i2c: Fix userspace_device list corruption
  MAINTAINERS: Add missing i2c files
  i2c/tsl2550: Fix lux value in extended mode
2009-11-30 14:50:44 -08:00
Jean Delvare bbd2d9c919 i2c: Fix userspace_device list corruption
Fix userspace_device list corruption. The corruption was caused by
clients not being removed when adapters with such clients were
themselves removed. Something like the following would trigger it
(assuming i2c-stub gets adapter number 3):

# modprobe i2c-stub chip_addr=0x50
# echo 24c08 0x50 > /sys/bus/i2c/devices/i2c-3/new_device 
# rmmod i2c-stub
# modprobe i2c-stub chip_addr=0x50
# echo 24c08 0x50 > /sys/bus/i2c/devices/i2c-3/new_device 

For the records, the stack trace in the kernel logs look like this:

kernel: WARNING: at lib/list_debug.c:30 __list_add+0x8b/0x90()
kernel: Hardware name: (...)
kernel: list_add corruption. prev->next should be next (c137fc84), but was (null). (prev=f57111b8).
kernel: Modules linked in: (...)
kernel: Pid: 4669, comm: bash Not tainted 2.6.32-rc8 #259
kernel: Call Trace:
kernel:  [<c111eb8b>] ? __list_add+0x8b/0x90
kernel:  [<c111eb8b>] ? __list_add+0x8b/0x90
kernel:  [<c103265c>] warn_slowpath_common+0x6c/0xc0
kernel:  [<c111eb8b>] ? __list_add+0x8b/0x90
kernel:  [<c10326f6>] warn_slowpath_fmt+0x26/0x30
kernel:  [<c111eb8b>] __list_add+0x8b/0x90
kernel:  [<c11ba165>] i2c_sysfs_new_device+0x1c5/0x250
kernel:  [<c10861be>] ? might_fault+0x2e/0x80
kernel:  [<c11b9fa0>] ? i2c_sysfs_new_device+0x0/0x250
kernel:  [<c118c625>] dev_attr_store+0x25/0x30
kernel:  [<c10e305c>] sysfs_write_file+0x9c/0xf0
kernel:  [<c109d35c>] vfs_write+0x9c/0x160
kernel:  [<c10e2fc0>] ? sysfs_write_file+0x0/0xf0
kernel:  [<c109d4dd>] sys_write+0x3d/0x70
kernel:  [<c1002ed8>] sysenter_do_call+0x12/0x36

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-11-26 09:22:33 +01:00
Michele Jr De Candia 5f5bfb09d8 i2c/tsl2550: Fix lux value in extended mode
According to the TAOS Application Note 'Controlling a Backlight with
the TSL2550 Ambient Light Sensor' (page 14), the actual lux value in
extended mode should be obtained multiplying the calculated lux value
by 5.

Signed-off-by: Michele Jr De Candia <michele.decandia@valueteam.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-11-26 09:22:32 +01:00
Lin Ming 2263576cfc ACPICA: Add post-order callback to acpi_walk_namespace
The existing interface only has a pre-order callback. This change
adds an additional parameter for a post-order callback which will
be more useful for bus scans. ACPICA BZ 779.

Also update the external calls to acpi_walk_namespace.

http://www.acpica.org/bugzilla/show_bug.cgi?id=779

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2009-11-24 21:31:10 -05:00
Russell King f8d5e5a8f5 ARM: PNX4008: i2c-pnx: use the same dev_id for request_irq and free_irq
This allows i2c-pnx to free its interrupt handler when the module
is removed or if an error occurs; using the same dev_id for both
request_irq and free_irq is desirable.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Ben Dooks <ben-linux@fluff.org>
2009-11-21 19:01:05 +00:00
Kevin Wells a7d73d8c68 i2c: i2c-pnx: Added missing mach/i2c.h and linux/io.h header file includes
Added missing mach/i2c.h and linux/io.h header file includes

Signed-off-by: Kevin Wells <kevin.wells@nxp.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-11-20 00:25:42 +00:00
Kevin Wells b2f125bcf5 i2c: i2c-pnx: Limit minimum jiffie timeout to 2
Limit minimum jiffie timeout to 2 to prevent early timeout on systems
with low tick rates

Signed-off-by: Kevin Wells <kevin.wells@nxp.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-11-20 00:25:41 +00:00
Crane Cai 3806e94b01 i2c-piix4: Modify code name SB900 to Hudson-2
Change SB900 to its formal code name Hudson-2.

Signed-off-by: Crane Cai <crane.cai@amd.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-11-07 13:10:46 +01:00
Joakim Tjernlund 45da790ebe i2c-mpc: Do not generate STOP after read.
The driver always ends a read with a STOP condition which
breaks subsequent I2C reads/writes in the same transaction as
these expect to do a repeated START(ReSTART).

This will also help I2C multimaster as the bus will not be released
after the first read, but when the whole transaction ends.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-11-02 23:28:47 +00:00
Richard Zhao db3a3d4ef7 i2c: imx: disable clock when it's possible to save power.
Enable clock before START, disable it after STOP.

Signed-off-by: Richard Zhao <linuxzsc@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-11-02 23:28:47 +00:00
Richard Zhao a4094a76e6 i2c: imx: only imx1 needs disable delay
check cpu_is_mx1() when disable delay.

Signed-off-by: Richard Zhao <linuxzsc@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-11-02 23:28:47 +00:00
Richard Zhao 43309f3b52 i2c: imx: check busy bit when START/STOP
The controller can't do anything else before it actually generates START/STOP.
So we check busy bit to make sure START/STOP is successfully finished.

If we don't check busy bit, START/STOP may fail on some fast CPUs.

Signed-off-by: Richard Zhao <linuxzsc@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-11-02 23:28:46 +00:00
Jean Delvare 18669eabde i2c: Hide probe errors caused by ACPI resource conflicts
When an ACPI resource conflict is detected, error messages are already
printed by ACPI. There's no point in causing the driver core to print
more error messages, so return one of the error codes for which no
message is printed.

This fixes bug #14293:
http://bugzilla.kernel.org/show_bug.cgi?id=14293

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-10-04 22:53:45 +02:00
Bjorn Helgaas e96c9284bd ACPI: i2c-scmi: don't use acpi_device_uid()
We recently removed the acpi_device_uid() interface because nobody
used it.  I don't think it's essential here either.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2009-09-26 01:42:07 -04:00
Russell King baea7b946f Merge branch 'origin' into for-linus
Conflicts:
	MAINTAINERS
2009-09-24 21:22:33 +01:00
Linus Torvalds 40aba21896 Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  i2c: Clearly mark ACPI drivers as such
  i2c: Add driver for SMBus Control Method Interface
  i2c-pnx: Correct use of request_region/request_mem_region
  MAINTAINERS: Add maintainer for AT24 and PCA9564/PCA9665
  i2c-piix4: Add AMD SB900 SMBus device ID
  i2c/chips: Remove deprecated pcf8574 driver
  i2c/chips: Remove deprecated pca9539 driver
  i2c/chips: Remove deprecated pcf8575 driver
  gpio/pcf857x: Copy i2c_device_id from old pcf8574 driver
  i2c/scx200_acb: Provide more information on bus errors
  i2c: Provide compatibility links for i2c adapters
  i2c: Convert i2c adapters to bus devices
  i2c: Convert i2c clients to a device type
  i2c/tsl2550: Use combined SMBus transactions
  i2c-taos-evm: Switch echo off to improve performance
  i2c: Drop unused i2c_driver.id field
2009-09-23 09:30:48 -07:00
Russell King 28f9f19db9 Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6 into devel 2009-09-21 16:02:30 +01:00
Wolfram Sang 5d3f33318a [PATCH] i2c-imx: make bus available early
As I2C is used by PMICs also, make the busses available early via
subsys_initcall().

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-09-19 23:36:56 +01:00
Mikael Pettersson b0999cc55b i2c-mv64xxx: correct mv64xxx_i2c_intr() return type
The mv64xxx_i2c_intr() irq handler in drivers/i2c/busses/i2c-mv64xxx.c
is declared as returning 'int', resulting in this compile-time warning:

drivers/i2c/busses/i2c-mv64xxx.c: In function 'mv64xxx_i2c_probe':
drivers/i2c/busses/i2c-mv64xxx.c:540: warning: passing argument 2 of 'request_irq' from incompatible pointer type

Fix: correct the return type to 'irqreturn_t'.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-09-19 23:02:03 +01:00
Jean Delvare cfd550ed3d i2c: Clearly mark ACPI drivers as such
Now that we have ACPI-based SMBus controller drivers, and we will start
telling users to use them instead of native drivers when I/O resources
conflict, I think it would be good to clearly mark ACPI drivers as such
in Kconfig.

This is exactly the same as we just did for hwmon drivers.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Crane Cai <crane.cai@amd.com>
2009-09-18 22:45:52 +02:00
Crane Cai dc9854212e i2c: Add driver for SMBus Control Method Interface
This driver supports the SMBus Control Method Interface. It needs BIOS declare
ACPI control methods which described in SMBus Control Method Interface Spec.
http://smbus.org/specs/smbus_cmi10.pdf

Signed-off-by: Crane Cai <crane.cai@amd.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18 22:45:51 +02:00
Julia Lawall 449d2c759d i2c-pnx: Correct use of request_region/request_mem_region
request_mem_region should be used when ioremap is used subsequently.
release_region is then correspondingly replaced by release_mem_region.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
expression start,E;
@@

- request_region
+ request_mem_region
  (start,...)
... when != request_mem_region(start,...)
    when != start = E
ioremap(start,...)

@@
expression r.start;
@@

- release_region
+ release_mem_region
  (start,...)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Vitaly Wool <vitalywool@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18 22:45:51 +02:00
Crane Cai 76b3e28fa7 i2c-piix4: Add AMD SB900 SMBus device ID
Add new SMBus device ID for AMD SB900.

Signed-off-by: Crane Cai <crane.cai@amd.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18 22:45:50 +02:00
Wolfram Sang e7c5c49ecd i2c/chips: Remove deprecated pcf8574 driver
The pcf8574 driver in drivers/i2c/chips which just exports its register to
sysfs is superseded by drivers/gpio/pcf857x.c which properly uses the gpiolib.
As this driver has been deprecated for more than a year, finally remove it.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18 22:45:49 +02:00
Wolfram Sang 732d481127 i2c/chips: Remove deprecated pca9539 driver
The pca9539 driver in drivers/i2c/chips which just exports its registers to
sysfs is superseded by drivers/gpio/pca953x.c which properly uses the gpiolib.
As this driver has been deprecated for more than a year, finally remove it.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Ben Gardner <gardner.ben@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18 22:45:48 +02:00
Wolfram Sang 8f67eeb0b4 i2c/chips: Remove deprecated pcf8575 driver
The pcf8575 driver in drivers/i2c/chips which just exports its register to
sysfs is superseded by drivers/gpio/pcf857x.c which properly uses the gpiolib.
As this driver has been deprecated for more than a year, finally remove it.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Bart Van Assche <bart.vanassche@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18 22:45:48 +02:00
Willy Tarreau fce96f3e5d i2c/scx200_acb: Provide more information on bus errors
Upon a bus error, it's rather hard to guess what happened. Dumping the
address, length and status provides a lot of value for troubleshooting
issues.

Signed-off-by: Willy Tarreau <wtarreau@exceliance.fr>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18 22:45:47 +02:00
Jean Delvare 2bb5095aff i2c: Provide compatibility links for i2c adapters
Some user-space applications may be relying on i2c adapters showing up
as class devices in sysfs. Provide compatibility links for them for
the time being. We will remove them after a long transition period.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
2009-09-18 22:45:46 +02:00
Jean Delvare 4f8cf8240a i2c: Convert i2c adapters to bus devices
Kay says i2c adapters shouldn't be class devices but bus devices.
Convert them that way, using a device type.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
2009-09-18 22:45:46 +02:00
Jean Delvare 51298d1257 i2c: Convert i2c clients to a device type
This is required for upcoming changes.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
2009-09-18 22:45:45 +02:00
Jean Delvare ac7809414f i2c/tsl2550: Use combined SMBus transactions
Make the I/O faster, mainly by using combined SMBus transactions when
possible. While the TSL2550 datasheet doesn't say the device supports
them, they seem to work just fine in practice, and a combined
transaction is faster than two simple transactions in many cases and
always more reliable.

A side effect is to suppress the delays between SMBus writes and
reads. The datasheet doesn't say they are needed and things work just
fine for me without them.

I also couldn't see any reason for the delay between reading the two
channels. Nor for the loop to get a reading in the first place. The
400 ms delay between samples only matters at chip power-up, after that
the chip always hold the previously sampled value so we never get to
wait.

All these changes make reading the lux value much faster and cheaper.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Michele De Candia <michele.decandia@valueteam.com>
Cc: Rodolfo Giometti <giometti@linux.it>
2009-09-18 22:45:44 +02:00
Jean Delvare 27693ce5f3 i2c-taos-evm: Switch echo off to improve performance
When echo is on, we waste time reading back our orders. Switching echo
off makes performance much better: SMBus byte data transactions are 47%
faster and byte transactions are 24% faster.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18 22:45:43 +02:00
Haojian Zhuang d7c46ddde3 [ARM] pxa: update dependancy of pxa i2c module
PXA I2C module is also used in Marvell PXA168 and PXA910 series.
Update the module dependancy of PXA I2C.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
2009-09-10 18:49:27 +08:00
Magnus Damm f1a3b994f9 i2c: Runtime PM for SuperH Mobile I2C
This patch modifies the SuperH Mobile I2C driver to support
Runtime PM. These changes is all that is needed for proper
Runtime PM support in this driver. Driver callbacks for
Runtime PM are empty because the device registers are always
re-initialized after pm_runtime_get_sync().

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-23 18:03:19 +09:00
Rafael J. Wysocki 8400146d0d Merge branch 'master' into for-linus 2009-08-23 00:03:00 +02:00
Linus Walleij c37faafa7d i2c-stu300: I2C STU300 stability updates
- blk clk is enabled when an irq arrives. The clk should be enabled,
  but just to make sure.
- All error bits are handled no matter state machine state
- All irq's will run complete() except for irq's that wasn't an event.
- No more looking into status registers just in case an interrupt
  has happend and the irq handle wasn't executed.
- irq_disable/enable are now separete functions.
- clk settings calculation changed to round upwards instead of
  downwards.
- Number of address send attempts before giving up is increased to 12
  from 10 since it most times take 8 tries before getting through.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-08-20 22:27:58 +01:00
Moiz Sonasath 61149787d6 i2c-omap: Enable workaround for Errata 1.153 based on
Silicon Errata 1.153 has been fixed on OMAP 3630|4430 with the use of a later
version of I2C IP block.

The errata impacts OMAP 2420|2430|3430, enable the workaround for these based
on I2C IP block revision number instead of OMAP CPU type

Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com
Reviewed-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-08-20 22:27:58 +01:00
Moiz Sonasath dd11976aea i2c-omap: ACK pending [R/X]DR and [R/X]RDY interrupts
ACK any pending read/write interrupts before exiting the ISR either after
completing the operation [ARDY interrupt] or in case of an error
[NACK|AL interrupt]

Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-08-20 22:27:57 +01:00
Nishanth Menon dcc4ec2694 i2c-omap: Fix I2C status ACK
I2C status ack for [RX]RDR and [RX]RDY could
cause race conditions of clearing the event
twice and a violation of the programing
sequence as defined in TRM This patch fixes
the same.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-08-20 22:27:57 +01:00
Rafael J. Wysocki 2e6713c766 Merge branch 'master' into for-linus 2009-07-30 19:38:04 +02:00
Sonasath, Moiz cd086d3aa6 i2c-omap: OMAP3430 Silicon Errata 1.153
When an XRDY/XDR is hit, wait for XUDF before writing data to DATA_REG.
Otherwise some data bytes can be lost while transferring them from the
memory to the I2C interface.

Do a Busy-wait for XUDF, before writing data to DATA_REG. While waiting
if there is NACK | AL, set the appropriate error flags, ack the pending
interrupts and return from the ISR.

Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Vikram pandita <vikram.pandita@ti.com>
[ben-linux@fluff.org: fixed mail format and added i2c-omap to subject]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30 01:03:24 +01:00
Sonasath, Moiz 04c688dd7a i2c-omap: In case of a NACK|ARDY|AL return from the ISR
In case of a NACK or ARDY or AL interrupt, complete the request.
There is no need to service the RRDY/RDR or XRDY/XDR interrupts.

Refer TRM SWPU114: Figure 18-31.I2C Master Transmitter Mode, Interrupt Method,
in F/S and HS Modes

http://focus.ti.com/pdfs/wtbu/SWPU114T_PrelimFinalEPDF_06_25_2009.pdf

Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Vikram pandita <vikram.pandita@ti.com>
[ben-linux@fluff.org: fixed mail format and added i2c-omap to subject]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30 01:03:24 +01:00
Sonasath, Moiz bfb6b6588a i2c-omap: Bug in reading the RXSTAT/TXSTAT values from the I2C_BUFFSTAT register
Fix bug in reading the I2C_BUFFSTAT register for getting byte count on RX/TX interrupt.

On Interrupt: I2C_STAT[RDR],
	read 'RXSTAT' from I2C_BUFFSTAT[8-13]
On Interrupt: I2C_STAT[XDR]
	read 'TXSTAT' from I2C_BUFFSTAT[0-5]

Signed-off-by: Jagadeesh Pakaravoor <j-pakaravoor@ti.com>
Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Vikram pandita <vikram.pandita@ti.com>
[ben-linux@fluff.org: fixed mail format and added i2c-omap to subject]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30 01:03:23 +01:00
Magnus Damm ccb3bc16b4 i2c-sh_mobile: change module_init() to subsys_initcall()
Convert the i2c-sh_mobile i2c bus driver to use
subsys_initcall() instead of module_init().

This change makes the driver register a bit earlier which
together with earlier platform data moves the time for probe().
The earlier probe() makes it possible to use i2c_get_adapter()
and i2c_transfer() from device_initcall().

The same strategy is used by other i2c bus drivers such as
i2c-pxa.c and i2c-s3c2410.c.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
[ben-linux@fluff.org: minor subject updaye]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30 00:59:09 +01:00
Roel Kluin 783fd6fa4c i2c: strncpy does not null terminate string
strlcpy() will always null terminate the string.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30 00:55:50 +01:00
Peter Korsgaard 0e014e92ba i2c-s3c2410: s3c24xx_i2c_init: don't clobber IICLC value
s3c24xx_i2c_init() was overwriting the IICLC value set just above in
s3c24xx_i2c_clockrate() with zero, effectively disabling the platform
line control setting.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30 00:55:50 +01:00
Rafael J. Wysocki b4093d6235 Merge branch 'master' into for-linus 2009-07-29 20:28:08 +02:00
Michele Jr De Candia 96f699ad09 i2c/tsl2550: Fix lux value in dark environment
I've tested TSL2550 driver and I've found a bug: when light is off, 
returned value from tsl2550_calculate_lux function is -1 when it should 
be 0 (sensor correctly read that light was off).

I think the bug is that a zero c0 value (approximated value of ch0) is 
misinterpreted as an error. 

Signed-off-by: Michele Jr De Candia <michele.decandia@valueteam.com>
Acked-by: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-07-28 16:33:03 +02:00
Magnus Damm 6a6c6189b1 I2C: Rework i2c-s3c2410 suspend_late()/resume() V2
This is V2 of the i2c-s3c2410 dev_pm_ops patch.

The callbacks are converted for CONFIG_SUSPEND like this:
  suspend_late() -> suspend_noirq()
  resume() -> resume()

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2009-07-22 00:28:39 +02:00
Magnus Damm 57f4d4f1b7 I2C: Rework i2c-pxa suspend_late()/resume_early()
This patch reworks platform driver power management code
for i2c-pxa from legacy late/early callbacks to dev_pm_ops.

The callbacks are converted for CONFIG_SUSPEND like this:
  suspend_late() -> suspend_noirq()
  resume_early() -> resume_noirq()

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2009-07-22 00:28:39 +02:00
Julia Lawall 593308259b i2c: Use resource_size
Use the function resource_size, which reduces the chance of introducing
off-by-one errors in calculating the resource size.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
struct resource *res;
@@

- (res->end - res->start) + 1
+ resource_size(res)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-15 00:03:56 +01:00
David Brownell 7605fa3b0a i2c-davinci: behave with i2cdetect
Make i2c-davinci cope properly with "i2cdetect":  don't spew
syslog spam on perfectly normal behaviors, or respond to any
address other than the one reserved for the SMBus host.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-15 00:03:56 +01:00
Kevin Hilman e164ddeeb8 i2c-davinci: convert clock usage after clkdev conversion
DaVinci core code has converted to the new clkdev API so
clock name strings are not needed.  Instead, just the a
'struct device' pointer is needed.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-15 00:03:56 +01:00
Joe Perches ad361c9884 Remove multiple KERN_ prefixes from printk formats
Commit 5fd29d6ccb ("printk: clean up
handling of log-levels and newlines") changed printk semantics.  printk
lines with multiple KERN_<level> prefixes are no longer emitted as
before the patch.

<level> is now included in the output on each additional use.

Remove all uses of multiple KERN_<level>s in formats.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-07-08 10:30:03 -07:00
Ingo Molnar 47749b14e5 i2c: fix build bug in i2c-designware.c
This build error triggers on x86:

 drivers/built-in.o: In function `i2c_dw_init':
 i2c-designware.c:(.text+0x4e37ca): undefined reference to `clk_get_rate'
 drivers/built-in.o: In function `dw_i2c_probe':
 i2c-designware.c:(.devinit.text+0x51f5e): undefined reference to `clk_get'
 i2c-designware.c:(.devinit.text+0x51f76): undefined reference to `clk_enable'
 i2c-designware.c:(.devinit.text+0x520ff): undefined reference to `clk_disable'
 i2c-designware.c:(.devinit.text+0x52108): undefined reference to `clk_put'

Because this new driver uses the clk_*() facilities which is an
ARM-only thing currently.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-06-25 11:22:12 -07:00
Baruch Siach 1ab52cf910 i2c: driver for the Synopsys DesignWare I2C controller
The i2c Linux driver for the DesignWare i2c block of Synopsys, which is meant
for AMBA Peripheral Bus. This i2c block is used on SoC chips like the ARM9
based PVG610.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-24 00:18:56 +01:00
Michael Trimarchi dc1972d027 i2c: Fix stuck transaction on cpm-i2c driver
When a process tries to read/write a disconnected i2c device, it receives a signal (e.g. ctrl-c) and the kernel gets stuck.

BUG: soft lockup - CPU#0 stuck for 61s! [I2CEEpromTest:392]
NIP: c01628f8 LR: c01628f0 CTR: c00177cc
REGS: c39abd70 TRAP: 0901   Not tainted  (2.6.25.7-alcore)
MSR: 00009032 <EE,ME,IR,DR>  CR: 42042048  XER: 20000000
TASK = c3889bd0[392] 'I2CEEpromTest' THREAD: c39aa000
GPR00: 00009000 c39abe20 c3889bd0 c39075c8 c39abe28 00000001 00000000 00000001
GPR08: c3889bd0 c39075c8 00009032 c39abe34 00002437
NIP [c01628f8] cpm_i2c_xfer+0x5fc/0x6d0
LR [c01628f0] cpm_i2c_xfer+0x5f4/0x6d0
Call Trace:
[c39abe20] [c0162924] cpm_i2c_xfer+0x628/0x6d0 (unreliable)
[c39abe90] [c015f6a0] i2c_transfer+0x88/0xb4
[c39abeb0] [c0160164] i2c_master_recv+0x48/0x6c
[c39abed0] [c01618dc] i2cdev_read+0x50/0xe4
[c39abef0] [c0068b24] vfs_read+0xc4/0x108
[c39abf10] [c0068f4c] sys_read+0x4c/0x90
[c39abf40] [c000d348] ret_from_syscall+0x0/0x38
Instruction dump:
3bc00064 92610010 3bf201c8 92810014 3b61

This happen because though the wait_event_interruptible_timeout takes the
signals into account, the driver does not handle them.
We propose to change the wait_event_interruptible_timeout with
wait_event_timeout, leaving the signals to be handled in other points
on the upper layers.

Signed-off-by: Bruno Morelli <bruno@evidence.eu.com>
Signed-off-by: Michael Trimarchi <michael@evidence.eu.com>
Acked-by: Jochen Friedrich <jochen@scram.de>
[ben-linux@fluff.org: fix title for patch]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-22 01:43:32 +01:00
Tony Lindgren ff0f242626 i2c-omap: Fix build breaking typo cpu_is_omap_2430
Hi Ben,

Can you please queue this fix?

Thanks,

Tony

>From ffe2b2cdf6283770b70a197e3748c6b40a1006be Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Wed, 17 Jun 2009 13:14:23 +0300
Subject: [PATCH] i2c-omap: Fix build breaking typo in cpu_is_omap_2430

Commit 84bf2c86 introduced a typo, it should be cpu_is_omap2430
instead. The typo was probably caused by a mismerge.

Without this patch all omaps fail to build with:
error: implicit declaration of function 'cpu_is_omap_2430'

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-22 01:43:32 +01:00
Linus Torvalds 5c6fb0059c Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  i2c: New macro to initialize i2c address lists on the fly
  i2c: Don't advertise i2c functions when not available
  i2c: Use rwsem instead of mutex for board info
  i2c: Add a sysfs interface to instantiate devices
  i2c: Limit core locking to the necessary sections
  i2c: Kill the redundant client list
  i2c: Kill is_newstyle_driver
  i2c: Merge i2c_attach_client into i2c_new_device
  i2c: Drop i2c_probe function
  i2c: Get rid of the legacy binding model
  i2c: Kill client_register and client_unregister methods
2009-06-19 17:45:51 -07:00
Rodolfo Giometti f18c41daea i2c: Use rwsem instead of mutex for board info
By using rwsem we can easily manage recursive calls of
i2c_scan_static_board_info() function without breaking the locking.

Signed-off-by: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-19 16:58:20 +02:00
Jean Delvare 99cd8e2587 i2c: Add a sysfs interface to instantiate devices
Add a sysfs interface to instantiate and delete I2C devices. This is
primarily a replacement of the force_* module parameters implemented
by some i2c drivers. These module parameters were implemented
internally by the I2C_CLIENT_INSMOD* macros, which don't scale well.

This can also be used when developing a driver on a self-soldered
board which doesn't yet have proper I2C device declaration at the
platform level, and presumably for various debugging situations.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
2009-06-19 16:58:20 +02:00
Jean Delvare 35fc37f818 i2c: Limit core locking to the necessary sections
The i2c-core code tends to hold the core lock for longer than it
should. Limit locking to the necessary sections for both performance
and clarity. This is also a requirement to support I2C multiplexers in
the future.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Rodolfo Giometti <giometti@linux.it>
Cc: David Brownell <dbrownell@users.sourceforge.net>
2009-06-19 16:58:19 +02:00
Jean Delvare e549c2b54d i2c: Kill the redundant client list
We used to maintain our own per-adapter list of i2c clients, but this
is redundant with what the driver core does, and no longer needed.
Just drop the redundant list.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
2009-06-19 16:58:19 +02:00
Jean Delvare 1e40ac12da i2c: Kill is_newstyle_driver
Legacy i2c drivers are gone, all drivers are new-style now, so there
is no point to check.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
2009-06-19 16:58:19 +02:00
Jean Delvare f8a227e8ac i2c: Merge i2c_attach_client into i2c_new_device
Now that i2c_attach_client is no longer exported, it doesn't need to
be a separate function. Merge it into its only user, i2c_new_device.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
2009-06-19 16:58:18 +02:00
Jean Delvare 36789b5ea5 i2c: Drop i2c_probe function
The legacy i2c_probe() function has no users left, get rid of it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
2009-06-19 16:58:18 +02:00
Jean Delvare 729d6dd571 i2c: Get rid of the legacy binding model
We converted all the legacy i2c drivers so we can finally get rid of
the legacy binding model. Hooray!

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
2009-06-19 16:58:18 +02:00
Jean Delvare 352da9820e i2c: Kill client_register and client_unregister methods
These methods were useful in the legacy binding model but no longer in
the new (standard) binding model. There are no users left so we can
drop them.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
2009-06-19 16:58:17 +02:00
Benjamin Herrenschmidt b71a107c66 Merge commit 'gcl/merge' into next
Manual merge of:
	drivers/net/fec_mpc52xx.c
2009-06-18 11:22:08 +10:00
Wolfgang Denk 87c441e54d powerpc/5xxx: Add common mpc5xxx_get_bus_frequency() function
So far, MPC512x used mpc512x_find_ips_freq() to get the bus frequency,
while MPC52xx used mpc52xx_find_ipb_freq().  Despite the different
clock names (IPS vs. IPB) the code was identical.

Use common code for both processor families.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-06-17 00:30:22 -06:00
Linus Walleij 4eaad8ad29 i2c-stu300: Make driver depend on MACH_U300
This makes the stu300 driver for the ST Micro ST DDC I2C bus
driver depend on MACH_U300, new platforms reusing this I2C
driver will need to add in a similar dependency.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
[ben-linux@fluff.org: re-aranged subject line]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-16 22:42:17 +01:00
Ben Dooks 933a2aec8d i2c-s3c2410: use resource_size()
Change the usage of res->end-res->start to resource_size(), missed
by the last patch to change this.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-16 22:42:16 +01:00
Linus Walleij c6ffddea36 i2c: Use resource_size macro
This replace all instances in the i2c busses tree of
res->end - res->start + 1 with the handy macro resource_size(res)
from ioport.h (coming in from platform_device.h).

This was created with a simple
sed -i -e 's/\([a-z]*\)->end *- *[a-z]*->start *+ *1/resource_size(\1)/g'

Then manually replacing the PXA redefiniton of the same kind
of macro manually. Recompiled some ARM defconfigs I could find to
make a rough test so it shouldn't break anything, though I
couldn't see exactly which configs you need for all the drivers.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-16 22:42:16 +01:00
Linus Walleij 18904c0ecd i2c: ST DDC I2C U300 bus driver v3
This adds support for the ST Microelectronics DDC I2C bus
driver. This bus is used in the U300 architecture recently
added to RMK:s ARM tree.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Reviewed-by: Ben Dooks <ben-linux@fluff.org>
Reviewed-by: Jean Delvare <khali@linus-fr.org>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-16 22:42:16 +01:00
Mike Frysinger 6df263cf2e i2c-bfin-twi: pull in io.h for ioremap()
Rather than relying on some of the headers implicitly pulling in io.h,
pull it in explicitly our self for ioremap() and friends.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-16 22:42:15 +01:00
Linus Torvalds 4858704da7 Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  therm_windtunnel: Convert to a new-style i2c driver
  therm_adt746x: Convert to a new-style i2c driver
  windfarm: Convert to new-style i2c drivers
  therm_pm72: Convert to a new-style i2c driver
  i2c-viapro: Add new PCI device ID for VX855
  i2c/chips: Move max6875 to drivers/misc/eeprom
  i2c: Do not give adapters a default parent
  i2c: Do not probe for TV chips on Voodoo3 adapters
  i2c: Retry automatically on arbitration loss
  i2c: Remove void casts
2009-06-16 11:29:17 -07:00
Linus Torvalds 0fa213310c Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (103 commits)
  powerpc: Fix bug in move of altivec code to vector.S
  powerpc: Add support for swiotlb on 32-bit
  powerpc/spufs: Remove unused error path
  powerpc: Fix warning when printing a resource_size_t
  powerpc/xmon: Remove unused variable in xmon.c
  powerpc/pseries: Fix warnings when printing resource_size_t
  powerpc: Shield code specific to 64-bit server processors
  powerpc: Separate PACA fields for server CPUs
  powerpc: Split exception handling out of head_64.S
  powerpc: Introduce CONFIG_PPC_BOOK3S
  powerpc: Move VMX and VSX asm code to vector.S
  powerpc: Set init_bootmem_done on NUMA platforms as well
  powerpc/mm: Fix a AB->BA deadlock scenario with nohash MMU context lock
  powerpc/mm: Fix some SMP issues with MMU context handling
  powerpc: Add PTRACE_SINGLEBLOCK support
  fbdev: Add PLB support and cleanup DCR in xilinxfb driver.
  powerpc/virtex: Add ml510 reference design device tree
  powerpc/virtex: Add Xilinx ML510 reference design support
  powerpc/virtex: refactor intc driver and add support for i8259 cascading
  powerpc/virtex: Add support for Xilinx PCI host bridge
  ...
2009-06-15 09:32:52 -07:00
Harald Welte a231591f04 i2c-viapro: Add new PCI device ID for VX855
The south bridge of the VIA VX855 chipset has a different PCI Device ID
so i2c-viapro.c needs to be updated with this.

Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15 18:01:49 +02:00
Wolfram Sang 4b364f230a i2c/chips: Move max6875 to drivers/misc/eeprom
This driver only reads the user EEPROM of that chip, so we can move it
to the eeprom-directory in order to further clean up (and later remove)
drivers/i2c/chips.

The Kconfig text was updated to match the current functionality,
dropping the meanwhile obsoleted parts.

Defconfigs have been adapted.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Ben Gardner <gardner.ben@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15 18:01:49 +02:00
Jean Delvare c52cf01f5b i2c: Do not give adapters a default parent
We don't need to give adapters a parent if they don't have one. The
driver core will put them in the virtual device directory and all will
be fine.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15 18:01:48 +02:00
Jean Delvare fa1b2ca4fa i2c: Do not probe for TV chips on Voodoo3 adapters
There's no point in giving the I2C bus of Voodoo3 adapters a class
value, there's no video chip driver checking for it anymore. If
support is ever needed, the video device should be instantiated
explicitly rather than probed.

To the best of my knowledge the only video chip that can be found on
these boards is a BT869 video encoder, for which no support exists
currently.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
2009-06-15 18:01:48 +02:00
Clifford Wolf 66b650f045 i2c: Retry automatically on arbitration loss
Some small changes in i2c core to retry i2c xfers until either the
maximum number of retries or the timeout is hit.

Signed-off-by: Clifford Wolf <clifford@clifford.at>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15 18:01:46 +02:00
Jack Stone 1cf92b453a i2c: Remove void casts
Remove uneeded void casts.

Signed-off-by: Jack Stone <jwjstone@fastmail.fm>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15 18:01:46 +02:00
Benjamin Herrenschmidt 7dafd239ab Merge commit 'origin/master' into next 2009-06-15 10:36:54 +10:00
Linus Torvalds 2cf4d4514d Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (417 commits)
  MAINTAINERS: EB110ATX is not ebsa110
  MAINTAINERS: update Eric Miao's email address and status
  fb: add support of LCD display controller on pxa168/910 (base layer)
  [ARM] 5552/1: ep93xx get_uart_rate(): use EP93XX_SYSCON_PWRCNT and EP93XX_SYSCON_PWRCN
  [ARM] pxa/sharpsl_pm: zaurus needs generic pxa suspend/resume routines
  [ARM] 5544/1: Trust PrimeCell resource sizes
  [ARM] pxa/sharpsl_pm: cleanup of gpio-related code.
  [ARM] pxa/sharpsl_pm: drop set_irq_type calls
  [ARM] pxa/sharpsl_pm: merge pxa-specific code into generic one
  [ARM] pxa/sharpsl_pm: merge the two sharpsl_pm.c since it's now pxa specific
  [ARM] sa1100: remove unused collie_pm.c
  [ARM] pxa: fix the conflicting non-static declarations of global_gpios[]
  [ARM] 5550/1: Add default configure file for w90p910 platform
  [ARM] 5549/1: Add clock api for w90p910 platform.
  [ARM] 5548/1: Add gpio api for w90p910 platform
  [ARM] 5551/1: Add multi-function pin api for w90p910 platform.
  [ARM] Make ARM_VIC_NR depend on ARM_VIC
  [ARM] 5546/1: ARM PL022 SSP/SPI driver v3
  ARM: OMAP4: SMP: Update defconfig for OMAP4430
  ARM: OMAP4: SMP: Enable SMP support for OMAP4430
  ...
2009-06-14 13:42:43 -07:00
Richard Röjfors dd14be4c27 i2c-ocores: Can add I2C devices to the bus
There is sometimes a need for the ocores driver to add devices to the
bus when installed.

i2c_register_board_info can not always be used, because the I2C devices
 are not known at an early state, they could for instance be connected
 on a I2C bus on a PCI device which has the Open Cores IP.

i2c_new_device can not be used in all cases either since the resulting
bus nummer might be unknown.

The solution is the pass a list of I2C devices in the platform data to
the Open Cores driver. This is useful for MFD drivers.

Signed-off-by: Richard Röjfors <richard.rojfors.ext@mocean-labs.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-13 10:39:28 +01:00
Ben Dooks 7d85ccd816 i2c-s3c2410: move to using platform idtable to match devices
Change to using platform id table to match either of the two supported
platform device names in the driver. This simplifies the driver init and
exit code

Note, log messages will now be prefixed with 's3c-i2c' instead of the
driver name, so output will be of the form of:

s3c-i2c s3c2440-i2c.0: slave address 0x10

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-13 10:39:26 +01:00
Aaro Koskinen 84bf2c868f i2c: OMAP3: Better noise suppression for fast/standard modes
Use longer noise filter period for fast and standard mode. Based on an
earlier patch by Eero Nurkkala.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-13 10:39:26 +01:00
Aaro Koskinen baf46b4e37 i2c: OMAP2/3: Fix scll/sclh calculations
Fix scll/sclh calculations for HS and fast modes. Currently the driver
uses equal (roughly) low/high times which will result in too short
low time.

OMAP3430 TRM gives the following equations:

	F/S: tLow  = (scll + 7) * internal_clk
	     tHigh = (sclh + 5) * internal_clk
	HS:  tLow  = (scll + 7) * fclk
	     tHigh = (sclh + 5) * fclk

Furthermore, the I2C specification sets the following minimum values
for HS tLow/tHigh for capacitive bus loads 100 pF (maximum speed 3400)
and 400 pF (maximum speed 1700):

	speed	tLow		tHigh
	3400	160 ns		60 ns
	1700	320 ns		120 ns

and for F/S:

	speed	tLow		tHigh
	400	1300 ns		600 ns
	100	4700 ns		4000 ns

By using duty cycles 33/66 (HS, F) and 50/50 (S) we stay above these
minimum values.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-13 10:39:25 +01:00
Michael Hennerich e0cd2dd5dd i2c: Blackfin TWI: implement I2C_FUNC_SMBUS_I2C_BLOCK functionality
Some drivers need i2c_smbus_read_i2c_block_data() functionality, so add
support for it to the Blackfin I2C bus driver.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
[ben-linux@fluff.org: shortened subject]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-13 10:39:25 +01:00
Frank Shew 94327d009e i2c: Blackfin TWI: fix transfer errors with repeat start
We have a custom BF537 board with an I2C RTC (MAX DS3231) running
uclinux 2007R1 for some time. Recently during migration to 2008R1.5-RC3
we losted access to the RTC. The RTC driver calls 'i2c_transfer()' which
in turns calls 'bfin_twi_master_xfer()' in i2c-bfin-twi.c.

Compared with 2007R1, it looks like the 2008R1.5 version of i2c-bin-twi.c
has a new mode 'TWI_I2C-MODE_REPEAT' which corresponds to the Repeat Start
Condition described in the HRM. However, according to the HRM, at XMIT or
RECV interrupt and when the data count is 0, not only is the RESTART bit
supposed to be set, but MDIR must also be set if the next operation is a
receive sequence, and cleared if not. Currently there is no code that looks
at the I2C_M_RD bit in the flag from the next cur_msg and set/clear the MDIR
flag accordingly at the same time that the RSTART bit is set. Instead, MDIR
is set or cleared (by OR'ing with 0?) after the RESTART bit has been cleared
during handling of MCOMP interrupt.

It appears that this is causing our failure with reading the RTC, as a
quick patch to set/clear MDIR when RESTART is set seem to solve our problem.

Signed-off-by: Frank Shew <fshew@geometrics.com>
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
[ben-linux@fluff.org: shorted subject]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-13 10:39:25 +01:00
Sonic Zhang 57a8f32eaf i2c: Blackfin TWI: fix REPEAT START mode doesn't repeat
Avoid rewrite TWI MASTER_CTL reg when issue next message
In i2c repeat transfer mode, byte count of next message should be filled
into part of the TWI MASTER_CTL reg when interrupt MCOMP of last
message transfer is triggered. But, other bits in this reg should
not be touched.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
[ben-linux@fluff.org: shorted subject]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-13 10:39:25 +01:00
Michael Hennerich 9528d1c7a5 i2c: Blackfin TWI: make sure we don't end up with a CLKDIV=0
Make sure we don't end up with an invalid CLKDIV=0 in case someone
specifies 20kHz SCL or less (5 * 1024 / 20 = 0x100).

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
[ben-linux@fluff.org: shortened subject line]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-13 10:39:25 +01:00
Benjamin Herrenschmidt bc47ab0241 Merge commit 'origin/master' into next
Manual merge of:
	arch/powerpc/kernel/asm-offsets.c
2009-06-12 16:53:38 +10:00
Eric Miao f0a8370139 [ARM] pxa: move mach/i2c.h to plat/i2c.h
Signed-off-by: Paul Shen <paul.shen@marvell.com>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
2009-06-05 10:32:01 +08:00
Eric Miao f23d491131 [ARM] pxa: add platform device ID table to pxa i2c driver
Signed-off-by: Eric Miao <eric.miao@marvell.com>
2009-06-05 10:21:42 +08:00
Sean MacLennan 9d2c0f67c8 i2c: Fix confusing i2c-ibm_iic message
The i2c-ibm_iic driver printed messages in an odd order that seemed
to list devices before the driver was probed.

Here is an example:

at24 0-0052: 512 byte 24c04 EEPROM (writable)
ibm-iic ef600700.i2c: using standard (100 kHz) mode
ad7414 0-004a: chip found

This changes the order to print the i2c driver message before scanning
for devices so that the logs show the driver, then the devices. 

Signed-off-by: Sean MacLennan <smaclennan@pikatech.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
2009-06-04 08:59:24 -04:00
Paul Mundt 464c9e1037 Merge branch 'sh/clkfwk' 2009-05-26 23:50:40 +09:00
Paul Mundt af777ce42d sh: clkfwk: module_clk -> peripheral_clk rename.
For consistenct naming, and to allow us to fix up some confusion in the
SH-Mobile clock framework, amongst other places.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-13 16:59:40 +09:00
Linus Torvalds 816dc3c82b Merge branch 'i2c-for-2630-rc5' of git://aeryn.fluff.org.uk/bjdooks/linux
* 'i2c-for-2630-rc5' of git://aeryn.fluff.org.uk/bjdooks/linux:
  i2c-cpm: Pass dev ptr to dma_*_coherent rather than NULL
  i2c: Enable i2c-s3c2410 for S3C64XX too
  i2c-mpc: bug fix for MPC52xx clock setting and printout
  i2c-pxa.c: timeouts off by 1
2009-05-12 11:21:51 -07:00
Mark Ware 36521c271e i2c-cpm: Pass dev ptr to dma_*_coherent rather than NULL
Recent DMA changes result in a BUG() when NULL is passed to
dma_alloc_coherent in place of a device.

Signed-off-by: Mark Ware <mware@elphinstone.net>
[ben-linux@fluff.org: fix patch moves]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-05-12 00:36:04 +01:00
Mark Brown 89bc5d4a91 i2c: Enable i2c-s3c2410 for S3C64XX too
This controller is also present on the S3C64xx series processors so
enable the driver in Kconfig for those platforms.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-05-12 00:36:03 +01:00
Wolfgang Grandegger 1904b03430 i2c-mpc: bug fix for MPC52xx clock setting and printout
The clock setting did not work for the MPC52xx due to a stupid bug.
Furthermore, the dev info output "clock=0" for old device trees was
misleading. This patch fixes both issues.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-05-12 00:35:56 +01:00
Enrik Berkhan 2196d1cf4a i2c-algo-pca: Let PCA9564 recover from unacked data byte (state 0x30)
Currently, the i2c-algo-pca driver does nothing if the chip enters state
0x30 (Data byte in I2CDAT has been transmitted; NOT ACK has been
received).  Thus, the i2c bus connected to the controller gets stuck
afterwards.

I have seen this kind of error on a custom board in certain load
situations most probably caused by interference or noise.

A possible reaction is to let the controller generate a STOP condition.
This is documented in the PCA9564 data sheet (2006-09-01) and the same
is done for other NACK states as well.

Further, state 0x38 isn't handled completely, either. Try to do another
START in this case like the data sheet says. As this couldn't be tested,
I've added a comment to try to reset the chip if the START doesn't help
as suggested by Wolfram Sang.

Signed-off-by: Enrik Berkhan <Enrik.Berkhan@ge.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-05-05 08:39:25 +02:00
Dave Airlie 0cdba07bb2 i2c-algo-bit: Fix timeout test
When fetching DDC using i2c algo bit, we were often seeing timeouts
before getting valid EDID on a retry. The VESA spec states 2ms is the
DDC timeout, so when this translates into 1 jiffie and we are close
to the end of the time period, it could return with a timeout less than
2ms.

Change this code to use time_after instead of time_after_eq.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-05-05 08:39:24 +02:00
Roel Kluin 4ccc28f725 i2c: Timeouts off by 1
with while (timeout++ < MAX_TIMEOUT); timeout reaches MAX_TIMEOUT + 1
after the loop, so the tests below are off by one.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-05-05 08:39:24 +02:00
Roel Kluin d10db3a07e i2c-pxa.c: timeouts off by 1
With `while (timeout--)' timeout reaches -1 after the loop, so the tests
below are off by one.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-05-03 22:54:23 +01:00
Jean Delvare 935298696f i2c: Let new-style drivers implement attach_adapter
While it isn't the way the standard device binding model works, it is
OK for new-style drivers to implement attach_adapter. It may help
convert the renaming legacy drivers to new style drivers faster.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
2009-04-13 17:02:14 +02:00
Jean Delvare 3f307fb37a i2c-voodoo3: Deprecate in favor of tdfxfb
Support for I2C/DDC was recently added to the tdfxfb driver, which
means that the i2c-voodoo3 driver can be deprecated.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Krzysztof Helt <krzysztof.h1@wp.pl>
2009-04-13 17:02:13 +02:00
Jean Delvare c454dee21d i2c-algo-pca: Fix use of uninitialized variable in debug message
A recent change broke debugging of pca_xfer(), fix it.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
2009-04-13 17:02:13 +02:00
Wolfram Sang 65de394df2 i2c: imx: Make disable_delay a per-device variable
'disable_delay' was static which is wrong as it is calculated using the per-device
bus speed. This patch turns 'disable_delay' into a per-device variable.

Reported-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Darius Augulis <augulis.darius@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-04-07 10:23:34 +01:00
Oskar Schirmer b486ddbc0f i2c: xtensa s6000 i2c driver
Support for the s6000 on-chip i2c controller.

Signed-off-by: Oskar Schirmer <os@emlix.com>
Signed-off-by: Daniel Glöckner <dg@emlix.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-04-07 10:23:34 +01:00
Wolfgang Grandegger f2bd5efe72 i2c: i2c-mpc: make I2C bus speed configurable
This patch makes the I2C bus speed configurable by using the I2C node
property "clock-frequency". If the property is not defined, the old
fixed clock settings will be used for backward comptibility.

The generic I2C clock properties, especially the CPU-specific source
clock pre-scaler are defined via the OF match table:

  static const struct of_device_id mpc_i2c_of_match[] = {
	...
	{.compatible = "fsl,mpc8543-i2c",
	 .data = &(struct fsl_i2c_match_data) {
			.setclock = mpc_i2c_setclock_8xxx,
			.prescaler = 2,
		},
	},

The "data" field defines the relevant I2C setclock function and the
relevant pre-scaler for the I2C source clock frequency.

It uses arch-specific tables and functions to determine resonable
Freqency Divider Register (fdr) values for MPC83xx, MPC85xx, MPC86xx,
MPC5200 and MPC5200B.

The i2c->flags field and the corresponding FSL_I2C_DEV_* definitions
have been removed as they are obsolete.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-04-07 10:18:47 +01:00
Wolfgang Grandegger 54377cd059 i2c: i2c-mpc: use dev based printout function
This patch used the dev_dbg, dev_err, etc. functions for debug
and error output instead of printk and pr_debug.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-04-07 10:18:47 +01:00
Wolfgang Grandegger 8101a30095 i2c: i2c-mpc: various coding style fixes
Fix errors reported by checkpatch (indention, long lines, trailing
white space, etc.).

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-04-07 10:18:47 +01:00
Darius Augulis 309c18d2cd i2c: imx: Add missing request_mem_region in probe()
Signed-off-by: Darius Augulis <augulis.darius@gmail.com>
[ben-linux@fluff.org: fix minor patch fault in remove]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-04-07 10:18:33 +01:00
Mark Brown 18dc83a6ea i2c: i2c-s3c2410: Initialise Samsung I2C controller early
This is required in order to ensure that core system devices such as
voltage regulators attached via I2C are avaiable early in boot.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-04-07 10:18:33 +01:00
Daniel Silverstone c564e6ae6c i2c-s3c2410: Simplify bus frequency calculation
The platform data for the i2c-s3c2410 driver used to allow a min,
max and desired frequency for the I2C bus. This patch reduces it
to simply a desired frequency ceiling and corrects all the uses
of the platform data appropriately.

This means, for example, that on a system with a 66MHz fclk, a
request for 100KHz will achieve 65KHz which is safe and
acceptable, rather than 378KHz which it would have achieved
without this change.

Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
Signed-off-by: Daniel Silverstone <dsilvers@simtec.co.uk>
[ben-linux@fluff.org: tidy subject and description]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-04-07 10:18:33 +01:00
Ben Dooks a192f7153b i2c-s3c2410: sda_delay should be in ns, not clock ticks
The sda_delay field should be specified in ns, not in clock ticks
as when using cpufreq we could be changing the bus rate.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
2009-04-07 10:18:33 +01:00
Darius Augulis aa11e38ce6 i2c: iMX/MXC support
Implementation of I2C Adapter/Algorithm Driver for I2C Bus integrated
in Freescale's i.MX/MXC processors.

Signed-off-by: Darius Augulis <augulis.darius@gmail.com>
Tested-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-04-07 10:18:32 +01:00
Jean Delvare abe213d7f6 i2c: Delete unused i2c-algo-sgi helper module
The i2c-algo-sgi code was merged into the vino driver, so we can
delete it now.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-04-06 18:12:25 +02:00
Linus Torvalds 3c6fae67d0 Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
* 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
  hwmon: (fschmd) Add support for the FSC Hades IC
  hwmon: (fschmd) Add support for the FSC Syleus IC
  i2c-i801: Instantiate FSC hardware montioring chips
  dmi: Let dmi_walk() users pass private data
  hwmon: Define a standard interface for chassis intrusion detection
  Move the pcf8591 driver to hwmon
  hwmon: (w83627ehf) Only expose in6 or temp3 on the W83667HG
  hwmon: (w83627ehf) Add support for W83667HG
  hwmon: (w83627ehf) Invert fan pin variables logic
  hwmon: (hdaps) Fix Thinkpad X41 axis inversion
  hwmon: (hdaps) Allow inversion of separate axis
  hwmon: (ds1621) Clean up documentation
  hwmon: (ds1621) Avoid unneeded register access
  hwmon: (ds1621) Clean up register access
  hwmon: (ds1621) Reorder code statements
2009-03-30 17:54:32 -07:00
Hans de Goede fa5bfab712 i2c-i801: Instantiate FSC hardware montioring chips
Detect various FSC hwmon IC's based on DMI tables and then let
the i2c-i801 driver instantiate the i2c client devices. Note that
some of the info in the added table is indentical for all rows, still
this is kept in the table to keep the code general and thus (hopefully)
easily extensible in the future.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-30 21:46:44 +02:00
Jean Delvare fb4504fe84 Move the pcf8591 driver to hwmon
Directory drivers/i2c/chips is going away, so drivers there must find
new homes. For the pcf8591 driver, the best choice seems to be the
hwmon subsystem. While the Philips PCF8591 device isn't a typical
hardware monitoring chip, its DAC interface is compatible with the
hwmon one, so it fits somewhat.

If a better subsystem is ever created for ADC/DAC chips, the driver
could be moved there.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Aurelien Jarno <aurelien@aurel32.net>
2009-03-30 21:46:43 +02:00
Benjamin Herrenschmidt 9ff9a26b78 Merge commit 'origin/master' into next
Manual merge of:
	arch/powerpc/include/asm/elf.h
	drivers/i2c/busses/i2c-mpc.c
2009-03-30 14:04:53 +11:00
Linus Torvalds 07d43ba986 Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
  i2c-core: Some style cleanups
  i2c-piix4: Add support for the Broadcom HT1100 chipset
  i2c-piix4: Add support to SB800 SMBus changes
  i2c-pca-platform: Use defaults if no platform_data given
  i2c-algo-pca: Use timeout for checking the state machine
  i2c-algo-pca: Rework waiting for a free bus
  i2c-algo-pca: Add PCA9665 support
  i2c: Adapt debug macros for KERN_* constants
  i2c-davinci: Fix timeout handling
  i2c: Adapter timeout is in jiffies
  i2c: Set a default timeout value for all adapters
  i2c: Add missing KERN_* constants to printks
  i2c-algo-pcf: Handle timeout correctly
  i2c-algo-pcf: Style cleanups
  eeprom/at24: Remove EXPERIMENTAL
  i2c-nforce2: Add support for MCP67, MCP73, MCP78S and MCP79
  i2c: Clarify which clients are auto-removed
  i2c: Let checkpatch shout on users of the legacy model
  i2c: Document the different ways to instantiate i2c devices
2009-03-28 14:04:53 -07:00
Zhenwen Xu 09b8ce0a69 i2c-core: Some style cleanups
Some lines over 80. 
The printk(KERN_ERR ... ) should be dev_err.
And some blankspace should be deleted.

Signed-off-by: Zhenwen Xu <helight.xu@gmail.com>
Signed-off-by: Jean Delvare <khlai@linux-fr.org>
2009-03-28 21:34:46 +01:00
Flavio Leitner 506a8b6c27 i2c-piix4: Add support for the Broadcom HT1100 chipset
Add support for the Broadcom HT1100 LD chipset (SMBus function.)

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-28 21:34:46 +01:00
Shane Huang 87e1960e93 i2c-piix4: Add support to SB800 SMBus changes
Add support for the AMD SB800 Family series of products.
Major changes include the changes to addressing the SMBus registers at different
location from the locations in the previous compatible parts from AMD such as
SB400/SB600/SB700. For SB800, the main features and register definitions of
SMBus and other interfaces are still compatible with the previous products with
the only change being in how to access the internal registers for these blocks.

Signed-off-by: Shane Huang <shane.huang@amd.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-28 21:34:46 +01:00
Wolfram Sang 6b110d13aa i2c-pca-platform: Use defaults if no platform_data given
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-28 21:34:45 +01:00
Wolfram Sang 2378bc09b9 i2c-algo-pca: Use timeout for checking the state machine
We now timeout also if the state machine does not change within the
given time. For that, the driver-specific completion-functions are
extended to return true or false depending on the timeout. This then
gets checked in the algorithm.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-28 21:34:45 +01:00
Wolfram Sang 8e99ada8de i2c-algo-pca: Rework waiting for a free bus
Waiting for a free bus now accepts the timeout value in jiffies and does
proper checking using time_before.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-28 21:34:45 +01:00
Marco Aurelio da Costa eff9ec95ef i2c-algo-pca: Add PCA9665 support
Add support for the PCA9665 I2C controller.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-28 21:34:44 +01:00
Frank Seidel bac3e7c2aa i2c: Adapt debug macros for KERN_* constants
According to kerneljanitors todo list all printk calls (beginning
a new line) should have an according KERN_* constant.
Those are the changes to the debug macros in the i2c subsystem
to meet this requirement. Also changing no-debug statements
to raw printks again.

Signed-off-by: Frank Seidel <frank@f-seidel.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
2009-03-28 21:34:44 +01:00
Jean Delvare 98a679cad5 i2c-davinci: Fix timeout handling
Properly set the adapter timeout value in jiffies, and then use that
value in the driver, rather than a hard-coded constant.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Troy Kisky <troy.kisky@boundarydevices.com>
Cc: Kevin Hilman <khilman@mvista.com>
2009-03-28 21:34:43 +01:00
Jean Delvare 8a52c6b4d5 i2c: Adapter timeout is in jiffies
i2c_adapter.timeout is in jiffies. Fix all drivers which thought
otherwise. It didn't really matter as long as the value was only used
inside the driver, but soon i2c-core will use it too so it must have
the proper unit.

Note: for the i2c-mpc driver, this fixes a bug in polling mode.
Timeout would trigger after 1 jiffy, which is most probably not what
the author wanted.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Clifford Wolf <clifford@clifford.at>
Acked-by: Sean MacLennan <smaclennan@pikatech.com>
Cc: Stefan Roese <sr@denx.de>
Acked-by: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Mark A. Greer <mgreer@mvista.com>
2009-03-28 21:34:43 +01:00
Jean Delvare 8fcfef6e65 i2c: Set a default timeout value for all adapters
Setting a default timeout value on a per-algo basis doesn't make any
sense. Move the default value setting to i2c-core. Individual adapter
drivers can specify a different (non-zero) value if they wish.

Also express the timeout value in a way which results in the same
duration regarless of the value of HZ.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
2009-03-28 21:34:43 +01:00
Frank Seidel 154d22b04a i2c: Add missing KERN_* constants to printks
According to kerneljanitors todo list all printk calls (beginning
a new line) should have an according KERN_* constant.
Those are the missing pieces here for the i2c subsystem.

Signed-off-by: Frank Seidel <frank@f-seidel.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-28 21:34:42 +01:00
Roel Kluin 94d78e180c i2c-algo-pcf: Handle timeout correctly
With a postfix decrement these timeouts reach -1 rather than 0, but after the
loop it is tested whether they have become 0.

As pointed out by Jean Delvare, the msg_num should be tested before the timeout.
With the current order, you could exit with a timeout error while all the
messages were successfully transferred.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Eric Brower <ebrower@gmail.com>
2009-03-28 21:34:42 +01:00
Roel Kluin 0c168ceb9e i2c-algo-pcf: Style cleanups
cleanup whitespace, fix comments and remove the unused STUB_I2C.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Eric Brower <ebrower@gmail.com>
2009-03-28 21:34:42 +01:00
Jean Delvare d2dd14ac18 i2c-nforce2: Add support for MCP67, MCP73, MCP78S and MCP79
The MCP78S and MCP79 appear to be compatible with the previous nForce
chips as far as the SMBus controller is concerned. The MCP67 and MCP73
were not tested yet but I'd be very surprised if they weren't
compatible too.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Oleg Ryjkov <olegr@olegr.ca>
Cc: Malcolm Lalkaka <mlalkaka@gmail.com>
Cc: Zbigniew Luszpinski <zbiggy@o2.pl>
2009-03-28 21:34:41 +01:00
Jean Delvare acec211ca6 i2c: Clarify which clients are auto-removed
The automatic removal of i2c clients only affects the clients which
were created automatically in the first place. Add a comment saying
that to avoid any confusion.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-28 21:34:40 +01:00
Russell King ed40d0c472 Merge branch 'origin' into devel
Conflicts:
	sound/soc/pxa/pxa2xx-i2s.c
2009-03-28 20:29:51 +00:00
Russell King 997302259f [ARM] acorn,ebsa110,footbridge,integrator,sa1100: Convert asm/io.h to linux/io.h
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-03-25 10:21:35 +00:00
Ming Lei f67f129e51 Driver core: implement uevent suppress in kobject
This patch implements uevent suppress in kobject and removes it
from struct device, based on the following ideas:

1,Uevent sending should be one attribute of kobject, so suppressing it
in kobject layer is more natural than in device layer. By this way,
we can do it for other objects embedded with kobject.

2,It may save several bytes for each instance of struct device.(On my
omap3(32bit ARM) based box, can save 8bytes per device object)

This patch also introduces dev_set|get_uevent_suppress() helpers to
set and query uevent_suppress attribute in case to help kobject
as private part of struct device in future.

[This version is against the latest driver-core patch set of Greg,please
ignore the last version.]

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-03-24 16:38:26 -07:00
Russell King 14b6848bc0 Merge branch 'omap-clks3' into devel
Conflicts:

	arch/arm/mach-omap2/clock.c
2009-03-19 12:39:58 +00:00
Russell King 97fb44eb6b Merge branch 'for-rmk' of git://git.pengutronix.de/git/imx/linux-2.6 into devel
Conflicts:

	arch/arm/mach-at91/gpio.c
2009-03-13 21:44:51 +00:00
Benjamin Herrenschmidt e14eee56c2 Merge commit 'origin/master' into next 2009-03-11 17:10:07 +11:00
Timur Tabi 1ab082d7cb i2c-mpc: do not allow interruptions when waiting for I2C to complete
The i2c_wait() function is using wait_event_interruptible_timeout() to wait for
the I2C controller to signal that it has completed an I2C bus operation.  If
the process that causes the I2C operation terminated abruptly, the wait will
be interrupted, returning an error.  It is better to let the I2C operation
finished before the process exits.

It is safe to use wait_event_timeout() instead, because the timeout will allow
the process to exit if the I2C bus hangs.  It's also better to allow the
I2C operation to finish, because unacknowledged I2C operations can cause the
I2C bus to hang.

Signed-off-by: Timur Tabi <timur@freescale.com>
Acked-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2009-03-09 09:25:34 -05:00
Linus Torvalds f41bf2ab99 Merge master.kernel.org:/home/rmk/linux-2.6-arm
* master.kernel.org:/home/rmk/linux-2.6-arm:
  [ARM] fix lots of ARM __devexit sillyness
  [ARM] 5417/1: Set the correct cacheid for ARMv6 CPUs with ARMv7 style MMU
  [ARM] 5416/1: Use unused address in v6_early_abort
  [ARM] 5411/1: S3C64XX: Fix EINT unmask
  [ARM] at91: fix for Atmel AT91 powersaving
  [ARM] RiscPC: Fix etherh oops
2009-03-03 14:12:41 -08:00
Russell King bdf602bd73 [ARM] fix lots of ARM __devexit sillyness
`iop_adma_remove' referenced in section `.data' of drivers/built-in.o: defined in discarded section `.devexit.text' of drivers/built-in.o
`mv_xor_remove' referenced in section `.data' of drivers/built-in.o: defined in discarded section `.devexit.text' of drivers/built-in.o
`mv64xxx_i2c_unmap_regs' referenced in section `.devinit.text' of drivers/built-in.o: defined in discarded section `.devexit.text' of drivers/built-in.o
`mv64xxx_i2c_remove' referenced in section `.data' of drivers/built-in.o: defined in discarded section `.devexit.text' of drivers/built-in.o
`orion_nand_remove' referenced in section `.data' of drivers/built-in.o: defined in discarded section `.devexit.text' of drivers/built-in.o
`pxafb_remove' referenced in section `.data' of drivers/built-in.o: defined in discarded section `.devexit.text' of drivers/built-in.o

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-03-03 21:04:04 +00:00
Russell King 531660ef56 Add i2c_board_info for RiscPC PCF8583
Add the necessary i2c_board_info structure to fix the lack of PCF8583
RTC on RiscPC.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
2009-02-24 19:19:50 +01:00
Jean Delvare 082a4cf809 i2c: Make sure i2c_algo_bit_data.timeout is HZ-independent
i2c_algo_bit_data.timeout is supposed to be in jiffies, so drivers
should use set this value in terms of HZ.

Ultimately I think this field should be discarded in favor of
i2c_adapter.timeout, but that's left for a future patch.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Lennert Buytenhek <kernel@wantstofly.org>
Acked-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
2009-02-24 19:19:49 +01:00
Jean Delvare cd97f39b7c i2c-dev: Clarify the unit of ioctl I2C_TIMEOUT
The unit in which user-space can set the bus timeout value is jiffies
for historical reasons (back when HZ was always 100.) This is however
not good because user-space doesn't know how long a jiffy lasts. The
timeout value should instead be set in a fixed time unit. Given the
original value of HZ, this unit should be 10 ms, for compatibility.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
2009-02-24 19:19:49 +01:00
Roel Kluin a746b578d8 i2c: Timeouts reach -1
With a postfix decrement these timeouts reach -1 rather than 0, but
after the loop it is tested whether they have become 0.

As pointed out by Jean Delvare, the condition we are waiting for should
also be tested before the timeout. With the current order, you could
exit with a timeout error while the job is actually done.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-02-24 19:19:48 +01:00
Roel Kluin f29d2e0275 i2c: Fix misplaced parentheses
Fix misplaced parentheses.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-02-24 19:19:48 +01:00
Catalin Marinas 2514cca06b [ARM] 5394/1: Add static bus numbering support to i2c-versatile
If dev->id is not -1, the platform code may use static bus numbering
rather than dynamic. The patch also changes the i2c_versatile_init to a
subsys_initcall rather than module_init to make sure it is initialised
before the I2C devices initialisation.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-02-19 11:30:22 +00:00
Russell King 5fe2338040 [ARM] omap: i2c: remove conditional ick clocks
By providing a dummy ick for OMAP1510 and OMAP310, we avoid having
SoC conditional clock information in i2c-omap.c.  Also, fix the
error handling by making sure we propagate the error returned via
clk_get().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-02-08 17:50:20 +00:00
Russell King 0e9ae109e4 [ARM] omap: i2c: remove armxor_ck
On OMAP1, the I2C functional clock (fck) is the armxor_ck, so there's
no need to get "armxor_ck" separately.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-02-08 17:50:20 +00:00
Russell King 1d14de087d [ARM] omap: i2c: use short connection ids
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-02-08 17:50:19 +00:00
Wolfram Sang 2e157888f1 i2c: Move old eeprom driver to /drivers/misc/eeprom
Update Kconfig text to specify this driver as I2C.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-01-26 21:19:53 +01:00
Wolfram Sang 5195e5093b i2c: Move at24 to drivers/misc/eeprom
As drivers/i2c/chips is going to go away, move the driver to
drivers/misc/eeprom. Other eeprom drivers may be moved here later, too.
Update Kconfig text to specify this driver as I2C.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-01-26 21:19:53 +01:00
Jean Delvare 1745522ccb i2c: Delete many unused adapter IDs
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-01-26 21:19:52 +01:00
Anton Vorontsov ea0105ea38 powerpc/83xx: Move mcu_mpc8349emitx driver out of drivers/i2c/chips/
This patch is used to help Jean Delvare to get rid of drivers/i2c/chips/
directory. The new location suggested by Kumar Gala: as the driver is
83xx specific it's placed into arch/powerpc/platforms/83xx/.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2009-01-13 17:46:31 -06:00
Linus Torvalds 7c7758f99d Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (123 commits)
  wimax/i2400m: add CREDITS and MAINTAINERS entries
  wimax: export linux/wimax.h and linux/wimax/i2400m.h with headers_install
  i2400m: Makefile and Kconfig
  i2400m/SDIO: TX and RX path backends
  i2400m/SDIO: firmware upload backend
  i2400m/SDIO: probe/disconnect, dev init/shutdown and reset backends
  i2400m/SDIO: header for the SDIO subdriver
  i2400m/USB: TX and RX path backends
  i2400m/USB: firmware upload backend
  i2400m/USB: probe/disconnect, dev init/shutdown and reset backends
  i2400m/USB: header for the USB bus driver
  i2400m: debugfs controls
  i2400m: various functions for device management
  i2400m: RX and TX data/control paths
  i2400m: firmware loading and bootrom initialization
  i2400m: linkage to the networking stack
  i2400m: Generic probe/disconnect, reset and message passing
  i2400m: host/device procotol and core driver definitions
  i2400m: documentation and instructions for usage
  wimax: Makefile, Kconfig and docbook linkage for the stack
  ...
2009-01-07 15:37:24 -08:00
David Brownell b8da8677d4 USB: move isp1301_omap to drivers/usb/otg
This moves the isp1301-omap driver from the drivers/i2c/chips
directory (which will be shrinking) into a new drivers/usb/otg
directory (which will grow, with more drivers and utilities).

Note that OTG infrastructure needs to be initialized before
either host or peripheral side USB support, and may be needed
before for pure host or pure peripheral configurations.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-01-07 10:00:02 -08:00
Jean Delvare 66c7acf61d i2c: Use snprintf to set adapter names
Use snprintf instead of sprintf to set adapter names, it's safer.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-01-07 14:29:18 +01:00
Jean Delvare 1561bfe59c Input: apanel - convert to new i2c binding
Convert the apanel driver to the new i2c device driver binding model,
as the legacy model is going away soon. In the new model, the apanel
driver is no longer scanning all the i2c adapters, instead the
relevant bus driver (i2c-i801) is instantiating the device as needed.

One side benefit is that the apanel driver will now load automatically
on all systems where it is needed.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>
2009-01-07 14:29:17 +01:00
Jean Delvare e1995f65be i2c: Drop I2C_CLASS_ALL
I2C_CLASS_ALL is almost never what bus driver authors really want.
These i2c classes are really only about which devices must be probed,
not what devices can be present. As device drivers get converted to the
new i2c device driver model, only a few device types will keep relying
on probing.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Sonic Zhang <sonic.zhang@analog.com>
2009-01-07 14:29:16 +01:00
Jean Delvare 22e965c2ae i2c: Get rid of remaining bus_id access
Use dev_name(dev) instead of accessing dev.bus_id directly, as the
latter is going away soon.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Kay Sievers <kay.sievers@vrfy.org>
2009-01-07 14:29:16 +01:00
Kay Sievers 27d9c1838f i2c: Replace bus_id with dev_name(), dev_set_name()
This patch is part of a larger patch series which will remove
the "char bus_id[20]" name string from struct device. The device
name is managed in the kobject anyway, and without any size
limitation, and just needlessly copied into "struct device".

To set and read the device name dev_name(dev) and dev_set_name(dev)
must be used. If your code uses static kobjects, which it shouldn't
do, "const char *init_name" can be used to statically provide the
name the registered device should have. At registration time, the
init_name field is cleared, to enforce the use of dev_name(dev) to
access the device name at a later time.

We need to get rid of all occurrences of bus_id in the entire tree
to be able to enable the new interface. Please apply this patch,
and possibly convert any remaining remaining occurrences of bus_id.

We want to submit a patch to -next, which will remove bus_id from
"struct device", to find the remaining pieces to convert, and finally
switch over to the new api, which will remove the 20 bytes array
and does no longer have a size limitation.

Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-01-07 14:29:16 +01:00
Linus Torvalds 8e128ce331 Merge branch 'for-next' of git://git.o-hand.com/linux-mfd
* 'for-next' of git://git.o-hand.com/linux-mfd: (30 commits)
  mfd: Fix section mismatch in da903x
  mfd: move drivers/i2c/chips/menelaus.c to drivers/mfd
  mfd: move drivers/i2c/chips/tps65010.c to drivers/mfd
  mfd: dm355evm msp430 driver
  mfd: Add missing break from wm3850-core
  mfd: Add WM8351 support
  mfd: Support configurable numbers of DCDCs and ISINKs on WM8350
  mfd: Handle missing WM8350 platform data
  mfd: Add WM8352 support
  mfd: Use irq_to_desc in twl4030 code
  power_supply: Add Dialog DA9030 battery charger driver
  mfd: Dialog DA9030 battery charger MFD driver
  mfd: Register WM8400 codec device
  mfd: Pass driver_data onto child devices
  mfd: Fix twl4030-core.c build error
  mfd: twl4030 regulator bug fixes
  mfd: twl4030: create some regulator devices
  mfd: twl4030: cleanup symbols and OMAP dependency
  mfd: twl4030: simplified child creation code
  power_supply: Add battery health reporting for WM8350
  ...
2009-01-05 19:04:09 -08:00