summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2015-08-19 08:43:20 (GMT)
committerTom Rini <trini@konsulko.com>2015-08-28 16:33:21 (GMT)
commit7ba792c04481c02b994260c7d12bd9ecdf6b6d0e (patch)
tree579ae9ade520bdf4d80ac6bd5dc41dfe7cb93e5f
parent7c379aaa0315eaaba7be959d0dc096e182bcee43 (diff)
downloadu-boot-fsl-qoriq-7ba792c04481c02b994260c7d12bd9ecdf6b6d0e.tar.xz
board: ti: OMAP5: added USB initializtion code
Implemented board_usb_init(), board_usb_cleanup() and usb_gadget_handle_interrupts() in omap5 board file that can be invoked by various gadget drivers. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
-rw-r--r--arch/arm/include/asm/arch-omap5/omap.h6
-rw-r--r--board/ti/omap5_uevm/evm.c75
2 files changed, 81 insertions, 0 deletions
diff --git a/arch/arm/include/asm/arch-omap5/omap.h b/arch/arm/include/asm/arch-omap5/omap.h
index 0420a5e..b5b3838 100644
--- a/arch/arm/include/asm/arch-omap5/omap.h
+++ b/arch/arm/include/asm/arch-omap5/omap.h
@@ -43,6 +43,12 @@
#define DRA7_USB_OTG_SS2_BASE 0x488D0000
#define DRA7_USB_OTG_SS2_GLUE_BASE 0x488C0000
#define DRA7_USB2_PHY2_POWER 0x4A002E74
+#else
+#define OMAP5XX_USB_OTG_SS_BASE 0x4A030000
+#define OMAP5XX_USB_OTG_SS_GLUE_BASE 0x4A020000
+#define OMAP5XX_USB3_PHY_PLL_CTRL 0x4A084C00
+#define OMAP5XX_USB3_PHY_POWER 0x4A002370
+#define OMAP5XX_USB2_PHY_POWER 0x4A002300
#endif
/* To be verified */
diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
index 833ffe9..d0d0e0e 100644
--- a/board/ti/omap5_uevm/evm.c
+++ b/board/ti/omap5_uevm/evm.c
@@ -8,9 +8,15 @@
*/
#include <common.h>
#include <palmas.h>
+#include <asm/arch/omap.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/mmc_host_def.h>
#include <tca642x.h>
+#include <usb.h>
+#include <linux/usb/gadget.h>
+#include <dwc3-uboot.h>
+#include <dwc3-omap-uboot.h>
+#include <ti-usb-phy-uboot.h>
#include "mux_data.h"
@@ -53,6 +59,75 @@ struct tca642x_bank_info tca642x_init[] = {
.configuration_reg = 0x40 },
};
+#ifdef CONFIG_USB_DWC3
+static struct dwc3_device usb_otg_ss = {
+ .maximum_speed = USB_SPEED_SUPER,
+ .base = OMAP5XX_USB_OTG_SS_BASE,
+ .tx_fifo_resize = false,
+ .index = 0,
+};
+
+static struct dwc3_omap_device usb_otg_ss_glue = {
+ .base = (void *)OMAP5XX_USB_OTG_SS_GLUE_BASE,
+ .utmi_mode = DWC3_OMAP_UTMI_MODE_SW,
+ .index = 0,
+};
+
+static struct ti_usb_phy_device usb_phy_device = {
+ .pll_ctrl_base = (void *)OMAP5XX_USB3_PHY_PLL_CTRL,
+ .usb2_phy_power = (void *)OMAP5XX_USB2_PHY_POWER,
+ .usb3_phy_power = (void *)OMAP5XX_USB3_PHY_POWER,
+ .index = 0,
+};
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+ if (index) {
+ printf("Invalid Controller Index\n");
+ return -EINVAL;
+ }
+
+ if (init == USB_INIT_DEVICE) {
+ usb_otg_ss.dr_mode = USB_DR_MODE_PERIPHERAL;
+ usb_otg_ss_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
+ } else {
+ usb_otg_ss.dr_mode = USB_DR_MODE_HOST;
+ usb_otg_ss_glue.vbus_id_status = OMAP_DWC3_ID_GROUND;
+ }
+
+ ti_usb_phy_uboot_init(&usb_phy_device);
+ dwc3_omap_uboot_init(&usb_otg_ss_glue);
+ dwc3_uboot_init(&usb_otg_ss);
+
+ return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+ if (index) {
+ printf("Invalid Controller Index\n");
+ return -EINVAL;
+ }
+
+ ti_usb_phy_uboot_exit(index);
+ dwc3_uboot_exit(index);
+ dwc3_omap_uboot_exit(index);
+
+ return 0;
+}
+
+int usb_gadget_handle_interrupts(int index)
+{
+ u32 status;
+
+ status = dwc3_omap_uboot_interrupt_status(index);
+ if (status)
+ dwc3_uboot_handle_interrupt(index);
+
+ return 0;
+}
+#endif
+
/**
* @brief board_init
*