diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2017-03-10 04:17:52 +0300 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2017-03-19 19:29:20 +0300 |
commit | 5a986dfeef889d281bb807f328418983ea7c0832 (patch) | |
tree | 116611866985768cc08ef4c5ae38d7a743959709 /board/toradex | |
parent | 9af131e3550bdc18b823c093b6a32346a7909569 (diff) | |
download | u-boot-5a986dfeef889d281bb807f328418983ea7c0832.tar.xz |
colibri_imx7: implement board level USB PHY mode
Implement board level USB PHY mode callback. On USB OTG Port 1
the Colibri standard foresees GPIO USBC_DET to decide whether the
port should run in Host or Device mode.
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Diffstat (limited to 'board/toradex')
-rw-r--r-- | board/toradex/colibri_imx7/colibri_imx7.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/board/toradex/colibri_imx7/colibri_imx7.c b/board/toradex/colibri_imx7/colibri_imx7.c index e1340c323b..c03bde168a 100644 --- a/board/toradex/colibri_imx7/colibri_imx7.c +++ b/board/toradex/colibri_imx7/colibri_imx7.c @@ -23,6 +23,7 @@ #include <netdev.h> #include <power/pmic.h> #include <power/rn5t567_pmic.h> +#include <usb.h> #include <usb/ehci-ci.h> #include "../common/tdx-common.h" @@ -46,6 +47,8 @@ DECLARE_GLOBAL_DATA_PTR; #define NAND_PAD_READY0_CTRL (PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_PUS_PU5KOHM) +#define USB_CDET_GPIO IMX_GPIO_NR(7, 14) + int dram_init(void) { gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE); @@ -71,6 +74,12 @@ static iomux_v3_cfg_t const usdhc1_pads[] = { MX7D_PAD_GPIO1_IO00__GPIO1_IO0 | MUX_PAD_CTRL(NO_PAD_CTRL), }; +#ifdef CONFIG_USB_EHCI_MX7 +static iomux_v3_cfg_t const usb_cdet_pads[] = { + MX7D_PAD_ENET1_CRS__GPIO7_IO14 | MUX_PAD_CTRL(NO_PAD_CTRL), +}; +#endif + #ifdef CONFIG_NAND_MXS static iomux_v3_cfg_t const gpmi_pads[] = { MX7D_PAD_SD3_DATA0__NAND_DATA00 | MUX_PAD_CTRL(NAND_PAD_CTRL), @@ -319,6 +328,11 @@ int board_init(void) setup_lcd(); #endif +#ifdef CONFIG_USB_EHCI_MX7 + imx_iomux_v3_setup_multiple_pads(usb_cdet_pads, ARRAY_SIZE(usb_cdet_pads)); + gpio_request(USB_CDET_GPIO, "usb-cdet-gpio"); +#endif + return 0; } @@ -417,4 +431,18 @@ int board_ehci_hcd_init(int port) } return 0; } + +int board_usb_phy_mode(int port) +{ + switch (port) { + case 0: + if (gpio_get_value(USB_CDET_GPIO)) + return USB_INIT_DEVICE; + else + return USB_INIT_HOST; + case 1: + default: + return USB_INIT_HOST; + } +} #endif |