ARMV7: Enhance support for OMAP4
Subsystems (5)
cover ARMV7: Enhance support for OMAP4
This patch series adds support for:
- pad mux initialization
- OMAP4 TWL6030 companion chip initialization
- usb driver and gadget support
It also fixes issues in the udelay implementation and the OMAP I2C driver as well as tweaks the default environment.
These patches were tested on Panda and OMAP4430 SDP as well as on the Gumstix Overo to verify that there were no regressions on OMAP3.
Steve Sakoman (9):
ARMV7: Add pad mux support for OMAP4
ARMV7: Fix udelay for OMAP4
ARMV7: Modify i2c driver for more reliable operation on OMAP4
ARMV7: Add support for the TWL6030 I2C power chip used in OMAP4
systems
ARMV7: Restructure omap3 musb driver to allow code sharing between
OMAP3 and OMAP4
ARMV7: Enable musb driver and usbtty on OMAP4430 SDP
ARMV7: Enable musb driver and usbtty on OMAP4 Panda
ARMV7: Update default environment for OMAP4 boards
arch/arm/cpu/armv7/omap-common/timer.c | 9 - arch/arm/cpu/armv7/omap4/board.c | 11 + arch/arm/include/asm/arch-omap3/cpu.h | 3 + arch/arm/include/asm/arch-omap3/i2c.h | 4 +- arch/arm/include/asm/arch-omap4/cpu.h | 3 + arch/arm/include/asm/arch-omap4/mux_omap4.h | 344 +++++++++++++++++++++++++++ arch/arm/include/asm/arch-omap4/omap4.h | 2 + board/ti/panda/panda.c | 27 ++ board/ti/panda/panda.h | 265 +++++++++++++++++++++ board/ti/sdp4430/sdp.c | 27 ++ board/ti/sdp4430/sdp.h | 265 +++++++++++++++++++++ drivers/i2c/omap24xx_i2c.c | 37 ++- drivers/i2c/omap24xx_i2c.h | 4 + drivers/power/Makefile | 1 + drivers/power/twl6030.c | 77 ++++++ drivers/usb/musb/omap3.c | 16 ++ drivers/usb/musb/omap3.h | 3 +- include/configs/omap4_panda.h | 28 ++- include/configs/omap4_sdp4430.h | 28 ++- include/twl6030.h | 90 +++++++ 20 files changed, 1215 insertions(+), 29 deletions(-) create mode 100644 arch/arm/include/asm/arch-omap4/mux_omap4.h create mode 100644 board/ti/panda/panda.h create mode 100644 board/ti/sdp4430/sdp.h create mode 100644 drivers/power/twl6030.c create mode 100644 include/twl6030.h
PATCH 1/8 ARMV7: Add pad mux support for OMAP4
Add functional multiplexing support for OMAP4 pads. Configure all the pads for the OMAP4430 SDP and OMAP4 Panda boards
--- arch/arm/cpu/armv7/omap4/board.c | 11 + arch/arm/include/asm/arch-omap4/mux_omap4.h | 344 +++++++++++++++++++++++++++ arch/arm/include/asm/arch-omap4/omap4.h | 2 + arch/arm/include/asm/arch-omap4/sys_proto.h | 1 + board/ti/panda/panda.c | 26 ++ board/ti/panda/panda.h | 265 +++++++++++++++++++++ board/ti/sdp4430/sdp.c | 26 ++ board/ti/sdp4430/sdp.h | 265 +++++++++++++++++++++ include/configs/omap4_panda.h | 1 + include/configs/omap4_sdp4430.h | 1 + 10 files changed, 942 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-omap4/mux_omap4.h create mode 100644 board/ti/panda/panda.h create mode 100644 board/ti/sdp4430/sdp.h
arch/arm/cpu/armv7/omap4/board.c +11 -0
@@ -88,3 +88,14 @@ int checkboard(void)return 0 ; } +/* +* This function is called by start_armboot. You can reliably use static +* data. Any boot-time function that require static data should be +* called from here +*/ +int arch_cpu_init (void ) +{ +set_muxconf_regs (); +return 0 ; +} +
arch/arm/include/asm/arch-omap4/mux_omap4.h new file +344 -0
344 lines not on this page · raw message
arch/arm/include/asm/arch-omap4/omap4.h +2 -0
@@ -44,6 +44,8 @@/* CONTROL */ #define CTRL_BASE (OMAP44XX_L4_CORE_BASE + 0x2000) +#define CONTROL_PADCONF_CORE (OMAP44XX_L4_CORE_BASE + 0x100000) +#define CONTROL_PADCONF_WKUP (OMAP44XX_L4_CORE_BASE + 0x31E000)/* UART */ #define UART1_BASE (OMAP44XX_L4_PER_BASE + 0x6a000)
arch/arm/include/asm/arch-omap4/sys_proto.h +1 -0
@@ -32,6 +32,7 @@ void gpmc_init(void);void watchdog_init (void );u32 get_device_type (void );void invalidate_dcache (u32 ); +void set_muxconf_regs (void );extern const struct omap_sysinfo sysinfo;
board/ti/panda/panda.c +26 -0
@@ -24,6 +24,8 @@#include <common.h> #include <asm/arch/sys_proto.h> +#include "panda.h" +DECLARE_GLOBAL_DATA_PTR ;const struct omap_sysinfo sysinfo = {
@@ -61,3 +63,27 @@ int misc_init_r(void) {return 0 ; } + +void do_set_mux (u32 base,struct pad_conf_entry const *array,int size) +{ +int i; +struct pad_conf_entry *pad = (struct pad_conf_entry *) array; + +for (i =0 ; i < size; i++, pad++) +writew (pad->val, base + pad->offset); +} + +/** +* @brief set_muxconf_regs Setting up the configuration Mux registers +* specific to the board. +*/ +void set_muxconf_regs (void ) +{ +do_set_mux (CONTROL_PADCONF_CORE , core_padconf_array, +sizeof (core_padconf_array) / +sizeof (struct pad_conf_entry )); + +do_set_mux (CONTROL_PADCONF_WKUP , wkup_padconf_array, +sizeof (wkup_padconf_array) / +sizeof (struct pad_conf_entry )); +}
board/ti/panda/panda.h new file +265 -0
265 lines not on this page · raw message
board/ti/sdp4430/sdp.c +26 -0
@@ -25,6 +25,8 @@#include <common.h> #include <asm/arch/sys_proto.h> +#include "sdp.h" +DECLARE_GLOBAL_DATA_PTR ;const struct omap_sysinfo sysinfo = {
@@ -62,3 +64,27 @@ int misc_init_r(void) {return 0 ; } + +void do_set_mux (u32 base,struct pad_conf_entry const *array,int size) +{ +int i; +struct pad_conf_entry *pad = (struct pad_conf_entry *) array; + +for (i =0 ; i < size; i++, pad++) +writew (pad->val, base + pad->offset); +} + +/** +* @brief set_muxconf_regs Setting up the configuration Mux registers +* specific to the board. +*/ +void set_muxconf_regs (void ) +{ +do_set_mux (CONTROL_PADCONF_CORE , core_padconf_array, +sizeof (core_padconf_array) / +sizeof (struct pad_conf_entry )); + +do_set_mux (CONTROL_PADCONF_WKUP , wkup_padconf_array, +sizeof (wkup_padconf_array) / +sizeof (struct pad_conf_entry )); +}
board/ti/sdp4430/sdp.h new file +265 -0
265 lines not on this page · raw message
include/configs/omap4_panda.h +1 -0
@@ -35,6 +35,7 @@#define CONFIG_OMAP44XX 1/* which is a 44XX */ #define CONFIG_OMAP4430 1/* which is in a 4430 */ #define CONFIG_PANDA 1/* working with Panda */ +#define CONFIG_ARCH_CPU_INIT /* Get CPU defs */ #include <asm/arch/cpu.h>
include/configs/omap4_sdp4430.h +1 -0
@@ -36,6 +36,7 @@#define CONFIG_OMAP44XX 1/* which is a 44XX */ #define CONFIG_OMAP4430 1/* which is in a 4430 */ #define CONFIG_4430SDP 1/* working with SDP */ +#define CONFIG_ARCH_CPU_INIT /* Get CPU defs */ #include <asm/arch/cpu.h>
Signature · 1 line
1.7.0.4
PATCH 2/8 ARMV7: Fix udelay for OMAP4
In reply to Steve SakomanThe OMAP4 x-load code sets gptimer1 clock source to 32Khz. This isn't acceptable for udelay. This patch changes from gptimer1 to gptimer2, which uses sys_clk at 38.4 Mhz.
--- arch/arm/cpu/armv7/omap-common/timer.c | 9 --------- include/configs/omap4_panda.h | 2 +- include/configs/omap4_sdp4430.h | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-)
arch/arm/cpu/armv7/omap-common/timer.c +0 -9
@@ -41,12 +41,8 @@ static struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;/* * Nothing really to do with interrupts, just starts up a counter. -* We run the counter with 13MHz, divided by 8, resulting in timer -* frequency of 1.625MHz. With 32bit counter register, counter -* overflows in ~44min */ -/* 13MHz / 8 = 1.625MHz */ #define TIMER_CLOCK (V_SCLK / (2 << CONFIG_SYS_PTV))#define TIMER_LOAD_VAL 0xffffffff
@@ -84,11 +80,6 @@ void set_timer(ulong t)/* delay x useconds */ void __udelay (unsigned long usec) { -#if defined(CONFIG_OMAP44XX ) -/* TODO temporary hack until OMAP4 clock setup routines are present */ -if (usec >1000 ) - usec = usec/1000 ; -#endif long tmo = usec * (TIMER_CLOCK /1000 ) /1000 ;unsigned long now, last =readl (&timer_base->tcrr);
include/configs/omap4_panda.h +1 -1
@@ -196,7 +196,7 @@#define CONFIG_SYS_LOAD_ADDR 0x80000000/* Use General purpose timer 1 */ -#define CONFIG_SYS_TIMERBASE GPT1_BASE +#define CONFIG_SYS_TIMERBASE GPT2_BASE#define CONFIG_SYS_PTV 2/* Divisor: 2^(PTV+1) => 8 */ #define CONFIG_SYS_HZ 1000
include/configs/omap4_sdp4430.h +1 -1
@@ -197,7 +197,7 @@#define CONFIG_SYS_LOAD_ADDR 0x80000000/* Use General purpose timer 1 */ -#define CONFIG_SYS_TIMERBASE GPT1_BASE +#define CONFIG_SYS_TIMERBASE GPT2_BASE#define CONFIG_SYS_PTV 2/* Divisor: 2^(PTV+1) => 8 */ #define CONFIG_SYS_HZ 1000
Signature · 1 line
1.7.0.4
PATCH 3/8 ARMV7: Modify i2c driver for more reliable operation on OMAP4
In reply to Steve SakomanIn addition to modifying the init routine to follow the TRM recommendations, this patch adds a retry count to two loops to avoid the possibility of infinite loops. It also corrects error message typos in the i2c_write routine.
--- arch/arm/include/asm/arch-omap3/i2c.h | 4 ++- drivers/i2c/omap24xx_i2c.c | 37 ++++++++++++++++++++++---------- drivers/i2c/omap24xx_i2c.h | 4 +++ 3 files changed, 32 insertions(+), 13 deletions(-)
arch/arm/include/asm/arch-omap3/i2c.h +3 -1
@@ -34,7 +34,9 @@ struct i2c {unsigned short stat;/* 0x08 */ unsigned short res3;unsigned short iv;/* 0x0C */ -unsigned short res4[3 ]; +unsigned short res4; +unsigned short syss;/* 0x10 */ +unsigned short res4a;unsigned short buf;/* 0x14 */ unsigned short res5;unsigned short cnt;/* 0x18 */
drivers/i2c/omap24xx_i2c.c +25 -12
@@ -41,6 +41,7 @@ void i2c_init (int speed, int slaveadd)int psc, fsscll, fssclh;int hsscll =0 , hssclh =0 ;u32 scll, sclh; +int reset_timeout =10 ;/* Only handle standard, fast and high speeds */ if ((speed != OMAP_I2C_STANDARD) &&
@@ -102,15 +103,22 @@ void i2c_init (int speed, int slaveadd) sclh = (unsigned int )fssclh; } -writew (0x2 , &i2c_base->sysc);/* for ES2 after soft reset */ -udelay (1000 ); -writew (0x0 , &i2c_base->sysc);/* will probably self clear but */ -if (readw (&i2c_base->con) &I2C_CON_EN ) {writew (0 , &i2c_base->con);udelay (50000 ); } +writew (0x2 , &i2c_base->sysc);/* for ES2 after soft reset */ +udelay (1000 ); + +writew (I2C_CON_EN , &i2c_base->con); +while (!(readw (&i2c_base->syss) &I2C_SYSS_RDONE ) && reset_timeout--) { +if (reset_timeout <=0 ) +printf ("ERROR: Timeout in soft-reset\n" ); +udelay (1000 ); + } + +writew (0 , &i2c_base->con);writew (psc, &i2c_base->psc);writew (scll, &i2c_base->scll);writew (sclh, &i2c_base->sclh);
@@ -134,6 +142,7 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) {int i2c_error =0 ;u16 status; +u16 retries;/* wait until bus not busy */ wait_for_bb ();
@@ -159,15 +168,16 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) }if (!i2c_error) { -/* free bus, otherwise we can't use a combined transction */ -writew (0 , &i2c_base->con); -while (readw (&i2c_base->stat) || (readw (&i2c_base->con) &I2C_CON_MST )) { + retries =10 ; +while ((readw (&i2c_base->stat) &0x14 ) || + (readw (&i2c_base->con) &I2C_CON_MST )) {udelay (10000 );/* Have to clear pending interrupt to clear I2C_STAT */ writew (0xFFFF , &i2c_base->stat); +if (!retries--) +break ; } -wait_for_bb ();/* set slave address */ writew (devaddr, &i2c_base->sa);/* read one byte from slave */
@@ -190,11 +200,14 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) }if (!i2c_error) { + retries =10 ;writew (I2C_CON_EN , &i2c_base->con);while (readw (&i2c_base->stat) || (readw (&i2c_base->con) &I2C_CON_MST )) {udelay (10000 );writew (0xFFFF , &i2c_base->stat); +if (!retries--) +break ; } } }
@@ -276,7 +289,7 @@ static void flush_fifo(void)* you get a bus error */ while (1 ){ - stat =readw (&i2c_base->stat); + stat =readw (&i2c_base->stat) &I2C_STAT_RRDY ;if (stat ==I2C_STAT_RRDY ){#if defined(CONFIG_OMAP243X ) || defined(CONFIG_OMAP34XX ) || \ defined(CONFIG_OMAP44XX )
@@ -357,18 +370,18 @@ int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len)int i;if (alen >1 ) { -printf ("I2C read: addr len %d not supported\n" , alen); +printf ("I2C write: addr len %d not supported\n" , alen);return 1 ; }if (addr + len >256 ) { -printf ("I2C read: address out of range\n" ); +printf ("I2C write: address out of range\n" );return 1 ; }for (i =0 ; i < len; i++) {if (i2c_write_byte (chip, addr + i, buffer[i])) { -printf ("I2C read: I/O error\n" ); +printf ("I2C write: I/O error\n" );i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE );return 1 ; }
drivers/i2c/omap24xx_i2c.h +4 -0
@@ -85,6 +85,10 @@#define I2C_SYSTEST_SDA_I (1 << 1)/* SDA line sense input value */ #define I2C_SYSTEST_SDA_O (1 << 0)/* SDA line drive output value */ +/* I2C System Status Register (I2C_SYSS): */ + +#define I2C_SYSS_RDONE (1 << 0)/* Internel reset monitoring */ +#define I2C_SCLL_SCLL 0#define I2C_SCLL_SCLL_M 0xFF#define I2C_SCLL_HSSCLL 8
Signature · 1 line
1.7.0.4
PATCH 3/8 ARMV7: Modify i2c driver for more reliable operation on OMAP4
Steve,
just minor nitpick below:
Quoted 32 lines · Steve Sakoman
In addition to modifying the init routine to follow the TRM recommendations, this patch adds a retry count to two loops to avoid the possibility of infinite loops. It also corrects error message typos in the
i2c_writeroutine.Signed-off-by Steve Sakoman<[email protected]>--- arch/arm/include/asm/arch-omap3/i2c.h | 4 ++- drivers/i2c/omap24xx_i2c.c | 37 ++++++++++++++++++++++---------- drivers/i2c/omap24xx_i2c.h | 4 +++ 3 files changed, 32 insertions(+), 13 deletions(-)arch/arm/include/asm/arch-omap3/i2c.h +3
-1@@ -34,7 +34,9 @@ struct i2c {unsigned short stat;/* 0x08 */ unsigned short res3;unsigned short iv;/* 0x0C */ -unsigned short res4[3 ]; +unsigned short res4; +unsigned short syss;/* 0x10 */ +unsigned short res4a;unsigned short buf;/* 0x14 */ unsigned short res5;unsigned short cnt;/* 0x18 */ drivers/i2c/omap24xx_i2c.c +0
-0
drivers/i2c/omap24xx_i2c.c void i2c_init (int speed, int slaveadd) · line 44
Quoted 4 lines
drivers/i2c/omap24xx_i2c.c +1
-0@@ -41,6 +41,7 @@ void i2c_init (int speed, int slaveadd)int psc, fsscll, fssclh;int hsscll =0 , hssclh =0 ;u32 scll, sclh; +int reset_timeout =10 ;
I am guessing we can life with a u8, we timeout in 10ms.. would asking for a #define I2C_TIMEOUT_RESET is too much here?
Quoted 31 lines
drivers/i2c/omap24xx_i2c.c +11
-4/* Only handle standard, fast and high speeds */ if ((speed != OMAP_I2C_STANDARD)&&@@ -102,15 +103,22 @@ void i2c_init (int speed, int slaveadd) sclh = (unsigned int )fssclh; } -writew (0x2 ,&i2c_base->sysc);/* for ES2 after soft reset */ -udelay (1000 ); -writew (0x0 ,&i2c_base->sysc);/* will probably self clear but */ -if (readw (&i2c_base->con)&I2C_CON_EN ) {writew (0 ,&i2c_base->con);udelay (50000 ); } +writew (0x2 ,&i2c_base->sysc);/* for ES2 after soft reset */ +udelay (1000 ); + +writew (I2C_CON_EN ,&i2c_base->con); +while (!(readw (&i2c_base->syss)&I2C_SYSS_RDONE )&& reset_timeout--) { +if (reset_timeout<=0 ) +printf ("ERROR: Timeout in soft-reset\n" ); +udelay (1000 ); + } + +writew (0 ,&i2c_base->con);writew (psc,&i2c_base->psc);writew (scll,&i2c_base->scll);writew (sclh,&i2c_base->sclh);
drivers/i2c/omap24xx_i2c.c static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) · line 145
Quoted 4 lines
drivers/i2c/omap24xx_i2c.c +1
-0@@ -134,6 +142,7 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) {int i2c_error =0 ;u16 status; +u16 retries;
u8 sounds good here - this does not seem to take more than 10..
drivers/i2c/omap24xx_i2c.c static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) · line 171
Quoted 11 lines
drivers/i2c/omap24xx_i2c.c +1
-3/* wait until bus not busy */ wait_for_bb ();@@ -159,15 +168,16 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) }if (!i2c_error) { -/* free bus, otherwise we can't use a combined transction */ -writew (0 ,&i2c_base->con); -while (readw (&i2c_base->stat) || (readw (&i2c_base->con)&I2C_CON_MST )) { + retries =10 ;
#define sounds nice here..
drivers/i2c/omap24xx_i2c.c static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) · line 179
Quoted 8 lines
drivers/i2c/omap24xx_i2c.c +4
-0+while ((readw (&i2c_base->stat)&0x14 ) || + (readw (&i2c_base->con)&I2C_CON_MST )) {udelay (10000 );/* Have to clear pending interrupt to clear I2C_STAT */ writew (0xFFFF ,&i2c_base->stat); +if (!retries--) +break ; }
do we just proceed in case of retry timeout?
Quoted 8 lines
drivers/i2c/omap24xx_i2c.c +0
-1-wait_for_bb ();/* set slave address */ writew (devaddr,&i2c_base->sa);/* read one byte from slave */ @@ -190,11 +200,14 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) }
drivers/i2c/omap24xx_i2c.c static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) · line 211
Quoted 10 lines
drivers/i2c/omap24xx_i2c.c +3
-0if (!i2c_error) { + retries =10 ;writew (I2C_CON_EN ,&i2c_base->con);while (readw (&i2c_base->stat) || (readw (&i2c_base->con)&I2C_CON_MST )) {udelay (10000 );writew (0xFFFF ,&i2c_base->stat); +if (!retries--) +break ; }
same comment on retry failure here..
Quoted 12 lines
drivers/i2c/omap24xx_i2c.c +1
-1} }@@ -276,7 +289,7 @@ static void flush_fifo(void)* you get a bus error */ while (1 ){ - stat =readw (&i2c_base->stat); + stat =readw (&i2c_base->stat)&I2C_STAT_RRDY ;if (stat ==I2C_STAT_RRDY ){#if defined(CONFIG_OMAP243X ) || defined(CONFIG_OMAP34XX ) || \ defined(CONFIG_OMAP44XX )
drivers/i2c/omap24xx_i2c.c int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len) · line 373
Quoted 5 lines
drivers/i2c/omap24xx_i2c.c +1
-1@@ -357,18 +370,18 @@ int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len)int i;if (alen>1 ) { -printf ("I2C read: addr len %d not supported\n" , alen); +printf ("I2C write: addr len %d not supported\n" , alen);
err.. do we need this change?
drivers/i2c/omap24xx_i2c.c int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len) · line 378
Quoted 6 lines
drivers/i2c/omap24xx_i2c.c +1
-1return 1 ; }if (addr + len>256 ) { -printf ("I2C read: address out of range\n" ); +printf ("I2C write: address out of range\n" );
err.. do we need this change?
drivers/i2c/omap24xx_i2c.c int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len) · line 384
Quoted 7 lines
drivers/i2c/omap24xx_i2c.c +1
-1return 1 ; }for (i =0 ; i< len; i++) {if (i2c_write_byte (chip, addr + i, buffer[i])) { -printf ("I2C read: I/O error\n" ); +printf ("I2C write: I/O error\n" );
err.. do we need this change?
Quoted 8 lines
drivers/i2c/omap24xx_i2c.c +0
-0i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE );return 1 ; }drivers/i2c/omap24xx_i2c.h +0
-0
drivers/i2c/omap24xx_i2c.h line 94
Quoted 10 lines
drivers/i2c/omap24xx_i2c.h +4
-0@@ -85,6 +85,10 @@#define I2C_SYSTEST_SDA_I (1<< 1)/* SDA line sense input value */ #define I2C_SYSTEST_SDA_O (1<< 0)/* SDA line drive output value */ +/* I2C System Status Register (I2C_SYSS): */ + +#define I2C_SYSS_RDONE (1<< 0)/* Internel reset monitoring */ +#define I2C_SCLL_SCLL 0#define I2C_SCLL_SCLL_M 0xFF#define I2C_SCLL_HSSCLL 8
Regards,
Nishanth Menon
PATCH 3/8 ARMV7: Modify i2c driver for more reliable operation on OMAP4
Quoted 34 lines · Nishanth Menon
Steve,
just minor nitpick below:Quoted 30 lines · Steve Sakoman
In addition to modifying the init routine to follow the TRM recommendations, this patch adds a retry count to two loops to avoid the possibility of infinite loops. ?It also corrects error message typos in the
i2c_writeroutine.Signed-off-by ?Steve Sakoman<[email protected]>---
? arch/arm/include/asm/arch-omap3/i2c.h | ? ?4 ++- ? drivers/i2c/omap24xx_i2c.c ? ? ? ? ? ?| ? 37 ++++++++++++++++++++++---------- ? drivers/i2c/omap24xx_i2c.h ? ? ? ? ? ?| ? ?4 +++? 3 files changed, 32 insertions(+), 13 deletions(-)
arch/arm/include/asm/arch-omap3/i2c.h +0
-0@@ -34,7 +34,9 @@ struct i2c {? ? ? unsigned short stat; ? ?/*
0x08*/
? ? ? unsigned short res3;
? ? ? unsigned short iv; ? ? ?/*0x0C*/
- ? ? unsigned short res4[3];
+ ? ? unsigned short res4;
+ ? ? unsigned short syss; ? ?/*0x10*/
+ ? ? unsigned short res4a;
? ? ? unsigned short buf; ? ? /*0x14*/
? ? ? unsigned short res5;
? ? ? unsigned short cnt; ? ? /*0x18*/drivers/i2c/omap24xx_i2c.c +0
-1--- a/drivers/i2c/omap24xx_i2c.c
Quoted 8 lines
drivers/i2c/omap24xx_i2c.c void i2c_init (int speed, int slaveadd) · line 44
Quoted 6 lines
+++
b/drivers/i2c/omap24xx_i2c.cdrivers/i2c/omap24xx_i2c.c +1
-0@@ -41,6 +41,7 @@ void i2c_init (int speed, int slaveadd) ? ? ? int psc, fsscll, fssclh; ? ? ? int hsscll = 0, hssclh = 0; ? ? ? u32 scll, sclh; + ? ? int reset_timeout = 10;I am guessing we ?can life with a u8, we timeout in 10ms.. would asking for a #define
I2C_TIMEOUT_RESETis too much here?
I can't imagine why we would ever want to make this a config option!
In normal operation the loop is only traversed one time. I only added the timeout to prevent the possibility of an infinite loop.
Quoted 56 lines
Quoted 31 lines
? ? ? /* Only handle standard, fast and high speeds */ ? ? ? if ((speed != OMAP_I2C_STANDARD)&&
drivers/i2c/omap24xx_i2c.c +11
-4@@ -102,15 +103,22 @@ void i2c_init (int speed, int slaveadd) ? ? ? ? ? ? ? sclh = (unsigned int)fssclh; ? ? ? } - ? ? writew(0x2,&i2c_base->sysc); /* for ES2 after soft reset */ - ? ? udelay(1000); - ? ? writew(0x0,&i2c_base->sysc); /* will probably self clear but */ - ? ? ? if (readw (&i2c_base->con)& ?I2C_CON_EN) { ? ? ? ? ? ? ? writew (0,&i2c_base->con); ? ? ? ? ? ? ? udelay (50000); ? ? ? } + ? ? writew(0x2,&i2c_base->sysc); /* for ES2 after soft reset */ + ? ? udelay(1000); + + ? ? writew(I2C_CON_EN,&i2c_base->con); + ? ? while (!(readw(&i2c_base->syss)& ?I2C_SYSS_RDONE)&& ?reset_timeout--) { + ? ? ? ? ? ? if (reset_timeout<= 0) + ? ? ? ? ? ? ? ? ? ? printf("ERROR: Timeout in soft-reset\n"); + ? ? ? ? ? ? udelay(1000); + ? ? } + + ? ? writew(0,&i2c_base->con); ? ? ? writew(psc,&i2c_base->psc); ? ? ? writew(scll,&i2c_base->scll); ? ? ? writew(sclh,&i2c_base->sclh);drivers/i2c/omap24xx_i2c.c static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) · line 145
Quoted 4 lines
drivers/i2c/omap24xx_i2c.c +1
-0@@ -134,6 +142,7 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) ? { ? ? ? int i2c_error = 0; ? ? ? u16 status; + ? ? u16 retries;u8 sounds good here - this does not seem to take more than 10..
drivers/i2c/omap24xx_i2c.c static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) · line 171
Quoted 11 lines
? ? ? /* wait until bus not busy */
? ? ?wait_for_bb();drivers/i2c/omap24xx_i2c.c +1
-3@@ -159,15 +168,16 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) ? ? ? } ? ? ? if (!i2c_error) { - ? ? ? ? ? ? /* free bus, otherwise we can't use a combined transction */ - ? ? ? ? ? ? writew (0,&i2c_base->con); - ? ? ? ? ? ? while (readw (&i2c_base->stat) || (readw (&i2c_base->con)& ?I2C_CON_MST)) { + ? ? ? ? ? ? retries = 10;#define sounds nice here..
Quoted 8 lines
drivers/i2c/omap24xx_i2c.c +2
-0+ ? ? ? ? ? ? while ((readw(&i2c_base->stat)& ?0x14) || + ? ? ? ? ? ? ? ? ? ? (readw(&i2c_base->con)& ?I2C_CON_MST)) { ? ? ? ? ? ? ? ? ? ? ? udelay (10000);? ? ? ? ? ? ? ? ? ? ? /* Have to clear pending interrupt to clear
I2C_STAT*/ ? ? ? ? ? ? ? ? ? ? ? writew (0xFFFF,&i2c_base->stat);
+ ? ? ? ? ? ? ? ? ? ? if (!retries--)
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? }
Quoted 1 line
do we just proceed in case of retry timeout?
Yes. Again this timeout was added to prevent an infinite loop hang.
Perhaps an error message if the timeout is triggered?
Quoted 8 lines
Quoted 8 lines
- ? ? ? ? ? ?
wait_for_bb();
? ? ? ? ? ? ? /* set slave address */
? ? ? ? ? ? ? writew (devaddr,&i2c_base->sa);
? ? ? ? ? ? ? /* read one byte from slave */drivers/i2c/omap24xx_i2c.c +0
-0@@ -190,11 +200,14 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) ? ? ? ? ? ? ? }
Quoted 11 lines
drivers/i2c/omap24xx_i2c.c static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) · line 211
Quoted 10 lines
drivers/i2c/omap24xx_i2c.c +3
-0? ? ? ? ? ? ? if (!i2c_error) { + ? ? ? ? ? ? ? ? ? ? retries = 10; ? ? ? ? ? ? ? ? ? ? ? writew (I2C_CON_EN,&i2c_base->con); ? ? ? ? ? ? ? ? ? ? ? while (readw (&i2c_base->stat) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|| (readw (&i2c_base->con)& ?I2C_CON_MST)) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? udelay (10000); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? writew (0xFFFF,&i2c_base->stat); + ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (!retries--) + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; ? ? ? ? ? ? ? ? ? ? ? }same comment on retry failure here..
Same response -- would you like to see an error message if the timeout is triggered?
Quoted 15 lines
Quoted 15 lines
drivers/i2c/omap24xx_i2c.c +0
-0? ? ? ? ? ? ? } ? ? ? }@@ -276,7 +289,7 @@ static void flush_fifo(void)? ? ? ?* you get a bus error
? ? ? ?*/
? ? ? while(1){
- ? ? ? ? ? ? stat =readw(&i2c_base->stat);
+ ? ? ? ? ? ? stat = readw(&i2c_base->stat)& ?I2C_STAT_RRDY; ? ? ? ? ? ? ?if(stat == I2C_STAT_RRDY){
? #ifdefined(CONFIG_OMAP243X)||defined(CONFIG_OMAP34XX)|| \
? ? ?defined(CONFIG_OMAP44XX)drivers/i2c/omap24xx_i2c.c +0
-0@@ -357,18 +370,18 @@ int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len) ? ? ? int i;
Quoted 4 lines
drivers/i2c/omap24xx_i2c.c int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len) · line 373
Quoted 3 lines
drivers/i2c/omap24xx_i2c.c +1
-1? ? ? if (alen> ?1) { - ? ? ? ? ? ? printf ("I2C read: addr len %d not supported\n", alen); + ? ? ? ? ? ? printf("I2C write: addr len %d not supported\n", alen);err.. do we need this change?
I think so -- otherwise the i2c_write function is printing messages claiming to come from i2c_read! Same for the other messages you flagged.
Regards,
Steve
PATCH 3/8 ARMV7: Modify i2c driver for more reliable operation on OMAP4
Quoted 45 lines · Steve Sakoman
Quoted 34 lines · Nishanth Menon
Steve,
just minor nitpick below:Quoted 30 lines · Steve Sakoman
In addition to modifying the init routine to follow the TRM recommendations, this patch adds a retry count to two loops to avoid the possibility of infinite loops. It also corrects error message typos in the
i2c_writeroutine.Signed-off-by Steve Sakoman<[email protected]>--- arch/arm/include/asm/arch-omap3/i2c.h | 4 ++- drivers/i2c/omap24xx_i2c.c | 37 ++++++++++++++++++++++---------- drivers/i2c/omap24xx_i2c.h | 4 +++ 3 files changed, 32 insertions(+), 13 deletions(-)arch/arm/include/asm/arch-omap3/i2c.h +3
-1@@ -34,7 +34,9 @@ struct i2c {unsigned short stat;/* 0x08 */ unsigned short res3;unsigned short iv;/* 0x0C */ -unsigned short res4[3 ]; +unsigned short res4; +unsigned short syss;/* 0x10 */ +unsigned short res4a;unsigned short buf;/* 0x14 */ unsigned short res5;unsigned short cnt;/* 0x18 */ drivers/i2c/omap24xx_i2c.c +0
-1--- a/drivers/i2c/omap24xx_i2c.cQuoted 8 lines
drivers/i2c/omap24xx_i2c.c void i2c_init (int speed, int slaveadd) · line 44
Quoted 6 lines
+++
b/drivers/i2c/omap24xx_i2c.cdrivers/i2c/omap24xx_i2c.c +1
-0@@ -41,6 +41,7 @@ void i2c_init (int speed, int slaveadd)int psc, fsscll, fssclh;int hsscll =0 , hssclh =0 ;u32 scll, sclh; +int reset_timeout =10 ;I am guessing we can life with a u8, we timeout in 10ms.. would asking for a #define
I2C_TIMEOUT_RESETis too much here?
Quoted 4 lines
I can't imagine why we would ever want to make this a config option!
In normal operation the loop is only traversed one time. I only added the timeout to prevent the possibility of an infinite loop.
not as a config option, but a #define in the C file so that it is readable, the 10 makes not much sense at a glance.. but as I mentioned, it is just a nitpick.. it just helps to quickly figure out which are the timeouts used in the driver.. I mean we cant proceed with i2c_init or use it as i2c master (aka no point in using the driver) if that happens in the system rt?
Quoted 57 lines
Quoted 57 lines
Quoted 32 lines
drivers/i2c/omap24xx_i2c.c +11
-4/* Only handle standard, fast and high speeds */ if ((speed != OMAP_I2C_STANDARD)&&@@ -102,15 +103,22 @@ void i2c_init (int speed, int slaveadd) sclh = (unsigned int )fssclh; } -writew (0x2 ,&i2c_base->sysc);/* for ES2 after soft reset */ -udelay (1000 ); -writew (0x0 ,&i2c_base->sysc);/* will probably self clear but */ -if (readw (&i2c_base->con)&I2C_CON_EN ) {writew (0 ,&i2c_base->con);udelay (50000 ); } +writew (0x2 ,&i2c_base->sysc);/* for ES2 after soft reset */ +udelay (1000 ); + +writew (I2C_CON_EN ,&i2c_base->con); +while (!(readw (&i2c_base->syss)&I2C_SYSS_RDONE )&& reset_timeout--) { +if (reset_timeout<=0 ) +printf ("ERROR: Timeout in soft-reset\n" ); +udelay (1000 ); + } + +writew (0 ,&i2c_base->con);writew (psc,&i2c_base->psc);writew (scll,&i2c_base->scll);writew (sclh,&i2c_base->sclh);drivers/i2c/omap24xx_i2c.c static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) · line 145
Quoted 4 lines
drivers/i2c/omap24xx_i2c.c +1
-0@@ -134,6 +142,7 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) {int i2c_error =0 ;u16 status; +u16 retries;u8 sounds good here - this does not seem to take more than 10..
drivers/i2c/omap24xx_i2c.c static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) · line 171
Quoted 11 lines
drivers/i2c/omap24xx_i2c.c +1
-3/* wait until bus not busy */ wait_for_bb ();@@ -159,15 +168,16 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) }if (!i2c_error) { -/* free bus, otherwise we can't use a combined transction */ -writew (0 ,&i2c_base->con); -while (readw (&i2c_base->stat) || (readw (&i2c_base->con)&I2C_CON_MST )) { + retries =10 ;#define sounds nice here..
Quoted 8 lines
drivers/i2c/omap24xx_i2c.c +4
-0+while ((readw (&i2c_base->stat)&0x14 ) || + (readw (&i2c_base->con)&I2C_CON_MST )) {udelay (10000 );/* Have to clear pending interrupt to clear I2C_STAT */ writew (0xFFFF ,&i2c_base->stat); +if (!retries--) +break ; }
Quoted 5 lines
Quoted 1 line
do we just proceed in case of retry timeout?
Yes. Again this timeout was added to prevent an infinite loop hang.
Perhaps an error message if the timeout is triggered?
print might e ok here, but at this point, we are looking to check what state we are in - master/slave if the state did not change aka controller is in slave mode, makes no sense in trying to dump data out.. it is doomed to failure :(.. quitting with an appropriate message?
Quoted 21 lines
Quoted 9 lines
Quoted 9 lines
drivers/i2c/omap24xx_i2c.c +0
-1-wait_for_bb ();/* set slave address */ writew (devaddr,&i2c_base->sa);/* read one byte from slave */ @@ -190,11 +200,14 @@ static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) }Quoted 11 lines
drivers/i2c/omap24xx_i2c.c static int i2c_read_byte (u8 devaddr, u8 regoffset, u8 * value) · line 211
Quoted 10 lines
drivers/i2c/omap24xx_i2c.c +3
-0if (!i2c_error) { + retries =10 ;writew (I2C_CON_EN ,&i2c_base->con);while (readw (&i2c_base->stat) || (readw (&i2c_base->con)&I2C_CON_MST )) {udelay (10000 );writew (0xFFFF ,&i2c_base->stat); +if (!retries--) +break ; }same comment on retry failure here..
Quoted 2 lines
Same response -- would you like to see an error message if the timeout is triggered?
lets see here -> interrupt status never gets cleared OR we are in slave mode.. my argument still stands in the case of master mode.. we can return error value for the caller of read_byte to handle, maybe we should be using that along with a print to scare the user ;) ?
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/i2c/omap24xx_i2c.c +1
-1} }@@ -276,7 +289,7 @@ static void flush_fifo(void)* you get a bus error */ while (1 ){ - stat =readw (&i2c_base->stat); + stat =readw (&i2c_base->stat)&I2C_STAT_RRDY ;if (stat ==I2C_STAT_RRDY ){#if defined(CONFIG_OMAP243X ) || defined(CONFIG_OMAP34XX ) || \ defined(CONFIG_OMAP44XX )@@ -357,18 +370,18 @@ int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len)int i;
Quoted 9 lines
Quoted 4 lines
drivers/i2c/omap24xx_i2c.c int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len) · line 373
Quoted 3 lines
drivers/i2c/omap24xx_i2c.c +1
-1if (alen>1 ) { -printf ("I2C read: addr len %d not supported\n" , alen); +printf ("I2C write: addr len %d not supported\n" , alen);err.. do we need this change?
I think so -- otherwise the
i2c_writefunction is printing messages claiming to come fromi2c_read! Same for the other messages you flagged.
Apologies on not being clear - I dont have a problem with the print as such, BUT, do we need a diff here which changes printf ("... to printf("... ? makes no reason why I need that for reliable OMAP4 operation :D..
Quoted 4 lines
Regards,
Steve
PATCH 3/8 ARMV7: Modify i2c driver for more reliable operation on OMAP4
Quoted 15 lines · Nishanth Menon
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
drivers/i2c/omap24xx_i2c.c +0
-0Quoted 8 lines
drivers/i2c/omap24xx_i2c.c void i2c_init (int speed, int slaveadd) · line 44
Quoted 5 lines
drivers/i2c/omap24xx_i2c.c +1
-0@@ -41,6 +41,7 @@ void i2c_init (int speed, int slaveadd) ? ? ? int psc, fsscll, fssclh; ? ? ? int hsscll = 0, hssclh = 0; ? ? ? u32 scll, sclh; + ? ? int reset_timeout = 10;I am guessing we ?can life with a u8, we timeout in 10ms.. would asking for a #define
I2C_TIMEOUT_RESETis too much here?I can't imagine why we would ever want to make this a config option!
Quoted 8 lines
Quoted 2 lines
In normal operation the loop is only traversed one time. ?I only added the timeout to prevent the possibility of an infinite loop.
not as a config option, but a #define in the C file so that it is readable, the 10 makes not much sense at a glance.. but as I mentioned, it is just a nitpick.. it just helps to quickly figure out which are the timeouts used in the driver.. I mean we cant proceed with
i2c_initor use it as i2c master (aka no point in using the driver) if that happens in the system rt?
OK, I will submit a version 2 with a #define for the timeout/retry count.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
drivers/i2c/omap24xx_i2c.c void i2c_init (int speed, int slaveadd) · line 45
Quoted 2 lines
drivers/i2c/omap24xx_i2c.c +1
-1- ? ? ? ? ? ? printf ("I2C read: addr len %d not supported\n", alen); + ? ? ? ? ? ? printf("I2C write: addr len %d not supported\n", alen);err.. do we need this change?
Quoted 8 lines
Quoted 4 lines
I think so -- otherwise the
i2c_writefunction is printing messages claiming to come fromi2c_read! ?Same for the other messages you flagged.Apologies on not being clear - I dont have a problem with the print as such, BUT, do we need a diff here which changes printf ("... to printf("... ? makes no reason why I need that for reliable OMAP4 operation :D..
The message is clearly wrong, but your point is well taken: an erroneous error message fix doesn't really belong in a patch for reliable operation on OMAP4.
Version 2 of this patch will address only the reliability issues and your request for a timeout #define.
I will then do a subsequent patch (not part of this series) to fix erroneous error messages, potential infinite loops, and a variety of whitespace and style issues.
Regards,
Steve
PATCH 3/8 ARMV7: Modify i2c driver for more reliable operation on OMAP4
Quoted 48 lines · Steve Sakoman
Quoted 15 lines · Nishanth Menon
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
drivers/i2c/omap24xx_i2c.c +0
-0Quoted 8 lines
drivers/i2c/omap24xx_i2c.c void i2c_init (int speed, int slaveadd) · line 44
Quoted 5 lines
drivers/i2c/omap24xx_i2c.c +1
-0@@ -41,6 +41,7 @@ void i2c_init (int speed, int slaveadd) ? ? ? int psc, fsscll, fssclh; ? ? ? int hsscll = 0, hssclh = 0; ? ? ? u32 scll, sclh; + ? ? int reset_timeout = 10;I am guessing we ?can life with a u8, we timeout in 10ms.. would asking for a #define
I2C_TIMEOUT_RESETis too much here?I can't imagine why we would ever want to make this a config option!
Quoted 8 lines
Quoted 2 lines
In normal operation the loop is only traversed one time. ?I only added the timeout to prevent the possibility of an infinite loop.
not as a config option, but a #define in the C file so that it is readable, the 10 makes not much sense at a glance.. but as I mentioned, it is just a nitpick.. it just helps to quickly figure out which are the timeouts used in the driver.. I mean we cant proceed with
i2c_initor use it as i2c master (aka no point in using the driver) if that happens in the system rt?OK, I will submit a version 2 with a #define for the timeout/retry count.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
drivers/i2c/omap24xx_i2c.c void i2c_init (int speed, int slaveadd) · line 45
Quoted 2 lines
drivers/i2c/omap24xx_i2c.c +1
-1- ? ? ? ? ? ? printf ("I2C read: addr len %d not supported\n", alen); + ? ? ? ? ? ? printf("I2C write: addr len %d not supported\n", alen);err.. do we need this change?
Quoted 8 lines
Quoted 4 lines
I think so -- otherwise the
i2c_writefunction is printing messages claiming to come fromi2c_read! ?Same for the other messages you flagged.Apologies on not being clear - I dont have a problem with the print as such, BUT, do we need a diff here which changes printf ("... to printf("... ? makes no reason why I need that for reliable OMAP4 operation :D..
The message is clearly wrong, but your point is well taken: ?an erroneous error message fix doesn't really belong in a patch for reliable operation on OMAP4.
Quoted 6 lines
Version 2 of this patch will address only the reliability issues and your request for a timeout #define.
I will then do a subsequent patch (not part of this series) to fix erroneous error messages, potential infinite loops, and a variety of whitespace and style issues.
alright.. thanks. looking for the v2 of this patch..
Quoted 5 lines
Regards,
Steve
PATCH 4/8 ARMV7: Add support for the TWL6030 I2C power chip used in OMAP4 systems
In reply to Steve SakomanThis patch add the basic infrastructure for the TWL6030 driver and enables support in the two existing OMAP4 boards, Panda and OMAP4430 SDP
--- drivers/power/Makefile | 1 + drivers/power/twl6030.c | 77 +++++++++++++++++++++++++++++++++ include/configs/omap4_panda.h | 3 + include/configs/omap4_sdp4430.h | 3 + include/twl6030.h | 90 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 174 insertions(+), 0 deletions(-) create mode 100644 drivers/power/twl6030.c create mode 100644 include/twl6030.h
drivers/power/Makefile +1 -0
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk LIB := $(obj)libpower.a COBJS-$(CONFIG_TWL4030_POWER) += twl4030.o +COBJS-$(CONFIG_TWL6030_POWER) += twl6030.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/power/twl6030.c new file +77 -0
77 lines not on this page · raw message
include/configs/omap4_panda.h +3 -0
@@ -103,6 +103,9 @@#define CONFIG_DRIVER_OMAP34XX_I2C 1#define CONFIG_I2C_MULTI_BUS 1 +/* TWL6030 */ +#define CONFIG_TWL6030_POWER 1 +/* MMC */ #define CONFIG_MMC 1#define CONFIG_OMAP3_MMC 1
include/configs/omap4_sdp4430.h +3 -0
@@ -104,6 +104,9 @@#define CONFIG_DRIVER_OMAP34XX_I2C 1#define CONFIG_I2C_MULTI_BUS 1 +/* TWL6030 */ +#define CONFIG_TWL6030_POWER 1 +/* MMC */ #define CONFIG_MMC 1#define CONFIG_OMAP3_MMC 1
include/twl6030.h new file +90 -0
90 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 5/8 ARMV7: Restructure omap3 musb driver to allow code sharing between OMAP3 and OMAP4
In reply to Steve Sakoman--- arch/arm/include/asm/arch-omap3/cpu.h | 3 +++ arch/arm/include/asm/arch-omap4/cpu.h | 3 +++ drivers/usb/musb/omap3.c | 16 ++++++++++++++++ drivers/usb/musb/omap3.h | 3 ++- 4 files changed, 24 insertions(+), 1 deletions(-)
arch/arm/include/asm/arch-omap3/cpu.h +3 -0
@@ -483,4 +483,7 @@ struct pm {#define I2C_BASE2 (OMAP34XX_CORE_L4_IO_BASE + 0x72000)#define I2C_BASE3 (OMAP34XX_CORE_L4_IO_BASE + 0x60000) +/* MUSB base */ +#define MUSB_BASE (OMAP34XX_CORE_L4_IO_BASE + 0xAB000) +#endif /* _CPU_H */
arch/arm/include/asm/arch-omap4/cpu.h +3 -0
@@ -139,4 +139,7 @@ struct watchdog {#define I2C_BASE2 (OMAP44XX_L4_PER_BASE + 0x72000)#define I2C_BASE3 (OMAP44XX_L4_PER_BASE + 0x60000) +/* MUSB base */ +#define MUSB_BASE (OMAP44XX_L4_CORE_BASE + 0xAB000) +#endif /* _CPU_H */
drivers/usb/musb/omap3.c +16 -0
@@ -31,6 +31,7 @@*/ #include <twl4030.h> +#include <twl6030.h> #include "omap3.h" static int platform_needs_initialization =1 ;
@@ -65,7 +66,12 @@ static struct omap3_otg_regs *otg;#define OMAP3_OTG_SYSSTATUS_RESETDONE 0x0001 +/* OMAP4430 has an internal PHY, use it */ +#ifdef CONFIG_OMAP4430 +#define OMAP3_OTG_INTERFSEL_OMAP 0x0000 +#else #define OMAP3_OTG_INTERFSEL_OMAP 0x0001 +#endif #define OMAP3_OTG_FORCESTDBY_STANDBY 0x0001
@@ -105,6 +111,11 @@ int musb_platform_init(void) goto end; }#endif + +#ifdef CONFIG_TWL6030_POWER +twl6030_usb_device_settings (); +#endif + otg = (struct omap3_otg_regs *)OMAP3_OTG_BASE ;/* Set OTG to always be on */
@@ -122,6 +133,11 @@ int musb_platform_init(void)#ifdef CONFIG_OMAP3_EVM musb_cfg.extvbus =omap3_evm_need_extvbus ();#endif + +#ifdef CONFIG_OMAP4430 +u32 *usbotghs_control = (u32 *)(CTRL_BASE +0x33C ); + *usbotghs_control =0x15 ; +#endif platform_needs_initialization =0 ; }
drivers/usb/musb/omap3.h +2 -1
@@ -31,10 +31,11 @@#ifndef _MUSB_OMAP3_H_#define _MUSB_OMAP3_H_ +#include <asm/arch/cpu.h> #include "musb_core.h" /* Base address of MUSB registers */ -#define MENTOR_USB0_BASE (OMAP34XX_CORE_L4_IO_BASE + 0xAB000) +#define MENTOR_USB0_BASE MUSB_BASE/* Base address of OTG registers */ #define OMAP3_OTG_BASE (MENTOR_USB0_BASE + 0x400)
Signature · 1 line
1.7.0.4
PATCH 6/8 ARMV7: Enable musb driver and usbtty on OMAP4430 SDP
In reply to Steve Sakoman--- include/configs/omap4_sdp4430.h | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
include/configs/omap4_sdp4430.h +15 -0
@@ -113,6 +113,20 @@#define CONFIG_SYS_MMC_SET_DEV 1#define CONFIG_DOS_PARTITION 1 +/* USB */ +#define CONFIG_MUSB_UDC 1 +#define CONFIG_USB_OMAP3 1 + +/* USB device configuration */ +#define CONFIG_USB_DEVICE 1 +#define CONFIG_USB_TTY 1 +#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 +/* Change these to suit your needs */ +#define CONFIG_USBD_VENDORID 0x0451 +#define CONFIG_USBD_PRODUCTID 0x5678 +#define CONFIG_USBD_MANUFACTURER "Texas Instruments" +#define CONFIG_USBD_PRODUCT_NAME "SDP4430" +/* Flash */ #define CONFIG_SYS_NO_FLASH 1
@@ -146,6 +160,7 @@#define CONFIG_EXTRA_ENV_SETTINGS \ "loadaddr=0x82000000\0" \ "console=ttyS2,115200n8\0" \ + "usbtty=cdc_acm\0" \ "mmcdev=1\0" \ "mmcroot=/dev/mmcblk0p2 rw\0" \ "mmcrootfstype=ext3 rootwait\0" \
Signature · 1 line
1.7.0.4
PATCH 7/8 ARMV7: Enable musb driver and usbtty on OMAP4 Panda
In reply to Steve Sakoman--- include/configs/omap4_panda.h | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
include/configs/omap4_panda.h +15 -0
@@ -112,6 +112,20 @@#define CONFIG_SYS_MMC_SET_DEV 1#define CONFIG_DOS_PARTITION 1 +/* USB */ +#define CONFIG_MUSB_UDC 1 +#define CONFIG_USB_OMAP3 1 + +/* USB device configuration */ +#define CONFIG_USB_DEVICE 1 +#define CONFIG_USB_TTY 1 +#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 +/* Change these to suit your needs */ +#define CONFIG_USBD_VENDORID 0x0451 +#define CONFIG_USBD_PRODUCTID 0x5678 +#define CONFIG_USBD_MANUFACTURER "Texas Instruments" +#define CONFIG_USBD_PRODUCT_NAME "OMAP4 Panda" +/* Flash */ #define CONFIG_SYS_NO_FLASH 1
@@ -145,6 +159,7 @@#define CONFIG_EXTRA_ENV_SETTINGS \ "loadaddr=0x82000000\0" \ "console=ttyS2,115200n8\0" \ + "usbtty=cdc_acm\0" \ "mmcdev=1\0" \ "mmcroot=/dev/mmcblk0p2 rw\0" \ "mmcrootfstype=ext3 rootwait\0" \
Signature · 1 line
1.7.0.4
PATCH 8/8 ARMV7: Update default environment for OMAP4 boards
In reply to Steve SakomanSpecify vram on command line, remove erroneous call to nandboot in the boot script, add CONFIG_BOOTDELAY
--- include/configs/omap4_panda.h | 5 ++++- include/configs/omap4_sdp4430.h | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-)
include/configs/omap4_panda.h +4 -1
@@ -153,6 +153,8 @@* Environment setup */ +#define CONFIG_BOOTDELAY 5 +/* allow overwriting serial config and ethaddr */ #define CONFIG_ENV_OVERWRITE
@@ -160,10 +162,12 @@"loadaddr=0x82000000\0" \"console=ttyS2,115200n8\0" \"usbtty=cdc_acm\0" \ +"vram=16M\0" \"mmcdev=1\0" \"mmcroot=/dev/mmcblk0p2 rw\0" \"mmcrootfstype=ext3 rootwait\0" \"mmcargs=setenv bootargs console=${console} " \ +"vram=${vram} " \"root=${mmcroot} " \"rootfstype=${mmcrootfstype}\0" \"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
@@ -181,7 +185,6 @@"else " \"if run loaduimage; then " \"run mmcboot; " \ -"else run nandboot; " \"fi; " \"fi; " \"fi"
include/configs/omap4_sdp4430.h +4 -1
@@ -154,6 +154,8 @@* Environment setup */ +#define CONFIG_BOOTDELAY 5 +/* allow overwriting serial config and ethaddr */ #define CONFIG_ENV_OVERWRITE
@@ -161,10 +163,12 @@"loadaddr=0x82000000\0" \"console=ttyS2,115200n8\0" \"usbtty=cdc_acm\0" \ +"vram=16M\0" \"mmcdev=1\0" \"mmcroot=/dev/mmcblk0p2 rw\0" \"mmcrootfstype=ext3 rootwait\0" \"mmcargs=setenv bootargs console=${console} " \ +"vram=${vram} " \"root=${mmcroot} " \"rootfstype=${mmcrootfstype}\0" \"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
@@ -182,7 +186,6 @@"else " \"if run loaduimage; then " \"run mmcboot; " \ -"else run nandboot; " \"fi; " \"fi; " \"fi"
Signature · 1 line
1.7.0.4
PATCH 8/8 ARMV7: Update default environment for OMAP4 boards
Quoted 14 lines · Steve Sakoman
Specify vram on command line, remove erroneous call to nandboot in the boot script, add
CONFIG_BOOTDELAYSigned-off-by Steve Sakoman<[email protected]>--- include/configs/omap4_panda.h | 5 ++++- include/configs/omap4_sdp4430.h | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-)include/configs/omap4_panda.h +0
-0
include/configs/omap4_panda.h line 157
Quoted 5 lines
include/configs/omap4_panda.h +2
-0@@ -153,6 +153,8 @@* Environment setup */ +#define CONFIG_BOOTDELAY 5 +
why? default 3 is good rt? ;)
Quoted 17 lines
include/configs/omap4_panda.h +2
-0/* allow overwriting serial config and ethaddr */ #define CONFIG_ENV_OVERWRITE @@ -160,10 +162,12 @@"loadaddr=0x82000000\0" \"console=ttyS2,115200n8\0" \"usbtty=cdc_acm\0" \ +"vram=16M\0" \"mmcdev=1\0" \"mmcroot=/dev/mmcblk0p2 rw\0" \"mmcrootfstype=ext3 rootwait\0" \"mmcargs=setenv bootargs console=${console} " \ +"vram=${vram} " \"root=${mmcroot} " \"rootfstype=${mmcrootfstype}\0" \"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
include/configs/omap4_panda.h line 184
Quoted 4 lines
include/configs/omap4_panda.h +0
-1@@ -181,7 +185,6 @@"else " \"if run loaduimage; then " \"run mmcboot; " \ -"else run nandboot; " \
ack
Quoted 37 lines
include/configs/omap4_panda.h +0
-0"fi; " \"fi; " \"fi" include/configs/omap4_sdp4430.h +4
-1@@ -154,6 +154,8 @@* Environment setup */ +#define CONFIG_BOOTDELAY 5 +/* allow overwriting serial config and ethaddr */ #define CONFIG_ENV_OVERWRITE @@ -161,10 +163,12 @@"loadaddr=0x82000000\0" \"console=ttyS2,115200n8\0" \"usbtty=cdc_acm\0" \ +"vram=16M\0" \"mmcdev=1\0" \"mmcroot=/dev/mmcblk0p2 rw\0" \"mmcrootfstype=ext3 rootwait\0" \"mmcargs=setenv bootargs console=${console} " \ +"vram=${vram} " \"root=${mmcroot} " \"rootfstype=${mmcrootfstype}\0" \"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \@@ -182,7 +186,6 @@"else " \"if run loaduimage; then " \"run mmcboot; " \ -"else run nandboot; " \"fi; " \"fi; " \"fi"