summaryrefslogtreecommitdiff
path: root/board/st/u8500/mmc_utils.c
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/st/u8500/mmc_utils.c
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/st/u8500/mmc_utils.c')
-rw-r--r--[-rwxr-xr-x]board/st/u8500/mmc_utils.c66
1 files changed, 66 insertions, 0 deletions
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);