summaryrefslogtreecommitdiff
path: root/board/omap2420h4/sys_info.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@pollux.(none)>2005-09-25 18:41:04 +0200
committerWolfgang Denk <wd@pollux.(none)>2005-09-25 18:41:04 +0200
commit49a7581c6ced35379ec3c450bb60fe736db9d733 (patch)
tree7f3d964bd45d09f62122231ac7e26c61b120349f /board/omap2420h4/sys_info.c
parent8e2be51de8dd03c1ce4d06cbb18ad06133d47cd5 (diff)
downloadu-boot-imx-49a7581c6ced35379ec3c450bb60fe736db9d733.zip
u-boot-imx-49a7581c6ced35379ec3c450bb60fe736db9d733.tar.gz
u-boot-imx-49a7581c6ced35379ec3c450bb60fe736db9d733.tar.bz2
OMAP242x H4 board update
- fix for ES2 differences. - switch to using the cfi_flash driver. - fix SRAM build address. - fix for GP device operation. - unlock SRAM for GP devices. - display more device information. - fix potential deadlock in omap24xx_i2c driver. - fix DLL load values to match dpllout*1 operation. - fix 2nd chip select init for combo DDR device. - add support for CFI Intel 28F256L18 on H4 board. Patch by Richard Woodruff, 03 Mar 2005
Diffstat (limited to 'board/omap2420h4/sys_info.c')
-rw-r--r--board/omap2420h4/sys_info.c116
1 files changed, 101 insertions, 15 deletions
diff --git a/board/omap2420h4/sys_info.c b/board/omap2420h4/sys_info.c
index 121d679..9864d3e 100644
--- a/board/omap2420h4/sys_info.c
+++ b/board/omap2420h4/sys_info.c
@@ -29,6 +29,16 @@
#include <i2c.h>
/**************************************************************************
+ * get_prod_id() - get id info from chips
+ ***************************************************************************/
+static u32 get_prod_id(void)
+{
+ u32 p;
+ p = __raw_readl(PRODUCTION_ID); /* get production ID */
+ return((p & CPU_242X_PID_MASK) >> 16);
+}
+
+/**************************************************************************
* get_cpu_type() - low level get cpu type
* - no C globals yet.
* - just looking to say if this is a 2422 or 2420 or ...
@@ -40,6 +50,14 @@ u32 get_cpu_type(void)
{
u32 v;
+ switch(get_prod_id()){
+ case 1:;/* 2420 */
+ case 2: return(CPU_2420); break; /* 2420 pop */
+ case 4: return(CPU_2422); break;
+ case 8: return(CPU_2423); break;
+ default: break; /* early 2420/2422's unmarked */
+ }
+
v = __raw_readl(TAP_IDCODE_REG);
v &= CPU_24XX_ID_MASK;
if (v == CPU_2420_CHIPID) { /* currently 2420 and 2422 have same id */
@@ -61,6 +79,16 @@ u32 get_cpu_rev(void)
v = v >> 28;
return(v+1); /* currently 2422 and 2420 match up */
}
+/****************************************************
+ * is_mem_sdr() - return 1 if mem type in use is SDR
+ ****************************************************/
+u32 is_mem_sdr(void)
+{
+ volatile u32 *burst = (volatile u32 *)(SDRC_MR_0+SDRC_CS0_OSET);
+ if(*burst == H4_2420_SDRC_MR_0_SDR)
+ return(1);
+ return(0);
+}
/***********************************************************
* get_mem_type() - identify type of mDDR part used.
@@ -70,24 +98,40 @@ u32 get_cpu_rev(void)
*************************************************************/
u32 get_mem_type(void)
{
- volatile u32 *burst = (volatile u32 *)(SDRC_MR_0+SDRC_CS0_OSET);
+ u32 cpu, sdr = is_mem_sdr();
- if (get_cpu_type() == CPU_2422)
+ cpu = get_cpu_type();
+ if (cpu == CPU_2422 || cpu == CPU_2423)
return(DDR_STACKED);
+ if(get_prod_id() == 0x2)
+ return(XDR_POP);
+
if (get_board_type() == BOARD_H4_MENELAUS)
- if(*burst == H4_2420_SDRC_MR_0_SDR)
+ if(sdr)
return(SDR_DISCRETE);
else
return(DDR_COMBO);
else
- if(*burst == H4_2420_SDRC_MR_0_SDR) /* SDP + SDR kit */
+ if(sdr) /* SDP + SDR kit */
return(SDR_DISCRETE);
else
return(DDR_DISCRETE); /* origional SDP */
}
/***********************************************************************
+ * get_cs0_size() - get size of chip select 0/1
+ ************************************************************************/
+u32 get_sdr_cs_size(u32 offset)
+{
+ u32 size;
+ size = __raw_readl(SDRC_MCFG_0+offset) >> 8; /* get ram size field */
+ size &= 0x2FF; /* remove unwanted bits */
+ size *= SZ_2M; /* find size in MB */
+ return(size);
+}
+
+/***********************************************************************
* get_board_type() - get board type based on current production stats.
* --- NOTE: 2 I2C EEPROMs will someday be populated with proper info.
* when they are available we can get info from there. This should
@@ -104,7 +148,7 @@ u32 get_board_type(void)
/******************************************************************
* get_sysboot_value() - get init word settings (dip switch on h4)
******************************************************************/
-u32 get_sysboot_value(void)
+inline u32 get_sysboot_value(void)
{
return(0x00000FFF & __raw_readl(CONTROL_STATUS));
}
@@ -193,22 +237,53 @@ u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
*********************************************************************/
void display_board_info(u32 btype)
{
- char cpu_2420[] = "2420";
+ char cpu_2420[] = "2420"; /* cpu type */
char cpu_2422[] = "2422";
- char db_men[] = "Menelaus";
- char db_ip[]= "IP";
- char *cpu_s, *db_s;
- u32 cpu = get_cpu_type();
+ char cpu_2423[] = "2423";
+ char db_men[] = "Menelaus"; /* board type */
+ char db_ip[] = "IP";
+ char mem_sdr[] = "mSDR"; /* memory type */
+ char mem_ddr[] = "mDDR";
+ char t_tst[] = "TST"; /* security level */
+ char t_emu[] = "EMU";
+ char t_hs[] = "HS";
+ char t_gp[] = "GP";
+ char unk[] = "?";
- if(cpu == CPU_2420)
- cpu_s = cpu_2420;
+ char *cpu_s, *db_s, *mem_s, *sec_s;
+ u32 cpu, rev, sec;
+
+ rev = get_cpu_rev();
+ cpu = get_cpu_type();
+ sec = get_device_type();
+
+ if(is_mem_sdr())
+ mem_s = mem_sdr;
else
+ mem_s = mem_ddr;
+
+ if(cpu == CPU_2423)
+ cpu_s = cpu_2423;
+ else if (cpu == CPU_2422)
cpu_s = cpu_2422;
+ else
+ cpu_s = cpu_2420;
+
if(btype == BOARD_H4_MENELAUS)
db_s = db_men;
else
db_s = db_ip;
- printf("TI H4 SDP Base Board with OMAP%s %s Daughter Board\n",cpu_s, db_s);
+
+ switch(sec){
+ case TST_DEVICE: sec_s = t_tst; break;
+ case EMU_DEVICE: sec_s = t_emu; break;
+ case HS_DEVICE: sec_s = t_hs; break;
+ case GP_DEVICE: sec_s = t_gp; break;
+ default: sec_s = unk;
+ }
+
+ printf("OMAP%s-%s revision %d\n", cpu_s, sec_s, rev-1);
+ printf("TI H4 SDP Base Board + %s Daughter Board + %s \n", db_s, mem_s);
}
/*************************************************************************
@@ -230,7 +305,7 @@ u32 get_board_rev(void)
/********************************************************
* get_base(); get upper addr of current execution
*******************************************************/
-static u32 get_base(void)
+u32 get_base(void)
{
u32 val;
__asm__ __volatile__("mov %0, pc \n" : "=r" (val) : : "memory");
@@ -242,7 +317,7 @@ static u32 get_base(void)
/********************************************************
* get_base2(); get 2upper addr of current execution
*******************************************************/
-static u32 get_base2(void)
+u32 get_base2(void)
{
u32 val;
__asm__ __volatile__("mov %0, pc \n" : "=r" (val) : : "memory");
@@ -300,3 +375,14 @@ u32 running_from_internal_boot(void)
else
return(0);
}
+
+/*************************************************************
+ * get_device_type(): tell if GP/HS/EMU/TST
+ *************************************************************/
+u32 get_device_type(void)
+{
+ int mode;
+ mode = __raw_readl(CONTROL_STATUS) & (BIT10|BIT9|BIT8);
+ return(mode >>= 8);
+}
+