]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
imx: ventana: make OTG VBUS power enable board specific
authorTim Harvey <tharvey@gateworks.com>
Mon, 13 Mar 2017 15:51:07 +0000 (08:51 -0700)
committerStefano Babic <sbabic@denx.de>
Sun, 19 Mar 2017 16:30:03 +0000 (17:30 +0100)
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
board/gateworks/gw_ventana/common.c
board/gateworks/gw_ventana/common.h
board/gateworks/gw_ventana/gw_ventana.c

index 49d6e52a53972abe615ced5247841750236f1617..a33c112057f53a65bf045dd8d60bf71d4efe31dd 100644 (file)
@@ -586,6 +586,7 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .rs485en = IMX_GPIO_NR(3, 24),
                .dioi2c_en = IMX_GPIO_NR(4,  5),
                .pcie_sson = IMX_GPIO_NR(1, 20),
+               .otgpwr_en = IMX_GPIO_NR(3, 22),
        },
 
        /* GW51xx */
@@ -604,6 +605,7 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .gps_shdn = IMX_GPIO_NR(1, 2),
                .vidin_en = IMX_GPIO_NR(5, 20),
                .wdis = IMX_GPIO_NR(7, 12),
+               .otgpwr_en = IMX_GPIO_NR(3, 22),
        },
 
        /* GW52xx */
@@ -626,6 +628,7 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .wdis = IMX_GPIO_NR(7, 12),
                .msata_en = GP_MSATA_SEL,
                .rs232_en = GP_RS232_EN,
+               .otgpwr_en = IMX_GPIO_NR(3, 22),
        },
 
        /* GW53xx */
@@ -647,6 +650,7 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .wdis = IMX_GPIO_NR(7, 12),
                .msata_en = GP_MSATA_SEL,
                .rs232_en = GP_RS232_EN,
+               .otgpwr_en = IMX_GPIO_NR(3, 22),
        },
 
        /* GW54xx */
@@ -670,6 +674,7 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .wdis = IMX_GPIO_NR(5, 17),
                .msata_en = GP_MSATA_SEL,
                .rs232_en = GP_RS232_EN,
+               .otgpwr_en = IMX_GPIO_NR(3, 22),
        },
 
        /* GW551x */
@@ -715,6 +720,7 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .pcie_rst = IMX_GPIO_NR(1, 0),
                .vidin_en = IMX_GPIO_NR(5, 20),
                .wdis = IMX_GPIO_NR(7, 12),
+               .otgpwr_en = IMX_GPIO_NR(3, 22),
        },
 };
 
@@ -725,10 +731,6 @@ void setup_iomux_gpio(int board, struct ventana_board_info *info)
        /* iomux common to all Ventana boards */
        SETUP_IOMUX_PADS(gw_gpio_pads);
 
-       /* OTG power off */
-       gpio_request(GP_USB_OTG_PWR, "usbotg_pwr");
-       gpio_direction_output(GP_USB_OTG_PWR, 0);
-
        if (board >= GW_UNKNOWN)
                return;
 
@@ -818,6 +820,12 @@ void setup_iomux_gpio(int board, struct ventana_board_info *info)
                gpio_direction_output(gpio_cfg[board].wdis, 1);
        }
 
+       /* OTG power off */
+       if (gpio_cfg[board].otgpwr_en) {
+               gpio_request(gpio_cfg[board].otgpwr_en, "usbotg_pwr");
+               gpio_direction_output(gpio_cfg[board].otgpwr_en, 0);
+       }
+
        /* sense vselect pin to see if we support uhs-i */
        gpio_request(GP_SD3_VSELECT, "sd3_vselect");
        gpio_direction_input(GP_SD3_VSELECT);
index 3d7aff1077c73dc36243e4388fbb9d945e25621a..693923346f2e194c4b5ab59c7a8a5d09be844d77 100644 (file)
@@ -13,7 +13,6 @@
 
 /* GPIO's common to all baseboards */
 #define GP_PHY_RST     IMX_GPIO_NR(1, 30)
-#define GP_USB_OTG_PWR IMX_GPIO_NR(3, 22)
 #define GP_SD3_CD      IMX_GPIO_NR(7, 0)
 #define GP_RS232_EN    IMX_GPIO_NR(2, 11)
 #define GP_MSATA_SEL   IMX_GPIO_NR(2, 8)
@@ -79,6 +78,7 @@ struct ventana {
        int wdis;
        int msata_en;
        int rs232_en;
+       int otgpwr_en;
        /* various features */
        bool usd_vsel;
 };
index 22a3c8e607eadf271f8b4fc50fd6adc58c518347..3f9d2f7010fecb58ed0adda7bbab224735b4dccd 100644 (file)
@@ -175,9 +175,11 @@ int board_ehci_hcd_init(int port)
 
 int board_ehci_power(int port, int on)
 {
-       if (port)
-               return 0;
-       gpio_set_value(GP_USB_OTG_PWR, on);
+       /* enable OTG VBUS */
+       if (!port && board_type < GW_UNKNOWN) {
+               if (gpio_cfg[board_type].otgpwr_en)
+                       gpio_set_value(gpio_cfg[board_type].otgpwr_en, on);
+       }
        return 0;
 }
 #endif /* CONFIG_USB_EHCI_MX6 */