aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-bfin-twi.c
Commit message (Collapse)AuthorAgeFilesLines
* i2c-bfin-twi: fix CLKDIV calculationSonic Zhang2009-12-241-3/+3
| | | | | | | | | | Calculation of the CLKDIV speed setting should be done using base 10 math rather than base 2. We also avoid exceeding the spec due to integer truncation and a 50% duty cycle. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* i2c: Use resource_size macroLinus Walleij2009-06-161-1/+1
| | | | | | | | | | | | | | | | | 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>
* i2c-bfin-twi: pull in io.h for ioremap()Mike Frysinger2009-06-161-0/+1
| | | | | | | | 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>
* i2c: Blackfin TWI: implement I2C_FUNC_SMBUS_I2C_BLOCK functionalityMichael Hennerich2009-06-131-1/+11
| | | | | | | | | | 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>
* i2c: Blackfin TWI: fix transfer errors with repeat startFrank Shew2009-06-131-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* i2c: Blackfin TWI: fix REPEAT START mode doesn't repeatSonic Zhang2009-06-131-8/+7
| | | | | | | | | | | | | | 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>
* i2c: Blackfin TWI: make sure we don't end up with a CLKDIV=0Michael Hennerich2009-06-131-3/+8
| | | | | | | | | | | 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>
* i2c: Delete many unused adapter IDsJean Delvare2009-01-261-1/+0
| | | | Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Drop I2C_CLASS_ALLJean Delvare2009-01-071-1/+1
| | | | | | | | | | | 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>
* i2c: Blackfin I2C Driver: Functional power management supportMichael Hennerich2008-07-281-11/+24
| | | | | | | | | | PM_SUSPEND_MEM: Blackfin does not maintain register state through Hibernate. Save and restore peripheral base initialization during PM transitions. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* i2c: Fix platform driver hotplug/coldplugKay Sievers2008-04-221-0/+1
| | | | | | | | | | | | Since 43cc71eed1250755986da4c0f9898f9a635cb3bf, 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>
* i2c-bfin-twi: Fix mismatch in add timer and delete timerHans Schillstrom2008-04-221-1/+2
| | | | | | | | | | Move init_completion to just before i2c transfer. http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=3385 Signed-off-by: Hans Schillstrom <hans.schillstrom@shlsys.com> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-bfin-twi: Use simpler comment headers and strip out information that is ↵Mike Frysinger2008-04-221-18/+4
| | | | | | | | maintained in the scm's log Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-bfin-twi: Cleanup driver descriptions, versions and some module useful ↵Bryan Wu2008-04-221-6/+6
| | | | | | | information Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-bfin-twi: Add missing pin mux operationBryan Wu2008-04-221-0/+15
| | | | | | | | | | Blackfin TWI controller hardware pin should be requested from GPIO port controller Before BF54x, there is no need to do this. But as long as BF54x and BF52x are supported by this generic driver, the missing pin mux operation should be added. Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-bfin-twi: Add platform_resource interface to support multi-port TWI ↵Bryan Wu2008-04-221-107/+176
| | | | | | | | | | | controllers - Dynamic alloc the resource of TWI driver data according to board information - TWI register read/write accessor based on dynamic regs_base - Support TWI0/TWI1 for BF54x Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-bfin-twi: Add repeat start feature to avoid break of a bundle of i2c ↵Sonic Zhang2008-04-221-71/+114
| | | | | | | | | | | master xfer operation - Create a new mode TWI_I2C_MODE_REPEAT. - No change to smbus operation. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-bfin-twi: Register adapter with a specific bus numberKalle Pokki2008-01-271-1/+2
| | | | | | | | | All the users of this driver explicitly specify the I2C bus numbers to be used in their platform data. Make the driver respect that. Signed-off-by: Kalle Pokki <kalle.pokki@eke.fi> Cc: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-bfin-twi: Remove useless twi_lock mutexFrancis Moreau2007-10-131-16/+0
| | | | | | | | | | Remove this unneeded mutex. Indeed it was used to serialize access to the hardware, but this is already done by the i2c-core layer, see 'bus_lock' mutex used by i2c_transfer(). Signed-off-by: Francis Moreau <francis.moro@gmail.com> Acked-by: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Blackfin Two Wire Interface driverBryan Wu2007-05-011-0/+644
The i2c linux driver for blackfin architecture which supports blackfin on-chip TWI controller i2c operation. Signed-off-by: Bryan Wu <bryan.wu@analog.com> Reviewed-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>