diff options
-rw-r--r-- | board/freescale/mx7ulp_evk/mx7ulp_evk.c | 39 | ||||
-rw-r--r-- | configs/mx7ulp_evk_defconfig | 6 | ||||
-rw-r--r-- | configs/mx7ulp_evk_plugin_defconfig | 6 | ||||
-rw-r--r-- | include/configs/mx7ulp_evk.h | 7 |
4 files changed, 57 insertions, 1 deletions
diff --git a/board/freescale/mx7ulp_evk/mx7ulp_evk.c b/board/freescale/mx7ulp_evk/mx7ulp_evk.c index d6c27db..afad505 100644 --- a/board/freescale/mx7ulp_evk/mx7ulp_evk.c +++ b/board/freescale/mx7ulp_evk/mx7ulp_evk.c @@ -9,11 +9,15 @@ #include <asm/arch/sys_proto.h> #include <asm/arch/mx7ulp-pins.h> #include <asm/arch/iomux.h> +#include <asm/gpio.h> +#include <usb.h> +#include <dm.h> DECLARE_GLOBAL_DATA_PTR; #define UART_PAD_CTRL (PAD_CTL_PUS_UP) #define QSPI_PAD_CTRL1 (PAD_CTL_PUS_UP | PAD_CTL_DSE) +#define OTG_ID_GPIO_PAD_CTRL (PAD_CTL_IBE_ENABLE) int dram_init(void) { @@ -63,6 +67,37 @@ int board_qspi_init(void) } #endif +#ifdef CONFIG_DM_USB +static iomux_cfg_t const usb_otg1_pads[] = { + MX7ULP_PAD_PTC8__PTC8 | MUX_PAD_CTRL(OTG_ID_GPIO_PAD_CTRL), /* gpio for OTG ID*/ +}; + +static void setup_usb(void) +{ + mx7ulp_iomux_setup_multiple_pads(usb_otg1_pads, + ARRAY_SIZE(usb_otg1_pads)); + + gpio_request(IMX_GPIO_NR(3, 8), "otg_id"); + gpio_direction_input(IMX_GPIO_NR(3, 8)); +} + +int board_ehci_usb_phy_mode(struct udevice *dev) +{ + int ret = 0; + + if (dev_get_addr(dev) == USBOTG0_RBASE) { + ret = gpio_get_value(IMX_GPIO_NR(3, 8)); + + if (ret) + return USB_INIT_DEVICE; + else + return USB_INIT_HOST; + } + + return USB_INIT_HOST; +} +#endif + int board_early_init_f(void) { setup_iomux_uart(); @@ -79,5 +114,9 @@ int board_init(void) board_qspi_init(); #endif +#ifdef CONFIG_DM_USB + setup_usb(); +#endif + return 0; } diff --git a/configs/mx7ulp_evk_defconfig b/configs/mx7ulp_evk_defconfig index 452c3ca..d813383 100644 --- a/configs/mx7ulp_evk_defconfig +++ b/configs/mx7ulp_evk_defconfig @@ -30,3 +30,9 @@ CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_ULP_WATCHDOG=y +CONFIG_CMD_USB=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_MXC_USB_OTG_HACTIVE=y +CONFIG_USB_STORAGE=y diff --git a/configs/mx7ulp_evk_plugin_defconfig b/configs/mx7ulp_evk_plugin_defconfig index 6f41bf6..3f1a658 100644 --- a/configs/mx7ulp_evk_plugin_defconfig +++ b/configs/mx7ulp_evk_plugin_defconfig @@ -31,3 +31,9 @@ CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_ULP_WATCHDOG=y +CONFIG_CMD_USB=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_MXC_USB_OTG_HACTIVE=y +CONFIG_USB_STORAGE=y diff --git a/include/configs/mx7ulp_evk.h b/include/configs/mx7ulp_evk.h index d3cb257..f30341f 100644 --- a/include/configs/mx7ulp_evk.h +++ b/include/configs/mx7ulp_evk.h @@ -46,7 +46,6 @@ #define CONFIG_ENV_SIZE SZ_8K #define CONFIG_CMD_FAT -#define CONFIG_DOS_PARTITION /* Using ULP WDOG for reset */ #define WDOG_BASE_ADDR WDG1_RBASE @@ -208,6 +207,12 @@ #define QSPI0_AMBA_BASE 0xC0000000 #endif +/* USB Configs */ +#define CONFIG_USB_HOST_ETHER +#define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_RTL8152 +#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) + #define CONFIG_OF_SYSTEM_SETUP #endif /* __CONFIG_H */ |