Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 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> |
Ben Warren | 1ab70f6 | 2009-12-14 16:30:39 -0800 | [diff] [blame] | 32 | #include <netdev.h> |
Tom Rix | 83ae698 | 2009-05-31 12:44:39 +0200 | [diff] [blame] | 33 | #ifdef CONFIG_STATUS_LED |
| 34 | #include <status_led.h> |
| 35 | #endif |
Tom Rix | cd78263 | 2009-06-28 12:52:29 -0500 | [diff] [blame] | 36 | #include <twl4030.h> |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 37 | #include <asm/io.h> |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 38 | #include <asm/arch/gpio.h> |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 39 | #include <asm/arch/mem.h> |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 40 | #include <asm/arch/mux.h> |
| 41 | #include <asm/arch/sys_proto.h> |
| 42 | #include <asm/mach-types.h> |
| 43 | #include "zoom2.h" |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 44 | #include "zoom2_serial.h" |
| 45 | |
| 46 | /* |
| 47 | * This the the zoom2, board specific, gpmc configuration for the |
| 48 | * quad uart on the debug board. The more general gpmc configurations |
Steve Sakoman | f56348a | 2010-06-17 21:50:01 -0700 | [diff] [blame] | 49 | * are setup at the cpu level in arch/arm/cpu/armv7/omap3/mem.c |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 50 | * |
| 51 | * The details of the setting of the serial gpmc setup are not available. |
| 52 | * The values were provided by another party. |
| 53 | */ |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 54 | static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = { |
| 55 | 0x00011000, |
| 56 | 0x001F1F01, |
| 57 | 0x00080803, |
| 58 | 0x1D091D09, |
| 59 | 0x041D1F1F, |
| 60 | 0x1D0904C4, 0 |
| 61 | }; |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 62 | |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 63 | /* Used to track the revision of the board */ |
| 64 | static zoom2_revision revision = ZOOM2_REVISION_UNKNOWN; |
| 65 | |
| 66 | /* |
| 67 | * Routine: zoom2_get_revision |
| 68 | * Description: Return the revision of the Zoom2 this code is running on. |
| 69 | */ |
| 70 | zoom2_revision zoom2_get_revision(void) |
| 71 | { |
| 72 | return revision; |
| 73 | } |
| 74 | |
| 75 | /* |
| 76 | * Routine: zoom2_identify |
| 77 | * Description: Detect which version of Zoom2 we are running on. |
| 78 | */ |
| 79 | void zoom2_identify(void) |
| 80 | { |
| 81 | /* |
| 82 | * To check for production board vs beta board, |
| 83 | * check if gpio 94 is clear. |
| 84 | * |
| 85 | * No way yet to check for alpha board identity. |
| 86 | * Alpha boards were produced in very limited quantities |
| 87 | * and they are not commonly used. They are mentioned here |
| 88 | * only for completeness. |
| 89 | */ |
| 90 | if (!omap_request_gpio(94)) { |
| 91 | unsigned int val; |
| 92 | |
| 93 | omap_set_gpio_direction(94, 1); |
| 94 | val = omap_get_gpio_datain(94); |
| 95 | omap_free_gpio(94); |
| 96 | |
| 97 | if (val) |
| 98 | revision = ZOOM2_REVISION_BETA; |
| 99 | else |
| 100 | revision = ZOOM2_REVISION_PRODUCTION; |
| 101 | } |
| 102 | |
| 103 | printf("Board revision "); |
| 104 | switch (revision) { |
| 105 | case ZOOM2_REVISION_PRODUCTION: |
| 106 | printf("Production\n"); |
| 107 | break; |
| 108 | case ZOOM2_REVISION_BETA: |
| 109 | printf("Beta\n"); |
| 110 | break; |
| 111 | default: |
| 112 | printf("Unknown\n"); |
| 113 | break; |
| 114 | } |
| 115 | } |
| 116 | |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 117 | /* |
| 118 | * Routine: board_init |
| 119 | * Description: Early hardware init. |
| 120 | */ |
| 121 | int board_init (void) |
| 122 | { |
| 123 | DECLARE_GLOBAL_DATA_PTR; |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 124 | u32 *gpmc_config; |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 125 | |
| 126 | gpmc_init (); /* in SRAM or SDRAM, finish GPMC */ |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 127 | |
| 128 | /* Configure console support on zoom2 */ |
| 129 | gpmc_config = gpmc_serial_TL16CP754C; |
Tom Rix | 96a27c6 | 2009-10-12 12:07:40 -0400 | [diff] [blame] | 130 | enable_gpmc_cs_config(gpmc_config, &gpmc_cfg->cs[3], |
Matthias Ludwig | 187af95 | 2009-05-19 09:09:31 +0200 | [diff] [blame] | 131 | SERIAL_TL16CP754C_BASE, GPMC_SIZE_16M); |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 132 | |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 133 | /* board id for Linux */ |
| 134 | gd->bd->bi_arch_number = MACH_TYPE_OMAP_ZOOM2; |
| 135 | /* boot param addr */ |
| 136 | gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); |
| 137 | |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 138 | #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT) |
| 139 | status_led_set (STATUS_LED_BOOT, STATUS_LED_ON); |
| 140 | #endif |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 141 | return 0; |
| 142 | } |
| 143 | |
| 144 | /* |
| 145 | * Routine: misc_init_r |
| 146 | * Description: Configure zoom board specific configurations |
| 147 | */ |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 148 | int misc_init_r(void) |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 149 | { |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 150 | zoom2_identify(); |
Tom Rix | 2c15513 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 151 | twl4030_power_init(); |
Grazvydas Ignotas | ead39d7 | 2009-12-10 17:10:21 +0200 | [diff] [blame] | 152 | twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 153 | dieid_num_r(); |
Tom Rix | cd78263 | 2009-06-28 12:52:29 -0500 | [diff] [blame] | 154 | |
| 155 | /* |
| 156 | * Board Reset |
| 157 | * The board is reset by holding the the large button |
| 158 | * on the top right side of the main board for |
| 159 | * eight seconds. |
| 160 | * |
| 161 | * There are reported problems of some beta boards |
| 162 | * continously resetting. For those boards, disable resetting. |
| 163 | */ |
| 164 | if (ZOOM2_REVISION_PRODUCTION <= zoom2_get_revision()) |
| 165 | twl4030_power_reset_init(); |
| 166 | |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 167 | return 0; |
| 168 | } |
| 169 | |
| 170 | /* |
| 171 | * Routine: set_muxconf_regs |
| 172 | * Description: Setting up the configuration Mux registers specific to the |
| 173 | * hardware. Many pins need to be moved from protect to primary |
| 174 | * mode. |
| 175 | */ |
| 176 | void set_muxconf_regs (void) |
| 177 | { |
| 178 | /* platform specific muxes */ |
| 179 | MUX_ZOOM2 (); |
| 180 | } |
Ben Warren | 1ab70f6 | 2009-12-14 16:30:39 -0800 | [diff] [blame] | 181 | |
| 182 | #ifdef CONFIG_CMD_NET |
| 183 | int board_eth_init(bd_t *bis) |
| 184 | { |
| 185 | int rc = 0; |
| 186 | #ifdef CONFIG_LAN91C96 |
| 187 | rc = lan91c96_initialize(0, CONFIG_LAN91C96_BASE); |
| 188 | #endif |
| 189 | return rc; |
| 190 | } |
| 191 | #endif |