OMAP3: Add support for OMAP3 die ID
authorDirk Behme <dirk.behme@googlemail.com>
Thu, 12 Mar 2009 18:30:50 +0000 (19:30 +0100)
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Fri, 13 Mar 2009 22:17:43 +0000 (23:17 +0100)
Read and store OMAP3 die ID in U-Boot environment.

Signed-off-by: Dirk Behme <dirk.behme@googlemail.com>
board/omap3/beagle/beagle.c
board/omap3/evm/evm.c
board/omap3/overo/overo.c
board/omap3/pandora/pandora.c
board/omap3/zoom1/zoom1.c
cpu/arm_cortexa8/omap3/sys_info.c
include/asm-arm/arch-omap3/cpu.h
include/asm-arm/arch-omap3/omap3.h
include/asm-arm/arch-omap3/sys_proto.h

index 7377058f794178a991f4700ed5bea8b378f019ee..8d6065196fab74f9de3e4dd6c79989abdc485fff 100644 (file)
@@ -116,6 +116,8 @@ int misc_init_r(void)
 
        beagle_identify();
 
+       dieid_num_r();
+
        return 0;
 }
 
index b406312e09b37a9b267e2a8fb63e8c16e7932e4a..3a27c8fe5dcdfcf465e1dca31310adc3430a77b4 100644 (file)
@@ -68,6 +68,8 @@ int misc_init_r(void)
        setup_net_chip();
 #endif
 
+       dieid_num_r();
+
        return 0;
 }
 
index 48375ad01e55d48863f63fa5dea946ee894a4503..37bf350e4e37588547cc72d4e7ae355b1536c433 100644 (file)
@@ -60,6 +60,8 @@ int misc_init_r(void)
 {
        power_init_r();
 
+       dieid_num_r();
+
        return 0;
 }
 
index 3f9de991cb3abd0dfccd6c0ffb6d44e195130863..dfd51ecfcba53b7d30ccbf45a2aa191732ea7794 100644 (file)
@@ -77,6 +77,8 @@ int misc_init_r(void)
        writel(GPIO28, &gpio5_base->setdataout);
        writel(GPIO4, &gpio6_base->setdataout);
 
+       dieid_num_r();
+
        return 0;
 }
 
index d67abf755f9d306ebcf9b37b45ad130f81435fb6..702f7327538a77e75f877b2cc9a8fdfc6296983d 100644 (file)
@@ -61,6 +61,7 @@ int board_init(void)
 int misc_init_r(void)
 {
        power_init_r();
+       dieid_num_r();
        return 0;
 }
 
index 28a102091a8a939e61133be48de131e268de2ad2..b385b912b43f786c213c216aee159562aa1ce35c 100644 (file)
@@ -36,6 +36,32 @@ static gpmc_csx_t *gpmc_cs_base = (gpmc_csx_t *)GPMC_CONFIG_CS0_BASE;
 static sdrc_t *sdrc_base = (sdrc_t *)OMAP34XX_SDRC_BASE;
 static ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE;
 
+/*****************************************************************
+ * dieid_num_r(void) - read and set die ID
+ *****************************************************************/
+void dieid_num_r(void)
+{
+       ctrl_id_t *id_base = (ctrl_id_t *)OMAP34XX_ID_L4_IO_BASE;
+       char *uid_s, die_id[34];
+       u32 id[4];
+
+       memset(die_id, 0, sizeof(die_id));
+
+       uid_s = getenv("dieid#");
+
+       if (uid_s == NULL) {
+               id[3] = readl(&id_base->die_id_0);
+               id[2] = readl(&id_base->die_id_1);
+               id[1] = readl(&id_base->die_id_2);
+               id[0] = readl(&id_base->die_id_3);
+               sprintf(die_id, "%08x%08x%08x%08x", id[0], id[1], id[2], id[3]);
+               setenv("dieid#", die_id);
+               uid_s = die_id;
+       }
+
+       printf("Die ID #%s\n", uid_s);
+}
+
 /******************************************
  * get_cpu_type(void) - extract cpu info
  ******************************************/
index 5b344f83782a4e7baf93a150c98153a9a058d9a6..c544e0c5d3a32e3a94f390267c5e5a1395935559 100644 (file)
@@ -60,6 +60,19 @@ typedef struct ctrl {
 #define OMAP3525               0x4c00
 #define OMAP3530               0x0c00
 
+#ifndef __ASSEMBLY__
+typedef struct ctrl_id {
+       unsigned char res1[0x4];
+       unsigned int idcode;            /* 0x04 */
+       unsigned int prod_id;           /* 0x08 */
+       unsigned char res2[0x0C];
+       unsigned int die_id_0;          /* 0x18 */
+       unsigned int die_id_1;          /* 0x1C */
+       unsigned int die_id_2;          /* 0x20 */
+       unsigned int die_id_3;          /* 0x24 */
+} ctrl_id_t;
+#endif /* __ASSEMBLY__ */
+
 /* device type */
 #define DEVICE_MASK            (0x7 << 8)
 #define SYSBOOT_MASK           0x1F
index 02e36d7e3f69de3f7b674b51ac5114c1b15b58e8..8c9656f9e1660f4220081b522d0910cc52ed87e8 100644 (file)
@@ -43,6 +43,7 @@
  */
 #define OMAP34XX_CORE_L4_IO_BASE       0x48000000
 #define OMAP34XX_WAKEUP_L4_IO_BASE     0x48300000
+#define OMAP34XX_ID_L4_IO_BASE         0x4830A200
 #define OMAP34XX_L4_PER                        0x49000000
 #define OMAP34XX_L4_IO_BASE            OMAP34XX_CORE_L4_IO_BASE
 
index ab3e1683f6e39b4d0e7b5fce45f33528f558f8dc..8b554bbe8ef50832dd0cf24d8c5b652908763487 100644 (file)
@@ -66,5 +66,6 @@ void sdelay(unsigned long);
 void make_cs1_contiguous(void);
 void omap_nand_switch_ecc(int);
 void power_init_r(void);
+void dieid_num_r(void);
 
 #endif