diff options
author | Igor Opaniuk <igor.opaniuk@toradex.com> | 2020-09-30 16:44:48 +0300 |
---|---|---|
committer | Denys Drozdov <denys.drozdov@toradex.com> | 2021-01-08 19:42:08 +0200 |
commit | 8852a7aa011b9862c10b7260b8cb5c60eee39a8e (patch) | |
tree | 047260c0056d57a36d007a6103fece0002113f63 | |
parent | 3007faba2321fd89ba7afe7e6b184c1c4defcbb8 (diff) |
colibri-imx8x: add board_ci_udc_phy_mode() and drop legacy usb init
1. Drop legacy board_usb_init(), as we use information from device tree
now.
2. As U-Boot doesn't have any extcon-usb-gpio framework for generation
of USB cable states from the USB ID pin connected to a GPIO pin,
provide board_ci_udc_phy_mode() functions which checks gpio line
state.
Related-to: ELB-3077
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
-rw-r--r-- | board/toradex/colibri-imx8x/colibri-imx8x.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/board/toradex/colibri-imx8x/colibri-imx8x.c b/board/toradex/colibri-imx8x/colibri-imx8x.c index 73b6cbff26..a7bdf27ef6 100644 --- a/board/toradex/colibri-imx8x/colibri-imx8x.c +++ b/board/toradex/colibri-imx8x/colibri-imx8x.c @@ -39,6 +39,8 @@ DECLARE_GLOBAL_DATA_PTR; #define UART_PAD_CTRL ((SC_PAD_CONFIG_OUT_IN << PADRING_CONFIG_SHIFT) | (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) \ | (SC_PAD_28FDSOI_DSE_DV_HIGH << PADRING_DSE_SHIFT) | (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT)) +#define USB_CDET_GPIO IMX_GPIO_NR(5, 9) + static iomux_cfg_t uart3_pads[] = { SC_P_FLEXCAN2_RX | MUX_MODE_ALT(2) | MUX_PAD_CTRL(UART_PAD_CTRL), SC_P_FLEXCAN2_TX | MUX_MODE_ALT(2) | MUX_PAD_CTRL(UART_PAD_CTRL), @@ -51,6 +53,20 @@ static void setup_iomux_uart(void) imx8_iomux_setup_multiple_pads(uart3_pads, ARRAY_SIZE(uart3_pads)); } +int board_ci_udc_phy_mode(void *__iomem phy_base, int phy_off) +{ + switch ((phys_addr_t)phy_base) { + case 0x5b0d0000: + if (gpio_get_value(USB_CDET_GPIO)) + return USB_INIT_DEVICE; + else + return USB_INIT_HOST; + case 0x5b110000: + default: + return USB_INIT_HOST; + } +} + void board_mem_get_layout(uint64_t *phys_sdram_1_start, uint64_t *phys_sdram_1_size, uint64_t *phys_sdram_2_start, @@ -153,28 +169,6 @@ static void board_gpio_init(void) } #endif -/* Only Enable USB3 resources currently */ -int board_usb_init(int index, enum usb_init_type init) -{ - struct power_domain pd; - int ret = 0; - - /* Power on usb */ - if (!power_domain_lookup_name("conn_usb2", &pd)) { - ret = power_domain_on(&pd); - if (ret) - printf("conn_usb2 Power up failed! (error = %d)\n", ret); - } - - if (!power_domain_lookup_name("conn_usb2_phy", &pd)) { - ret = power_domain_on(&pd); - if (ret) - printf("conn_usb2_phy Power up failed! (error = %d)\n", ret); - } - - return ret; -} - int board_init(void) { #ifdef CONFIG_MXC_GPIO |