]> git.ipfire.org Git - thirdparty/u-boot.git/blame - board/logicpd/zoom2/zoom2.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[thirdparty/u-boot.git] / board / logicpd / zoom2 / zoom2.c
CommitLineData
376aee78
TR
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 *
1a459660 13 * SPDX-License-Identifier: GPL-2.0+
376aee78
TR
14 */
15#include <common.h>
1ab70f6f 16#include <netdev.h>
83ae698f
TR
17#ifdef CONFIG_STATUS_LED
18#include <status_led.h>
19#endif
cd782635 20#include <twl4030.h>
376aee78 21#include <asm/io.h>
cfc4384c 22#include <asm/arch/mmc_host_def.h>
84c3b631 23#include <asm/gpio.h>
660888b7 24#include <asm/arch/mem.h>
376aee78
TR
25#include <asm/arch/mux.h>
26#include <asm/arch/sys_proto.h>
27#include <asm/mach-types.h>
28#include "zoom2.h"
660888b7
TR
29#include "zoom2_serial.h"
30
29565326
JR
31DECLARE_GLOBAL_DATA_PTR;
32
660888b7
TR
33/*
34 * This the the zoom2, board specific, gpmc configuration for the
35 * quad uart on the debug board. The more general gpmc configurations
f56348af 36 * are setup at the cpu level in arch/arm/cpu/armv7/omap3/mem.c
660888b7
TR
37 *
38 * The details of the setting of the serial gpmc setup are not available.
39 * The values were provided by another party.
40 */
660888b7
TR
41static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = {
42 0x00011000,
43 0x001F1F01,
44 0x00080803,
45 0x1D091D09,
46 0x041D1F1F,
47 0x1D0904C4, 0
48};
376aee78 49
a30f519b
TR
50/* 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 */
84c3b631 77 if (!gpio_request(94, "")) {
a30f519b
TR
78 unsigned int val;
79
84c3b631
SP
80 gpio_direction_input(94);
81 val = gpio_get_value(94);
a30f519b
TR
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
376aee78
TR
103/*
104 * Routine: board_init
105 * Description: Early hardware init.
106 */
107int board_init (void)
108{
660888b7 109 u32 *gpmc_config;
376aee78
TR
110
111 gpmc_init (); /* in SRAM or SDRAM, finish GPMC */
660888b7
TR
112
113 /* Configure console support on zoom2 */
114 gpmc_config = gpmc_serial_TL16CP754C;
96a27c6d 115 enable_gpmc_cs_config(gpmc_config, &gpmc_cfg->cs[3],
187af954 116 SERIAL_TL16CP754C_BASE, GPMC_SIZE_16M);
660888b7 117
376aee78
TR
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
660888b7
TR
123#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
124 status_led_set (STATUS_LED_BOOT, STATUS_LED_ON);
125#endif
376aee78
TR
126 return 0;
127}
128
129/*
130 * Routine: misc_init_r
131 * Description: Configure zoom board specific configurations
132 */
a30f519b 133int misc_init_r(void)
376aee78 134{
a30f519b 135 zoom2_identify();
2c155130 136 twl4030_power_init();
ead39d7a 137 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
a30f519b 138 dieid_num_r();
cd782635
TR
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
376aee78
TR
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 */
161void set_muxconf_regs (void)
162{
163 /* platform specific muxes */
164 MUX_ZOOM2 ();
165}
1ab70f6f 166
cfc4384c
TR
167#ifdef CONFIG_GENERIC_MMC
168int board_mmc_init(bd_t *bis)
169{
e3913f56 170 return omap_mmc_init(0, 0, 0, -1, -1);
cfc4384c
TR
171}
172#endif
173
1ab70f6f
BW
174#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