]> git.ipfire.org Git - people/ms/u-boot.git/blob - board/omap3/zoom2/zoom2.c
ZOOM2 detect the version of the zoom2 board at runtime.
[people/ms/u-boot.git] / board / omap3 / zoom2 / zoom2.c
1 /*
2 * Copyright (c) 2009 Wind River Systems, Inc.
3 * Tom Rix <Tom.Rix@windriver.com>
4 *
5 * Derived from Zoom1 code by
6 * Nishanth Menon <nm@ti.com>
7 * Sunil Kumar <sunilsaini05@gmail.com>
8 * Shashi Ranjan <shashiranjanmca05@gmail.com>
9 * Richard Woodruff <r-woodruff2@ti.com>
10 * Syed Mohammed Khasim <khasim@ti.com>
11 *
12 *
13 * See file CREDITS for list of people who contributed to this
14 * project.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 */
31 #include <common.h>
32 #ifdef CONFIG_STATUS_LED
33 #include <status_led.h>
34 #endif
35 #include <asm/io.h>
36 #include <asm/arch/gpio.h>
37 #include <asm/arch/mem.h>
38 #include <asm/arch/mux.h>
39 #include <asm/arch/sys_proto.h>
40 #include <asm/mach-types.h>
41 #include "zoom2.h"
42 #include "zoom2_serial.h"
43
44 /*
45 * This the the zoom2, board specific, gpmc configuration for the
46 * quad uart on the debug board. The more general gpmc configurations
47 * are setup at the cpu level in cpu/arm_cortexa8/omap3/mem.c
48 *
49 * The details of the setting of the serial gpmc setup are not available.
50 * The values were provided by another party.
51 */
52 extern void enable_gpmc_config(u32 *gpmc_config, gpmc_csx_t *gpmc_cs_base,
53 u32 base, u32 size);
54
55 static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = {
56 0x00011000,
57 0x001F1F01,
58 0x00080803,
59 0x1D091D09,
60 0x041D1F1F,
61 0x1D0904C4, 0
62 };
63
64 /* Used to track the revision of the board */
65 static zoom2_revision revision = ZOOM2_REVISION_UNKNOWN;
66
67 /*
68 * Routine: zoom2_get_revision
69 * Description: Return the revision of the Zoom2 this code is running on.
70 */
71 zoom2_revision zoom2_get_revision(void)
72 {
73 return revision;
74 }
75
76 /*
77 * Routine: zoom2_identify
78 * Description: Detect which version of Zoom2 we are running on.
79 */
80 void zoom2_identify(void)
81 {
82 /*
83 * To check for production board vs beta board,
84 * check if gpio 94 is clear.
85 *
86 * No way yet to check for alpha board identity.
87 * Alpha boards were produced in very limited quantities
88 * and they are not commonly used. They are mentioned here
89 * only for completeness.
90 */
91 if (!omap_request_gpio(94)) {
92 unsigned int val;
93
94 omap_set_gpio_direction(94, 1);
95 val = omap_get_gpio_datain(94);
96 omap_free_gpio(94);
97
98 if (val)
99 revision = ZOOM2_REVISION_BETA;
100 else
101 revision = ZOOM2_REVISION_PRODUCTION;
102 }
103
104 printf("Board revision ");
105 switch (revision) {
106 case ZOOM2_REVISION_PRODUCTION:
107 printf("Production\n");
108 break;
109 case ZOOM2_REVISION_BETA:
110 printf("Beta\n");
111 break;
112 default:
113 printf("Unknown\n");
114 break;
115 }
116 }
117
118 /*
119 * Routine: board_init
120 * Description: Early hardware init.
121 */
122 int board_init (void)
123 {
124 DECLARE_GLOBAL_DATA_PTR;
125 gpmc_csx_t *serial_cs_base;
126 u32 *gpmc_config;
127
128 gpmc_init (); /* in SRAM or SDRAM, finish GPMC */
129
130 /* Configure console support on zoom2 */
131 gpmc_config = gpmc_serial_TL16CP754C;
132 serial_cs_base = (gpmc_csx_t *) (GPMC_CONFIG_CS0_BASE +
133 (3 * GPMC_CONFIG_WIDTH));
134 enable_gpmc_config(gpmc_config,
135 serial_cs_base,
136 SERIAL_TL16CP754C_BASE,
137 GPMC_SIZE_16M);
138
139 /* board id for Linux */
140 gd->bd->bi_arch_number = MACH_TYPE_OMAP_ZOOM2;
141 /* boot param addr */
142 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
143
144 #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
145 status_led_set (STATUS_LED_BOOT, STATUS_LED_ON);
146 #endif
147 return 0;
148 }
149
150 /*
151 * Routine: misc_init_r
152 * Description: Configure zoom board specific configurations
153 */
154 int misc_init_r(void)
155 {
156 zoom2_identify();
157 power_init_r();
158 dieid_num_r();
159 return 0;
160 }
161
162 /*
163 * Routine: set_muxconf_regs
164 * Description: Setting up the configuration Mux registers specific to the
165 * hardware. Many pins need to be moved from protect to primary
166 * mode.
167 */
168 void set_muxconf_regs (void)
169 {
170 /* platform specific muxes */
171 MUX_ZOOM2 ();
172 }