2 * Freescale MX28EVK board
4 * (C) Copyright 2011 Freescale Semiconductor, Inc.
6 * Author: Fabio Estevam <fabio.estevam@freescale.com>
9 * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
10 * on behalf of DENX Software Engineering GmbH
12 * SPDX-License-Identifier: GPL-2.0+
18 #include <asm/arch/imx-regs.h>
19 #include <asm/arch/iomux-mx28.h>
20 #include <asm/arch/clock.h>
21 #include <asm/arch/sys_proto.h>
22 #include <linux/mii.h>
27 DECLARE_GLOBAL_DATA_PTR;
32 int board_early_init_f(void)
34 /* IO0 clock at 480MHz */
35 mxs_set_ioclk(MXC_IOCLK0, 480000);
36 /* IO1 clock at 480MHz */
37 mxs_set_ioclk(MXC_IOCLK1, 480000);
39 /* SSP0 clock at 96MHz */
40 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
41 /* SSP2 clock at 160MHz */
42 mxs_set_sspclk(MXC_SSPCLK2, 160000, 0);
45 mxs_iomux_setup_pad(MX28_PAD_SSP2_SS1__USB1_OVERCURRENT);
46 mxs_iomux_setup_pad(MX28_PAD_AUART2_RX__GPIO_3_8 |
47 MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL);
48 gpio_direction_output(MX28_PAD_AUART2_RX__GPIO_3_8, 1);
52 gpio_direction_output(MX28_PAD_LCD_RESET__GPIO_3_30, 1);
54 /* Set contrast to maximum */
55 gpio_direction_output(MX28_PAD_PWM2__GPIO_3_18, 1);
62 return mxs_dram_init();
67 /* Adress of boot parameters */
68 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
74 static int mx28evk_mmc_wp(int id)
77 printf("MXS MMC: Invalid card selected (card id = %d)\n", id);
81 return gpio_get_value(MX28_PAD_SSP1_SCK__GPIO_2_12);
84 int board_mmc_init(bd_t *bis)
86 /* Configure WP as input */
87 gpio_direction_input(MX28_PAD_SSP1_SCK__GPIO_2_12);
89 /* Configure MMC0 Power Enable */
90 gpio_direction_output(MX28_PAD_PWM3__GPIO_3_28, 0);
92 return mxsmmc_initialize(bis, 0, mx28evk_mmc_wp, NULL);
98 int board_eth_init(bd_t *bis)
100 struct mxs_clkctrl_regs *clkctrl_regs =
101 (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;
102 struct eth_device *dev;
105 ret = cpu_eth_init(bis);
109 /* MX28EVK uses ENET_CLK PAD to drive FEC clock */
110 writel(CLKCTRL_ENET_TIME_SEL_RMII_CLK | CLKCTRL_ENET_CLK_OUT_EN,
111 &clkctrl_regs->hw_clkctrl_enet);
114 gpio_direction_output(MX28_PAD_SSP1_DATA3__GPIO_2_15, 0);
117 gpio_direction_output(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 0);
119 gpio_set_value(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 1);
121 ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE);
123 puts("FEC MXS: Unable to init FEC0\n");
127 ret = fecmxc_initialize_multi(bis, 1, 3, MXS_ENET1_BASE);
129 puts("FEC MXS: Unable to init FEC1\n");
133 dev = eth_get_dev_by_name("FEC0");
135 puts("FEC MXS: Unable to get FEC0 device entry\n");
139 dev = eth_get_dev_by_name("FEC1");
141 puts("FEC MXS: Unable to get FEC1 device entry\n");