blob: 88c3bf36089c7ee2830fdf0d2dad94c0dd7cfbe9 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Fabio Estevam5ffd3c52011-12-20 05:46:34 +00002/*
3 * Freescale MX28EVK board
4 *
5 * (C) Copyright 2011 Freescale Semiconductor, Inc.
6 *
7 * Author: Fabio Estevam <fabio.estevam@freescale.com>
8 *
9 * Based on m28evk.c:
10 * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
11 * on behalf of DENX Software Engineering GmbH
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000012 */
13
14#include <common.h>
Simon Glass97589732020-05-10 11:40:02 -060015#include <init.h>
Simon Glass274e0b02020-05-10 11:39:56 -060016#include <net.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060017#include <asm/global_data.h>
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000018#include <asm/gpio.h>
19#include <asm/io.h>
20#include <asm/arch/imx-regs.h>
21#include <asm/arch/iomux-mx28.h>
22#include <asm/arch/clock.h>
23#include <asm/arch/sys_proto.h>
Simon Glassdbd79542020-05-10 11:40:11 -060024#include <linux/delay.h>
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000025#include <linux/mii.h>
26#include <miiphy.h>
27#include <netdev.h>
28#include <errno.h>
29
30DECLARE_GLOBAL_DATA_PTR;
31
32/*
33 * Functions
34 */
35int board_early_init_f(void)
36{
37 /* IO0 clock at 480MHz */
Otavio Salvador2906f942013-01-11 03:19:03 +000038 mxs_set_ioclk(MXC_IOCLK0, 480000);
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000039 /* IO1 clock at 480MHz */
Otavio Salvador2906f942013-01-11 03:19:03 +000040 mxs_set_ioclk(MXC_IOCLK1, 480000);
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000041
42 /* SSP0 clock at 96MHz */
Otavio Salvador2906f942013-01-11 03:19:03 +000043 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
Otavio Salvador22ff8942012-08-27 23:56:40 +000044 /* SSP2 clock at 160MHz */
Otavio Salvador2906f942013-01-11 03:19:03 +000045 mxs_set_sspclk(MXC_SSPCLK2, 160000, 0);
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000046
Matthias Fuchsce575c42012-01-18 01:33:08 +000047#ifdef CONFIG_CMD_USB
48 mxs_iomux_setup_pad(MX28_PAD_SSP2_SS1__USB1_OVERCURRENT);
49 mxs_iomux_setup_pad(MX28_PAD_AUART2_RX__GPIO_3_8 |
50 MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL);
51 gpio_direction_output(MX28_PAD_AUART2_RX__GPIO_3_8, 1);
52#endif
53
Fabio Estevam9f95ce22013-05-10 09:14:09 +000054 /* Power on LCD */
55 gpio_direction_output(MX28_PAD_LCD_RESET__GPIO_3_30, 1);
56
57 /* Set contrast to maximum */
58 gpio_direction_output(MX28_PAD_PWM2__GPIO_3_18, 1);
59
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000060 return 0;
61}
62
63int dram_init(void)
64{
Otavio Salvadora2bbe0c2012-08-19 04:58:30 +000065 return mxs_dram_init();
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000066}
67
68int board_init(void)
69{
70 /* Adress of boot parameters */
71 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
72
73 return 0;
74}