2 * (C) Copyright 2011 Freescale Semiconductor, Inc.
4 * Author: Fabio Estevam <fabio.estevam@freescale.com>
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
23 #include <asm/arch/imx-regs.h>
24 #include <asm/arch/imx25-pinmux.h>
25 #include <asm/arch/sys_proto.h>
26 #include <asm/arch/clock.h>
28 #include <fsl_esdhc.h>
30 #define CARD_DETECT IMX_GPIO_NR(2, 1)
32 DECLARE_GLOBAL_DATA_PTR;
34 #ifdef CONFIG_FSL_ESDHC
35 struct fsl_esdhc_cfg esdhc_cfg[1] = {
42 /* dram_init must store complete ramsize in gd->ram_size */
43 gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
48 int board_early_init_f(void)
50 mx25_uart1_init_pins();
57 /* address of boot parameters */
58 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
63 #ifdef CONFIG_FSL_ESDHC
64 int board_mmc_getcd(struct mmc *mmc)
66 struct iomuxc_mux_ctl *muxctl;
67 struct iomuxc_pad_ctl *padctl;
68 u32 gpio_mux_mode = MX25_PIN_MUX_MODE(5);
71 * Set up the Card Detect pin.
73 * SD1_GPIO_CD: gpio2_1 is ALT 5 mode of pin A15
76 muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE;
77 padctl = (struct iomuxc_pad_ctl *)IMX_IOPADCTL_BASE;
79 writel(gpio_mux_mode, &muxctl->pad_a15);
80 writel(0x0, &padctl->pad_a15);
82 gpio_direction_input(CARD_DETECT);
83 return !gpio_get_value(CARD_DETECT);
86 int board_mmc_init(bd_t *bis)
88 struct iomuxc_mux_ctl *muxctl;
89 u32 sdhc1_mux_mode = MX25_PIN_MUX_MODE(0) | MX25_PIN_MUX_SION;
91 muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE;
92 writel(sdhc1_mux_mode, &muxctl->pad_sd1_cmd);
93 writel(sdhc1_mux_mode, &muxctl->pad_sd1_clk);
94 writel(sdhc1_mux_mode, &muxctl->pad_sd1_data0);
95 writel(sdhc1_mux_mode, &muxctl->pad_sd1_data1);
96 writel(sdhc1_mux_mode, &muxctl->pad_sd1_data2);
97 writel(sdhc1_mux_mode, &muxctl->pad_sd1_data3);
99 esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC1_CLK);
100 return fsl_esdhc_initialize(bis, &esdhc_cfg[0]);
106 puts("Board: MX25PDK\n");