summaryrefslogtreecommitdiff
path: root/board/freescale/mx25pdk
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2012-10-23 06:34:49 +0000
committerStefano Babic <sbabic@denx.de>2012-10-26 16:28:07 +0200
commitaf2a4093cb141f9c5ea433c41ab06a528a7792a6 (patch)
treec8d1d5645281c741c378e9561cf570d7497ecb00 /board/freescale/mx25pdk
parentd6d94e73608c51ea9bdbd4c2012ebabefd9d1600 (diff)
downloadu-boot-imx-af2a4093cb141f9c5ea433c41ab06a528a7792a6.zip
u-boot-imx-af2a4093cb141f9c5ea433c41ab06a528a7792a6.tar.gz
u-boot-imx-af2a4093cb141f9c5ea433c41ab06a528a7792a6.tar.bz2
mx25pdk: Add esdhc support
mx25pdk has a SD/MMC slot connected to esdhc1. Add support for it and allow the environment variables to be saved into SD/MMC. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Diffstat (limited to 'board/freescale/mx25pdk')
-rw-r--r--board/freescale/mx25pdk/mx25pdk.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/board/freescale/mx25pdk/mx25pdk.c b/board/freescale/mx25pdk/mx25pdk.c
index 4a8352f..9bf2d48 100644
--- a/board/freescale/mx25pdk/mx25pdk.c
+++ b/board/freescale/mx25pdk/mx25pdk.c
@@ -19,12 +19,24 @@
#include <common.h>
#include <asm/io.h>
+#include <asm/gpio.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/imx25-pinmux.h>
#include <asm/arch/sys_proto.h>
+#include <asm/arch/clock.h>
+#include <mmc.h>
+#include <fsl_esdhc.h>
+
+#define CARD_DETECT IMX_GPIO_NR(2, 1)
DECLARE_GLOBAL_DATA_PTR;
+#ifdef CONFIG_FSL_ESDHC
+struct fsl_esdhc_cfg esdhc_cfg[1] = {
+ {IMX_MMC_SDHC1_BASE},
+};
+#endif
+
int dram_init(void)
{
/* dram_init must store complete ramsize in gd->ram_size */
@@ -48,6 +60,47 @@ int board_init(void)
return 0;
}
+#ifdef CONFIG_FSL_ESDHC
+int board_mmc_getcd(struct mmc *mmc)
+{
+ struct iomuxc_mux_ctl *muxctl;
+ struct iomuxc_pad_ctl *padctl;
+ u32 gpio_mux_mode = MX25_PIN_MUX_MODE(5);
+
+ /*
+ * Set up the Card Detect pin.
+ *
+ * SD1_GPIO_CD: gpio2_1 is ALT 5 mode of pin A15
+ *
+ */
+ muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE;
+ padctl = (struct iomuxc_pad_ctl *)IMX_IOPADCTL_BASE;
+
+ writel(gpio_mux_mode, &muxctl->pad_a15);
+ writel(0x0, &padctl->pad_a15);
+
+ gpio_direction_input(CARD_DETECT);
+ return !gpio_get_value(CARD_DETECT);
+}
+
+int board_mmc_init(bd_t *bis)
+{
+ struct iomuxc_mux_ctl *muxctl;
+ u32 sdhc1_mux_mode = MX25_PIN_MUX_MODE(0) | MX25_PIN_MUX_SION;
+
+ muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE;
+ writel(sdhc1_mux_mode, &muxctl->pad_sd1_cmd);
+ writel(sdhc1_mux_mode, &muxctl->pad_sd1_clk);
+ writel(sdhc1_mux_mode, &muxctl->pad_sd1_data0);
+ writel(sdhc1_mux_mode, &muxctl->pad_sd1_data1);
+ writel(sdhc1_mux_mode, &muxctl->pad_sd1_data2);
+ writel(sdhc1_mux_mode, &muxctl->pad_sd1_data3);
+
+ esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC1_CLK);
+ return fsl_esdhc_initialize(bis, &esdhc_cfg[0]);
+}
+#endif
+
int checkboard(void)
{
puts("Board: MX25PDK\n");