summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerry Lv <r65388@freescale.com>2009-07-14 15:59:12 +0800
committerFred Fan <r01011@freescale.com>2009-09-10 17:03:32 +0800
commit98ab00fc5434683e5e281156e24d6a52fa17a417 (patch)
tree664f1d6ca684c68da4258907f98b1dec8769479e
parentafbf753cb44a5b7dfb8bcff430b48a4999214f02 (diff)
downloadu-boot-imx-98ab00fc5434683e5e281156e24d6a52fa17a417.zip
u-boot-imx-98ab00fc5434683e5e281156e24d6a52fa17a417.tar.gz
u-boot-imx-98ab00fc5434683e5e281156e24d6a52fa17a417.tar.bz2
ENGR00114201: Add MMC configs to mx35 3stack config file.
Add MMC configs to mx35 3stack config file. Signed-off-by: Terry Lv <r65388@freescale.com>
-rw-r--r--board/freescale/mx35_3stack/flash_header.S6
-rw-r--r--common/env_mmc.c2
-rw-r--r--drivers/mmc/fsl_esdhc.c123
-rw-r--r--include/configs/mx35_3stack.h36
4 files changed, 81 insertions, 86 deletions
diff --git a/board/freescale/mx35_3stack/flash_header.S b/board/freescale/mx35_3stack/flash_header.S
index 6786e8d..b662669 100644
--- a/board/freescale/mx35_3stack/flash_header.S
+++ b/board/freescale/mx35_3stack/flash_header.S
@@ -22,7 +22,7 @@
#include "board-mx35_3stack.h"
#ifdef CONFIG_FLASH_HEADER
-#ifndef FHEADER_OFFSET
+#ifndef CONFIG_FLASH_HEADER_OFFSET
# error "Must define the offset of flash header"
#endif
@@ -37,9 +37,9 @@ dcd_##i: ;\
.section ".text.flasheader", "x"
b _start
- .org FHEADER_OFFSET
+ .org CONFIG_FLASH_HEADER_OFFSET
app_code_jump_v: .long GEN_FHEADERADDR(_start)
-app_code_barker: .long 0xB1
+app_code_barker: .long CONFIG_FLASH_HEADER_BARKER
app_code_csf: .long 0
hwcfg_ptr_ptr: .long GEN_FHEADERADDR(hwcfg_ptr)
super_root_key: .long 0
diff --git a/common/env_mmc.c b/common/env_mmc.c
index 413a5c7..74e6c60 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -295,7 +295,7 @@ void env_relocate_spec(void)
}
total = CONFIG_ENV_SIZE;
- ret = mmc_read(CONFIG_ENV_OFFSET, (u_char *)env_ptr, &total);
+ ret = mmc_read(CONFIG_ENV_OFFSET, (u_char *)env_ptr, total);
if (ret || total != CONFIG_ENV_SIZE)
return use_default();
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 9fcce5b..fab39eb 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -210,31 +210,15 @@ u32 interface_reset(void)
/* Wait for clearance of CIHB and CDIHB Bits */
for (u32Retries = RETRIES_TIMES; u32Retries > 0; --u32Retries) {
- if (!is_soc_rev(CHIP_REV_1_0)) {
- if (readl(esdhc_base_pointer + SDHCI_PRESENT_STATE) \
- & ESDHC_CMD_INHIBIT) {
- reset_status = 1;
- } else {
- reset_status = 0;
- break;
- }
- } else if (!is_soc_rev(CHIP_REV_2_0)) {
- if (readl(esdhc_base_pointer + SDHCI_SYSTEM_CONTROL) \
- & ESDHC_SOFTWARE_RESET) {
- reset_status = 1;
- } else {
- reset_status = 0;
- break;
- }
+ if (readl(esdhc_base_pointer + SDHCI_SYSTEM_CONTROL) \
+ & ESDHC_SOFTWARE_RESET) {
+ reset_status = 1;
+ } else {
+ reset_status = 0;
+ break;
}
}
- if (!is_soc_rev(CHIP_REV_1_0)) {
- /* send 80 clock ticks for card to power up */
- REG_WRITE_OR(ESDHC_SYSCTL_INITA, \
- esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
- }
-
/* Set data bus width of ESDCH */
esdhc_set_data_transfer_width(0x00000000);
/* Set Endianness of ESDHC */
@@ -265,32 +249,19 @@ void interface_configure_clock(sdhc_freq_t frequency)
u32 ident_freq = 0;
u32 oper_freq = 0;
- if (!is_soc_rev(CHIP_REV_1_0)) {
- /* Enable ipg_perclk, HCLK enable and IPG Clock enable. */
- REG_WRITE_OR(ESDHC_CLOCK_ENABLE, \
- esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
- /* Clear DTOCV SDCLKFS bits */
- REG_WRITE_OR(ESDHC_FREQ_MASK, \
- esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
- ident_freq = ESDHC_SYSCTL_IDENT_FREQ_TO1;
- oper_freq = ESDHC_SYSCTL_OPERT_FREQ_TO1;
- } else if (!is_soc_rev(CHIP_REV_2_0)) {
- /* Clear SDCLKEN bit */
- REG_WRITE_OR((~ESDHC_SYSCTL_SDCLKEN_MASK), \
- esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
+ /* Clear SDCLKEN bit */
+ REG_WRITE_OR((~ESDHC_SYSCTL_SDCLKEN_MASK), \
+ esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
- /* Clear DTOCV, SDCLKFS, DVFS bits */
- REG_WRITE_OR((~ESDHC_SYSCTL_FREQ_MASK), \
- esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
- ident_freq = ESDHC_SYSCTL_IDENT_FREQ_TO2;
- oper_freq = ESDHC_SYSCTL_OPERT_FREQ_TO2;
- }
+ /* Clear DTOCV, SDCLKFS, DVFS bits */
+ REG_WRITE_OR((~ESDHC_SYSCTL_FREQ_MASK), \
+ esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
+ ident_freq = ESDHC_SYSCTL_IDENT_FREQ_TO2;
+ oper_freq = ESDHC_SYSCTL_OPERT_FREQ_TO2;
- if (!is_soc_rev(CHIP_REV_2_0)) {
- /* Disable the PEREN, HCKEN and IPGEN */
- REG_WRITE_OR((~ESDHC_SYSCTL_INPUT_CLOCK_MASK), \
+ /* Disable the PEREN, HCKEN and IPGEN */
+ REG_WRITE_OR((~ESDHC_SYSCTL_INPUT_CLOCK_MASK), \
esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
- }
if (frequency == IDENTIFICATION_FREQ) {
/* Input frequecy to eSDHC is 36 MHZ */
@@ -306,28 +277,26 @@ void interface_configure_clock(sdhc_freq_t frequency)
esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
}
- if (!is_soc_rev(CHIP_REV_2_0)) {
- /* Start a general purpose timer */
- /* Wait for clock to be stable */
- SDHC_DELAY_BY_100(96);
+ /* Start a general purpose timer */
+ /* Wait for clock to be stable */
+ SDHC_DELAY_BY_100(96);
- /* Set SDCLKEN bit to enable clock */
- REG_WRITE_OR(ESDHC_SYSCTL_SDCLKEN_MASK, \
- esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
+ /* Set SDCLKEN bit to enable clock */
+ REG_WRITE_OR(ESDHC_SYSCTL_SDCLKEN_MASK, \
+ esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
- /* Mask Data Timeout Error Status Enable Interrupt (DTOESEN) */
- REG_WRITE_AND((~ESDHC_IRQSTATEN_DTOESEN), \
+ /* Mask Data Timeout Error Status Enable Interrupt (DTOESEN) */
+ REG_WRITE_AND((~ESDHC_IRQSTATEN_DTOESEN), \
esdhc_base_pointer + SDHCI_INT_ENABLE);
- /* Set the Data Timeout Counter Value(DTOCV) */
- REG_WRITE_OR(ESDHC_SYSCTL_DTOCV_VAL, \
- esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
+ /* Set the Data Timeout Counter Value(DTOCV) */
+ REG_WRITE_OR(ESDHC_SYSCTL_DTOCV_VAL, \
+ esdhc_base_pointer + SDHCI_SYSTEM_CONTROL);
- /* Enable Data Timeout Error Status
- Enable Interrupt (DTOESEN) */
- REG_WRITE_OR(ESDHC_IRQSTATEN_DTOESEN, \
+ /* Enable Data Timeout Error Status
+ Enable Interrupt (DTOESEN) */
+ REG_WRITE_OR(ESDHC_IRQSTATEN_DTOESEN, \
esdhc_base_pointer + SDHCI_INT_ENABLE);
- }
}
/*
@@ -409,8 +378,7 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
static void esdhc_set_data_transfer_width(u32 data_transfer_width)
{
/* Set DWT bit of protocol control register according to bus_width */
- if (!is_soc_rev(CHIP_REV_2_0))
- REG_WRITE_AND((~ESDHC_BUS_WIDTH_MASK), \
+ REG_WRITE_AND((~ESDHC_BUS_WIDTH_MASK), \
esdhc_base_pointer + SDHCI_HOST_CONTROL);
REG_WRITE_OR((data_transfer_width), \
@@ -422,10 +390,8 @@ static void esdhc_set_data_transfer_width(u32 data_transfer_width)
*/
static void esdhc_set_endianness(u32 endian_mode)
{
- if (!is_soc_rev(CHIP_REV_2_0)) {
- REG_WRITE_AND((~ESDHC_ENDIAN_MODE_MASK), \
- esdhc_base_pointer + SDHCI_HOST_CONTROL);
- }
+ REG_WRITE_AND((~ESDHC_ENDIAN_MODE_MASK), \
+ esdhc_base_pointer + SDHCI_HOST_CONTROL);
/* Set DWT bit of protocol control register according to bus_width */
REG_WRITE_OR((endian_mode), \
esdhc_base_pointer + SDHCI_HOST_CONTROL);
@@ -506,12 +472,11 @@ u32 interface_send_cmd_wait_resp(esdhc_cmd_t *cmd)
/* Enable Interrupt */
REG_WRITE_OR(ESDHC_INTERRUPT_ENABLE, \
esdhc_base_pointer + SDHCI_INT_ENABLE);
- if (!is_soc_rev(CHIP_REV_2_0)) {
- cmd_status = interface_wait_cmd_data_lines(cmd->data_present);
- if (cmd_status == 1)
- return 1;
- }
+ cmd_status = interface_wait_cmd_data_lines(cmd->data_present);
+
+ if (cmd_status == 1)
+ return 1;
/* Configure Command */
esdhc_cmd_config(cmd);
@@ -647,10 +612,8 @@ u32 interface_data_read(u32 *dest_ptr, u32 blk_len)
*tmp_ptr++ = \
readl(esdhc_base_pointer + SDHCI_BUFFER);
}
- if (!is_soc_rev(CHIP_REV_2_0)) {
- /* Clear the BRR */
- esdhc_clear_buf_rdy_intr(ESDHC_STATUS_BUF_READ_RDY_MSK);
- }
+ /* Clear the BRR */
+ esdhc_clear_buf_rdy_intr(ESDHC_STATUS_BUF_READ_RDY_MSK);
} else {
debug("esdhc_wait_buf_rdy_intr failed\n");
break;
@@ -661,7 +624,7 @@ u32 interface_data_read(u32 *dest_ptr, u32 blk_len)
status = esdhc_check_data();
- if (!is_soc_rev(CHIP_REV_2_0) && !status)
+ if (!status)
status = 0;
debug("esdhc_check_data: %d\n", status);
@@ -770,10 +733,8 @@ static u32 esdhc_check_data(void)
ESDHC_STATUS_TIME_OUT_READ_MASK) &&
!(readl(esdhc_base_pointer + SDHCI_INT_STATUS) & \
ESDHC_STATUS_READ_CRC_ERR_MSK)) {
- if (!is_soc_rev(CHIP_REV_2_0)) {
- writel(ESDHC_STATUS_TRANSFER_COMPLETE_MSK, \
- (esdhc_base_pointer + SDHCI_INT_STATUS));
- }
+ writel(ESDHC_STATUS_TRANSFER_COMPLETE_MSK, \
+ (esdhc_base_pointer + SDHCI_INT_STATUS));
status = 0;
} else {
status = 1;
diff --git a/include/configs/mx35_3stack.h b/include/configs/mx35_3stack.h
index 49c0b84..a49939a 100644
--- a/include/configs/mx35_3stack.h
+++ b/include/configs/mx35_3stack.h
@@ -36,6 +36,10 @@
#define CONFIG_DISPLAY_CPUINFO
#define CONFIG_DISPLAY_BOARDINFO
+#define CONFIG_FLASH_HEADER 1
+#define CONFIG_FLASH_HEADER_OFFSET 0x400
+#define CONFIG_FLASH_HEADER_BARKER 0xB1
+
#define BOARD_LATE_INIT
/*
* Disabled for now due to build problems under Debian and a significant increase
@@ -178,6 +182,19 @@
#define PHYS_SDRAM_1 CSD0_BASE_ADDR
#define PHYS_SDRAM_1_SIZE (128 * 1024 * 1024)
+/*
+ * MMC Configs
+ * */
+/*
+#define CONFIG_FSL_MMC 1
+
+#define CONFIG_MMC 1
+#define CONFIG_CMD_MMC
+#define CONFIG_DOS_PARTITION 1
+#define CONFIG_CMD_FAT 1
+#define CONFIG_MMC_BASE 0x0
+*/
+
/*-----------------------------------------------------------------------
* FLASH and environment organization
*/
@@ -188,7 +205,6 @@
#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE
#define CONFIG_SYS_MONITOR_LEN (512 * 1024) /* Reserve 256KiB */
-#define CONFIG_ENV_IS_IN_FLASH 1
#define CONFIG_ENV_SECT_SIZE (128 * 1024)
#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE
@@ -204,6 +220,24 @@
*/
#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_ENV_SECT_SIZE)
+#if defined(CONFIG_FSL_MMC)
+ #define CONFIG_FSL_ENV_IN_MMC
+#elif defined(CONFIG_CMD_NAND)
+ #define CONFIG_FSL_ENV_IN_NAND
+#else
+ #define CONFIG_ENV_IS_IN_FLASH 1
+#endif
+
+#if defined(CONFIG_FSL_ENV_IN_NAND)
+ #define CONFIG_ENV_IS_IN_NAND 1
+ #define CONFIG_ENV_OFFSET 0x100000
+#elif defined(CONFIG_FSL_ENV_IN_MMC)
+ #define CONFIG_ENV_IS_IN_MMC 1
+ #define CONFIG_ENV_OFFSET (1024 * 1024)
+#elif defined(CONFIG_FSL_ENV_IS_IN_FLASH)
+ #define CONFIG_ENV_IS_IN_FLASH 1
+#endif
+
/*-----------------------------------------------------------------------
* CFI FLASH driver setup
*/