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