summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dufour2013-02-01 10:54:36 +0100
committerCyril Jourdan2013-02-11 13:42:52 +0100
commit2a5312e706bb786ef5e2649adda29530cb63adcc (patch)
tree23f94389a90e825c3e50f8cebad367635b25bb40
parent17b2b02b7783ef077671a99d33369d1b237db3cb (diff)
{common/inc, cleo/uboot}: put the 2X mode in img header and atag, refs #3734
2X mode is now stored in image header, but not set by default. If set, its value will prevail on the NVRAM field. The value of the DSP mode is set in ATAG regardless it comes from img header or NVRAM, so linux will not have to read NVRAM anymore.
-rw-r--r--cleopatre/u-boot-1.1.6/common/cmd_spidboot.c38
-rw-r--r--common/include/asm/arch/spc300-atag.h14
-rw-r--r--common/include/spid_img_desc.h17
3 files changed, 62 insertions, 7 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
diff --git a/common/include/asm/arch/spc300-atag.h b/common/include/asm/arch/spc300-atag.h
index 941a984dec..fe062a513c 100644
--- a/common/include/asm/arch/spc300-atag.h
+++ b/common/include/asm/arch/spc300-atag.h
@@ -27,6 +27,20 @@ struct tag_spc300 {
u32 plc_mem_size;
u32 cur_img_slot;
u32 autoswitch_en;
+ u32 dsp_mode;
};
+/**
+ * List of supported DSP modes.
+ * This enum is converted by u-boot from spidimg_desc values, see
+ * spid_img_desc.h.
+ * Beware that values can differ between the two files.
+ */
+typedef enum {
+ SPC300_ATAG_DSP_MODE_INVALID,
+ SPC300_ATAG_DSP_MODE_1X,
+ SPC300_ATAG_DSP_MODE_2X,
+ SPC300_ATAG_DSP_MODE_NB
+} spc300_atag_dsp_mode_t;
+
#endif /* __ASM_ARCH_SPC300_ATAG_H */
diff --git a/common/include/spid_img_desc.h b/common/include/spid_img_desc.h
index c83dec6c21..90f5924be7 100644
--- a/common/include/spid_img_desc.h
+++ b/common/include/spid_img_desc.h
@@ -65,6 +65,19 @@ typedef enum {
} spidcom_image_desc_image_type_t;
/**
+ * List of supported DSP modes.
+ * This enum is converted by u-boot in spc300_atag values, see
+ * asm/arch/spc300-atag.h.
+ * Beware that values can differ between the two files.
+ */
+typedef enum {
+ SPIDCOM_IMG_DESC_DSP_MODE_NONE,
+ SPIDCOM_IMG_DESC_DSP_MODE_1X,
+ SPIDCOM_IMG_DESC_DSP_MODE_2X,
+ SPIDCOM_IMG_DESC_DSP_MODE_NB
+} spidcom_image_desc_dsp_mode_t;
+
+/**
* Version of the common header for image descriptor.
*/
#define SPIDCOM_IMG_DESC_COMMON_HEADER_VERSION 1
@@ -87,12 +100,14 @@ typedef struct {
uint32_t image_type;
/** Speed of System Clock in MHz */
uint32_t sysclk_speed;
+ /** DSP PLL mode */
+ uint32_t dsp_mode;
} spidcom_image_desc_header_t;
/**
* Reserved size at the end of all descriptors (in bytes).
*/
-#define SPIDCOM_IMG_DESC_COMMON_RESERVER_SIZE 832
+#define SPIDCOM_IMG_DESC_COMMON_RESERVER_SIZE 828
/**
* Image descriptor for SPC300 (and MSE500-300).