diff options
author | Michael Brandt <michael.brandt@stericsson.com> | 2010-02-17 13:14:09 +0100 |
---|---|---|
committer | Jonas ABERG <jonas.aberg@stericsson.com> | 2010-05-19 07:40:42 +0200 |
commit | 1e4db0172510318ddc94ef7fcc071fdd435c2e47 (patch) | |
tree | 1cb7fde9a824922054de38fe09f5c3d29347b6ab /board/st/u8500/u8500.c | |
parent | 9a711e3345a291058e071ddbc4133c9f71941eec (diff) |
General I2C refactoring and environment settings cleanup
These are the patches for WP252006.
There will be a follow-up patched for WP254081.
Environment settings
* board_id bootargs parameter from board_id environment var
set in board_late_init().
* decreased bootdelay to 1 second
* added check for keypress on bootdelay==0
* removed preboot command and introduced "run cmdfile" instead
* changed rootfstype from ext2 to ext3
General I2C refactoring
* include/configs/u8500.h:
Enabled i2c command line commands.
Changed environment settings to use board_id as set in
board_late_init().
Added I2C address and configuration defines.
* board/st/u8500/Makefile: Replaced i2c.o with u8500_i2c.o.
* board/st/u8500/gpio.c, gpio.h: Added I2C busses to altfunc_table.
* board/st/u8500/init_mmc.c: removed config_extended_gpio() and therefore I2C
references. GPIOE settings are now in board_late_init().
* board/st/u8500/u8500.c:
Removed I2C/SD gpio settings from addr,value array.
board_late_init():
Determine and set board_id environment variable
0: mop500, 1: href500
Above boards have different GPIO expander chips which we can
distinguish by the chip id (1 and 3).
The board_id environment variable is needed for the Linux bootargs.
Signed-off-by: Michael Brandt <Michael.Brandt@stericsson.com>
Change-Id: I4c2cab28c1cb74692e0c72b2daa422e97787ff8d
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/167
Reviewed-by: Michael BRANDT <michael.brandt@stericsson.com>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'board/st/u8500/u8500.c')
-rw-r--r-- | board/st/u8500/u8500.c | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/board/st/u8500/u8500.c b/board/st/u8500/u8500.c index 5be3f5149..83e899434 100644 --- a/board/st/u8500/u8500.c +++ b/board/st/u8500/u8500.c @@ -22,6 +22,8 @@ */ #include <config.h> +#include <common.h> +#include <i2c.h> #include <asm/types.h> #include <asm/io.h> #include <asm/errno.h> @@ -67,6 +69,8 @@ #define PRCM_TCR (PRCMU_BASE + 0x1C8) +int board_id; /* set in board_late_init() */ + /* PLLs for clock management registers */ enum { GATED = 0, @@ -189,8 +193,6 @@ unsigned int addr_vall_arr[] = { 0x8011F008, 0x00001CFF, // Clocks for HSI TODO Enable reqd only 0x8000F000, 0x00007FFF, // Clocks for I2C TODO Enable reqd only 0x8000F008, 0x00007FFF, // Clocks for I2C TODO Enable reqd only -0x8000E120, 0x003C0000, // GPIO for I2C/SD -0x8000E124, 0x00000000, // GPIO for I2C/SD 0x80157020, 0x00000150, // I2C 48MHz clock 0x8012F000, 0x00007FFF, // Clocks for SD TODO Enable reqd only 0x8012F008, 0x00007FFF, // Clocks for SD TODO Enable reqd only @@ -214,11 +216,57 @@ unsigned int addr_vall_arr[] = { }; #ifdef BOARD_LATE_INIT +/* + * called after all initialisation were done, but before the generic + * mmc_initialize(). + */ int board_late_init(void) { + uchar byte; +#ifdef CONFIG_MMC + uchar byte_array[] = {0x06, 0x06}; +#endif + + /* + * Determine and set board_id environment variable + * 0: mop500, 1: href500 + * Above boards have different GPIO expander chips which we can + * distinguish by the chip id. + * + * The board_id environment variable is needed for the Linux bootargs. + */ + (void) i2c_set_bus_num(0); + (void) i2c_read(CONFIG_SYS_I2C_GPIOE_ADDR, 0x80, 1, &byte, 1); + if (byte == 0x01) { + board_id = 0; + setenv("board_id", "0"); + } else { + board_id = 1; + setenv("board_id", "1"); + } +#ifdef CONFIG_MMC + /* + * config extended GPIO pins for level shifter and + * SDMMC_ENABLE + */ + if (board_id == 0) { + /* MOP500 */ + byte = 0x0c; + (void) i2c_write(CONFIG_SYS_I2C_GPIOE_ADDR, 0x89, 1, &byte, 1); + (void) i2c_write(CONFIG_SYS_I2C_GPIOE_ADDR, 0x83, 1, &byte, 1); + } else { + /* HREF */ + /* set the direction of GPIO KPY9 and KPY10 */ + byte = 0x06; + (void) i2c_write(CONFIG_SYS_I2C_GPIOE_ADDR, 0xC8, 1, &byte, 1); + /* must be a multibyte access */ + (void) i2c_write(CONFIG_SYS_I2C_GPIOE_ADDR, 0xC4, 1, + &byte_array[0], 2); + } +#endif /* CONFIG_MMC */ return (0); } -#endif +#endif /* BOARD_LATE_INIT */ static void init_regs(void) { |