blob: f13fdb8d47e76db7e65f45e5adc8a3484c0e238d [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Marek Vasut189e35b2013-01-12 07:11:11 +00002/*
3 * Olimex MX23 Olinuxino board
4 *
5 * Copyright (C) 2013 Marek Vasut <marex@denx.de>
Marek Vasut189e35b2013-01-12 07:11:11 +00006 */
7
8#include <common.h>
Simon Glass97589732020-05-10 11:40:02 -06009#include <init.h>
Otavio Salvador3600ec32013-03-07 07:32:53 +000010#include <asm/gpio.h>
Marek Vasut73f2b032013-01-22 15:01:05 +000011#include <asm/io.h>
12#include <asm/arch/iomux-mx23.h>
Marek Vasut189e35b2013-01-12 07:11:11 +000013#include <asm/arch/imx-regs.h>
Marek Vasut73f2b032013-01-22 15:01:05 +000014#include <asm/arch/clock.h>
Marek Vasut189e35b2013-01-12 07:11:11 +000015#include <asm/arch/sys_proto.h>
Uri Mashiach4892d392017-01-19 10:51:45 +020016#ifdef CONFIG_LED_STATUS
Otavio Salvadorfcc76892013-02-23 02:43:09 +000017#include <status_led.h>
18#endif
Simon Glassdbd79542020-05-10 11:40:11 -060019#include <linux/delay.h>
Marek Vasut189e35b2013-01-12 07:11:11 +000020
21DECLARE_GLOBAL_DATA_PTR;
22
23/*
24 * Functions
25 */
26int board_early_init_f(void)
27{
Marek Vasut73f2b032013-01-22 15:01:05 +000028 /* 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
Marek Vasut3f302a72014-04-28 03:38:42 +020034 return 0;
35}
36
Otavio Salvador801fa152013-03-02 05:17:29 +000037#ifdef CONFIG_CMD_USB
Marek Vasut3f302a72014-04-28 03:38:42 +020038int board_ehci_hcd_init(int port)
39{
40 /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */
Otavio Salvador801fa152013-03-02 05:17:29 +000041 gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
Marek Vasut3f302a72014-04-28 03:38:42 +020042 udelay(100);
43 return 0;
44}
Otavio Salvador801fa152013-03-02 05:17:29 +000045
Marek Vasut3f302a72014-04-28 03:38:42 +020046int 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);
Marek Vasut189e35b2013-01-12 07:11:11 +000050 return 0;
51}
Marek Vasut3f302a72014-04-28 03:38:42 +020052#endif
Marek Vasut189e35b2013-01-12 07:11:11 +000053
54int dram_init(void)
55{
56 return mxs_dram_init();
57}
Marek Vasut73f2b032013-01-22 15:01:05 +000058
59#ifdef CONFIG_CMD_MMC
60static int mx23_olx_mmc_cd(int id)
61{
62 return 1; /* Card always present */
63}
64
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +090065int board_mmc_init(struct bd_info *bis)
Marek Vasut73f2b032013-01-22 15:01:05 +000066{
67 return mxsmmc_initialize(bis, 0, NULL, mx23_olx_mmc_cd);
68}
69#endif
Marek Vasut189e35b2013-01-12 07:11:11 +000070
71int board_init(void)
72{
73 /* Adress of boot parameters */
74 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
75
Uri Mashiach4892d392017-01-19 10:51:45 +020076#if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE)
77 status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_STATE);
Otavio Salvadorfcc76892013-02-23 02:43:09 +000078#endif
79
Marek Vasut189e35b2013-01-12 07:11:11 +000080 return 0;
81}