blob: dadbeb6730c091d618571f95fc9dafe011324e84 [file] [log] [blame]
Tom Rix0419d912009-05-15 23:48:36 +02001/*
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>
Tom Rix6c66b662009-05-31 12:44:39 +020032#ifdef CONFIG_STATUS_LED
33#include <status_led.h>
34#endif
Tom Rix330a90a2009-06-28 12:52:29 -050035#include <twl4030.h>
Tom Rix0419d912009-05-15 23:48:36 +020036#include <asm/io.h>
Tom Rixbd12eea2009-06-02 20:53:56 -050037#include <asm/arch/gpio.h>
Tom Rix93bed9b2009-05-31 12:44:37 +020038#include <asm/arch/mem.h>
Tom Rix0419d912009-05-15 23:48:36 +020039#include <asm/arch/mux.h>
40#include <asm/arch/sys_proto.h>
41#include <asm/mach-types.h>
42#include "zoom2.h"
Tom Rix93bed9b2009-05-31 12:44:37 +020043#include "zoom2_serial.h"
Tom Rix0419d912009-05-15 23:48:36 +020044
45/*
Tom Rix93bed9b2009-05-31 12:44:37 +020046 * This the the zoom2, board specific, gpmc configuration for the
47 * quad uart on the debug board. The more general gpmc configurations
48 * are setup at the cpu level in cpu/arm_cortexa8/omap3/mem.c
49 *
50 * The details of the setting of the serial gpmc setup are not available.
51 * The values were provided by another party.
52 */
Tom Rix93bed9b2009-05-31 12:44:37 +020053static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = {
54 0x00011000,
55 0x001F1F01,
56 0x00080803,
57 0x1D091D09,
58 0x041D1F1F,
59 0x1D0904C4, 0
60};
61
Tom Rixbd12eea2009-06-02 20:53:56 -050062/* Used to track the revision of the board */
63static zoom2_revision revision = ZOOM2_REVISION_UNKNOWN;
64
65/*
66 * Routine: zoom2_get_revision
67 * Description: Return the revision of the Zoom2 this code is running on.
68 */
69zoom2_revision zoom2_get_revision(void)
70{
71 return revision;
72}
73
74/*
75 * Routine: zoom2_identify
76 * Description: Detect which version of Zoom2 we are running on.
77 */
78void zoom2_identify(void)
79{
80 /*
81 * To check for production board vs beta board,
82 * check if gpio 94 is clear.
83 *
84 * No way yet to check for alpha board identity.
85 * Alpha boards were produced in very limited quantities
86 * and they are not commonly used. They are mentioned here
87 * only for completeness.
88 */
89 if (!omap_request_gpio(94)) {
90 unsigned int val;
91
92 omap_set_gpio_direction(94, 1);
93 val = omap_get_gpio_datain(94);
94 omap_free_gpio(94);
95
96 if (val)
97 revision = ZOOM2_REVISION_BETA;
98 else
99 revision = ZOOM2_REVISION_PRODUCTION;
100 }
101
102 printf("Board revision ");
103 switch (revision) {
104 case ZOOM2_REVISION_PRODUCTION:
105 printf("Production\n");
106 break;
107 case ZOOM2_REVISION_BETA:
108 printf("Beta\n");
109 break;
110 default:
111 printf("Unknown\n");
112 break;
113 }
114}
115
Tom Rix93bed9b2009-05-31 12:44:37 +0200116/*
Tom Rix0419d912009-05-15 23:48:36 +0200117 * Routine: board_init
118 * Description: Early hardware init.
119 */
120int board_init (void)
121{
122 DECLARE_GLOBAL_DATA_PTR;
Tom Rix93bed9b2009-05-31 12:44:37 +0200123 u32 *gpmc_config;
Tom Rix0419d912009-05-15 23:48:36 +0200124
125 gpmc_init (); /* in SRAM or SDRAM, finish GPMC */
Tom Rix93bed9b2009-05-31 12:44:37 +0200126
127 /* Configure console support on zoom2 */
128 gpmc_config = gpmc_serial_TL16CP754C;
Tom Rixab2780f2009-10-12 12:07:40 -0400129 enable_gpmc_cs_config(gpmc_config, &gpmc_cfg->cs[3],
Matthias Ludwige06da3d2009-05-19 09:09:31 +0200130 SERIAL_TL16CP754C_BASE, GPMC_SIZE_16M);
Tom Rix93bed9b2009-05-31 12:44:37 +0200131
Tom Rix0419d912009-05-15 23:48:36 +0200132 /* board id for Linux */
133 gd->bd->bi_arch_number = MACH_TYPE_OMAP_ZOOM2;
134 /* boot param addr */
135 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
136
Tom Rix93bed9b2009-05-31 12:44:37 +0200137#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
138 status_led_set (STATUS_LED_BOOT, STATUS_LED_ON);
139#endif
Tom Rix0419d912009-05-15 23:48:36 +0200140 return 0;
141}
142
143/*
144 * Routine: misc_init_r
145 * Description: Configure zoom board specific configurations
146 */
Tom Rixbd12eea2009-06-02 20:53:56 -0500147int misc_init_r(void)
Tom Rix0419d912009-05-15 23:48:36 +0200148{
Tom Rixbd12eea2009-06-02 20:53:56 -0500149 zoom2_identify();
Tom Rix0f2a8042009-06-28 12:52:30 -0500150 twl4030_power_init();
151 twl4030_led_init();
Tom Rixbd12eea2009-06-02 20:53:56 -0500152 dieid_num_r();
Tom Rix330a90a2009-06-28 12:52:29 -0500153
154 /*
155 * Board Reset
156 * The board is reset by holding the the large button
157 * on the top right side of the main board for
158 * eight seconds.
159 *
160 * There are reported problems of some beta boards
161 * continously resetting. For those boards, disable resetting.
162 */
163 if (ZOOM2_REVISION_PRODUCTION <= zoom2_get_revision())
164 twl4030_power_reset_init();
165
Tom Rix0419d912009-05-15 23:48:36 +0200166 return 0;
167}
168
169/*
170 * Routine: set_muxconf_regs
171 * Description: Setting up the configuration Mux registers specific to the
172 * hardware. Many pins need to be moved from protect to primary
173 * mode.
174 */
175void set_muxconf_regs (void)
176{
177 /* platform specific muxes */
178 MUX_ZOOM2 ();
179}