blob: ada572912dad84d9c2aab6f0444fbf1268793b8b [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
Simon Glass97589732020-05-10 11:40:02 -060014#include <init.h>
Simon Glass274e0b02020-05-10 11:39:56 -060015#include <net.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060016#include <asm/global_data.h>
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000017#include <asm/gpio.h>
18#include <asm/io.h>
19#include <asm/arch/imx-regs.h>
20#include <asm/arch/iomux-mx28.h>
21#include <asm/arch/clock.h>
22#include <asm/arch/sys_proto.h>
Simon Glassdbd79542020-05-10 11:40:11 -060023#include <linux/delay.h>
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000024#include <linux/mii.h>
25#include <miiphy.h>
26#include <netdev.h>
27#include <errno.h>
28
29DECLARE_GLOBAL_DATA_PTR;
30
31/*
32 * Functions
33 */
34int board_early_init_f(void)
35{
36 /* IO0 clock at 480MHz */
Otavio Salvador2906f942013-01-11 03:19:03 +000037 mxs_set_ioclk(MXC_IOCLK0, 480000);
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000038 /* IO1 clock at 480MHz */
Otavio Salvador2906f942013-01-11 03:19:03 +000039 mxs_set_ioclk(MXC_IOCLK1, 480000);
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000040
41 /* SSP0 clock at 96MHz */
Otavio Salvador2906f942013-01-11 03:19:03 +000042 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
Otavio Salvador22ff8942012-08-27 23:56:40 +000043 /* SSP2 clock at 160MHz */
Otavio Salvador2906f942013-01-11 03:19:03 +000044 mxs_set_sspclk(MXC_SSPCLK2, 160000, 0);
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000045
Matthias Fuchsce575c42012-01-18 01:33:08 +000046#ifdef CONFIG_CMD_USB
47 mxs_iomux_setup_pad(MX28_PAD_SSP2_SS1__USB1_OVERCURRENT);
48 mxs_iomux_setup_pad(MX28_PAD_AUART2_RX__GPIO_3_8 |
49 MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL);
50 gpio_direction_output(MX28_PAD_AUART2_RX__GPIO_3_8, 1);
51#endif
52
Fabio Estevam9f95ce22013-05-10 09:14:09 +000053 /* Power on LCD */
54 gpio_direction_output(MX28_PAD_LCD_RESET__GPIO_3_30, 1);
55
56 /* Set contrast to maximum */
57 gpio_direction_output(MX28_PAD_PWM2__GPIO_3_18, 1);
58
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000059 return 0;
60}
61
62int dram_init(void)
63{
Otavio Salvadora2bbe0c2012-08-19 04:58:30 +000064 return mxs_dram_init();
Fabio Estevam5ffd3c52011-12-20 05:46:34 +000065}
66
67int board_init(void)
68{
69 /* Adress of boot parameters */
70 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
71
72 return 0;
73}