diff options
author | Michael Brandt <Michael.Brandt@stericsson.com> | 2010-01-07 16:08:03 +0100 |
---|---|---|
committer | Michael Brandt <Michael.Brandt@stericsson.com> | 2010-01-07 16:08:03 +0100 |
commit | d157ec3412960375dee37e7845bb5e6315397d6a (patch) | |
tree | f557b605f8d9eaeac8b89ea5eb29308d6271c8aa /board/st/u8500/init_mmc.c | |
parent | 55e1520985c4d0f3fdce2f27873b4231790b8c3d (diff) |
PACK3 changes
applied PACK3 changes:
* cpu/arm_cortexa9/start.S: reset register changed, but U-Boot reset
command still does not work.
* config.mk: build address changed to 0x05FC0000
* board/st/u8500/mmc.c: MBR change: descrease 4th partition size (userfs
2) from 0x00c0'0000 to 0x00b9'a000 sectors (6,442,450,944 to
6,228,541,440 bytes).
* board\st\u8500\init_mmc.c: modify bootargs to set board_id to HREF or
MOP. Is is an extremly ugly solution. It modifies the bootargs env
variable directly (bootargs[9] = board_id;), instead of setting a
additional environment variable board_id and use it in the bootargs
envvar.
* board/st/u8500/mmc.c: undocumented clock changes.
* board/st/u8500/mmc_utils.c:
new routine to switch to 4-bit interface.
The switch is done in mmc_read_file(). It would make more sense
to do so in mmc_init.
* board/st/u8500/u8500.c:
clock changes for HSI and I2C. I2C is now clocked by SOC1 PLL and runs
with 24 MHz (depends on boot ROM SOC1 initialisation)
Diffstat (limited to 'board/st/u8500/init_mmc.c')
-rw-r--r--[-rwxr-xr-x] | board/st/u8500/init_mmc.c | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/board/st/u8500/init_mmc.c b/board/st/u8500/init_mmc.c index 7d6656024..5ee8190af 100755..100644 --- a/board/st/u8500/init_mmc.c +++ b/board/st/u8500/init_mmc.c @@ -28,10 +28,14 @@ #include "mmc_utils.h" #include "i2c.h" +#define HREF_BOARD_ID ('1') +#define MOP500_BOARD_ID ('0') +char Bootargs_buf[512]; + #ifdef CONFIG_CMD_FAT #include <part.h> #include <fat.h> -#endif +#endif #define LOOP(x) {int i;for(i=0;i<1000;i++);} @@ -148,7 +152,8 @@ static void config_extended_gpio(void) t_i2c_error error_i2c; u8 read_data = 0; u8 dataArr[2]={0x06,0x06}; - + char board_id = HREF_BOARD_ID; + I2C_SetBaseAddress(I2C0, CFG_I2C0_BASE); error_i2c = I2C_Init(I2C0, CFG_I2C0_BASE); @@ -203,6 +208,7 @@ static void config_extended_gpio(void) LOOP(5); error_status = I2C_WriteSingleData(I2C0, I2C0_SLAVE_ADDRESS, I2C_BYTE_INDEX, 0x83, 0x0C); LOOP(5); + board_id = MOP500_BOARD_ID; } else if(read_data==0x03) /* If chip is = 0x3,the platform is HREF, so config Toshiba controller*/ { @@ -216,15 +222,38 @@ static void config_extended_gpio(void) error_status = I2C_WriteMultipleData(I2C0, I2C0_SLAVE_ADDRESS, I2C_BYTE_INDEX, 0xC4, dataArr,2); LOOP(5); + board_id = HREF_BOARD_ID; if(error_status) printf("Error in I2C_WriteMultipleData error = %d",error_status); } else - printf("\nunknown platform: chip ID = %x\n", read_data); + printf("\nunknown platform: chip ID = %x\n", read_data); + + /* Now modify bootargs to save the board_id, required for automatic platform detection */ + char * bootargs = getenv("bootargs"); + if(sizeof(Bootargs_buf) < strlen(bootargs)) { + printf("ERROR: Insufficient temp buffer, bootargs not modified"); + return; + } + strcpy(Bootargs_buf, bootargs); + bootargs = strstr (Bootargs_buf, "board_id="); + if(bootargs){ + /*board_id parameter already present , modify correct value*/ + bootargs[9] = board_id; + } + else { + /*board_id parameter not present , append board_id with proper value*/ + strcat(Bootargs_buf, " board_id=1 "); + /*point to the last character of string*/ + bootargs = Bootargs_buf + strlen(Bootargs_buf) -2; + *bootargs = board_id; + } + /*Now save the new bootargs*/ + setenv("bootargs", Bootargs_buf); + saveenv(); + //printf("Bootargs after platform detection:\n%s\n", getenv("bootargs")); return; - - } @@ -287,9 +316,9 @@ static int init_mmc(void) } gpio_base_address = (void *) IO_ADDRESS(CFG_GPIO_0_BASE); - gpio_base_address -> gpio_dats |= 0x1FFC0000; - gpio_base_address -> gpio_pdis &= ~0x1FFC0000; - + gpio_base_address -> gpio_dats |= 0xFFC0000; + gpio_base_address -> gpio_pdis &= ~0xFFC0000; + if (mmc_hw_init() != 0) { printf("mmc_init: hw init failed\n"); } @@ -306,7 +335,7 @@ static int init_mmc(void) mmc_dev.removable = 0; mmc_dev.block_read = mmc_block_read; #ifdef CONFIG_CMD_FAT - if (fat_register_device(&mmc_dev, 1) != 0) { + if (fat_register_device(&mmc_dev, 1) != 0) { printf("mmc_init: could not register as FAT device\n"); } #endif /* CONFIG_CMD_FAT */ |