Commit graph

18 commits

Author SHA1 Message Date
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
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
Russell King a09e64fbc0 [ARM] Move include/asm-arm/arch-* to arch/arm/*/include/mach
This just leaves include/asm-arm/plat-* to deal with.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-08-07 09:55:48 +01:00
Russell King be50972935 [ARM] Remove asm/hardware.h, use asm/arch/hardware.h instead
Remove includes of asm/hardware.h in addition to asm/arch/hardware.h.
Then, since asm/hardware.h only exists to include asm/arch/hardware.h,
update everything to directly include asm/arch/hardware.h and remove
asm/hardware.h.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-08-07 09:40:08 +01:00
Russell King 0f8469a54f [ARM] Eliminate useless includes of asm/mach-types.h
There are 43 includes of asm/mach-types.h by files that don't
reference anything from that file.  Remove these unnecessary
includes.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-08-07 09:40:04 +01:00
Troy Kisky 2e74378798 i2c-davinci: Initialize cmd_complete sooner
If an interrupt happens before an I2c master read/write,
complete is called on uninitialized structure.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Kevin Hilman <khilman@mvista.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:21 +02:00
Troy Kisky 5a0d5f5ffa i2c-davinci: Fix signal handling bug
If wait_for_completion_interruptible_timeout exits due
to a signal, the i2c bus was locking up.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Kevin Hilman <khilman@mvista.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:21 +02:00
Troy Kisky 0ab56e2067 i2c-davinci: Remove useless IVR read
Interrupts are enabled at the point where the DAVINCI_I2C_IVR_REG is read,
so unless an interrupt happened just at that moment, no interrupt would be
pending. Even though documentation implies you should do this, I see no
reason. If slave support is added, this read would cause a hard to
reproduce bug.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Kevin Hilman <khilman@mvista.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:20 +02:00
Troy Kisky d868caa177 i2c-davinci: Move dev_dbg statement for more output
Previously the dev_dbg only printed if no error.
Printing also on an error is more useful

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Kevin Hilman <khilman@mvista.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:20 +02:00
Troy Kisky cc99ff70c7 i2c-davinci: Ensure clock between 7-12 MHz
Ensure psc value gives a clock between 7-12 MHz

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Kevin Hilman <khilman@mvista.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:20 +02:00
Kay Sievers add8eda7f2 i2c: Fix platform driver hotplug/coldplug
Since 43cc71eed1, the platform
modalias is prefixed with "platform:". Add MODULE_ALIAS() to the
hotpluggable I2C platform drivers, to allow module auto loading.

[ db: add some more drivers ]

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-04-22 22:16:49 +02:00
Harvey Harrison 08882d2093 i2c: Replace remaining __FUNCTION__ occurrences
__FUNCTION__ is gcc-specific, use __func__.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-04-22 22:16:47 +02:00
Troy Kisky b73a9aece5 i2c-davinci: Fix lost interrupt
DAVINCI_I2C_STR_REG is a write 1 to clear register,
so don't use a read/modify/write cycle.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Acked-by: Dirk Behme <dirk.behme@gmail.com>
Signed-off-by: Kevin Hilman <khilman@mvista.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-04-11 12:07:05 +02:00
Jean Delvare 2caeac8104 i2c: Don't uselessly set i2c_adapter.retries
I2C adapter drivers are supposed to handle retries on nack by themselves
if they do, so there's no point in setting .retries if they don't.

As this retry mechanism is going away (at least in its current form),
clean this up now so that we don't get build failures later.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-01-27 18:14:47 +01:00
Joe Perches fce3ff0331 i2c: Add missing spaces in split log messages
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-12-12 13:45:24 +01:00
Vladimir Barinov 95a7f10ead i2c: Add DaVinci I2C controller support
Signed-off-by: Vladimir Barinov <vbarinov@ru.mvista.com>
Acked-by: Trilok Soni <soni.trilok@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-10-13 23:56:30 +02:00