Clean up system info: - Move board dependent config to board header - Clean up code and remove unused code
Signed-off-by: Dirk Behme <[EMAIL PROTECTED]> --- board/omap3/beagle/beagle.h | 6 + board/omap3/evm/evm.h | 6 + board/omap3/overo/overo.h | 6 + cpu/arm_cortexa8/omap3/board.c | 7 +- cpu/arm_cortexa8/omap3/sys_info.c | 102 ++++----------------------------- include/asm-arm/arch-omap3/sys_proto.h | 4 - 6 files changed, 39 insertions(+), 92 deletions(-) Index: u-boot-arm/board/omap3/beagle/beagle.h =================================================================== --- u-boot-arm.orig/board/omap3/beagle/beagle.h +++ u-boot-arm/board/omap3/beagle/beagle.h @@ -26,8 +26,14 @@ const omap3_sysinfo sysinfo = { SDP_3430_V1, SDP_3430_V2, + DDR_STACKED, "3530", "OMAP3 Beagle board", +#if defined(CONFIG_ENV_IS_IN_ONENAND) + "OneNAND", +#else + "NAND", +#endif }; /* Index: u-boot-arm/board/omap3/evm/evm.h =================================================================== --- u-boot-arm.orig/board/omap3/evm/evm.h +++ u-boot-arm/board/omap3/evm/evm.h @@ -26,8 +26,14 @@ const omap3_sysinfo sysinfo = { OMAP3EVM_V1, OMAP3EVM_V2, + DDR_DISCRETE, "35X-Family", "OMAP3 EVM board", +#if defined(CONFIG_ENV_IS_IN_ONENAND) + "OneNAND", +#else + "NAND", +#endif }; static int setup_net_chip(void); Index: u-boot-arm/board/omap3/overo/overo.h =================================================================== --- u-boot-arm.orig/board/omap3/overo/overo.h +++ u-boot-arm/board/omap3/overo/overo.h @@ -26,8 +26,14 @@ const omap3_sysinfo sysinfo = { SDP_3430_V1, SDP_3430_V2, + DDR_STACKED, "3503", "Gumstix Overo board", +#if defined(CONFIG_ENV_IS_IN_ONENAND) + "OneNAND", +#else + "NAND", +#endif }; /* Index: u-boot-arm/cpu/arm_cortexa8/omap3/board.c =================================================================== --- u-boot-arm.orig/cpu/arm_cortexa8/omap3/board.c +++ u-boot-arm/cpu/arm_cortexa8/omap3/board.c @@ -44,6 +44,8 @@ #define UNLOCK_2 0x00000000 #define UNLOCK_3 0x0000FFFF +extern omap3_sysinfo sysinfo; + /****************************************************************************** * Routine: delay * Description: spinning delay to use before udelay works @@ -265,10 +267,9 @@ int dram_init(void) { DECLARE_GLOBAL_DATA_PTR; unsigned int size0 = 0, size1 = 0; - u32 mtype, btype; + u32 btype; btype = get_board_type(); - mtype = get_mem_type(); display_board_info(btype); @@ -277,7 +278,7 @@ int dram_init(void) * where it can be started. Early init code will init * memory on CS0. */ - if ((mtype == DDR_COMBO) || (mtype == DDR_STACKED)) { + if ((sysinfo.mtype == DDR_COMBO) || (sysinfo.mtype == DDR_STACKED)) { do_sdrc_init(SDRC_CS1_OSET, NOT_EARLY); make_cs1_contiguous(); } Index: u-boot-arm/cpu/arm_cortexa8/omap3/sys_info.c =================================================================== --- u-boot-arm.orig/cpu/arm_cortexa8/omap3/sys_info.c +++ u-boot-arm/cpu/arm_cortexa8/omap3/sys_info.c @@ -34,28 +34,6 @@ extern omap3_sysinfo sysinfo; static u32 *gpmc_base = (u32 *)GPMC_BASE; -/************************************************************************** - * get_gpmc0_type() - ***************************************************************************/ -u32 get_gpmc0_type(void) -{ -#if defined(CONFIG_ENV_IS_IN_ONENAND) - return 1; /* OneNAND */ -#else - return 2; /* NAND */ -#endif -} - -/**************************************************** - * get_cpu_type() - low level get cpu type - * - no C globals yet. - ****************************************************/ -u32 get_cpu_type(void) -{ - /* fixme, need to get register defines for OMAP3 */ - return CPU_3430; -} - /****************************************** * get_cpu_rev(void) - extract version info ******************************************/ @@ -81,24 +59,11 @@ u32 get_cpu_rev(void) ****************************************************/ u32 is_mem_sdr(void) { - volatile u32 *burst = (volatile u32 *) (SDRC_MR_0 + SDRC_CS0_OSET); - if (*burst == SDP_SDRC_MR_0_SDR) + if (readl(SDRC_MR_0 + SDRC_CS0_OSET) == SDP_SDRC_MR_0_SDR) return 1; return 0; } -/*********************************************************** - * get_mem_type() - identify type of mDDR part used. - ***********************************************************/ -u32 get_mem_type(void) -{ -#if defined(CONFIG_OMAP3_BEAGLE) || defined(CONFIG_OVERO) - return DDR_STACKED; -#else - return DDR_DISCRETE; -#endif -} - /*********************************************************************** * get_cs0_size() - get size of chip select 0/1 ************************************************************************/ @@ -189,68 +154,34 @@ u32 get_board_rev(void) *********************************************************************/ void display_board_info(u32 btype) { - char *bootmode[] = { - "NOR", - "ONENAND", - "NAND", - "P2a", - "NOR", - "NOR", - "P2a", - "P2b", - }; - u32 brev = get_board_rev(); - char db_ver[] = "0.0"; /* board type */ - char mem_sdr[] = "mSDR"; /* memory type */ - char mem_ddr[] = "LPDDR"; - char t_tst[] = "TST"; /* security level */ - char t_emu[] = "EMU"; - char t_hs[] = "HS"; - char t_gp[] = "GP"; - char unk[] = "?"; -#ifdef CONFIG_LED_INFO - char led_string[CONFIG_LED_LEN] = { 0 }; -#endif - char p_l3[] = "165"; - char p_cpu[] = "2"; - - char *db_s, *mem_s, *sec_s; - u32 cpu, rev, sec; - - rev = get_cpu_rev(); - cpu = get_cpu_type(); - sec = get_device_type(); + char *mem_s, *sec_s; if (is_mem_sdr()) - mem_s = mem_sdr; + mem_s = "mSDR"; else - mem_s = mem_ddr; + mem_s = "LPDDR"; - db_s = db_ver; - db_s[0] += (brev >> 4) & 0xF; - db_s[2] += brev & 0xF; - - switch (sec) { + switch (get_device_type()) { case TST_DEVICE: - sec_s = t_tst; + sec_s = "TST"; break; case EMU_DEVICE: - sec_s = t_emu; + sec_s = "EMU"; break; case HS_DEVICE: - sec_s = t_hs; + sec_s = "HS"; break; case GP_DEVICE: - sec_s = t_gp; + sec_s = "GP"; break; default: - sec_s = unk; + sec_s = "?"; } - printf("OMAP%s-%s rev %d, CPU-OPP%s L3-%sMHz\n", sysinfo.cpu_string, - sec_s, rev, p_cpu, p_l3); + printf("OMAP%s-%s rev %d, CPU-OPP2 L3-165MHz\n", sysinfo.cpu_string, + sec_s, get_cpu_rev()); printf("%s + %s/%s\n", sysinfo.board_string, - mem_s, bootmode[get_gpmc0_type()]); + mem_s, sysinfo.nand_string); } @@ -305,7 +236,7 @@ u32 is_running_in_sdram(void) /*************************************************************** * get_boot_type() - Is this an XIP type device or a stream one - * bits 4-0 specify type. Bit 5 sys mem/perif + * bits 4-0 specify type. Bit 5 says mem/perif ***************************************************************/ u32 get_boot_type(void) { @@ -317,8 +248,5 @@ u32 get_boot_type(void) *************************************************************/ u32 get_device_type(void) { - int mode; - - mode = readl(CONTROL_STATUS) & (DEVICE_MASK); - return mode >>= 8; + return ((readl(CONTROL_STATUS) & (DEVICE_MASK)) >> 8); } Index: u-boot-arm/include/asm-arm/arch-omap3/sys_proto.h =================================================================== --- u-boot-arm.orig/include/asm-arm/arch-omap3/sys_proto.h +++ u-boot-arm/include/asm-arm/arch-omap3/sys_proto.h @@ -24,8 +24,10 @@ typedef struct { u32 board_type_v1; u32 board_type_v2; + u32 mtype; char *cpu_string; char *board_string; + char *nand_string; } omap3_sysinfo; void prcm_init(void); @@ -39,11 +41,9 @@ void gpmc_init(void); void watchdog_init(void); void set_muxconf_regs(void); -u32 get_cpu_type(void); u32 get_cpu_rev(void); u32 get_mem_type(void); u32 get_sysboot_value(void); -u32 get_gpmc0_base(void); u32 is_gpmc_muxed(void); u32 get_gpmc0_type(void); u32 get_gpmc0_width(void); _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot