u-boot/include/asm-arm
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
..
arch-arm720t s3c4510b: move specific code to soc directory 2009-03-29 23:01:36 +02:00
arch-arm925t Patches by Kshitij, 04 Jul 2003 2003-07-15 20:04:06 +00:00
arch-arm926ejs * Patch by George G. Davis, 19 Aug 2003: 2003-08-29 22:00:43 +00:00
arch-at91 at91: Introduction of at91sam9g10 SOC. 2009-07-12 17:56:11 +02:00
arch-at91rm9200 at91rm9200: move define from lowlevel_init to header 2009-01-06 21:41:59 +01:00
arch-davinci davinci_nand chipselect/init cleanup 2009-07-07 17:58:03 -05:00
arch-imx arm-imx: Fix register definitions 2008-03-02 21:15:06 +01:00
arch-ixp Big white-space cleanup. 2008-05-21 00:14:08 +02:00
arch-kirkwood arm, kirkwood: added kw_gpio_set_valid() in gpio.h 2009-07-23 00:20:33 +02:00
arch-ks8695 * Patch by Greg Ungerer, 19 May 2005: 2005-05-19 22:39:42 +00:00
arch-lpc2292 Eliminated arch-specific mmc header requirement 2009-02-16 18:07:41 -06:00
arch-mx27 Coding style cleanup; update CHANGELOG 2009-07-07 22:35:02 +02:00
arch-mx31 MX31: Add NAND SPL boot support to i.MX31 PDK board. 2009-07-06 21:53:18 +02:00
arch-nomadik arm nomadik: use 1000 as HZ value and rewrite timer code 2009-07-06 21:53:08 +02:00
arch-omap Update omap5912osk board support 2006-05-10 10:55:16 +02:00
arch-omap3 OMAP I2C Fix the sampling clock. 2009-07-28 08:52:33 +02:00
arch-omap24xx OMAP I2C Fix the sampling clock. 2009-07-28 08:52:33 +02:00
arch-pxa pxa: fix CKEN_B register bits 2009-07-12 17:43:32 +02:00
arch-s3c24x0 Fix e-mail address of Gary Jennejohn. 2009-05-15 22:11:59 +02:00
arch-s3c44b0 * Patch by Andrea Scian, 17 Feb 2004: 2004-02-24 00:16:43 +00:00
arch-s3c64xx ARM: Add arm1176 core with S3C6400 SoC 2008-08-31 00:39:46 +02:00
arch-s3c4510b s3c4510b: move specific code to soc directory 2009-03-29 23:01:36 +02:00
arch-sa1100 Big white-space cleanup. 2008-05-21 00:14:08 +02:00
proc-armv * Code cleanup: 2003-06-27 21:31:46 +00:00
atomic.h * Header file cleanup for ARM 2003-06-25 22:26:29 +00:00
bitops.h * Code cleanup: 2003-06-27 21:31:46 +00:00
byteorder.h * Code cleanup: 2003-06-27 21:31:46 +00:00
cache.h move L2 cache enable/disable function to cache.c in the omap3 SoC directory 2009-07-06 21:52:25 +02:00
config.h Add an architecture specific config.h for common defines 2009-02-10 00:43:54 +01:00
dma-mapping.h Fix @ -> <at> substitution 2008-05-10 00:30:22 +02:00
errno.h asm-generic: Consolidate errno.h to asm-generic/errno.h 2009-07-09 14:07:11 +02:00
global_data.h rename CFG_ macros to CONFIG_SYS 2008-10-18 21:54:03 +02:00
hardware.h * Header file cleanup for ARM 2003-06-25 22:26:29 +00:00
io.h Introduce virt_to_phys() 2008-12-15 22:04:29 +01:00
mach-types.h ARM: Update mach-types 2009-07-06 21:52:47 +02:00
macro.h ARM: Add macros.h to be used in assembler file. 2009-06-21 16:18:12 +02:00
memory.h * Header file cleanup for ARM 2003-06-25 22:26:29 +00:00
posix_types.h Initial revision 2002-08-14 13:28:45 +00:00
processor.h * Header file cleanup for ARM 2003-06-25 22:26:29 +00:00
ptrace.h * Code cleanup: 2003-06-27 21:31:46 +00:00
setup.h * Code cleanup: 2003-06-27 21:31:46 +00:00
sizes.h * Header file cleanup for ARM 2003-06-25 22:26:29 +00:00
string.h * Patch by Daniel Engström, 18 Nov 2002: 2002-11-19 23:01:07 +00:00
system.h arm: update co-processor 15 access 2009-04-05 13:02:43 +02:00
types.h Introduce phys_size_t and move phys_addr_t into asm/types.h 2008-04-13 17:13:46 -07:00
u-boot-arm.h arch_misc_init support for ARM architectures 2009-06-12 20:45:46 +02:00
u-boot.h remove bi_enet*addr from global data for all arches 2009-03-20 22:39:12 +01:00
unaligned.h Add unaligned.h for arm 2009-07-19 11:56:34 +02:00