u-boot/drivers
Tom Rix 7f79dfb48b OMAP I2C Fix the sampling clock.
This problem is seen on Zoom1 and Zoom2 in the startup and
when i2c probe is used

Before :

In:    serial
Out:   serial
Err:   serial
timed out in wait_for_bb: I2C_STAT=1000
timed out in wait_for_bb: I2C_STAT=1000
timed out in wait_for_bb: I2C_STAT=1000
timed out in wait_for_pin: I2C_STAT=1000
I2C read: I/O error
timed out in wait_for_bb: I2C_STAT=1000
timed out in wait_for_bb: I2C_STAT=1000
Die ID #327c00020000000004013ddd05026013
Hit any key to stop autoboot:  0
OMAP3 Zoom1# i2c probe
Valid chip addresses:timed out in wait_for_bb: I2C_STAT=1000
 02 03 04 05 06 07 08 09 0A 0B 0C 0D <snip>

After :

In:    serial
Out:   serial
Err:   serial
Die ID #327c00020000000004013ddd05026013
Hit any key to stop autoboot:  0
OMAP3 Zoom1# i2c probe
Valid chip addresses: 48 49 4A 4B

The addresses are for the twl4030.

The prescalar that converts the function clock to the sampling
clock is hardcoded to 0.  The reference manual recommends 7
if the function clock is 96MHz.

Instead of just changing the hardcoded values, the prescalar
is calculated from the value I2C_IP_CLK.

The i2c #defines are in kHz.  The speed passed into the
i2c init routine is in Hz.  To be consistent, change the
defines to be in Hz.

The timing calculations are based on what is done in the
linux 2.6.30 kernel in drivers/i2c/buses/i2c_omap.c as
apposed to what is done in TRM.

The major variables in the timing caculations are
specified as #defines that can be overriden as required.

The variables and their defaults are

I2C_IP_CLK				SYSTEM_CLOCK_96
I2C_INTERNAL_SAMPLING_CLK		19200000
I2C_FASTSPEED_SCLL_TRIM			6
I2C_FASTSPEED_SCLH_TRIM			6
I2C_HIGHSPEED_PHASE_ONE_SCLL_TRIM	I2C_FASTSPEED_SCLL_TRIM
I2C_HIGHSPEED_PHASE_ONE_SCLH_TRIM	I2C_FASTSPEED_SCLH_TRIM
I2C_HIGHSPEED_PHASE_TWO_SCLL_TRIM	I2C_FASTSPEED_SCLL_TRIM
I2C_HIGHSPEED_PHASE_TWO_SCLH		I2C_FASTSPEED_SCLH_TRIM

This was runtime verified on Zoom1, Zoom2, Beagle and Overo.
The 400kHz and 3.4M cases were verifed on test Zoom1,
Zoom2, Beagle and Overo configurations.

Testing for omap2 will be done in a second step as Nishanth
and Jean-Christophe commented.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Heiko Schocher <hs@denx.de>
2009-07-28 08:52:33 +02:00
..
bios_emulator unify HOST_CFLAGS and HOSTCFLAGS 2009-07-23 21:26:14 +02:00
block ahci: Fix gcc 4.4 compiler warning 2009-07-23 21:04:58 +02:00
dma 83xx: Add support for fsl_dma driver 2009-07-02 11:15:57 -05:00
fpga fpga: Fix Spartan III FPGA booting 2009-02-21 22:52:44 +01:00
gpio Kirkwood: add Marvell Kirkwood gpio driver 2009-07-23 00:19:28 +02:00
hwmon rename CFG_ macros to CONFIG_SYS 2008-10-18 21:54:03 +02:00
i2c OMAP I2C Fix the sampling clock. 2009-07-28 08:52:33 +02:00
input stdio/device: rework function naming convention 2009-07-18 00:27:46 +02:00
misc General help message cleanup 2009-06-12 20:47:16 +02:00
mmc mmc: set bus width to 1 and clock to minimum early during initialization 2009-07-19 22:07:29 +02:00
mtd Remove legacy NAND and disk on chip code. 2009-07-16 19:07:47 -05:00
net Coding Style cleanup; update CHANGELOG. 2009-07-23 22:23:23 +02:00
pci 83xx: Replace CONFIG_MPC83[0-9]X with MPC83[0-9]x 2009-06-12 20:47:17 +02:00
pcmcia mpc8xx_pcmcia: move CONFIG_8xx out of .c file and into Makefile 2009-02-18 00:51:21 +01:00
qe Coding style cleanup; update CHANGELOG 2009-07-07 22:35:02 +02:00
rtc Update CHANGELOG, coding style cleanup. 2009-04-05 00:27:57 +02:00
serial stdio/device: rework function naming convention 2009-07-18 00:27:46 +02:00
spi Merge branch 'master' of git://git.denx.de/u-boot-arm 2009-07-07 22:22:05 +02:00
twserial drivers/twserial: Add protocol driver for "three wire serial" interface. 2009-03-30 09:38:36 +02:00
usb usb: bugfix driver/usb/host/ehci-hcd.c function ehci_submit_root 2009-07-23 23:27:06 +02:00
video video: bus_vcxk.c: fix style issues added by 50217dee 2009-07-26 13:18:43 +02:00
watchdog at91sam9: add watchdog support 2009-04-04 20:42:19 +02:00