summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorMichael Brandt <Michael.Brandt@stericsson.com>2010-01-07 16:08:03 +0100
committerMichael Brandt <Michael.Brandt@stericsson.com>2010-01-07 16:08:03 +0100
commitd157ec3412960375dee37e7845bb5e6315397d6a (patch)
treef557b605f8d9eaeac8b89ea5eb29308d6271c8aa /board
parent55e1520985c4d0f3fdce2f27873b4231790b8c3d (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')
-rw-r--r--[-rwxr-xr-x]board/st/u8500/config.mk2
-rw-r--r--[-rwxr-xr-x]board/st/u8500/emmc.c4
-rw-r--r--[-rwxr-xr-x]board/st/u8500/init_mmc.c47
-rw-r--r--[-rwxr-xr-x]board/st/u8500/mmc.c44
-rw-r--r--[-rwxr-xr-x]board/st/u8500/mmc_utils.c66
-rw-r--r--[-rwxr-xr-x]board/st/u8500/u8500.c5
6 files changed, 139 insertions, 29 deletions
diff --git a/board/st/u8500/config.mk b/board/st/u8500/config.mk
index a7b5c846c..62c222dfa 100755..100644
--- a/board/st/u8500/config.mk
+++ b/board/st/u8500/config.mk
@@ -12,7 +12,7 @@
sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
ifndef TEXT_BASE
-TEXT_BASE = 0x07F80000
+TEXT_BASE = 0x05FC0000
endif
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
diff --git a/board/st/u8500/emmc.c b/board/st/u8500/emmc.c
index 214b2b14b..1d214c026 100755..100644
--- a/board/st/u8500/emmc.c
+++ b/board/st/u8500/emmc.c
@@ -185,8 +185,8 @@ int emmc_write_pib(void)
emmc_last_sector[0x1F8] = 0x35;
emmc_last_sector[0x1F9] = 0x00;
emmc_last_sector[0x1FA] = 0x00;
- emmc_last_sector[0x1FB] = 0x00;
- emmc_last_sector[0x1FC] = 0xC0;
+ emmc_last_sector[0x1FB] = 0xA0;
+ emmc_last_sector[0x1FC] = 0xB9;
emmc_last_sector[0x1FD] = 0x00;
emmc_last_sector[0x1FE] = 0x55;
emmc_last_sector[0x1FF] = 0xAA;
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 */
diff --git a/board/st/u8500/mmc.c b/board/st/u8500/mmc.c
index e80f8315f..98b353a3a 100755..100644
--- a/board/st/u8500/mmc.c
+++ b/board/st/u8500/mmc.c
@@ -820,25 +820,39 @@ t_mmc_error mmc_initializeCards(u8 card_num)
//rca++;
error = MMC_OK; //All cards get intialized
- card_initialized = TRUE;
- /*
- t_mmc[card_num]->mmc_Argument = (u32) 0x03B70100;
- t_mmc[card_num]->mmc_Command =
- APP_SD_SET_BUSWIDTH | RespExpected | LongResponse | CmdPathEnable;
+ card_initialized = TRUE;
+
+ if (card_num != selected_card)
+ {
+ t_mmc[card_num]->mmc_Argument = card_array[card_num].RCA;
+ t_mmc[card_num]->mmc_Command = SEL_DESEL_CARD
+ | RespExpected | CmdPathEnable;
+ error = mmc_cmdresp145error(SEL_DESEL_CARD, card_num);
+
+ if (error != MMC_OK)
+ {
+ printf("SEL_DESEL_CARD ::error=0x%x \n", error);
+ return error;
+ }
+ else
+ selected_card = card_num;
+ }
+
+ t_mmc[card_num]->mmc_Argument = (u32) (0x03B70201);
+ t_mmc[card_num]->mmc_Command =
+ APP_SD_SET_BUSWIDTH | RespExpected | CmdPathEnable;
error = mmc_cmdresp2error(card_num);
- if (error != MMC_OK)
- {
- printf("emmc card init response for CMD6 error \n");
- return error;
- }
- */
+ if (error != MMC_OK)
+ {
+ printf("emmc card init response for CMD6 error \n");
+ return error;
+ }
}
- t_mmc[card_num]->mmc_Power = 0x3; /* PUSHPULL mode after intialization */
- t_mmc[card_num]->mmc_Clock = 0x4100; //(t_mmc0->mmc_Clock & 0xFFFFFF00) | 0x00000002;
-
- return error;
+ t_mmc[card_num]->mmc_Power = 0x3;
+ t_mmc[card_num]->mmc_Clock = 0x7500;
+ return error;
}
/****************************************************************************/
diff --git a/board/st/u8500/mmc_utils.c b/board/st/u8500/mmc_utils.c
index 3c31d9333..a9119f883 100755..100644
--- a/board/st/u8500/mmc_utils.c
+++ b/board/st/u8500/mmc_utils.c
@@ -430,6 +430,62 @@ end:
return error;
}
+t_mmc_error mmc_select_n_switch ()
+{
+ t_mmc_error error = MMC_OK;
+ t_mmc_command_control commcontrol;
+ t_mmc_clock_control clockcontrol;
+ u32 response;
+ u8 cardno = 1;
+
+ commcontrol.IsRespExpected = TRUE;
+ commcontrol.IsLongResp = FALSE;
+ commcontrol.IsInterruptMode = FALSE;
+ commcontrol.IsPending = FALSE;
+ commcontrol.cmdpath = MMC_ENABLE;
+
+ // send command for selecting the card
+ if (cardno != selected_card)
+ {
+ error = mmc_sendcommand (MMC_SEL_DESEL_CARD, t_mmc_rel_addr, commcontrol);
+ error = mmc_cmdresp145error_2 (MMC_SEL_DESEL_CARD);
+ if (error != MMC_OK)
+ {
+ goto end;
+ }
+ else
+ {
+ selected_card = cardno;
+ }
+ }
+ error = mmc_getresponse (MMC_SHORT_RESP, &response);
+ if (response & 0x02000000)
+ {
+ error = MMC_LOCK_UNLOCK_FAILED;
+ goto end;
+ }
+ /*
+ error = mmc_sendcommand (MMC_APP_CMD, 0x00000000, commcontrol);
+ error = mmc_cmdresp145error_2(MMC_APP_CMD);
+ error = mmc_sendcommand (6, 0x2, commcontrol);
+ error = mmc_cmdresp145error_2(6);
+ if (error != MMC_OK)
+ {
+ goto end;
+ }
+ clockcontrol.pwrsave= MMC_DISABLE;
+ clockcontrol.bypass = MMC_DISABLE;
+ clockcontrol.widebus= MMC_ENABLE;
+ error = mmc_configclockcontrol (clockcontrol);
+ if (error != MMC_OK)
+ {
+ goto end;
+ }
+ */
+end:
+ return error;
+}
+
t_mmc_error mmc_readcid (u32 * CID)
{
t_mmc_error error = MMC_OK;
@@ -522,6 +578,16 @@ t_mmc_error mmc_read_file (char *filename, u32 address, u32 * FileSize)
result = FAIL;
goto end;
}
+
+ // Select card and switch to 4-Bit, TODO HS if possible
+ response = mmc_select_n_switch ();
+
+ if (response != MMC_OK)
+ {
+ printf ("Error while select or switching to 4-bit/HS\n");
+ goto end;
+ }
+
// Read the MBR
response = mmc_readblock (1, 0, (u32 *) sector, 512, MMCPOLLING);
diff --git a/board/st/u8500/u8500.c b/board/st/u8500/u8500.c
index 3c627c7b0..5be3f5149 100755..100644
--- a/board/st/u8500/u8500.c
+++ b/board/st/u8500/u8500.c
@@ -186,12 +186,12 @@ int dram_init(void)
unsigned int addr_vall_arr[] = {
0x8011F000, 0x0000FFFF, // Clocks for HSI TODO Enable reqd only
-0x8011F008, 0x00001C44, // Clocks for HSI TODO Enable reqd only
+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, 0x00000130, // I2C 48MHz clock
+0x80157020, 0x00000150, // I2C 48MHz clock
0x8012F000, 0x00007FFF, // Clocks for SD TODO Enable reqd only
0x8012F008, 0x00007FFF, // Clocks for SD TODO Enable reqd only
0xA03DF000, 0x0000000D, // Clock for MTU Timers
@@ -199,6 +199,7 @@ unsigned int addr_vall_arr[] = {
0x8011E004, 0x0000FFE0, // GPIO ALT FUNC for EMMC
0x8011E020, 0x0000FFE0, // GPIO ALT FUNC for EMMC
0x8011E024, 0x00000000, // GPIO ALT FUNC for EMMC
+0x8012E000, 0x20000000, // GPIO ALT FUNC for UART
0x8012E00C, 0x00000000, // GPIO ALT FUNC for SD
0x8012E004, 0x0FFC0000, // GPIO ALT FUNC for SD
0x8012E020, 0x60000000, // GPIO ALT FUNC for SD