]> git.sur5r.net Git - u-boot/blobdiff - board/freescale/mx7dsabresd/mx7dsabresd.c
mx7dsabresd: Print secure/non-secure mode info
[u-boot] / board / freescale / mx7dsabresd / mx7dsabresd.c
index bbcc5bb0c6fcbee107349c1269d9e2a66d0682ed..3098e1a3dd80ca2c7465a75135affbe3ebc0d4f4 100644 (file)
@@ -23,7 +23,8 @@
 #include <i2c.h>
 #include <asm/imx-common/mxc_i2c.h>
 #include <asm/arch/crm_regs.h>
-#include <usb/ehci-fsl.h>
+#include <usb.h>
+#include <usb/ehci-ci.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -111,6 +112,14 @@ static iomux_v3_cfg_t const usdhc3_emmc_pads[] = {
        MX7D_PAD_SD3_RESET_B__GPIO6_IO11 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
 };
 
+static iomux_v3_cfg_t const usb_otg1_pads[] = {
+       MX7D_PAD_GPIO1_IO05__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+static iomux_v3_cfg_t const usb_otg2_pads[] = {
+       MX7D_PAD_UART3_CTS_B__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
 #define IOX_SDI IMX_GPIO_NR(1, 9)
 #define IOX_STCP IMX_GPIO_NR(1, 12)
 #define IOX_SHCP IMX_GPIO_NR(1, 13)
@@ -162,7 +171,7 @@ static enum qn_level seq[3][2] = {
 
 static enum qn_func qn_output[8] = {
        qn_disable, qn_reset, qn_reset, qn_reset, qn_reset, qn_reset, qn_enable,
-       qn_enable
+       qn_disable
 };
 
 static void iox74lv_init(void)
@@ -328,22 +337,12 @@ static struct fsl_esdhc_cfg usdhc_cfg[3] = {
        {USDHC3_BASE_ADDR},
 };
 
-static int mmc_get_env_devno(void)
+int board_mmc_get_env_dev(int devno)
 {
-       struct bootrom_sw_info **p =
-               (struct bootrom_sw_info **)ROM_SW_INFO_ADDR;
-
-       u8 boot_type = (*p)->boot_dev_type;
-       u8 dev_no = (*p)->boot_dev_instance;
-
-       /* If not boot from sd/mmc, use default value */
-       if ((boot_type != BOOT_TYPE_SD) && (boot_type != BOOT_TYPE_MMC))
-               return CONFIG_SYS_MMC_ENV_DEV;
+       if (devno == 2)
+               devno--;
 
-       if (dev_no == 2)
-               dev_no--;
-
-       return dev_no;
+       return devno;
 }
 
 static int mmc_map_to_kernel_blk(int dev_no)
@@ -376,7 +375,7 @@ int board_mmc_init(bd_t *bis)
        int i, ret;
        /*
         * According to the board_mmc_init() the following map is done:
-        * (U-boot device node)    (Physical Port)
+        * (U-Boot device node)    (Physical Port)
         * mmc0                    USDHC1
         * mmc2                    USDHC3 (eMMC)
         */
@@ -432,7 +431,7 @@ static void mmc_late_init(void)
 {
        char cmd[32];
        char mmcblk[32];
-       u32 dev_no = mmc_get_env_devno();
+       u32 dev_no = mmc_get_env_dev();
 
        if (!check_mmc_autodetect())
                return;
@@ -521,6 +520,10 @@ int board_early_init_f(void)
        setup_iomux_uart();
 
        setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
+       imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
+                                        ARRAY_SIZE(usb_otg1_pads));
+       imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
+                                        ARRAY_SIZE(usb_otg2_pads));
 
        return 0;
 }
@@ -606,35 +609,24 @@ int board_late_init(void)
 
 int checkboard(void)
 {
-       puts("Board: i.MX7D SABRESD\n");
+       char *mode;
+
+       if (IS_ENABLED(CONFIG_ARMV7_BOOT_SEC_DEFAULT))
+               mode = "secure";
+       else
+               mode = "non-secure";
+
+       printf("Board: i.MX7D SABRESD in %s mode\n", mode);
 
        return 0;
 }
 
 #ifdef CONFIG_USB_EHCI_MX7
-static iomux_v3_cfg_t const usb_otg1_pads[] = {
-       MX7D_PAD_GPIO1_IO05__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
-static iomux_v3_cfg_t const usb_otg2_pads[] = {
-       MX7D_PAD_UART3_CTS_B__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
-int board_ehci_hcd_init(int port)
+int board_usb_phy_mode(int port)
 {
-       switch (port) {
-       case 0:
-               imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
-                                                ARRAY_SIZE(usb_otg1_pads));
-               break;
-       case 1:
-               imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
-                                                ARRAY_SIZE(usb_otg2_pads));
-               break;
-       default:
-               printf("MXC USB port %d not yet supported\n", port);
-               return -EINVAL;
-       }
-       return 0;
+       if (port == 0)
+               return USB_INIT_DEVICE;
+       else
+               return USB_INIT_HOST;
 }
 #endif