blob: f1d7cb8c93a2440230718311e950ef18704635d6 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Marek Vasut64a93862013-01-12 07:11:11 +00002/*
3 * Olimex MX23 Olinuxino board
4 *
5 * Copyright (C) 2013 Marek Vasut <marex@denx.de>
Marek Vasut64a93862013-01-12 07:11:11 +00006 */
7
8#include <common.h>
Otavio Salvador7315e3b2013-03-07 07:32:53 +00009#include <asm/gpio.h>
Marek Vasut13b1ebd2013-01-22 15:01:05 +000010#include <asm/io.h>
11#include <asm/arch/iomux-mx23.h>
Marek Vasut64a93862013-01-12 07:11:11 +000012#include <asm/arch/imx-regs.h>
Marek Vasut13b1ebd2013-01-22 15:01:05 +000013#include <asm/arch/clock.h>
Marek Vasut64a93862013-01-12 07:11:11 +000014#include <asm/arch/sys_proto.h>
Uri Mashiach2d8d1902017-01-19 10:51:45 +020015#ifdef CONFIG_LED_STATUS
Otavio Salvador36c7c922013-02-23 02:43:09 +000016#include <status_led.h>
17#endif
Marek Vasut64a93862013-01-12 07:11:11 +000018
19DECLARE_GLOBAL_DATA_PTR;
20
21/*
22 * Functions
23 */
24int board_early_init_f(void)
25{
Marek Vasut13b1ebd2013-01-22 15:01:05 +000026 /* IO0 clock at 480MHz */
27 mxs_set_ioclk(MXC_IOCLK0, 480000);
28
29 /* SSP0 clock at 96MHz */
30 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
31
Marek Vasut64a93862013-01-12 07:11:11 +000032 return 0;
33}
34
Marek Vasutca11db22014-04-28 03:38:42 +020035#ifdef CONFIG_CMD_USB
36int board_ehci_hcd_init(int port)
37{
38 /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */
39 gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
40 udelay(100);
41 return 0;
42}
43
44int board_ehci_hcd_exit(int port)
45{
46 /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */
47 gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 0);
48 return 0;
49}
50#endif
51
Marek Vasut64a93862013-01-12 07:11:11 +000052int dram_init(void)
53{
54 return mxs_dram_init();
55}
56
Marek Vasut13b1ebd2013-01-22 15:01:05 +000057#ifdef CONFIG_CMD_MMC
58static int mx23_olx_mmc_cd(int id)
59{
60 return 1; /* Card always present */
61}
62
63int board_mmc_init(bd_t *bis)
64{
65 return mxsmmc_initialize(bis, 0, NULL, mx23_olx_mmc_cd);
66}
67#endif
68
Marek Vasut64a93862013-01-12 07:11:11 +000069int board_init(void)
70{
71 /* Adress of boot parameters */
72 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
73
Uri Mashiach2d8d1902017-01-19 10:51:45 +020074#if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE)
75 status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_STATE);
Otavio Salvador36c7c922013-02-23 02:43:09 +000076#endif
77
Marek Vasut64a93862013-01-12 07:11:11 +000078 return 0;
79}