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> |
Tom Rix | 83ae698 | 2009-05-31 12:44:39 +0200 | [diff] [blame] | 32 | #ifdef CONFIG_STATUS_LED |
| 33 | #include <status_led.h> |
| 34 | #endif |
Tom Rix | cd78263 | 2009-06-28 12:52:29 -0500 | [diff] [blame] | 35 | #include <twl4030.h> |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 36 | #include <asm/io.h> |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 37 | #include <asm/arch/gpio.h> |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 38 | #include <asm/arch/mem.h> |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 39 | #include <asm/arch/mux.h> |
| 40 | #include <asm/arch/sys_proto.h> |
| 41 | #include <asm/mach-types.h> |
| 42 | #include "zoom2.h" |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 43 | #include "zoom2_serial.h" |
| 44 | |
| 45 | /* |
| 46 | * 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 | */ |
Matthias Ludwig | 187af95 | 2009-05-19 09:09:31 +0200 | [diff] [blame^] | 53 | void enable_gpmc_cs_config(u32 *gpmc_config, struct gpmc_cs *cs, u32 base, |
| 54 | u32 size); |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 55 | |
| 56 | static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = { |
| 57 | 0x00011000, |
| 58 | 0x001F1F01, |
| 59 | 0x00080803, |
| 60 | 0x1D091D09, |
| 61 | 0x041D1F1F, |
| 62 | 0x1D0904C4, 0 |
| 63 | }; |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 64 | |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 65 | /* Used to track the revision of the board */ |
| 66 | static zoom2_revision revision = ZOOM2_REVISION_UNKNOWN; |
| 67 | |
| 68 | /* |
| 69 | * Routine: zoom2_get_revision |
| 70 | * Description: Return the revision of the Zoom2 this code is running on. |
| 71 | */ |
| 72 | zoom2_revision zoom2_get_revision(void) |
| 73 | { |
| 74 | return revision; |
| 75 | } |
| 76 | |
| 77 | /* |
| 78 | * Routine: zoom2_identify |
| 79 | * Description: Detect which version of Zoom2 we are running on. |
| 80 | */ |
| 81 | void zoom2_identify(void) |
| 82 | { |
| 83 | /* |
| 84 | * To check for production board vs beta board, |
| 85 | * check if gpio 94 is clear. |
| 86 | * |
| 87 | * No way yet to check for alpha board identity. |
| 88 | * Alpha boards were produced in very limited quantities |
| 89 | * and they are not commonly used. They are mentioned here |
| 90 | * only for completeness. |
| 91 | */ |
| 92 | if (!omap_request_gpio(94)) { |
| 93 | unsigned int val; |
| 94 | |
| 95 | omap_set_gpio_direction(94, 1); |
| 96 | val = omap_get_gpio_datain(94); |
| 97 | omap_free_gpio(94); |
| 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 | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 119 | /* |
| 120 | * Routine: board_init |
| 121 | * Description: Early hardware init. |
| 122 | */ |
| 123 | int board_init (void) |
| 124 | { |
| 125 | DECLARE_GLOBAL_DATA_PTR; |
Matthias Ludwig | 187af95 | 2009-05-19 09:09:31 +0200 | [diff] [blame^] | 126 | gpmc_t *gpmc = (gpmc_t *)GPMC_BASE; |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 127 | u32 *gpmc_config; |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 128 | |
| 129 | gpmc_init (); /* in SRAM or SDRAM, finish GPMC */ |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 130 | |
| 131 | /* Configure console support on zoom2 */ |
| 132 | gpmc_config = gpmc_serial_TL16CP754C; |
Matthias Ludwig | 187af95 | 2009-05-19 09:09:31 +0200 | [diff] [blame^] | 133 | enable_gpmc_cs_config(gpmc_config, &gpmc->cs[4], |
| 134 | SERIAL_TL16CP754C_BASE, GPMC_SIZE_16M); |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 135 | |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 136 | /* board id for Linux */ |
| 137 | gd->bd->bi_arch_number = MACH_TYPE_OMAP_ZOOM2; |
| 138 | /* boot param addr */ |
| 139 | gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); |
| 140 | |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 141 | #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT) |
| 142 | status_led_set (STATUS_LED_BOOT, STATUS_LED_ON); |
| 143 | #endif |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 144 | return 0; |
| 145 | } |
| 146 | |
| 147 | /* |
| 148 | * Routine: misc_init_r |
| 149 | * Description: Configure zoom board specific configurations |
| 150 | */ |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 151 | int misc_init_r(void) |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 152 | { |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 153 | zoom2_identify(); |
Tom Rix | 2c15513 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 154 | twl4030_power_init(); |
| 155 | twl4030_led_init(); |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 156 | dieid_num_r(); |
Tom Rix | cd78263 | 2009-06-28 12:52:29 -0500 | [diff] [blame] | 157 | |
| 158 | /* |
| 159 | * Board Reset |
| 160 | * The board is reset by holding the the large button |
| 161 | * on the top right side of the main board for |
| 162 | * eight seconds. |
| 163 | * |
| 164 | * There are reported problems of some beta boards |
| 165 | * continously resetting. For those boards, disable resetting. |
| 166 | */ |
| 167 | if (ZOOM2_REVISION_PRODUCTION <= zoom2_get_revision()) |
| 168 | twl4030_power_reset_init(); |
| 169 | |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 170 | return 0; |
| 171 | } |
| 172 | |
| 173 | /* |
| 174 | * Routine: set_muxconf_regs |
| 175 | * Description: Setting up the configuration Mux registers specific to the |
| 176 | * hardware. Many pins need to be moved from protect to primary |
| 177 | * mode. |
| 178 | */ |
| 179 | void set_muxconf_regs (void) |
| 180 | { |
| 181 | /* platform specific muxes */ |
| 182 | MUX_ZOOM2 (); |
| 183 | } |