V3 Zoom hw reset
The i2c patch is a cleaned up version of the one I RFC-ed to the list earlier. It addresses Nishanth's concerns by using the kernel's algorithm and by making the major parameters overridable by a board config. Jean's request for no weak function is addressed by this being done only with #defines. I have reverified on the hw listed in the commit.
The twl4030 patch I don't think anyone had a problem with.
The twl4030 hw reset has been generalized. After analyzing beagle schematics, I believe this can be used by anyone with supporting hw. So the function stays in power.c and the #ifdef's are removed.
PATCH 1/3 OMAP3 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_96I2C_INTERNAL_SAMPLING_CLK 19200000I2C_SCLL_TRIM 6I2C_SCLH_TRIM 6
This was runtime verified on Zoom1, Zoom2, Beagle and Overo. The 400kHz case was verifed on a test Zoom1 configuration.
--- drivers/i2c/omap24xx_i2c.c | 34 +++++++++++++++++++----- include/asm-arm/arch-omap3/i2c.h | 54 +++++++++++++++++++++++++++++++++----- 2 files changed, 74 insertions(+), 14 deletions(-)
drivers/i2c/omap24xx_i2c.c +27 -7
@@ -31,7 +31,29 @@ static void flush_fifo(void);void i2c_init (int speed,int slaveadd) { -u16 scl; +int psc, scll, sclh; + +/* Only handle standard and fast speeds */ +if ((speed !=OMAP_I2C_STANDARD ) && + (speed !=OMAP_I2C_FAST_MODE )) { +printf ("Error : I2C unsupported speed %d\n" , speed); +return ; + } + + psc =I2C_IP_CLK /I2C_INTERNAL_SAMPLING_CLK ; + psc -=1 ; +if (psc <I2C_PSC_MIN ) { +printf ("Error : I2C unsupported prescalar %d\n" , psc); +return ; + } + + scll = sclh =I2C_INTERNAL_SAMPLING_CLK / (2 * speed); + scll -=I2C_SCLL_TRIM ; + sclh -=I2C_SCLH_TRIM ; +if ((scll <0 ) || (sclh <0 )) { +printf ("Error : I2C initializing clock\n" ); +return ; + }writew (0x2 ,I2C_SYSC );/* for ES2 after soft reset */ udelay (1000 );
@@ -42,12 +64,10 @@ void i2c_init (int speed, int slaveadd)udelay (50000 ); } -/* 12MHz I2C module clock */ -writew (0 ,I2C_PSC ); - speed = speed/1000 ;/* 100 or 400 */ - scl = ((12000 /(speed*2 )) -7 );/* use 7 when PSC = 0 */ -writew (scl,I2C_SCLL ); -writew (scl,I2C_SCLH ); +writew (psc,I2C_PSC ); +writew (scll,I2C_SCLL ); +writew (sclh,I2C_SCLH ); +/* own address */ writew (slaveadd,I2C_OA );writew (I2C_CON_EN ,I2C_CON );
include/asm-arm/arch-omap3/i2c.h +47 -7
63 lines not on this page · raw message
Signature · 1 line
1.6.0.5
PATCH 2/3 I2C Add initial support for TWL4030
The TWL4030 supplies many peripheral for OMAP3 boards. These include power management, usb and, keyboard.
The product description is found here:
http://focus.ti.com/docs/prod/folders/print/tps65950.html
Product reference document, tps65950.pdf, is found here:
http://www.ti.com/lit/gpn/tps65950
--- include/twl4030.h | 232 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 232 insertions(+), 0 deletions(-) create mode 100644 include/twl4030.h
include/twl4030.h new file +232 -0
@@ -0,0 +1,232 @@ +/* +* Copyright (c) 2009 Wind River Systems, Inc. +* Tom Rix <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +* Derived from code on omapzoom, git://git.omapzoom.com/repo/u-boot.git +* +* Copyright (C) 2007-2009 Texas Instruments, Inc. +*/ + +#ifndef TWL4030_H +#define TWL4030_H + +#include <common.h> +#include <i2c.h> + +/* I2C chip addresses */ + +/* USB */ +#define TWL4030_CHIP_USB 0x48 +/* AUD */ +#define TWL4030_CHIP_AUDIO_VOICE 0x49 +#define TWL4030_CHIP_GPIO 0x49 +#define TWL4030_CHIP_INTBR 0x49 +#define TWL4030_CHIP_PIH 0x49 +#define TWL4030_CHIP_TEST 0x49 +/* AUX */ +#define TWL4030_CHIP_KEYPAD 0x4a +#define TWL4030_CHIP_MADC 0x4a +#define TWL4030_CHIP_INTERRUPTS 0x4a +#define TWL4030_CHIP_LED 0x4a +#define TWL4030_CHIP_MAIN_CHARGE 0x4a +#define TWL4030_CHIP_PRECHARGE 0x4a +#define TWL4030_CHIP_PWM0 0x4a +#define TWL4030_CHIP_PWM1 0x4a +#define TWL4030_CHIP_PWMA 0x4a +#define TWL4030_CHIP_PWMB 0x4a +/* POWER */ +#define TWL4030_CHIP_BACKUP 0x4b +#define TWL4030_CHIP_INT 0x4b +#define TWL4030_CHIP_PM_MASTER 0x4b +#define TWL4030_CHIP_PM_RECEIVER 0x4b +#define TWL4030_CHIP_RTC 0x4b +#define TWL4030_CHIP_SECURED_REG 0x4b + +/* Register base addresses */ + +/* USB */ +#define TWL4030_BASEADD_USB 0x0000 +/* AUD */ +#define TWL4030_BASEADD_AUDIO_VOICE 0x0000 +#define TWL4030_BASEADD_GPIO 0x0098 +#define TWL4030_BASEADD_INTBR 0x0085 +#define TWL4030_BASEADD_PIH 0x0080 +#define TWL4030_BASEADD_TEST 0x004C +/* AUX */ +#define TWL4030_BASEADD_INTERRUPTS 0x00B9 +#define TWL4030_BASEADD_LED 0x00EE +#define TWL4030_BASEADD_MADC 0x0000 +#define TWL4030_BASEADD_MAIN_CHARGE 0x0074 +#define TWL4030_BASEADD_PRECHARGE 0x00AA +#define TWL4030_BASEADD_PWM0 0x00F8 +#define TWL4030_BASEADD_PWM1 0x00FB +#define TWL4030_BASEADD_PWMA 0x00EF +#define TWL4030_BASEADD_PWMB 0x00F1 +#define TWL4030_BASEADD_KEYPAD 0x00D2 +/* POWER */ +#define TWL4030_BASEADD_BACKUP 0x0014 +#define TWL4030_BASEADD_INT 0x002E +#define TWL4030_BASEADD_PM_MASTER 0x0036 +#define TWL4030_BASEADD_PM_RECIEVER 0x005B +#define TWL4030_BASEADD_RTC 0x001C +#define TWL4030_BASEADD_SECURED_REG 0x0000 + +/* +* Power Management Master +*/ +#define TWL4030_PM_MASTER_CFG_P1_TRANSITION 0x36 +#define TWL4030_PM_MASTER_CFG_P2_TRANSITION 0x37 +#define TWL4030_PM_MASTER_CFG_P3_TRANSITION 0x38 +#define TWL4030_PM_MASTER_CFG_P123_TRANSITION 0x39 +#define TWL4030_PM_MASTER_STS_BOOT 0x3A +#define TWL4030_PM_MASTER_CFG_BOOT 0x3B +#define TWL4030_PM_MASTER_SHUNDAN 0x3C +#define TWL4030_PM_MASTER_BOOT_BCI 0x3D +#define TWL4030_PM_MASTER_CFG_PWRANA1 0x3E +#define TWL4030_PM_MASTER_CFG_PWRANA2 0x3F +#define TWL4030_PM_MASTER_BGAP_TRIM 0x40 +#define TWL4030_PM_MASTER_BACKUP_MISC_STS 0x41 +#define TWL4030_PM_MASTER_BACKUP_MISC_CFG 0x42 +#define TWL4030_PM_MASTER_BACKUP_MISC_TST 0x43 +#define TWL4030_PM_MASTER_PROTECT_KEY 0x44 +#define TWL4030_PM_MASTER_STS_HW_CONDITIONS 0x45 +#define TWL4030_PM_MASTER_P1_SW_EVENTS 0x46 +#define TWL4030_PM_MASTER_P2_SW_EVENTS 0x47 +#define TWL4030_PM_MASTER_P3_SW_EVENTS 0x48 +#define TWL4030_PM_MASTER_STS_P123_STATE 0x49 +#define TWL4030_PM_MASTER_PB_CFG 0x4A +#define TWL4030_PM_MASTER_PB_WORD_MSB 0x4B +#define TWL4030_PM_MASTER_PB_WORD_LSB 0x4C +#define TWL4030_PM_MASTER_SEQ_ADD_W2P 0x52 +#define TWL4030_PM_MASTER_SEQ_ADD_P2A 0x53 +#define TWL4030_PM_MASTER_SEQ_ADD_A2W 0x54 +#define TWL4030_PM_MASTER_SEQ_ADD_A2S 0x55 +#define TWL4030_PM_MASTER_SEQ_ADD_S2A12 0x56 +#define TWL4030_PM_MASTER_SEQ_ADD_S2A3 0x57 +#define TWL4030_PM_MASTER_SEQ_ADD_WARM 0x58 +#define TWL4030_PM_MASTER_MEMORY_ADDRESS 0x59 +#define TWL4030_PM_MASTER_MEMORY_DATA 0x5A +#define TWL4030_PM_MASTER_SC_CONFIG 0x5B +#define TWL4030_PM_MASTER_SC_DETECT1 0x5C +#define TWL4030_PM_MASTER_SC_DETECT2 0x5D +#define TWL4030_PM_MASTER_WATCHDOG_CFG 0x5E +#define TWL4030_PM_MASTER_IT_CHECK_CFG 0x5F +#define TWL4030_PM_MASTER_VIBRATOR_CFG 0x60 +#define TWL4030_PM_MASTER_DCDC_GLOBAL_CFG 0x61 +#define TWL4030_PM_MASTER_VDD1_TRIM1 0x62 +#define TWL4030_PM_MASTER_VDD1_TRIM2 0x63 +#define TWL4030_PM_MASTER_VDD2_TRIM1 0x64 +#define TWL4030_PM_MASTER_VDD2_TRIM2 0x65 +#define TWL4030_PM_MASTER_VIO_TRIM1 0x66 +#define TWL4030_PM_MASTER_VIO_TRIM2 0x67 +#define TWL4030_PM_MASTER_MISC_CFG 0x68 +#define TWL4030_PM_MASTER_LS_TST_A 0x69 +#define TWL4030_PM_MASTER_LS_TST_B 0x6A +#define TWL4030_PM_MASTER_LS_TST_C 0x6B +#define TWL4030_PM_MASTER_LS_TST_D 0x6C +#define TWL4030_PM_MASTER_BB_CFG 0x6D +#define TWL4030_PM_MASTER_MISC_TST 0x6E +#define TWL4030_PM_MASTER_TRIM1 0x6F +/* P[1-3]_SW_EVENTS */ +#define TWL4030_PM_MASTER_SW_EVENTS_STOPON_PWRON (1 << 6) +#define TWL4030_PM_MASTER_SW_EVENTS_STOPON_SYSEN (1 << 5) +#define TWL4030_PM_MASTER_SW_EVENTS_ENABLE_WARMRESET (1 << 4) +#define TWL4030_PM_MASTER_SW_EVENTS_LVL_WAKEUP (1 << 3) +#define TWL4030_PM_MASTER_SW_EVENTS_DEVACT (1 << 2) +#define TWL4030_PM_MASTER_SW_EVENTS_DEVSLP (1 << 1) +#define TWL4030_PM_MASTER_SW_EVENTS_DEVOFF (1 << 0) + +/* Power Managment Receiver */ +#define TWL4030_PM_RECEIVER_VUSB1V5_DEV_GRP 0xCC +#define TWL4030_PM_RECEIVER_VUSB1V5_TYPE 0xCD +#define TWL4030_PM_RECEIVER_VUSB1V5_REMAP 0xCE +#define TWL4030_PM_RECEIVER_VUSB1V8_DEV_GRP 0xCF +#define TWL4030_PM_RECEIVER_VUSB1V8_TYPE 0xD0 +#define TWL4030_PM_RECEIVER_VUSB1V8_REMAP 0xD1 +#define TWL4030_PM_RECEIVER_VUSB3V1_DEV_GRP 0xD2 +#define TWL4030_PM_RECEIVER_VUSB3V1_TYPE 0xD3 +#define TWL4030_PM_RECEIVER_VUSB3V1_REMAP 0xD4 +#define TWL4030_PM_RECEIVER_VUSBCP_DEV_GRP 0xD5 +#define TWL4030_PM_RECEIVER_VUSBCP_DEV_TYPE 0xD6 +#define TWL4030_PM_RECEIVER_VUSBCP_DEV_REMAP 0xD7 +#define TWL4030_PM_RECEIVER_VUSB_DEDICATED1 0xD8 +#define TWL4030_PM_RECEIVER_VUSB_DEDICATED2 0xD9 + +/* Keypad */ +#define TWL4030_KEYPAD_KEYP_CTRL_REG 0xD2 +#define TWL4030_KEYPAD_KEY_DEB_REG 0xD3 +#define TWL4030_KEYPAD_LONG_KEY_REG1 0xD4 +#define TWL4030_KEYPAD_LK_PTV_REG 0xD5 +#define TWL4030_KEYPAD_TIME_OUT_REG1 0xD6 +#define TWL4030_KEYPAD_TIME_OUT_REG2 0xD7 +#define TWL4030_KEYPAD_KBC_REG 0xD8 +#define TWL4030_KEYPAD_KBR_REG 0xD9 +#define TWL4030_KEYPAD_KEYP_SMS 0xDA +#define TWL4030_KEYPAD_FULL_CODE_7_0 0xDB +#define TWL4030_KEYPAD_FULL_CODE_15_8 0xDC +#define TWL4030_KEYPAD_FULL_CODE_23_16 0xDD +#define TWL4030_KEYPAD_FULL_CODE_31_24 0xDE +#define TWL4030_KEYPAD_FULL_CODE_39_32 0xDF +#define TWL4030_KEYPAD_FULL_CODE_47_40 0xE0 +#define TWL4030_KEYPAD_FULL_CODE_55_48 0xE1 +#define TWL4030_KEYPAD_FULL_CODE_63_56 0xE2 +#define TWL4030_KEYPAD_KEYP_ISR1 0xE3 +#define TWL4030_KEYPAD_KEYP_IMR1 0xE4 +#define TWL4030_KEYPAD_KEYP_ISR2 0xE5 +#define TWL4030_KEYPAD_KEYP_IMR2 0xE6 +#define TWL4030_KEYPAD_KEYP_SIR 0xE7 +#define TWL4030_KEYPAD_KEYP_EDR 0xE8 +#define TWL4030_KEYPAD_KEYP_SIH_CTRL 0xE9 + +#define TWL4030_KEYPAD_CTRL_KBD_ON (1 << 6) +#define TWL4030_KEYPAD_CTRL_RP_EN (1 << 5) +#define TWL4030_KEYPAD_CTRL_TOLE_EN (1 << 4) +#define TWL4030_KEYPAD_CTRL_TOE_EN (1 << 3) +#define TWL4030_KEYPAD_CTRL_LK_EN (1 << 2) +#define TWL4030_KEYPAD_CTRL_SOFTMODEN (1 << 1) +#define TWL4030_KEYPAD_CTRL_SOFT_NRST (1 << 0) + +/* USB */ +#define TWL4030_USB_FUNC_CTRL (0x04) +#define TWL4030_USB_OPMODE_MASK (3 << 3) +#define TWL4030_USB_XCVRSELECT_MASK (3 << 0) +#define TWL4030_USB_IFC_CTRL (0x07) +#define TWL4030_USB_CARKITMODE (1 << 2) +#define TWL4030_USB_POWER_CTRL (0xAC) +#define TWL4030_USB_OTG_ENAB (1 << 5) +#define TWL4030_USB_PHY_PWR_CTRL (0xFD) +#define TWL4030_USB_PHYPWD (1 << 0) +#define TWL4030_USB_PHY_CLK_CTRL (0xFE) +#define TWL4030_USB_CLOCKGATING_EN (1 << 2) +#define TWL4030_USB_CLK32K_EN (1 << 1) +#define TWL4030_USB_REQ_PHY_DPLL_CLK (1 << 0) +#define TWL4030_USB_PHY_CLK_CTRL_STS (0xFF) +#define TWL4030_USB_PHY_DPLL_CLK (1 << 0) + +/* Convience functions to read and write from TWL4030 */ +static inline int twl4030_i2c_write_u8 (u8 chip_no,u8 val,u8 reg) +{ +return i2c_write (chip_no, reg,1 , &val,1 ); +} + +static inline int twl4030_i2c_read_u8 (u8 chip_no,u8 *val,u8 reg) +{ +return i2c_read (chip_no, reg,1 , val,1 ); +} + +#endif /* TWL4030_H */
Signature · 1 line
1.6.0.5
PATCH 3/3 TWL4030 Add power reset button
The Zoom2 power reset button is on the top right side of the main board. Press and hold for about to 8 seconds to completely reset the board.
Some of the beta boards have a hardware problem that prevents using this feature. If is difficult to further characterize the boards that fail. So disable resetting for all beta boards.
The Zoom1 reset button is the red circle on the top right, front of the board. Press and hold the button for 8 seconds to completely reset the board.
After analyzing beagle, it was determined that other boards that use the twl4030 for power managment can also make use this function.
The resetting is done by the power management part of the twl4030. Since there is no existing drivers/power, add one.
The compilation of power/twl4030.h is controlled by the config variable CONFIG_TWL4030_POWER
--- Makefile | 1 + board/omap3/zoom1/zoom1.c | 9 +++++++ board/omap3/zoom2/zoom2.c | 14 ++++++++++++ drivers/power/Makefile | 47 +++++++++++++++++++++++++++++++++++++++++ drivers/power/twl4030.c | 47 +++++++++++++++++++++++++++++++++++++++++ include/configs/omap3_zoom1.h | 5 ++++ include/configs/omap3_zoom2.h | 5 ++++ include/twl4030.h | 3 ++ 8 files changed, 131 insertions(+), 0 deletions(-) create mode 100644 drivers/power/Makefile create mode 100644 drivers/power/twl4030.c
Makefile +1 -0
@@ -247,6 +247,7 @@ LIBS += drivers/net/phy/libphy.a LIBS += drivers/net/sk98lin/libsk98lin.a LIBS += drivers/pci/libpci.a LIBS += drivers/pcmcia/libpcmcia.a +LIBS += drivers/power/libpower.a LIBS += drivers/spi/libspi.a ifeq ($(CPU),mpc83xx) LIBS += drivers/qe/qe.a
board/omap3/zoom1/zoom1.c +9 -0
@@ -31,6 +31,7 @@* MA 02111-1307 USA */ #include <common.h> +#include <twl4030.h> #include <asm/io.h> #include <asm/arch/mux.h> #include <asm/arch/sys_proto.h>
@@ -62,6 +63,14 @@ int misc_init_r(void) {power_init_r ();dieid_num_r (); + +/* +* Board Reset +* The board is reset by holding the red button on the +* top right front face for eight seconds. +*/ +twl4030_power_reset_init (); +return 0 ; }
board/omap3/zoom2/zoom2.c +14 -0
@@ -32,6 +32,7 @@#ifdef CONFIG_STATUS_LED #include <status_led.h> #endif +#include <twl4030.h> #include <asm/io.h> #include <asm/arch/gpio.h> #include <asm/arch/mem.h>
@@ -156,6 +157,19 @@ int misc_init_r(void)zoom2_identify ();power_init_r ();dieid_num_r (); + +/* +* Board Reset +* The board is reset by holding the the large button +* on the top right side of the main board for +* eight seconds. +* +* There are reported problems of some beta boards +* continously resetting. For those boards, disable resetting. +*/ +if (ZOOM2_REVISION_PRODUCTION <=zoom2_get_revision ()) +twl4030_power_reset_init (); +return 0 ; }
drivers/power/Makefile new file +47 -0
47 lines not on this page · raw message
drivers/power/twl4030.c new file +47 -0
47 lines not on this page · raw message
include/configs/omap3_zoom1.h +5 -0
@@ -126,6 +126,11 @@#define CONFIG_DRIVER_OMAP34XX_I2C 1/* +* TWL4030 +*/ +#define CONFIG_TWL4030_POWER 1 + +/* * Board NAND Info. */ #define CONFIG_NAND_OMAP_GPMC
include/configs/omap3_zoom2.h +5 -0
@@ -147,6 +147,11 @@#define CONFIG_DRIVER_OMAP34XX_I2C 1/* +* TWL4030 +*/ +#define CONFIG_TWL4030_POWER 1 + +/* * Board NAND Info. */ #define CONFIG_NAND_OMAP_GPMC
include/twl4030.h +3 -0
@@ -229,4 +229,7 @@ static inline int twl4030_i2c_read_u8(u8 chip_no, u8 *val, u8 reg) return i2c_read(chip_no, reg, 1, val, 1); } +/* For hardware resetting */ +void twl4030_power_reset_init (void ); +#endif /* TWL4030_H */
Signature · 1 line
1.6.0.5
Menon
PATCH 3/3 TWL4030 Add power reset button
Quoted 8 lines
-----Original Message-----
From: Tom Rix [mailto:Tom.Rix at windriver.com]
Sent: Thursday, June 18, 2009 11:14 PM
To: u-boot at lists.denx.de; Menon, Nishanth; dirk.behme at googlemail.com
Cc: Tom Rix
Subject: [PATCH 3/3] TWL4030 Add power reset button
Regards,
Nishanth Menon
Menon
PATCH 2/3 I2C Add initial support for TWL4030
In reply to Tom RixQuoted 9 lines
-----Original Message-----
From: Tom Rix [mailto:Tom.Rix at windriver.com]
Sent: Thursday, June 18, 2009 11:14 PM
To: u-boot at lists.denx.de; Menon, Nishanth; dirk.behme at googlemail.com
Cc: Tom Rix
Subject: [PATCH 2/3] I2C Add initial support for TWL4030+++
b/include/twl4030.h
<snip>
Quoted 23 lines
include/twl4030.h new file +23
-0+/* POWER */ +#define TWL4030_CHIP_BACKUP 0x4b +#define TWL4030_CHIP_INT 0x4b +#define TWL4030_CHIP_PM_MASTER 0x4b +#define TWL4030_CHIP_PM_RECEIVER 0x4b +#define TWL4030_CHIP_RTC 0x4b +#define TWL4030_CHIP_SECURED_REG 0x4b + +/* Register base addresses */ + +/* USB */ +#define TWL4030_BASEADD_USB 0x0000 +/* AUD */ +#define TWL4030_BASEADD_AUDIO_VOICE 0x0000 +#define TWL4030_BASEADD_GPIO 0x0098 +#define TWL4030_BASEADD_INTBR 0x0085 +#define TWL4030_BASEADD_PIH 0x0080 +#define TWL4030_BASEADD_TEST 0x004C +/* AUX */ +#define TWL4030_BASEADD_INTERRUPTS 0x00B9 +#define TWL4030_BASEADD_LED 0x00EE +#define TWL4030_BASEADD_MADC 0x0000 +#define TWL4030_BASEADD_MAIN_CHARGE 0x0074
<snip>
Review
Quoted 2 lines
(quoted diff) +2
-0+static inline int twl4030_i2c_write_u8(u8 chip_no, u8 val, u8 reg) +{
Could you add a little more documentation what I should use for chip_no etc? My main problem when I think as a first time looker, is trying to understand Which #defines should I be using where? I really do not want to see half a dozen repeated emails on the list asking for this info
<snip>
Regards,
Nishanth Menon
Menon
PATCH 1/3 OMAP3 I2C Fix the sampling clock.
In reply to Tom RixQuoted 6 lines
-----Original Message-----
From: Tom Rix [mailto:Tom.Rix at windriver.com]
Sent: Thursday, June 18, 2009 11:14 PM
To: u-boot at lists.denx.de; Menon, Nishanth; dirk.behme at googlemail.com
Cc: Tom Rix
Subject: [PATCH 1/3] OMAP3 I2C Fix the sampling clock.
There is one comment below though..
Quoted 17 lines
Signed-off-by Tom Rix <[email protected]>--- drivers/i2c/omap24xx_i2c.c | 34 +++++++++++++++++++----- include/asm-arm/arch-omap3/i2c.h | 54 +++++++++++++++++++++++++++++++++----- 2 files changed, 74 insertions(+), 14 deletions(-)drivers/i2c/omap24xx_i2c.c +0
-0@@ -31,7 +31,29 @@ static void flush_fifo(void);void i2c_init (int speed,int slaveadd) {
drivers/i2c/omap24xx_i2c.c static void flush_fifo(void); · line 42
Quoted 10 lines
drivers/i2c/omap24xx_i2c.c +9
-1-u16 scl; +int psc, scll, sclh; + +/* Only handle standard and fast speeds */ +if ((speed !=OMAP_I2C_STANDARD ) && + (speed !=OMAP_I2C_FAST_MODE )) { +printf ("Error : I2C unsupported speed %d\n" , speed); +return ; + } +
We may want to bring the HSI2C support back in though
Regards,
Nishanth Menon
PATCH 1/3 OMAP3 I2C Fix the sampling clock.
Quoted 25 lines · Nishanth
Quoted 7 lines
-----Original Message-----
From: Tom Rix [mailto:Tom.Rix at windriver.com]
Sent: Thursday, June 18, 2009 11:14 PM
To: u-boot at lists.denx.de; Menon, Nishanth; dirk.behme at googlemail.com
Cc: Tom Rix
Subject: [PATCH 1/3] OMAP3 I2C Fix the sampling clock.Acked-by Nishanth Menon<[email protected]>There is one comment below though..
Quoted 13 lines
Signed-off-by Tom Rix <[email protected]>--- drivers/i2c/omap24xx_i2c.c | 34 +++++++++++++++++++----- include/asm-arm/arch-omap3/i2c.h | 54 +++++++++++++++++++++++++++++++++----- 2 files changed, 74 insertions(+), 14 deletions(-)drivers/i2c/omap24xx_i2c.c +0
-0@@ -31,7 +31,29 @@ static void flush_fifo(void);
Quoted 17 lines
drivers/i2c/omap24xx_i2c.c static void flush_fifo(void); · line 57
Quoted 13 lines
drivers/i2c/omap24xx_i2c.c +9
-1void i2c_init (int speed,int slaveadd) { -u16 scl; +int psc, scll, sclh; + +/* Only handle standard and fast speeds */ +if ((speed !=OMAP_I2C_STANDARD ) && + (speed !=OMAP_I2C_FAST_MODE )) { +printf ("Error : I2C unsupported speed %d\n" , speed); +return ; + } +We may want to bring the HSI2C support back in though
How about I do this in a later patch?
The configs I looked at only used the much slower standard speed. Tom
Quoted 3 lines
Regards,
Nishanth Menon
PATCH 1/3 OMAP3 I2C Fix the sampling clock.
Tom said the following on 06/20/2009 01:22 PM:
Quoted 46 lines
Quoted 26 lines · Nishanth
Quoted 8 lines
-----Original Message-----
From: Tom Rix [mailto:Tom.Rix at windriver.com]
Sent: Thursday, June 18, 2009 11:14 PM
To: u-boot at lists.denx.de; Menon, Nishanth; dirk.behme at googlemail.com
Cc: Tom Rix
Subject: [PATCH 1/3] OMAP3 I2C Fix the sampling clock.Acked-by Nishanth Menon<[email protected]>There is one comment below though..
Quoted 13 lines
Signed-off-by Tom Rix <[email protected]>--- drivers/i2c/omap24xx_i2c.c | 34 +++++++++++++++++++----- include/asm-arm/arch-omap3/i2c.h | 54 +++++++++++++++++++++++++++++++++----- 2 files changed, 74 insertions(+), 14 deletions(-)drivers/i2c/omap24xx_i2c.c +0
-0@@ -31,7 +31,29 @@ static void flush_fifo(void);Quoted 18 lines
Quoted 4 lines
drivers/i2c/omap24xx_i2c.c +1
-1void i2c_init (int speed,int slaveadd) { -u16 scl; +int psc, scll, sclh;drivers/i2c/omap24xx_i2c.c static void flush_fifo(void);
Quoted 10 lines
drivers/i2c/omap24xx_i2c.c +8
-0+ +/* Only handle standard and fast speeds */ +if ((speed !=OMAP_I2C_STANDARD ) && + (speed !=OMAP_I2C_FAST_MODE )) { +printf ("Error : I2C unsupported speed %d\n" , speed); +return ; + } +We may want to bring the HSI2C support back in though
Quoted 3 lines
How about I do this in a later patch?
The configs I looked at only used the much slower standard speed.
Sounds good as long as it is in TODO somewhere.. kinda sad if we talk 400khz to TWL5030 which could go upto 2.4mhz or so.. Regards,
Nishanth Menon
PATCH 1/3 OMAP3 I2C Fix the sampling clock.
In reply to Tom RixHi,
I'll add a mandatory condition
this code MUST be test on omap2 too
I think the TI's dev could help on this
Best Regards,
J.
Menon
PATCH 1/3 OMAP3 I2C Fix the sampling clock.
Quoted 10 lines
-----Original Message-----
From: Jean-Christophe PLAGNIOL-VILLARD [mailto:plagnioj at jcrosoft.com]
Sent: Saturday, June 20, 2009 8:19 PM
To: Tom Rix
Cc: u-boot at lists.denx.de; Menon, Nishanth; dirk.behme at googlemail.com
Subject: Re: [U-Boot] [PATCH 1/3] OMAP3 I2C Fix the sampling clock.
I'll add a mandatory condition
this code MUST be test on omap2 tooI think the TI's dev could help on this
Would have been great if we had functional omap2 support in mainline - 2420/2430.. I don't even have one of those boards around :(
Regards,
Nishanth Menon
PATCH 1/3 OMAP3 I2C Fix the sampling clock.
Quoted 9 lines · Nishanth
Quoted 9 lines
-----Original Message-----
From: Jean-Christophe PLAGNIOL-VILLARD [mailto:plagnioj at jcrosoft.com]
Sent: Saturday, June 20, 2009 8:19 PM
To: Tom Rix
Cc: u-boot at lists.denx.de; Menon, Nishanth; dirk.behme at googlemail.com
Subject: Re: [U-Boot] [PATCH 1/3] OMAP3 I2C Fix the sampling clock.
I'll add a mandatory condition
this code MUST be test on omap2 too
Quoted 5 lines
Quoted 2 lines
I think the TI's dev could help on this
Would have been great if we had functional omap2 support in mainline - 2420/2430.. I don't even have one of those boards around :(
There is the omap2420h4.
From the git log, it looks like it was active in 2004-2005.
I do not have one.
If someone wants to send one to me, I will be happy to test the i2c patch.
The i2c init came from the kernel, it looked like that same init code was used for 24xx and 34xx. I do not believe there will be any problems but if there were, they should be able to dealt with in the board config file by overriding the #defines the init code uses.
Tom
Quoted 4 lines
Regards,
Nishanth Menon
PATCH 1/3 OMAP3 I2C Fix the sampling clock.
In reply to Jean-Christophe PLAGNIOL-VILLARDQuoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Hi,
I'll add a mandatory condition
this code MUST be test on omap2 too
I have made a mistake on MAKEALL testing.
I will have to resubmit this patchset when the issues are resolved. I will arrange to have this tested on an omap2
Tom
Quoted 5 lines
I think the TI's dev could help on this
Best Regards,
J.
Hello Tom,
Quoted 11 lines · Tom Rix
The i2c patch is a cleaned up version of the one I RFC-ed to the list earlier. It addresses Nishanth's concerns by using the kernel's algorithm and by making the major parameters overridable by a board config. Jean's request for no weak function is addressed by this being done only with #defines. I have reverified on the hw listed in the commit.
The twl4030 patch I don't think anyone had a problem with.
The twl4030 hw reset has been generalized. After analyzing beagle schematics, I believe this can be used by anyone with supporting hw. So the function stays in
power.cand the #ifdef's are removed.
I think your 3 patches are OK, and if Jean-Christophe give his Acked-by, I can add this to the i2c tree and send a pull request to Wolfgang, or if Jean-Christophe wants to add this to the arm tree I give my Acked-by to your patches.
bye
heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 11 lines · Heiko Schocher
Hello Tom,
Quoted 8 lines · Tom Rix
The i2c patch is a cleaned up version of the one I RFC-ed to the list earlier. It addresses Nishanth's concerns by using the kernel's algorithm and by making the major parameters overridable by a board config. Jean's request for no weak function is addressed by this being done only with #defines. I have reverified on the hw listed in the commit.
The twl4030 patch I don't think anyone had a problem with.
Quoted 8 lines
Quoted 3 lines
The twl4030 hw reset has been generalized. After analyzing beagle schematics, I believe this can be used by anyone with supporting hw. So the function stays in
power.cand the #ifdef's are removed.I think your 3 patches are OK, and if Jean-Christophe give his Acked-by, I can add this to the i2c tree and send a pull request to Wolfgang, or if Jean-Christophe wants to add this to the arm tree I give my Acked-by to your patches.
if it's confirm that it's also work on omap2 Ack
Best Regards,
J.