blob: e14de04695ade0d901f667e2b1e99c24f164e403 [file] [log] [blame]
Tom Rix376aee72009-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 *
Wolfgang Denk1a459662013-07-08 09:37:19 +020013 * SPDX-License-Identifier: GPL-2.0+
Tom Rix376aee72009-05-15 23:48:36 +020014 */
15#include <common.h>
Ben Warren1ab70f62009-12-14 16:30:39 -080016#include <netdev.h>
Tom Rix83ae6982009-05-31 12:44:39 +020017#ifdef CONFIG_STATUS_LED
18#include <status_led.h>
19#endif
Tom Rixcd782632009-06-28 12:52:29 -050020#include <twl4030.h>
Tom Rix376aee72009-05-15 23:48:36 +020021#include <asm/io.h>
Tom Rinicfc43842011-09-03 21:51:00 -040022#include <asm/arch/mmc_host_def.h>
Sanjeev Premi84c3b632011-09-08 10:51:01 -040023#include <asm/gpio.h>
Tom Rix660888b2009-05-31 12:44:37 +020024#include <asm/arch/mem.h>
Tom Rix376aee72009-05-15 23:48:36 +020025#include <asm/arch/mux.h>
26#include <asm/arch/sys_proto.h>
27#include <asm/mach-types.h>
28#include "zoom2.h"
Tom Rix660888b2009-05-31 12:44:37 +020029#include "zoom2_serial.h"
30
John Rigby29565322010-12-20 18:27:51 -070031DECLARE_GLOBAL_DATA_PTR;
32
Tom Rix660888b2009-05-31 12:44:37 +020033/*
34 * This the the zoom2, board specific, gpmc configuration for the
35 * quad uart on the debug board. The more general gpmc configurations
Steve Sakomanf56348a2010-06-17 21:50:01 -070036 * are setup at the cpu level in arch/arm/cpu/armv7/omap3/mem.c
Tom Rix660888b2009-05-31 12:44:37 +020037 *
38 * The details of the setting of the serial gpmc setup are not available.
39 * The values were provided by another party.
40 */
Tom Rix660888b2009-05-31 12:44:37 +020041static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = {
42 0x00011000,
43 0x001F1F01,
44 0x00080803,
45 0x1D091D09,
46 0x041D1F1F,
47 0x1D0904C4, 0
48};
Tom Rix376aee72009-05-15 23:48:36 +020049
Tom Rixa30f5192009-06-02 20:53:56 -050050/* Used to track the revision of the board */
51static zoom2_revision revision = ZOOM2_REVISION_UNKNOWN;
52
53/*
54 * Routine: zoom2_get_revision
55 * Description: Return the revision of the Zoom2 this code is running on.
56 */
57zoom2_revision zoom2_get_revision(void)
58{
59 return revision;
60}
61
62/*
63 * Routine: zoom2_identify
64 * Description: Detect which version of Zoom2 we are running on.
65 */
66void zoom2_identify(void)
67{
68 /*
69 * To check for production board vs beta board,
70 * check if gpio 94 is clear.
71 *
72 * No way yet to check for alpha board identity.
73 * Alpha boards were produced in very limited quantities
74 * and they are not commonly used. They are mentioned here
75 * only for completeness.
76 */
Sanjeev Premi84c3b632011-09-08 10:51:01 -040077 if (!gpio_request(94, "")) {
Tom Rixa30f5192009-06-02 20:53:56 -050078 unsigned int val;
79
Sanjeev Premi84c3b632011-09-08 10:51:01 -040080 gpio_direction_input(94);
81 val = gpio_get_value(94);
Tom Rixa30f5192009-06-02 20:53:56 -050082
83 if (val)
84 revision = ZOOM2_REVISION_BETA;
85 else
86 revision = ZOOM2_REVISION_PRODUCTION;
87 }
88
89 printf("Board revision ");
90 switch (revision) {
91 case ZOOM2_REVISION_PRODUCTION:
92 printf("Production\n");
93 break;
94 case ZOOM2_REVISION_BETA:
95 printf("Beta\n");
96 break;
97 default:
98 printf("Unknown\n");
99 break;
100 }
101}
102
Tom Rix376aee72009-05-15 23:48:36 +0200103/*
104 * Routine: board_init
105 * Description: Early hardware init.
106 */
107int board_init (void)
108{
Tom Rix660888b2009-05-31 12:44:37 +0200109 u32 *gpmc_config;
Tom Rix376aee72009-05-15 23:48:36 +0200110
111 gpmc_init (); /* in SRAM or SDRAM, finish GPMC */
Tom Rix660888b2009-05-31 12:44:37 +0200112
113 /* Configure console support on zoom2 */
114 gpmc_config = gpmc_serial_TL16CP754C;
Tom Rix96a27c62009-10-12 12:07:40 -0400115 enable_gpmc_cs_config(gpmc_config, &gpmc_cfg->cs[3],
Matthias Ludwig187af952009-05-19 09:09:31 +0200116 SERIAL_TL16CP754C_BASE, GPMC_SIZE_16M);
Tom Rix660888b2009-05-31 12:44:37 +0200117
Tom Rix376aee72009-05-15 23:48:36 +0200118 /* board id for Linux */
119 gd->bd->bi_arch_number = MACH_TYPE_OMAP_ZOOM2;
120 /* boot param addr */
121 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
122
Tom Rix660888b2009-05-31 12:44:37 +0200123#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
124 status_led_set (STATUS_LED_BOOT, STATUS_LED_ON);
125#endif
Tom Rix376aee72009-05-15 23:48:36 +0200126 return 0;
127}
128
129/*
130 * Routine: misc_init_r
131 * Description: Configure zoom board specific configurations
132 */
Tom Rixa30f5192009-06-02 20:53:56 -0500133int misc_init_r(void)
Tom Rix376aee72009-05-15 23:48:36 +0200134{
Tom Rixa30f5192009-06-02 20:53:56 -0500135 zoom2_identify();
Tom Rix2c155132009-06-28 12:52:30 -0500136 twl4030_power_init();
Grazvydas Ignotasead39d72009-12-10 17:10:21 +0200137 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
Tom Rixa30f5192009-06-02 20:53:56 -0500138 dieid_num_r();
Tom Rixcd782632009-06-28 12:52:29 -0500139
140 /*
141 * Board Reset
142 * The board is reset by holding the the large button
143 * on the top right side of the main board for
144 * eight seconds.
145 *
146 * There are reported problems of some beta boards
147 * continously resetting. For those boards, disable resetting.
148 */
149 if (ZOOM2_REVISION_PRODUCTION <= zoom2_get_revision())
150 twl4030_power_reset_init();
151
Tom Rix376aee72009-05-15 23:48:36 +0200152 return 0;
153}
154
155/*
156 * Routine: set_muxconf_regs
157 * Description: Setting up the configuration Mux registers specific to the
158 * hardware. Many pins need to be moved from protect to primary
159 * mode.
160 */
161void set_muxconf_regs (void)
162{
163 /* platform specific muxes */
164 MUX_ZOOM2 ();
165}
Ben Warren1ab70f62009-12-14 16:30:39 -0800166
Tom Rinicfc43842011-09-03 21:51:00 -0400167#ifdef CONFIG_GENERIC_MMC
168int board_mmc_init(bd_t *bis)
169{
Nikita Kiryanove3913f52012-12-03 02:19:47 +0000170 return omap_mmc_init(0, 0, 0, -1, -1);
Tom Rinicfc43842011-09-03 21:51:00 -0400171}
172#endif
173
Ben Warren1ab70f62009-12-14 16:30:39 -0800174#ifdef CONFIG_CMD_NET
175int board_eth_init(bd_t *bis)
176{
177 int rc = 0;
178#ifdef CONFIG_LAN91C96
179 rc = lan91c96_initialize(0, CONFIG_LAN91C96_BASE);
180#endif
181 return rc;
182}
183#endif