summaryrefslogtreecommitdiff
path: root/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'cleopatre/u-boot-1.1.6/common/cmd_spidboot.c')
-rw-r--r--cleopatre/u-boot-1.1.6/common/cmd_spidboot.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c b/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c
index 20fa9d439c..763104a1df 100644
--- a/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c
+++ b/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c
@@ -87,6 +87,22 @@ static uint32_t autoswitch_en = 0;
defined (CONFIG_REVISION_TAG)
static struct tag *params;
+/*
+ * Get the DSP mode by combining image header information (mode), and NVRAM.
+ * If the value in header is undefined, we will use the NVRAM value. Otherwise
+ * image header value prevails.
+ */
+static spidcom_image_desc_dsp_mode_t compute_dsp_mode (spidcom_image_desc_dsp_mode_t mode,
+ spidcom_nvram_t *nvram)
+{
+ if (mode == SPIDCOM_IMG_DESC_DSP_MODE_2X
+ || (mode != SPIDCOM_IMG_DESC_DSP_MODE_1X
+ && (NVRAM_BFEXT (MSE500_MODE, nvram->pkg_cfg) == NVRAM_MSE500_MODE_500)))
+ return SPIDCOM_IMG_DESC_DSP_MODE_2X;
+
+ return SPIDCOM_IMG_DESC_DSP_MODE_1X;
+}
+
static void setup_start_tag (bd_t *bd)
{
params = (struct tag *) bd->bi_boot_params;
@@ -157,7 +173,15 @@ void setup_spc300_tag (bd_t *bd, spidcom_image_desc_generic_t *hdr,
params->u.spc300.nvram_offset = bd->bi_nvram_addr - PHYS_FLASH_SPI_1;
if (hdr->type == SPIDCOM_IMG_DESC_IMAGE_TYPE_300)
{
- params->u.spc300.plc_mem_size = hdr->img_300.plc_ram;
+ params->u.spc300.plc_mem_size = hdr->img_300.plc_ram;
+ if (compute_dsp_mode (hdr->header->dsp_mode,
+ (spidcom_nvram_t *)(gd->bd->bi_nvram_addr))
+ == SPIDCOM_IMG_DESC_DSP_MODE_2X)
+ {
+ params->u.spc300.dsp_mode = SPC300_ATAG_DSP_MODE_2X;
+ }
+ else
+ params->u.spc300.dsp_mode = SPC300_ATAG_DSP_MODE_1X;
}
params->u.spc300.cur_img_slot = img_slot;
params->u.spc300.autoswitch_en = autoswitch_en;
@@ -285,11 +309,10 @@ static void setup_system_pll (uint32_t speed, uint32_t type)
/*
* This function sets the DSP PLL speed. Value is determined depending on
- * the image type and the mode in NVRAM.
+ * the image type, the DSP mode and the NVRAM.
*/
-static void setup_dsp_pll (uint32_t type)
+static void setup_dsp_pll (uint32_t type, uint32_t mode)
{
- spidcom_nvram_t *nvram = (spidcom_nvram_t *)(gd->bd->bi_nvram_addr);
int adc_div, dsp_div, dac_div, loop_div, icp;
if (type == SPIDCOM_IMG_DESC_IMAGE_TYPE_200)
@@ -314,8 +337,11 @@ static void setup_dsp_pll (uint32_t type)
loop_div = 25;
icp = 2;
- if (NVRAM_BFEXT (MSE500_MODE, nvram->pkg_cfg) == NVRAM_MSE500_MODE_500)
+ if (compute_dsp_mode (mode, (spidcom_nvram_t *)(gd->bd->bi_nvram_addr))
+ == SPIDCOM_IMG_DESC_DSP_MODE_2X)
+ {
*((volatile uint32_t *)(MARIA_REGBANK_BASE + RB_CLK_DIV_DSP_OFFSET)) = CLK_DIV_DSP_1;
+ }
}
*((volatile uint32_t *)RB_DPLL_BYPASS) = PLL_CMD_BYPASS;
@@ -879,7 +905,7 @@ int do_spidboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#if defined (CONFIG_CHIP_MSE500)
/* Before booting Linux, we need to set System and DSP PLL. */
setup_system_pll (hdr->header->sysclk_speed, hdr->header->image_type);
- setup_dsp_pll (hdr->header->image_type);
+ setup_dsp_pll (hdr->header->image_type, hdr->header->dsp_mode);
if (hdr->header->image_type == SPIDCOM_IMG_DESC_IMAGE_TYPE_300)
fixup_iomux ();
#endif