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 * See file CREDITS for list of people who contributed to this
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
29 #include <asm/arch/imx-regs.h>
30 #include <asm/arch/iomux-mx28.h>
31 #include <asm/arch/clock.h>
32 #include <asm/arch/sys_proto.h>
33 #include <linux/mii.h>
38 DECLARE_GLOBAL_DATA_PTR;
43 int board_early_init_f(void)
45 /* IO0 clock at 480MHz */
46 mxs_set_ioclk(MXC_IOCLK0, 480000);
47 /* IO1 clock at 480MHz */
48 mxs_set_ioclk(MXC_IOCLK1, 480000);
50 /* SSP0 clock at 96MHz */
51 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
52 /* SSP2 clock at 160MHz */
53 mxs_set_sspclk(MXC_SSPCLK2, 160000, 0);
56 mxs_iomux_setup_pad(MX28_PAD_SSP2_SS1__USB1_OVERCURRENT);
57 mxs_iomux_setup_pad(MX28_PAD_AUART2_RX__GPIO_3_8 |
58 MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL);
59 gpio_direction_output(MX28_PAD_AUART2_RX__GPIO_3_8, 1);
63 gpio_direction_output(MX28_PAD_LCD_RESET__GPIO_3_30, 1);
65 /* Set contrast to maximum */
66 gpio_direction_output(MX28_PAD_PWM2__GPIO_3_18, 1);
73 return mxs_dram_init();
78 /* Adress of boot parameters */
79 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
85 static int mx28evk_mmc_wp(int id)
88 printf("MXS MMC: Invalid card selected (card id = %d)\n", id);
92 return gpio_get_value(MX28_PAD_SSP1_SCK__GPIO_2_12);
95 int board_mmc_init(bd_t *bis)
97 /* Configure WP as input */
98 gpio_direction_input(MX28_PAD_SSP1_SCK__GPIO_2_12);
100 /* Configure MMC0 Power Enable */
101 gpio_direction_output(MX28_PAD_PWM3__GPIO_3_28, 0);
103 return mxsmmc_initialize(bis, 0, mx28evk_mmc_wp, NULL);
107 #ifdef CONFIG_CMD_NET
109 int board_eth_init(bd_t *bis)
111 struct mxs_clkctrl_regs *clkctrl_regs =
112 (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;
113 struct eth_device *dev;
116 ret = cpu_eth_init(bis);
118 /* MX28EVK uses ENET_CLK PAD to drive FEC clock */
119 writel(CLKCTRL_ENET_TIME_SEL_RMII_CLK | CLKCTRL_ENET_CLK_OUT_EN,
120 &clkctrl_regs->hw_clkctrl_enet);
123 gpio_direction_output(MX28_PAD_SSP1_DATA3__GPIO_2_15, 0);
126 gpio_direction_output(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 0);
128 gpio_set_value(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 1);
130 ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE);
132 puts("FEC MXS: Unable to init FEC0\n");
136 ret = fecmxc_initialize_multi(bis, 1, 3, MXS_ENET1_BASE);
138 puts("FEC MXS: Unable to init FEC1\n");
142 dev = eth_get_dev_by_name("FEC0");
144 puts("FEC MXS: Unable to get FEC0 device entry\n");
148 dev = eth_get_dev_by_name("FEC1");
150 puts("FEC MXS: Unable to get FEC1 device entry\n");