blob: e2a03a110b6d69c2bf0016f39ec59d6d1aae325f [file] [log] [blame]
Marek Vasut64a93862013-01-12 07:11:11 +00001/*
2 * Olimex MX23 Olinuxino board
3 *
4 * Copyright (C) 2013 Marek Vasut <marex@denx.de>
5 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Marek Vasut64a93862013-01-12 07:11:11 +00007 */
8
9#include <common.h>
Otavio Salvador7315e3b2013-03-07 07:32:53 +000010#include <asm/gpio.h>
Marek Vasut13b1ebd2013-01-22 15:01:05 +000011#include <asm/io.h>
12#include <asm/arch/iomux-mx23.h>
Marek Vasut64a93862013-01-12 07:11:11 +000013#include <asm/arch/imx-regs.h>
Marek Vasut13b1ebd2013-01-22 15:01:05 +000014#include <asm/arch/clock.h>
Marek Vasut64a93862013-01-12 07:11:11 +000015#include <asm/arch/sys_proto.h>
Otavio Salvador36c7c922013-02-23 02:43:09 +000016#ifdef CONFIG_STATUS_LED
17#include <status_led.h>
18#endif
Marek Vasut64a93862013-01-12 07:11:11 +000019
20DECLARE_GLOBAL_DATA_PTR;
21
22/*
23 * Functions
24 */
25int board_early_init_f(void)
26{
Marek Vasut13b1ebd2013-01-22 15:01:05 +000027 /* IO0 clock at 480MHz */
28 mxs_set_ioclk(MXC_IOCLK0, 480000);
29
30 /* SSP0 clock at 96MHz */
31 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
32
Otavio Salvadorebe1d172013-03-02 05:17:29 +000033#ifdef CONFIG_CMD_USB
34 /* Enable LAN9512 */
35 gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
36#endif
37
Marek Vasut64a93862013-01-12 07:11:11 +000038 return 0;
39}
40
41int dram_init(void)
42{
43 return mxs_dram_init();
44}
45
Marek Vasut13b1ebd2013-01-22 15:01:05 +000046#ifdef CONFIG_CMD_MMC
47static int mx23_olx_mmc_cd(int id)
48{
49 return 1; /* Card always present */
50}
51
52int board_mmc_init(bd_t *bis)
53{
54 return mxsmmc_initialize(bis, 0, NULL, mx23_olx_mmc_cd);
55}
56#endif
57
Marek Vasut64a93862013-01-12 07:11:11 +000058int board_init(void)
59{
60 /* Adress of boot parameters */
61 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
62
Otavio Salvador36c7c922013-02-23 02:43:09 +000063#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
64 status_led_set(STATUS_LED_BOOT, STATUS_LED_STATE);
65#endif
66
Marek Vasut64a93862013-01-12 07:11:11 +000067 return 0;
68}