Merge git://git.denx.de/u-boot-fsl-qoriq
[oweals/u-boot.git] / board / embest / mx6boards / mx6boards.c
index 6d869611a865d2f4a93f8a0927725f3354967c9a..ae04f68445c9171601274405f96f0a519b3d4040 100644 (file)
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
-#include <asm/errno.h>
+#include <linux/errno.h>
 #include <asm/gpio.h>
-#include <asm/imx-common/iomux-v3.h>
-#include <asm/imx-common/boot_mode.h>
-#include <asm/imx-common/mxc_i2c.h>
-#include <asm/imx-common/video.h>
+#include <asm/mach-imx/iomux-v3.h>
+#include <asm/mach-imx/boot_mode.h>
+#include <asm/mach-imx/mxc_i2c.h>
+#include <asm/mach-imx/spi.h>
+#include <asm/mach-imx/video.h>
 #include <i2c.h>
+#include <input.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
 #include <miiphy.h>
@@ -215,12 +217,12 @@ int board_mmc_getcd(struct mmc *mmc)
 
 int board_mmc_init(bd_t *bis)
 {
-       s32 status = 0;
+       int ret;
        int i;
 
        /*
         * According to the board_mmc_init() the following map is done:
-        * (U-boot device node)    (Physical Port)
+        * (U-Boot device node)    (Physical Port)
         * ** RiOTboard :
         * mmc0                    SDCard slot (bottom)
         * mmc1                    uSDCard slot (top)
@@ -246,6 +248,7 @@ int board_mmc_init(bd_t *bis)
                                        riotboard_usdhc3_pads,
                                        ARRAY_SIZE(riotboard_usdhc3_pads));
                                gpio_direction_input(USDHC3_CD_GPIO);
+                       } else {
                                gpio_direction_output(IMX_GPIO_NR(7, 8) , 0);
                                udelay(250);
                                gpio_set_value(IMX_GPIO_NR(7, 8), 1);
@@ -266,13 +269,15 @@ int board_mmc_init(bd_t *bis)
                        printf("Warning: you configured more USDHC controllers"
                               "(%d) then supported by the board (%d)\n",
                               i + 1, CONFIG_SYS_FSL_USDHC_NUM);
-                       return status;
+                       return -EINVAL;
                }
 
-               status |= fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
+               ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
+               if (ret)
+                       return ret;
        }
 
-       return status;
+       return 0;
 }
 #endif
 
@@ -284,6 +289,11 @@ iomux_v3_cfg_t const ecspi1_pads[] = {
        MX6_PAD_EIM_EB2__GPIO2_IO30 | MUX_PAD_CTRL(NO_PAD_CTRL),
 };
 
+int board_spi_cs_gpio(unsigned bus, unsigned cs)
+{
+       return (bus == 0 && cs == 0) ? (IMX_GPIO_NR(2, 30)) : -1;
+}
+
 static void setup_spi(void)
 {
        imx_iomux_v3_setup_multiple_pads(ecspi1_pads, ARRAY_SIZE(ecspi1_pads));
@@ -392,12 +402,6 @@ static void disable_lvds(struct display_info_t const *dev)
                     IOMUXC_GPR2_LVDS_CH0_MODE_MASK);
 }
 
-static int detect_hdmi(struct display_info_t const *dev)
-{
-       struct hdmi_regs *hdmi  = (struct hdmi_regs *)HDMI_ARB_BASE_ADDR;
-       return readb(&hdmi->phy_stat0) & HDMI_DVI_STAT;
-}
-
 static void do_enable_hdmi(struct display_info_t const *dev)
 {
        disable_lvds(dev);