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 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 13 | * SPDX-License-Identifier: GPL-2.0+ |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 14 | */ |
| 15 | #include <common.h> |
Ben Warren | 1ab70f6 | 2009-12-14 16:30:39 -0800 | [diff] [blame] | 16 | #include <netdev.h> |
Tom Rix | 83ae698 | 2009-05-31 12:44:39 +0200 | [diff] [blame] | 17 | #ifdef CONFIG_STATUS_LED |
| 18 | #include <status_led.h> |
| 19 | #endif |
Tom Rix | cd78263 | 2009-06-28 12:52:29 -0500 | [diff] [blame] | 20 | #include <twl4030.h> |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 21 | #include <asm/io.h> |
Tom Rini | cfc4384 | 2011-09-03 21:51:00 -0400 | [diff] [blame] | 22 | #include <asm/arch/mmc_host_def.h> |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 23 | #include <asm/gpio.h> |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 24 | #include <asm/arch/mem.h> |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 25 | #include <asm/arch/mux.h> |
| 26 | #include <asm/arch/sys_proto.h> |
| 27 | #include <asm/mach-types.h> |
| 28 | #include "zoom2.h" |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 29 | #include "zoom2_serial.h" |
| 30 | |
John Rigby | 2956532 | 2010-12-20 18:27:51 -0700 | [diff] [blame] | 31 | DECLARE_GLOBAL_DATA_PTR; |
| 32 | |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 33 | /* |
| 34 | * This the the zoom2, board specific, gpmc configuration for the |
| 35 | * quad uart on the debug board. The more general gpmc configurations |
Steve Sakoman | f56348a | 2010-06-17 21:50:01 -0700 | [diff] [blame] | 36 | * 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] | 37 | * |
| 38 | * The details of the setting of the serial gpmc setup are not available. |
| 39 | * The values were provided by another party. |
| 40 | */ |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 41 | static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = { |
| 42 | 0x00011000, |
| 43 | 0x001F1F01, |
| 44 | 0x00080803, |
| 45 | 0x1D091D09, |
| 46 | 0x041D1F1F, |
| 47 | 0x1D0904C4, 0 |
| 48 | }; |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 49 | |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 50 | /* Used to track the revision of the board */ |
| 51 | static 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 | */ |
| 57 | zoom2_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 | */ |
| 66 | void 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 Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 77 | if (!gpio_request(94, "")) { |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 78 | unsigned int val; |
| 79 | |
Sanjeev Premi | 84c3b63 | 2011-09-08 10:51:01 -0400 | [diff] [blame] | 80 | gpio_direction_input(94); |
| 81 | val = gpio_get_value(94); |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 82 | |
| 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 Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 103 | /* |
| 104 | * Routine: board_init |
| 105 | * Description: Early hardware init. |
| 106 | */ |
| 107 | int board_init (void) |
| 108 | { |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 109 | u32 *gpmc_config; |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 110 | |
| 111 | gpmc_init (); /* in SRAM or SDRAM, finish GPMC */ |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 112 | |
| 113 | /* Configure console support on zoom2 */ |
| 114 | gpmc_config = gpmc_serial_TL16CP754C; |
Tom Rix | 96a27c6 | 2009-10-12 12:07:40 -0400 | [diff] [blame] | 115 | enable_gpmc_cs_config(gpmc_config, &gpmc_cfg->cs[3], |
Matthias Ludwig | 187af95 | 2009-05-19 09:09:31 +0200 | [diff] [blame] | 116 | SERIAL_TL16CP754C_BASE, GPMC_SIZE_16M); |
Tom Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 117 | |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 118 | /* 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 Rix | 660888b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 123 | #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT) |
| 124 | status_led_set (STATUS_LED_BOOT, STATUS_LED_ON); |
| 125 | #endif |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 126 | return 0; |
| 127 | } |
| 128 | |
| 129 | /* |
| 130 | * Routine: misc_init_r |
| 131 | * Description: Configure zoom board specific configurations |
| 132 | */ |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 133 | int misc_init_r(void) |
Tom Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 134 | { |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 135 | zoom2_identify(); |
Tom Rix | 2c15513 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 136 | twl4030_power_init(); |
Grazvydas Ignotas | ead39d7 | 2009-12-10 17:10:21 +0200 | [diff] [blame] | 137 | twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); |
Tom Rix | a30f519 | 2009-06-02 20:53:56 -0500 | [diff] [blame] | 138 | dieid_num_r(); |
Tom Rix | cd78263 | 2009-06-28 12:52:29 -0500 | [diff] [blame] | 139 | |
| 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 Rix | 376aee7 | 2009-05-15 23:48:36 +0200 | [diff] [blame] | 152 | 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 | */ |
| 161 | void set_muxconf_regs (void) |
| 162 | { |
| 163 | /* platform specific muxes */ |
| 164 | MUX_ZOOM2 (); |
| 165 | } |
Ben Warren | 1ab70f6 | 2009-12-14 16:30:39 -0800 | [diff] [blame] | 166 | |
Tom Rini | cfc4384 | 2011-09-03 21:51:00 -0400 | [diff] [blame] | 167 | #ifdef CONFIG_GENERIC_MMC |
| 168 | int board_mmc_init(bd_t *bis) |
| 169 | { |
Nikita Kiryanov | e3913f5 | 2012-12-03 02:19:47 +0000 | [diff] [blame] | 170 | return omap_mmc_init(0, 0, 0, -1, -1); |
Tom Rini | cfc4384 | 2011-09-03 21:51:00 -0400 | [diff] [blame] | 171 | } |
| 172 | #endif |
| 173 | |
Ben Warren | 1ab70f6 | 2009-12-14 16:30:39 -0800 | [diff] [blame] | 174 | #ifdef CONFIG_CMD_NET |
| 175 | int 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 |