xref: /openbmc/u-boot/board/bosch/shc/board.c (revision 83d290c5)
1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
2d8ccbe93SHeiko Schocher /*
3d8ccbe93SHeiko Schocher  * board.c
4d8ccbe93SHeiko Schocher  *
5d8ccbe93SHeiko Schocher  * (C) Copyright 2016
6d8ccbe93SHeiko Schocher  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
7d8ccbe93SHeiko Schocher  *
8d8ccbe93SHeiko Schocher  * Based on:
9d8ccbe93SHeiko Schocher  * Board functions for TI AM335X based boards
10d8ccbe93SHeiko Schocher  *
11d8ccbe93SHeiko Schocher  * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
12d8ccbe93SHeiko Schocher  */
13d8ccbe93SHeiko Schocher 
14d8ccbe93SHeiko Schocher #include <common.h>
15d8ccbe93SHeiko Schocher #include <errno.h>
16d8ccbe93SHeiko Schocher #include <spl.h>
17d8ccbe93SHeiko Schocher #include <asm/arch/cpu.h>
18d8ccbe93SHeiko Schocher #include <asm/arch/hardware.h>
19d8ccbe93SHeiko Schocher #include <asm/arch/omap.h>
20d8ccbe93SHeiko Schocher #include <asm/arch/ddr_defs.h>
21d8ccbe93SHeiko Schocher #include <asm/arch/clock.h>
22d8ccbe93SHeiko Schocher #include <asm/arch/gpio.h>
23d8ccbe93SHeiko Schocher #include <asm/arch/mmc_host_def.h>
24d8ccbe93SHeiko Schocher #include <asm/arch/sys_proto.h>
25d8ccbe93SHeiko Schocher #include <asm/arch/mem.h>
26d8ccbe93SHeiko Schocher #include <asm/io.h>
27d8ccbe93SHeiko Schocher #include <asm/emif.h>
28d8ccbe93SHeiko Schocher #include <asm/gpio.h>
29d8ccbe93SHeiko Schocher #include <i2c.h>
30d8ccbe93SHeiko Schocher #include <miiphy.h>
31d8ccbe93SHeiko Schocher #include <cpsw.h>
32d8ccbe93SHeiko Schocher #include <power/tps65217.h>
33d8ccbe93SHeiko Schocher #include <environment.h>
34d8ccbe93SHeiko Schocher #include <watchdog.h>
35d8ccbe93SHeiko Schocher #include <environment.h>
36d8ccbe93SHeiko Schocher #include "mmc.h"
37d8ccbe93SHeiko Schocher #include "board.h"
38d8ccbe93SHeiko Schocher 
39d8ccbe93SHeiko Schocher DECLARE_GLOBAL_DATA_PTR;
40d8ccbe93SHeiko Schocher 
41d8ccbe93SHeiko Schocher #if defined(CONFIG_SPL_BUILD) || \
42d8ccbe93SHeiko Schocher 	(defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_DM_ETH))
43d8ccbe93SHeiko Schocher static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
44d8ccbe93SHeiko Schocher #endif
45d8ccbe93SHeiko Schocher static struct shc_eeprom __attribute__((section(".data"))) header;
46d8ccbe93SHeiko Schocher static int shc_eeprom_valid;
47d8ccbe93SHeiko Schocher 
48d8ccbe93SHeiko Schocher /*
49d8ccbe93SHeiko Schocher  * Read header information from EEPROM into global structure.
50d8ccbe93SHeiko Schocher  */
51d8ccbe93SHeiko Schocher static int read_eeprom(void)
52d8ccbe93SHeiko Schocher {
53d8ccbe93SHeiko Schocher 	/* Check if baseboard eeprom is available */
54d8ccbe93SHeiko Schocher 	if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {
55d8ccbe93SHeiko Schocher 		puts("Could not probe the EEPROM; something fundamentally wrong on the I2C bus.\n");
56d8ccbe93SHeiko Schocher 		return -ENODEV;
57d8ccbe93SHeiko Schocher 	}
58d8ccbe93SHeiko Schocher 
59d8ccbe93SHeiko Schocher 	/* read the eeprom using i2c */
60d8ccbe93SHeiko Schocher 	if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)&header,
61d8ccbe93SHeiko Schocher 		     sizeof(header))) {
62d8ccbe93SHeiko Schocher 		puts("Could not read the EEPROM; something fundamentally wrong on the I2C bus.\n");
63d8ccbe93SHeiko Schocher 		return -EIO;
64d8ccbe93SHeiko Schocher 	}
65d8ccbe93SHeiko Schocher 
66d8ccbe93SHeiko Schocher 	if (header.magic != HDR_MAGIC) {
67d8ccbe93SHeiko Schocher 		printf("Incorrect magic number (0x%x) in EEPROM\n",
68d8ccbe93SHeiko Schocher 		       header.magic);
69d8ccbe93SHeiko Schocher 		return -EIO;
70d8ccbe93SHeiko Schocher 	}
71d8ccbe93SHeiko Schocher 
72d8ccbe93SHeiko Schocher 	shc_eeprom_valid = 1;
73d8ccbe93SHeiko Schocher 
74d8ccbe93SHeiko Schocher 	return 0;
75d8ccbe93SHeiko Schocher }
76d8ccbe93SHeiko Schocher 
77d8ccbe93SHeiko Schocher static void shc_request_gpio(void)
78d8ccbe93SHeiko Schocher {
79d8ccbe93SHeiko Schocher 	gpio_request(LED_PWR_BL_GPIO, "LED PWR BL");
80d8ccbe93SHeiko Schocher 	gpio_request(LED_PWR_RD_GPIO, "LED PWR RD");
81d8ccbe93SHeiko Schocher 	gpio_request(RESET_GPIO, "reset");
82d8ccbe93SHeiko Schocher 	gpio_request(WIFI_REGEN_GPIO, "WIFI REGEN");
83d8ccbe93SHeiko Schocher 	gpio_request(WIFI_RST_GPIO, "WIFI rst");
84d8ccbe93SHeiko Schocher 	gpio_request(ZIGBEE_RST_GPIO, "ZigBee rst");
85d8ccbe93SHeiko Schocher 	gpio_request(BIDCOS_RST_GPIO, "BIDCOS rst");
86d8ccbe93SHeiko Schocher 	gpio_request(ENOC_RST_GPIO, "ENOC rst");
87d8ccbe93SHeiko Schocher #if defined CONFIG_B_SAMPLE
88d8ccbe93SHeiko Schocher 	gpio_request(LED_PWR_GN_GPIO, "LED PWR GN");
89d8ccbe93SHeiko Schocher 	gpio_request(LED_CONN_BL_GPIO, "LED CONN BL");
90d8ccbe93SHeiko Schocher 	gpio_request(LED_CONN_RD_GPIO, "LED CONN RD");
91d8ccbe93SHeiko Schocher 	gpio_request(LED_CONN_GN_GPIO, "LED CONN GN");
92d8ccbe93SHeiko Schocher #else
93d8ccbe93SHeiko Schocher 	gpio_request(LED_LAN_BL_GPIO, "LED LAN BL");
94d8ccbe93SHeiko Schocher 	gpio_request(LED_LAN_RD_GPIO, "LED LAN RD");
95d8ccbe93SHeiko Schocher 	gpio_request(LED_CLOUD_BL_GPIO, "LED CLOUD BL");
96d8ccbe93SHeiko Schocher 	gpio_request(LED_CLOUD_RD_GPIO, "LED CLOUD RD");
97d8ccbe93SHeiko Schocher 	gpio_request(LED_PWM_GPIO, "LED PWM");
98d8ccbe93SHeiko Schocher 	gpio_request(Z_WAVE_RST_GPIO, "Z WAVE rst");
99d8ccbe93SHeiko Schocher #endif
100d8ccbe93SHeiko Schocher 	gpio_request(BACK_BUTTON_GPIO, "Back button");
101d8ccbe93SHeiko Schocher 	gpio_request(FRONT_BUTTON_GPIO, "Front button");
102d8ccbe93SHeiko Schocher }
103d8ccbe93SHeiko Schocher 
104d8ccbe93SHeiko Schocher /*
105d8ccbe93SHeiko Schocher  * Function which forces all installed modules into running state for ICT
106d8ccbe93SHeiko Schocher  * testing. Called by SPL.
107d8ccbe93SHeiko Schocher  */
108d8ccbe93SHeiko Schocher static void __maybe_unused force_modules_running(void)
109d8ccbe93SHeiko Schocher {
110d8ccbe93SHeiko Schocher 	/* Wi-Fi power regulator enable - high = enabled */
111d8ccbe93SHeiko Schocher 	gpio_direction_output(WIFI_REGEN_GPIO, 1);
112d8ccbe93SHeiko Schocher 	/*
113d8ccbe93SHeiko Schocher 	 * Wait for Wi-Fi power regulator to reach a stable voltage
114d8ccbe93SHeiko Schocher 	 * (soft-start time, max. 350 µs)
115d8ccbe93SHeiko Schocher 	 */
116d8ccbe93SHeiko Schocher 	__udelay(350);
117d8ccbe93SHeiko Schocher 
118d8ccbe93SHeiko Schocher 	/* Wi-Fi module reset - high = running */
119d8ccbe93SHeiko Schocher 	gpio_direction_output(WIFI_RST_GPIO, 1);
120d8ccbe93SHeiko Schocher 
121d8ccbe93SHeiko Schocher 	/* ZigBee reset - high = running */
122d8ccbe93SHeiko Schocher 	gpio_direction_output(ZIGBEE_RST_GPIO, 1);
123d8ccbe93SHeiko Schocher 
124d8ccbe93SHeiko Schocher 	/* BidCos reset - high = running */
125d8ccbe93SHeiko Schocher 	gpio_direction_output(BIDCOS_RST_GPIO, 1);
126d8ccbe93SHeiko Schocher 
127d8ccbe93SHeiko Schocher #if !defined(CONFIG_B_SAMPLE)
128d8ccbe93SHeiko Schocher 	/* Z-Wave reset - high = running */
129d8ccbe93SHeiko Schocher 	gpio_direction_output(Z_WAVE_RST_GPIO, 1);
130d8ccbe93SHeiko Schocher #endif
131d8ccbe93SHeiko Schocher 
132d8ccbe93SHeiko Schocher 	/* EnOcean reset - low = running */
133d8ccbe93SHeiko Schocher 	gpio_direction_output(ENOC_RST_GPIO, 0);
134d8ccbe93SHeiko Schocher }
135d8ccbe93SHeiko Schocher 
136d8ccbe93SHeiko Schocher /*
137d8ccbe93SHeiko Schocher  * Function which forces all installed modules into reset - to be released by
138d8ccbe93SHeiko Schocher  * the OS, called by SPL
139d8ccbe93SHeiko Schocher  */
140d8ccbe93SHeiko Schocher static void __maybe_unused force_modules_reset(void)
141d8ccbe93SHeiko Schocher {
142d8ccbe93SHeiko Schocher 	/* Wi-Fi module reset - low = reset */
143d8ccbe93SHeiko Schocher 	gpio_direction_output(WIFI_RST_GPIO, 0);
144d8ccbe93SHeiko Schocher 
145d8ccbe93SHeiko Schocher 	/* Wi-Fi power regulator enable - low = disabled */
146d8ccbe93SHeiko Schocher 	gpio_direction_output(WIFI_REGEN_GPIO, 0);
147d8ccbe93SHeiko Schocher 
148d8ccbe93SHeiko Schocher 	/* ZigBee reset - low = reset */
149d8ccbe93SHeiko Schocher 	gpio_direction_output(ZIGBEE_RST_GPIO, 0);
150d8ccbe93SHeiko Schocher 
151d8ccbe93SHeiko Schocher 	/* BidCos reset - low = reset */
152d8ccbe93SHeiko Schocher 	/*gpio_direction_output(BIDCOS_RST_GPIO, 0);*/
153d8ccbe93SHeiko Schocher 
154d8ccbe93SHeiko Schocher #if !defined(CONFIG_B_SAMPLE)
155d8ccbe93SHeiko Schocher 	/* Z-Wave reset - low = reset */
156d8ccbe93SHeiko Schocher 	gpio_direction_output(Z_WAVE_RST_GPIO, 0);
157d8ccbe93SHeiko Schocher #endif
158d8ccbe93SHeiko Schocher 
159d8ccbe93SHeiko Schocher 	/* EnOcean reset - high = reset*/
160d8ccbe93SHeiko Schocher 	gpio_direction_output(ENOC_RST_GPIO, 1);
161d8ccbe93SHeiko Schocher }
162d8ccbe93SHeiko Schocher 
163d8ccbe93SHeiko Schocher /*
164d8ccbe93SHeiko Schocher  * Function to set the LEDs in the state "Bootloader booting"
165d8ccbe93SHeiko Schocher  */
166d8ccbe93SHeiko Schocher static void __maybe_unused leds_set_booting(void)
167d8ccbe93SHeiko Schocher {
168d8ccbe93SHeiko Schocher #if defined(CONFIG_B_SAMPLE)
169d8ccbe93SHeiko Schocher 
170d8ccbe93SHeiko Schocher 	/* Turn all red LEDs on */
171d8ccbe93SHeiko Schocher 	gpio_direction_output(LED_PWR_RD_GPIO, 1);
172d8ccbe93SHeiko Schocher 	gpio_direction_output(LED_CONN_RD_GPIO, 1);
173d8ccbe93SHeiko Schocher 
174d8ccbe93SHeiko Schocher #else /* All other SHCs starting with B2-Sample */
175d8ccbe93SHeiko Schocher 	/* Set the PWM GPIO */
176d8ccbe93SHeiko Schocher 	gpio_direction_output(LED_PWM_GPIO, 1);
177d8ccbe93SHeiko Schocher 	/* Turn all red LEDs on */
178d8ccbe93SHeiko Schocher 	gpio_direction_output(LED_PWR_RD_GPIO, 1);
179d8ccbe93SHeiko Schocher 	gpio_direction_output(LED_LAN_RD_GPIO, 1);
180d8ccbe93SHeiko Schocher 	gpio_direction_output(LED_CLOUD_RD_GPIO, 1);
181d8ccbe93SHeiko Schocher 
182d8ccbe93SHeiko Schocher #endif
183d8ccbe93SHeiko Schocher }
184d8ccbe93SHeiko Schocher 
185d8ccbe93SHeiko Schocher /*
186d8ccbe93SHeiko Schocher  * Function to set the LEDs in the state "Bootloader error"
187d8ccbe93SHeiko Schocher  */
188d8ccbe93SHeiko Schocher static void leds_set_failure(int state)
189d8ccbe93SHeiko Schocher {
190d8ccbe93SHeiko Schocher #if defined(CONFIG_B_SAMPLE)
191d8ccbe93SHeiko Schocher 	/* Turn all blue and green LEDs off */
192d8ccbe93SHeiko Schocher 	gpio_set_value(LED_PWR_BL_GPIO, 0);
193d8ccbe93SHeiko Schocher 	gpio_set_value(LED_PWR_GN_GPIO, 0);
194d8ccbe93SHeiko Schocher 	gpio_set_value(LED_CONN_BL_GPIO, 0);
195d8ccbe93SHeiko Schocher 	gpio_set_value(LED_CONN_GN_GPIO, 0);
196d8ccbe93SHeiko Schocher 
197d8ccbe93SHeiko Schocher 	/* Turn all red LEDs to 'state' */
198d8ccbe93SHeiko Schocher 	gpio_set_value(LED_PWR_RD_GPIO, state);
199d8ccbe93SHeiko Schocher 	gpio_set_value(LED_CONN_RD_GPIO, state);
200d8ccbe93SHeiko Schocher 
201d8ccbe93SHeiko Schocher #else /* All other SHCs starting with B2-Sample */
202d8ccbe93SHeiko Schocher 	/* Set the PWM GPIO */
203d8ccbe93SHeiko Schocher 	gpio_direction_output(LED_PWM_GPIO, 1);
204d8ccbe93SHeiko Schocher 
205d8ccbe93SHeiko Schocher 	/* Turn all blue LEDs off */
206d8ccbe93SHeiko Schocher 	gpio_set_value(LED_PWR_BL_GPIO, 0);
207d8ccbe93SHeiko Schocher 	gpio_set_value(LED_LAN_BL_GPIO, 0);
208d8ccbe93SHeiko Schocher 	gpio_set_value(LED_CLOUD_BL_GPIO, 0);
209d8ccbe93SHeiko Schocher 
210d8ccbe93SHeiko Schocher 	/* Turn all red LEDs to 'state' */
211d8ccbe93SHeiko Schocher 	gpio_set_value(LED_PWR_RD_GPIO, state);
212d8ccbe93SHeiko Schocher 	gpio_set_value(LED_LAN_RD_GPIO, state);
213d8ccbe93SHeiko Schocher 	gpio_set_value(LED_CLOUD_RD_GPIO, state);
214d8ccbe93SHeiko Schocher #endif
215d8ccbe93SHeiko Schocher }
216d8ccbe93SHeiko Schocher 
217d8ccbe93SHeiko Schocher /*
218d8ccbe93SHeiko Schocher  * Function to set the LEDs in the state "Bootloader finished"
219d8ccbe93SHeiko Schocher  */
220d8ccbe93SHeiko Schocher static void leds_set_finish(void)
221d8ccbe93SHeiko Schocher {
222d8ccbe93SHeiko Schocher #if defined(CONFIG_B_SAMPLE)
223d8ccbe93SHeiko Schocher 	/* Turn all LEDs off */
224d8ccbe93SHeiko Schocher 	gpio_set_value(LED_PWR_BL_GPIO, 0);
225d8ccbe93SHeiko Schocher 	gpio_set_value(LED_PWR_RD_GPIO, 0);
226d8ccbe93SHeiko Schocher 	gpio_set_value(LED_PWR_GN_GPIO, 0);
227d8ccbe93SHeiko Schocher 	gpio_set_value(LED_CONN_BL_GPIO, 0);
228d8ccbe93SHeiko Schocher 	gpio_set_value(LED_CONN_RD_GPIO, 0);
229d8ccbe93SHeiko Schocher 	gpio_set_value(LED_CONN_GN_GPIO, 0);
230d8ccbe93SHeiko Schocher #else /* All other SHCs starting with B2-Sample */
231d8ccbe93SHeiko Schocher 	/* Turn all LEDs off */
232d8ccbe93SHeiko Schocher 	gpio_set_value(LED_PWR_BL_GPIO, 0);
233d8ccbe93SHeiko Schocher 	gpio_set_value(LED_PWR_RD_GPIO, 0);
234d8ccbe93SHeiko Schocher 	gpio_set_value(LED_LAN_BL_GPIO, 0);
235d8ccbe93SHeiko Schocher 	gpio_set_value(LED_LAN_RD_GPIO, 0);
236d8ccbe93SHeiko Schocher 	gpio_set_value(LED_CLOUD_BL_GPIO, 0);
237d8ccbe93SHeiko Schocher 	gpio_set_value(LED_CLOUD_RD_GPIO, 0);
238d8ccbe93SHeiko Schocher 
239d8ccbe93SHeiko Schocher 	/* Turn off the PWM GPIO and mux it to EHRPWM */
240d8ccbe93SHeiko Schocher 	gpio_set_value(LED_PWM_GPIO, 0);
241d8ccbe93SHeiko Schocher 	enable_shc_board_pwm_pin_mux();
242d8ccbe93SHeiko Schocher #endif
243d8ccbe93SHeiko Schocher }
244d8ccbe93SHeiko Schocher 
245d8ccbe93SHeiko Schocher static void check_button_status(void)
246d8ccbe93SHeiko Schocher {
247d8ccbe93SHeiko Schocher 	ulong value;
248d8ccbe93SHeiko Schocher 	gpio_direction_input(FRONT_BUTTON_GPIO);
249d8ccbe93SHeiko Schocher 	value = gpio_get_value(FRONT_BUTTON_GPIO);
250d8ccbe93SHeiko Schocher 
251d8ccbe93SHeiko Schocher 	if (value == 0) {
252d8ccbe93SHeiko Schocher 		printf("front button activated !\n");
253382bee57SSimon Glass 		env_set("harakiri", "1");
254d8ccbe93SHeiko Schocher 	}
255d8ccbe93SHeiko Schocher }
256d8ccbe93SHeiko Schocher 
257d8ccbe93SHeiko Schocher #ifndef CONFIG_SKIP_LOWLEVEL_INIT
258d8ccbe93SHeiko Schocher #ifdef CONFIG_SPL_OS_BOOT
259d8ccbe93SHeiko Schocher int spl_start_uboot(void)
260d8ccbe93SHeiko Schocher {
261d8ccbe93SHeiko Schocher 	return 1;
262d8ccbe93SHeiko Schocher }
263d8ccbe93SHeiko Schocher #endif
264d8ccbe93SHeiko Schocher 
265d8ccbe93SHeiko Schocher static void shc_board_early_init(void)
266d8ccbe93SHeiko Schocher {
267d8ccbe93SHeiko Schocher 	shc_request_gpio();
268d8ccbe93SHeiko Schocher # ifdef CONFIG_SHC_ICT
269d8ccbe93SHeiko Schocher 	/* Force all modules into enabled state for ICT testing */
270d8ccbe93SHeiko Schocher 	force_modules_running();
271d8ccbe93SHeiko Schocher # else
272d8ccbe93SHeiko Schocher 	/* Force all modules to enter Reset state until released by the OS */
273d8ccbe93SHeiko Schocher 	force_modules_reset();
274d8ccbe93SHeiko Schocher # endif
275d8ccbe93SHeiko Schocher 	leds_set_booting();
276d8ccbe93SHeiko Schocher }
277d8ccbe93SHeiko Schocher 
278d8ccbe93SHeiko Schocher #define MPU_SPREADING_PERMILLE 18 /* Spread 1.8 percent */
279d8ccbe93SHeiko Schocher #define OSC	(V_OSCK/1000000)
280d8ccbe93SHeiko Schocher /* Bosch: Predivider must be fixed to 4, so N = 4-1 */
281d8ccbe93SHeiko Schocher #define MPUPLL_N        (4-1)
282d8ccbe93SHeiko Schocher /* Bosch: Fref = 24 MHz / (N+1) = 24 MHz / 4 = 6 MHz */
283d8ccbe93SHeiko Schocher #define MPUPLL_FREF (OSC / (MPUPLL_N + 1))
284d8ccbe93SHeiko Schocher 
285d8ccbe93SHeiko Schocher const struct dpll_params dpll_ddr_shc = {
286d8ccbe93SHeiko Schocher 		400, OSC-1, 1, -1, -1, -1, -1};
287d8ccbe93SHeiko Schocher 
288d8ccbe93SHeiko Schocher const struct dpll_params *get_dpll_ddr_params(void)
289d8ccbe93SHeiko Schocher {
290d8ccbe93SHeiko Schocher 	return &dpll_ddr_shc;
291d8ccbe93SHeiko Schocher }
292d8ccbe93SHeiko Schocher 
293d8ccbe93SHeiko Schocher /*
294d8ccbe93SHeiko Schocher  * As we enabled downspread SSC with 1.8%, the values needed to be corrected
295d8ccbe93SHeiko Schocher  * such that the 20% overshoot will not lead to too high frequencies.
296d8ccbe93SHeiko Schocher  * In all cases, this is achieved by subtracting one from M (6 MHz less).
297d8ccbe93SHeiko Schocher  * Example: 600 MHz CPU
298d8ccbe93SHeiko Schocher  *   Step size: 24 MHz OSC, N = 4 (fix) --> Fref = 6 MHz
299d8ccbe93SHeiko Schocher  *   600 MHz - 6 MHz (1x Fref) = 594 MHz
300d8ccbe93SHeiko Schocher  *   SSC: 594 MHz * 1.8% = 10.7 MHz SSC
301d8ccbe93SHeiko Schocher  *   Overshoot: 10.7 MHz * 20 % = 2.2 MHz
302d8ccbe93SHeiko Schocher  *   --> Fmax = 594 MHz + 2.2 MHz = 596.2 MHz, lower than 600 MHz --> OK!
303d8ccbe93SHeiko Schocher  */
304d8ccbe93SHeiko Schocher const struct dpll_params dpll_mpu_shc_opp100 = {
305d8ccbe93SHeiko Schocher 		99, MPUPLL_N, 1, -1, -1, -1, -1};
306d8ccbe93SHeiko Schocher 
307d8ccbe93SHeiko Schocher void am33xx_spl_board_init(void)
308d8ccbe93SHeiko Schocher {
309d8ccbe93SHeiko Schocher 	int sil_rev;
310d8ccbe93SHeiko Schocher 	int mpu_vdd;
311d8ccbe93SHeiko Schocher 
312d8ccbe93SHeiko Schocher 	puts(BOARD_ID_STR);
313d8ccbe93SHeiko Schocher 
314d8ccbe93SHeiko Schocher 	/*
315d8ccbe93SHeiko Schocher 	 * Set CORE Frequency to OPP100
316d8ccbe93SHeiko Schocher 	 * Hint: DCDC3 (CORE) defaults to 1.100V (for OPP100)
317d8ccbe93SHeiko Schocher 	 */
318d8ccbe93SHeiko Schocher 	do_setup_dpll(&dpll_core_regs, &dpll_core_opp100);
319d8ccbe93SHeiko Schocher 
320d8ccbe93SHeiko Schocher 	sil_rev = readl(&cdev->deviceid) >> 28;
321d8ccbe93SHeiko Schocher 	if (sil_rev < 2) {
322d8ccbe93SHeiko Schocher 		puts("We do not support Silicon Revisions below 2.0!\n");
323d8ccbe93SHeiko Schocher 		return;
324d8ccbe93SHeiko Schocher 	}
325d8ccbe93SHeiko Schocher 
326d8ccbe93SHeiko Schocher 	dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev);
327d8ccbe93SHeiko Schocher 	if (i2c_probe(TPS65217_CHIP_PM))
328d8ccbe93SHeiko Schocher 		return;
329d8ccbe93SHeiko Schocher 
330d8ccbe93SHeiko Schocher 	/*
331d8ccbe93SHeiko Schocher 	 * Retrieve the CPU max frequency by reading the efuse
332d8ccbe93SHeiko Schocher 	 * SHC-Default: 600 MHz
333d8ccbe93SHeiko Schocher 	 */
334d8ccbe93SHeiko Schocher 	switch (dpll_mpu_opp100.m) {
335d8ccbe93SHeiko Schocher 	case MPUPLL_M_1000:
336d8ccbe93SHeiko Schocher 		mpu_vdd = TPS65217_DCDC_VOLT_SEL_1325MV;
337d8ccbe93SHeiko Schocher 		break;
338d8ccbe93SHeiko Schocher 	case MPUPLL_M_800:
339d8ccbe93SHeiko Schocher 		mpu_vdd = TPS65217_DCDC_VOLT_SEL_1275MV;
340d8ccbe93SHeiko Schocher 		break;
341d8ccbe93SHeiko Schocher 	case MPUPLL_M_720:
342d8ccbe93SHeiko Schocher 		mpu_vdd = TPS65217_DCDC_VOLT_SEL_1200MV;
343d8ccbe93SHeiko Schocher 		break;
344d8ccbe93SHeiko Schocher 	case MPUPLL_M_600:
345d8ccbe93SHeiko Schocher 		mpu_vdd = TPS65217_DCDC_VOLT_SEL_1100MV;
346d8ccbe93SHeiko Schocher 		break;
347d8ccbe93SHeiko Schocher 	case MPUPLL_M_300:
348d8ccbe93SHeiko Schocher 		mpu_vdd = TPS65217_DCDC_VOLT_SEL_950MV;
349d8ccbe93SHeiko Schocher 		break;
350d8ccbe93SHeiko Schocher 	default:
351d8ccbe93SHeiko Schocher 		puts("Cannot determine the frequency, failing!\n");
352d8ccbe93SHeiko Schocher 		return;
353d8ccbe93SHeiko Schocher 	}
354d8ccbe93SHeiko Schocher 
355d8ccbe93SHeiko Schocher 	if (tps65217_voltage_update(TPS65217_DEFDCDC2, mpu_vdd)) {
356d8ccbe93SHeiko Schocher 		puts("tps65217_voltage_update failure\n");
357d8ccbe93SHeiko Schocher 		return;
358d8ccbe93SHeiko Schocher 	}
359d8ccbe93SHeiko Schocher 
360d8ccbe93SHeiko Schocher 	/* Set MPU Frequency to what we detected */
361d8ccbe93SHeiko Schocher 	printf("MPU reference clock runs at %d MHz\n", MPUPLL_FREF);
362d8ccbe93SHeiko Schocher 	printf("Setting MPU clock to %d MHz\n", MPUPLL_FREF *
363d8ccbe93SHeiko Schocher 	       dpll_mpu_shc_opp100.m);
364d8ccbe93SHeiko Schocher 	do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_shc_opp100);
365d8ccbe93SHeiko Schocher 
366d8ccbe93SHeiko Schocher 	/* Enable Spread Spectrum for this freq to be clean on EMI side */
367d8ccbe93SHeiko Schocher 	set_mpu_spreadspectrum(MPU_SPREADING_PERMILLE);
368d8ccbe93SHeiko Schocher 
369d8ccbe93SHeiko Schocher 	/*
370d8ccbe93SHeiko Schocher 	 * Using the default voltages for the PMIC (TPS65217D)
371d8ccbe93SHeiko Schocher 	 * LS1 = 1.8V (VDD_1V8)
372d8ccbe93SHeiko Schocher 	 * LS2 = 3.3V (VDD_3V3A)
373d8ccbe93SHeiko Schocher 	 * LDO1 = 1.8V (VIO and VRTC)
374d8ccbe93SHeiko Schocher 	 * LDO2 = 3.3V (VDD_3V3AUX)
375d8ccbe93SHeiko Schocher 	 */
376d8ccbe93SHeiko Schocher 	shc_board_early_init();
377d8ccbe93SHeiko Schocher }
378d8ccbe93SHeiko Schocher 
379d8ccbe93SHeiko Schocher void set_uart_mux_conf(void)
380d8ccbe93SHeiko Schocher {
381d8ccbe93SHeiko Schocher 	enable_uart0_pin_mux();
382d8ccbe93SHeiko Schocher }
383d8ccbe93SHeiko Schocher 
384d8ccbe93SHeiko Schocher void set_mux_conf_regs(void)
385d8ccbe93SHeiko Schocher {
386d8ccbe93SHeiko Schocher 	enable_shc_board_pin_mux();
387d8ccbe93SHeiko Schocher }
388d8ccbe93SHeiko Schocher 
389d8ccbe93SHeiko Schocher const struct ctrl_ioregs ioregs_evmsk = {
390d8ccbe93SHeiko Schocher 	.cm0ioctl		= MT41K256M16HA125E_IOCTRL_VALUE,
391d8ccbe93SHeiko Schocher 	.cm1ioctl		= MT41K256M16HA125E_IOCTRL_VALUE,
392d8ccbe93SHeiko Schocher 	.cm2ioctl		= MT41K256M16HA125E_IOCTRL_VALUE,
393d8ccbe93SHeiko Schocher 	.dt0ioctl		= MT41K256M16HA125E_IOCTRL_VALUE,
394d8ccbe93SHeiko Schocher 	.dt1ioctl		= MT41K256M16HA125E_IOCTRL_VALUE,
395d8ccbe93SHeiko Schocher };
396d8ccbe93SHeiko Schocher 
397d8ccbe93SHeiko Schocher static const struct ddr_data ddr3_shc_data = {
398d8ccbe93SHeiko Schocher 	.datardsratio0 = MT41K256M16HA125E_RD_DQS,
399d8ccbe93SHeiko Schocher 	.datawdsratio0 = MT41K256M16HA125E_WR_DQS,
400d8ccbe93SHeiko Schocher 	.datafwsratio0 = MT41K256M16HA125E_PHY_FIFO_WE,
401d8ccbe93SHeiko Schocher 	.datawrsratio0 = MT41K256M16HA125E_PHY_WR_DATA,
402d8ccbe93SHeiko Schocher };
403d8ccbe93SHeiko Schocher 
404d8ccbe93SHeiko Schocher static const struct cmd_control ddr3_shc_cmd_ctrl_data = {
405d8ccbe93SHeiko Schocher 	.cmd0csratio = MT41K256M16HA125E_RATIO,
406d8ccbe93SHeiko Schocher 	.cmd0iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
407d8ccbe93SHeiko Schocher 
408d8ccbe93SHeiko Schocher 	.cmd1csratio = MT41K256M16HA125E_RATIO,
409d8ccbe93SHeiko Schocher 	.cmd1iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
410d8ccbe93SHeiko Schocher 
411d8ccbe93SHeiko Schocher 	.cmd2csratio = MT41K256M16HA125E_RATIO,
412d8ccbe93SHeiko Schocher 	.cmd2iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
413d8ccbe93SHeiko Schocher };
414d8ccbe93SHeiko Schocher 
415d8ccbe93SHeiko Schocher static struct emif_regs ddr3_shc_emif_reg_data = {
416d8ccbe93SHeiko Schocher 	.sdram_config = MT41K256M16HA125E_EMIF_SDCFG,
417d8ccbe93SHeiko Schocher 	.ref_ctrl = MT41K256M16HA125E_EMIF_SDREF,
418d8ccbe93SHeiko Schocher 	.sdram_tim1 = MT41K256M16HA125E_EMIF_TIM1,
419d8ccbe93SHeiko Schocher 	.sdram_tim2 = MT41K256M16HA125E_EMIF_TIM2,
420d8ccbe93SHeiko Schocher 	.sdram_tim3 = MT41K256M16HA125E_EMIF_TIM3,
421d8ccbe93SHeiko Schocher 	.zq_config = MT41K256M16HA125E_ZQ_CFG,
422d8ccbe93SHeiko Schocher 	.emif_ddr_phy_ctlr_1 = MT41K256M16HA125E_EMIF_READ_LATENCY |
423d8ccbe93SHeiko Schocher 				PHY_EN_DYN_PWRDN,
424d8ccbe93SHeiko Schocher };
425d8ccbe93SHeiko Schocher 
426d8ccbe93SHeiko Schocher void sdram_init(void)
427d8ccbe93SHeiko Schocher {
428d8ccbe93SHeiko Schocher 	/* Configure the DDR3 RAM */
429d8ccbe93SHeiko Schocher 	config_ddr(400, &ioregs_evmsk, &ddr3_shc_data,
430d8ccbe93SHeiko Schocher 		   &ddr3_shc_cmd_ctrl_data, &ddr3_shc_emif_reg_data, 0);
431d8ccbe93SHeiko Schocher }
432d8ccbe93SHeiko Schocher #endif
433d8ccbe93SHeiko Schocher 
434d8ccbe93SHeiko Schocher /*
435d8ccbe93SHeiko Schocher  * Basic board specific setup.  Pinmux has been handled already.
436d8ccbe93SHeiko Schocher  */
437d8ccbe93SHeiko Schocher int board_init(void)
438d8ccbe93SHeiko Schocher {
439d8ccbe93SHeiko Schocher #if defined(CONFIG_HW_WATCHDOG)
440d8ccbe93SHeiko Schocher 	hw_watchdog_init();
441d8ccbe93SHeiko Schocher #endif
442d8ccbe93SHeiko Schocher 	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
443d8ccbe93SHeiko Schocher 	if (read_eeprom() < 0)
444d8ccbe93SHeiko Schocher 		puts("EEPROM Content Invalid.\n");
445d8ccbe93SHeiko Schocher 
446d8ccbe93SHeiko Schocher 	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
447d8ccbe93SHeiko Schocher #if defined(CONFIG_NOR) || defined(CONFIG_NAND)
448d8ccbe93SHeiko Schocher 	gpmc_init();
449d8ccbe93SHeiko Schocher #endif
450d8ccbe93SHeiko Schocher 	shc_request_gpio();
451d8ccbe93SHeiko Schocher 
452d8ccbe93SHeiko Schocher 	return 0;
453d8ccbe93SHeiko Schocher }
454d8ccbe93SHeiko Schocher 
455d8ccbe93SHeiko Schocher #ifdef CONFIG_BOARD_LATE_INIT
456d8ccbe93SHeiko Schocher int board_late_init(void)
457d8ccbe93SHeiko Schocher {
458d8ccbe93SHeiko Schocher 	check_button_status();
459d8ccbe93SHeiko Schocher #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
460d8ccbe93SHeiko Schocher 	if (shc_eeprom_valid)
461d8ccbe93SHeiko Schocher 		if (is_valid_ethaddr(header.mac_addr))
462fd1e959eSSimon Glass 			eth_env_set_enetaddr("ethaddr", header.mac_addr);
463d8ccbe93SHeiko Schocher #endif
464d8ccbe93SHeiko Schocher 
465d8ccbe93SHeiko Schocher 	return 0;
466d8ccbe93SHeiko Schocher }
467d8ccbe93SHeiko Schocher #endif
468d8ccbe93SHeiko Schocher 
469d8ccbe93SHeiko Schocher #ifndef CONFIG_DM_ETH
470d8ccbe93SHeiko Schocher #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
471d8ccbe93SHeiko Schocher 	(defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
472d8ccbe93SHeiko Schocher static void cpsw_control(int enabled)
473d8ccbe93SHeiko Schocher {
474d8ccbe93SHeiko Schocher 	/* VTP can be added here */
475d8ccbe93SHeiko Schocher 
476d8ccbe93SHeiko Schocher 	return;
477d8ccbe93SHeiko Schocher }
478d8ccbe93SHeiko Schocher 
479d8ccbe93SHeiko Schocher static struct cpsw_slave_data cpsw_slaves[] = {
480d8ccbe93SHeiko Schocher 	{
481d8ccbe93SHeiko Schocher 		.slave_reg_ofs	= 0x208,
482d8ccbe93SHeiko Schocher 		.sliver_reg_ofs	= 0xd80,
483d8ccbe93SHeiko Schocher 		.phy_addr	= 0,
484d8ccbe93SHeiko Schocher 	},
485d8ccbe93SHeiko Schocher 	{
486d8ccbe93SHeiko Schocher 		.slave_reg_ofs	= 0x308,
487d8ccbe93SHeiko Schocher 		.sliver_reg_ofs	= 0xdc0,
488d8ccbe93SHeiko Schocher 		.phy_addr	= 1,
489d8ccbe93SHeiko Schocher 	},
490d8ccbe93SHeiko Schocher };
491d8ccbe93SHeiko Schocher 
492d8ccbe93SHeiko Schocher static struct cpsw_platform_data cpsw_data = {
493d8ccbe93SHeiko Schocher 	.mdio_base		= CPSW_MDIO_BASE,
494d8ccbe93SHeiko Schocher 	.cpsw_base		= CPSW_BASE,
495d8ccbe93SHeiko Schocher 	.mdio_div		= 0xff,
496d8ccbe93SHeiko Schocher 	.channels		= 8,
497d8ccbe93SHeiko Schocher 	.cpdma_reg_ofs		= 0x800,
498d8ccbe93SHeiko Schocher 	.slaves			= 1,
499d8ccbe93SHeiko Schocher 	.slave_data		= cpsw_slaves,
500d8ccbe93SHeiko Schocher 	.ale_reg_ofs		= 0xd00,
501d8ccbe93SHeiko Schocher 	.ale_entries		= 1024,
502d8ccbe93SHeiko Schocher 	.host_port_reg_ofs	= 0x108,
503d8ccbe93SHeiko Schocher 	.hw_stats_reg_ofs	= 0x900,
504d8ccbe93SHeiko Schocher 	.bd_ram_ofs		= 0x2000,
505d8ccbe93SHeiko Schocher 	.mac_control		= (1 << 5),
506d8ccbe93SHeiko Schocher 	.control		= cpsw_control,
507d8ccbe93SHeiko Schocher 	.host_port_num		= 0,
508d8ccbe93SHeiko Schocher 	.version		= CPSW_CTRL_VERSION_2,
509d8ccbe93SHeiko Schocher };
510d8ccbe93SHeiko Schocher #endif
511d8ccbe93SHeiko Schocher 
512d8ccbe93SHeiko Schocher /*
513d8ccbe93SHeiko Schocher  * This function will:
514d8ccbe93SHeiko Schocher  * Read the eFuse for MAC addresses, and set ethaddr/eth1addr/usbnet_devaddr
515d8ccbe93SHeiko Schocher  * in the environment
516d8ccbe93SHeiko Schocher  * Perform fixups to the PHY present on certain boards.  We only need this
517d8ccbe93SHeiko Schocher  * function in:
518d8ccbe93SHeiko Schocher  * - SPL with either CPSW or USB ethernet support
519d8ccbe93SHeiko Schocher  * - Full U-Boot, with either CPSW or USB ethernet
520d8ccbe93SHeiko Schocher  * Build in only these cases to avoid warnings about unused variables
521d8ccbe93SHeiko Schocher  * when we build an SPL that has neither option but full U-Boot will.
522d8ccbe93SHeiko Schocher  */
523d8ccbe93SHeiko Schocher #if ((defined(CONFIG_SPL_ETH_SUPPORT) || \
524b432b1ebSFaiz Abbas 	defined(CONFIG_SPL_USB_ETHER)) && \
525d8ccbe93SHeiko Schocher 	defined(CONFIG_SPL_BUILD)) || \
526d8ccbe93SHeiko Schocher 	((defined(CONFIG_DRIVER_TI_CPSW) || \
527d8ccbe93SHeiko Schocher 	  defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)) && \
528d8ccbe93SHeiko Schocher 	 !defined(CONFIG_SPL_BUILD))
529d8ccbe93SHeiko Schocher int board_eth_init(bd_t *bis)
530d8ccbe93SHeiko Schocher {
531d8ccbe93SHeiko Schocher 	int rv, n = 0;
532d8ccbe93SHeiko Schocher 	uint8_t mac_addr[6];
533d8ccbe93SHeiko Schocher 	uint32_t mac_hi, mac_lo;
534d8ccbe93SHeiko Schocher 
535d8ccbe93SHeiko Schocher 	/* try reading mac address from efuse */
536d8ccbe93SHeiko Schocher 	mac_lo = readl(&cdev->macid0l);
537d8ccbe93SHeiko Schocher 	mac_hi = readl(&cdev->macid0h);
538d8ccbe93SHeiko Schocher 	mac_addr[0] = mac_hi & 0xFF;
539d8ccbe93SHeiko Schocher 	mac_addr[1] = (mac_hi & 0xFF00) >> 8;
540d8ccbe93SHeiko Schocher 	mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
541d8ccbe93SHeiko Schocher 	mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
542d8ccbe93SHeiko Schocher 	mac_addr[4] = mac_lo & 0xFF;
543d8ccbe93SHeiko Schocher 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
544d8ccbe93SHeiko Schocher 
545d8ccbe93SHeiko Schocher #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
546d8ccbe93SHeiko Schocher 	(defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
54700caae6dSSimon Glass 	if (!env_get("ethaddr")) {
548d8ccbe93SHeiko Schocher 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
549d8ccbe93SHeiko Schocher 
550d8ccbe93SHeiko Schocher 		if (is_valid_ethaddr(mac_addr))
551fd1e959eSSimon Glass 			eth_env_set_enetaddr("ethaddr", mac_addr);
552d8ccbe93SHeiko Schocher 	}
553d8ccbe93SHeiko Schocher 
554d8ccbe93SHeiko Schocher 	writel(MII_MODE_ENABLE, &cdev->miisel);
555d8ccbe93SHeiko Schocher 	cpsw_slaves[0].phy_if =	PHY_INTERFACE_MODE_MII;
556d8ccbe93SHeiko Schocher 	cpsw_slaves[1].phy_if = cpsw_slaves[0].phy_if;
557d8ccbe93SHeiko Schocher 	rv = cpsw_register(&cpsw_data);
558d8ccbe93SHeiko Schocher 	if (rv < 0)
559d8ccbe93SHeiko Schocher 		printf("Error %d registering CPSW switch\n", rv);
560d8ccbe93SHeiko Schocher 	else
561d8ccbe93SHeiko Schocher 		n += rv;
562d8ccbe93SHeiko Schocher #endif
563d8ccbe93SHeiko Schocher 
564d8ccbe93SHeiko Schocher #if defined(CONFIG_USB_ETHER) && \
565b432b1ebSFaiz Abbas 	(!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USB_ETHER))
566d8ccbe93SHeiko Schocher 	if (is_valid_ethaddr(mac_addr))
567fd1e959eSSimon Glass 		eth_env_set_enetaddr("usbnet_devaddr", mac_addr);
568d8ccbe93SHeiko Schocher 
569d8ccbe93SHeiko Schocher 	rv = usb_eth_initialize(bis);
570d8ccbe93SHeiko Schocher 	if (rv < 0)
571d8ccbe93SHeiko Schocher 		printf("Error %d registering USB_ETHER\n", rv);
572d8ccbe93SHeiko Schocher 	else
573d8ccbe93SHeiko Schocher 		n += rv;
574d8ccbe93SHeiko Schocher #endif
575d8ccbe93SHeiko Schocher 	return n;
576d8ccbe93SHeiko Schocher }
577d8ccbe93SHeiko Schocher #endif
578d8ccbe93SHeiko Schocher 
579d8ccbe93SHeiko Schocher #endif /* CONFIG_DM_ETH */
580d8ccbe93SHeiko Schocher 
581d8ccbe93SHeiko Schocher #ifdef CONFIG_SHOW_BOOT_PROGRESS
582d8ccbe93SHeiko Schocher static void bosch_check_reset_pin(void)
583d8ccbe93SHeiko Schocher {
584d8ccbe93SHeiko Schocher 	if (readl(GPIO1_BASE + OMAP_GPIO_IRQSTATUS_SET_0) & RESET_MASK) {
585d8ccbe93SHeiko Schocher 		printf("Resetting ...\n");
586d8ccbe93SHeiko Schocher 		writel(RESET_MASK, GPIO1_BASE + OMAP_GPIO_IRQSTATUS_SET_0);
587d8ccbe93SHeiko Schocher 		disable_interrupts();
588d8ccbe93SHeiko Schocher 		reset_cpu(0);
589d8ccbe93SHeiko Schocher 		/*NOTREACHED*/
590d8ccbe93SHeiko Schocher 	}
591d8ccbe93SHeiko Schocher }
592d8ccbe93SHeiko Schocher 
593d8ccbe93SHeiko Schocher static void hang_bosch(const char *cause, int code)
594d8ccbe93SHeiko Schocher {
595d8ccbe93SHeiko Schocher 	int lv;
596d8ccbe93SHeiko Schocher 
597d8ccbe93SHeiko Schocher 	gpio_direction_input(RESET_GPIO);
598d8ccbe93SHeiko Schocher 
599d8ccbe93SHeiko Schocher 	/* Enable reset pin interrupt on falling edge */
600d8ccbe93SHeiko Schocher 	writel(RESET_MASK, GPIO1_BASE + OMAP_GPIO_IRQSTATUS_SET_0);
601d8ccbe93SHeiko Schocher 	writel(RESET_MASK, GPIO1_BASE + OMAP_GPIO_FALLINGDETECT);
602d8ccbe93SHeiko Schocher 	enable_interrupts();
603d8ccbe93SHeiko Schocher 
604d8ccbe93SHeiko Schocher 	puts(cause);
605d8ccbe93SHeiko Schocher 	for (;;) {
606d8ccbe93SHeiko Schocher 		for (lv = 0; lv < code; lv++) {
607d8ccbe93SHeiko Schocher 			bosch_check_reset_pin();
608d8ccbe93SHeiko Schocher 			leds_set_failure(1);
609d8ccbe93SHeiko Schocher 			__udelay(150 * 1000);
610d8ccbe93SHeiko Schocher 			leds_set_failure(0);
611d8ccbe93SHeiko Schocher 			__udelay(150 * 1000);
612d8ccbe93SHeiko Schocher 		}
613d8ccbe93SHeiko Schocher #if defined(BLINK_CODE)
614d8ccbe93SHeiko Schocher 		__udelay(300 * 1000);
615d8ccbe93SHeiko Schocher #endif
616d8ccbe93SHeiko Schocher 	}
617d8ccbe93SHeiko Schocher }
618d8ccbe93SHeiko Schocher 
619d8ccbe93SHeiko Schocher void show_boot_progress(int val)
620d8ccbe93SHeiko Schocher {
621d8ccbe93SHeiko Schocher 	switch (val) {
622d8ccbe93SHeiko Schocher 	case BOOTSTAGE_ID_NEED_RESET:
623d8ccbe93SHeiko Schocher 		hang_bosch("need reset", 4);
624d8ccbe93SHeiko Schocher 		break;
625d8ccbe93SHeiko Schocher 	}
626d8ccbe93SHeiko Schocher }
627d8ccbe93SHeiko Schocher #endif
628d8ccbe93SHeiko Schocher 
629d8ccbe93SHeiko Schocher void arch_preboot_os(void)
630d8ccbe93SHeiko Schocher {
631d8ccbe93SHeiko Schocher 	leds_set_finish();
632d8ccbe93SHeiko Schocher }
633d8ccbe93SHeiko Schocher 
6344aa2ba3aSMasahiro Yamada #if defined(CONFIG_MMC)
635d8ccbe93SHeiko Schocher int board_mmc_init(bd_t *bis)
636d8ccbe93SHeiko Schocher {
637d8ccbe93SHeiko Schocher 	int ret;
638d8ccbe93SHeiko Schocher 
639d8ccbe93SHeiko Schocher 	/* Bosch: Do not enable 52MHz for eMMC device to avoid EMI */
640d8ccbe93SHeiko Schocher 	ret = omap_mmc_init(0, MMC_MODE_HS_52MHz, 26000000, -1, -1);
641d8ccbe93SHeiko Schocher 	if (ret)
642d8ccbe93SHeiko Schocher 		return ret;
643d8ccbe93SHeiko Schocher 
644d8ccbe93SHeiko Schocher 	ret = omap_mmc_init(1, MMC_MODE_HS_52MHz, 26000000, -1, -1);
645d8ccbe93SHeiko Schocher 	return ret;
646d8ccbe93SHeiko Schocher }
647d8ccbe93SHeiko Schocher #endif
648