1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Olimex MX23 Olinuxino board
4  *
5  * Copyright (C) 2013 Marek Vasut <marex@denx.de>
6  */
7 
8 #include <init.h>
9 #include <asm/global_data.h>
10 #include <asm/gpio.h>
11 #include <asm/io.h>
12 #include <asm/arch/iomux-mx23.h>
13 #include <asm/arch/imx-regs.h>
14 #include <asm/arch/clock.h>
15 #include <asm/arch/sys_proto.h>
16 #ifdef CONFIG_LED_STATUS
17 #include <status_led.h>
18 #endif
19 #include <linux/delay.h>
20 
21 DECLARE_GLOBAL_DATA_PTR;
22 
23 /*
24  * Functions
25  */
board_early_init_f(void)26 int board_early_init_f(void)
27 {
28 	/* IO0 clock at 480MHz */
29 	mxs_set_ioclk(MXC_IOCLK0, 480000);
30 
31 	/* SSP0 clock at 96MHz */
32 	mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
33 
34 	return 0;
35 }
36 
37 #ifdef CONFIG_CMD_USB
board_ehci_hcd_init(int port)38 int board_ehci_hcd_init(int port)
39 {
40 	/* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */
41 	gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
42 	udelay(100);
43 	return 0;
44 }
45 
board_ehci_hcd_exit(int port)46 int board_ehci_hcd_exit(int port)
47 {
48 	/* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */
49 	gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 0);
50 	return 0;
51 }
52 #endif
53 
dram_init(void)54 int dram_init(void)
55 {
56 	return mxs_dram_init();
57 }
58 
board_init(void)59 int board_init(void)
60 {
61 	/* Adress of boot parameters */
62 	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
63 
64 #if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE)
65 	status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_STATE);
66 #endif
67 
68 	return 0;
69 }
70