Merge branch 'master' of git://git.denx.de/u-boot-arm
[platform/kernel/u-boot.git] / board / freescale / mx53ard / mx53ard.c
index 40b5c19..2fc8570 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/arch/mx5x_pins.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
+#include <asm/arch/clock.h>
 #include <asm/arch/iomux.h>
 #include <asm/errno.h>
 #include <netdev.h>
@@ -33,7 +34,7 @@
 #include <fsl_esdhc.h>
 #include <asm/gpio.h>
 
-#define ETHERNET_INT           (1 * 32 + 31)  /* GPIO2_31 */
+#define ETHERNET_INT           IMX_GPIO_NR(2, 31)
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -79,8 +80,8 @@ static void setup_iomux_uart(void)
 
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg esdhc_cfg[2] = {
-       {MMC_SDHC1_BASE_ADDR, 1 },
-       {MMC_SDHC2_BASE_ADDR, 1 },
+       {MMC_SDHC1_BASE_ADDR},
+       {MMC_SDHC2_BASE_ADDR},
 };
 
 int board_mmc_getcd(struct mmc *mmc)
@@ -89,12 +90,14 @@ int board_mmc_getcd(struct mmc *mmc)
        int ret;
 
        mxc_request_iomux(MX53_PIN_GPIO_1, IOMUX_CONFIG_ALT1);
+       gpio_direction_input(IMX_GPIO_NR(1, 1));
        mxc_request_iomux(MX53_PIN_GPIO_4, IOMUX_CONFIG_ALT1);
+       gpio_direction_input(IMX_GPIO_NR(1, 4));
 
        if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
-               ret = !gpio_get_value(1); /* GPIO1_1 */
+               ret = !gpio_get_value(IMX_GPIO_NR(1, 1));
        else
-               ret = !gpio_get_value(4); /* GPIO1_4 */
+               ret = !gpio_get_value(IMX_GPIO_NR(1, 4));
 
        return ret;
 }
@@ -104,6 +107,9 @@ int board_mmc_init(bd_t *bis)
        u32 index;
        s32 status = 0;
 
+       esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
+       esdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+
        for (index = 0; index < CONFIG_SYS_FSL_ESDHC_NUM; index++) {
                switch (index) {
                case 0:
@@ -285,7 +291,7 @@ int board_init(void)
 
 int board_eth_init(bd_t *bis)
 {
-       int rc = 0;
+       int rc = -ENODEV;
 
        weim_smc911x_iomux();
        weim_cs1_settings();