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