3 * Texas Instruments, <www.ti.com>
4 * Richard Woodruff <r-woodruff2@ti.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 #include <asm/arch/omap2420.h>
25 #include <asm/arch/bits.h>
26 #include <asm/arch/mem.h> /* get mem tables */
27 #include <asm/arch/sys_proto.h>
28 #include <asm/arch/sys_info.h>
31 /**************************************************************************
32 * get_cpu_type() - low level get cpu type
34 * - just looking to say if this is a 2422 or 2420 or ...
35 * - to start with we will look at switch settings..
36 * - 2422 id's same as 2420 for ES1 will rely on H4 board characteristics
37 * (mux for 2420, non-mux for 2422).
38 ***************************************************************************/
39 u32 get_cpu_type(void)
43 v = __raw_readl(TAP_IDCODE_REG);
44 v &= CPU_24XX_ID_MASK;
45 if (v == CPU_2420_CHIPID) { /* currently 2420 and 2422 have same id */
46 if (is_gpmc_muxed() == GPMC_MUXED) /* if mux'ed */
51 return(CPU_2420); /* don't know, say 2420 */
54 /******************************************
55 * get_cpu_rev(void) - extract version info
56 ******************************************/
60 v = __raw_readl(TAP_IDCODE_REG);
62 return(v+1); /* currently 2422 and 2420 match up */
65 /***********************************************************
66 * get_mem_type() - identify type of mDDR part used.
67 * 2422 uses stacked DDR, 2 parts CS0/CS1.
68 * 2420 may have 1 or 2, no good way to know...only init 1...
69 * when eeprom data is up we can select 1 more.
70 *************************************************************/
71 u32 get_mem_type(void)
73 if (get_cpu_type() == CPU_2422)
76 if (get_board_type() == BOARD_H4_MENELAUS)
82 /***********************************************************************
83 * get_board_type() - get board type based on current production stats.
84 * --- NOTE: 2 I2C EEPROMs will someday be populated with proper info.
85 * when they are available we can get info from there. This should
86 * be correct of all known boards up until today.
87 ************************************************************************/
88 u32 get_board_type(void)
90 if (i2c_probe(I2C_MENELAUS) == 0)
91 return(BOARD_H4_MENELAUS);
96 /******************************************************************
97 * get_sysboot_value() - get init word settings (dip switch on h4)
98 ******************************************************************/
99 u32 get_sysboot_value(void)
101 return(0x00000FFF & __raw_readl(CONTROL_STATUS));
104 /***************************************************************************
105 * get_gpmc0_base() - Return current address hardware will be
106 * fetching from. The below effectively gives what is correct, its a bit
107 * mis-leading compared to the TRM. For the most general case the mask
108 * needs to be also taken into account this does work in practice.
109 * - for u-boot we currently map:
114 ****************************************************************************/
115 u32 get_gpmc0_base(void)
119 b = __raw_readl(GPMC_CONFIG7_0);
120 b &= 0x1F; /* keep base [5:0] */
121 b = b << 24; /* ret 0x0b000000 */
125 /*****************************************************************
126 * is_gpmc_muxed() - tells if address/data lines are multiplexed
127 *****************************************************************/
128 u32 is_gpmc_muxed(void)
131 mux = get_sysboot_value();
132 if (mux & BIT1) /* if mux'ed */
135 return(GPMC_NONMUXED);
138 /************************************************************************
139 * get_gpmc0_type() - read sysboot lines to see type of memory attached
140 ************************************************************************/
141 u32 get_gpmc0_type(void)
144 type = get_sysboot_value();
145 if ((type & (BIT3|BIT2)) == (BIT3|BIT2))
151 /*******************************************************************
152 * get_gpmc0_width() - See if bus is in x8 or x16 (mainly for nand)
153 *******************************************************************/
154 u32 get_gpmc0_width(void)
157 width = get_sysboot_value();
158 if ((width & 0xF) == (BIT3|BIT2))
164 /*********************************************************************
165 * wait_on_value() - common routine to allow waiting for changes in
167 *********************************************************************/
168 u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
173 val = __raw_readl(read_addr) & read_bit_mask;
174 if (val == match_value)
181 /*********************************************************************
182 * display_board_info() - print banner with board info.
183 *********************************************************************/
184 void display_board_info(u32 btype)
186 char cpu_2420[] = "2420";
187 char cpu_2422[] = "2422";
188 char db_men[] = "Menelaus";
191 u32 cpu = get_cpu_type();
197 if(btype == BOARD_H4_MENELAUS)
201 printf("TI H4 SDP Base Board with OMAP%s %s Daughter Board\n",cpu_s, db_s);