1 // SPDX-License-Identifier: GPL-2.0+
4 * Texas Instruments Incorporated, <www.ti.com>
5 * Aneesh V <aneesh@ti.com>
6 * Steve Sakoman <steve@sakoman.com>
12 #include <asm/arch/omap.h>
13 #include <asm/arch/sys_proto.h>
14 #include <asm/arch/mmc_host_def.h>
18 #include <asm/global_data.h>
19 #include <linux/delay.h>
20 #include <linux/usb/gadget.h>
21 #include <dwc3-uboot.h>
22 #include <dwc3-omap-uboot.h>
23 #include <ti-usb-phy-uboot.h>
27 #if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_XHCI_OMAP)
31 #include <asm/mach-types.h>
32 #include <asm/arch/clock.h>
33 #include <asm/arch/ehci.h>
34 #include <asm/ehci-omap.h>
35 #include <asm/arch/sata.h>
37 #define DIE_ID_REG_BASE (OMAP54XX_L4_CORE_BASE + 0x2000)
38 #define DIE_ID_REG_OFFSET 0x200
42 DECLARE_GLOBAL_DATA_PTR;
44 const struct omap_sysinfo sysinfo = {
45 "Board: OMAP5432 uEVM\n"
49 * @brief tca642x_init - uEVM default values for the GPIO expander
50 * input reg, output reg, polarity reg, configuration reg
52 struct tca642x_bank_info tca642x_init[] = {
56 .configuration_reg = 0x80 },
60 .configuration_reg = 0xff },
64 .configuration_reg = 0x40 },
67 #ifdef CONFIG_USB_DWC3
68 static struct dwc3_device usb_otg_ss = {
69 .maximum_speed = USB_SPEED_SUPER,
70 .base = OMAP5XX_USB_OTG_SS_BASE,
71 .tx_fifo_resize = false,
75 static struct dwc3_omap_device usb_otg_ss_glue = {
76 .base = (void *)OMAP5XX_USB_OTG_SS_GLUE_BASE,
77 .utmi_mode = DWC3_OMAP_UTMI_MODE_SW,
81 static struct ti_usb_phy_device usb_phy_device = {
82 .pll_ctrl_base = (void *)OMAP5XX_USB3_PHY_PLL_CTRL,
83 .usb2_phy_power = (void *)OMAP5XX_USB2_PHY_POWER,
84 .usb3_phy_power = (void *)OMAP5XX_USB3_PHY_POWER,
88 int board_usb_init(int index, enum usb_init_type init)
91 printf("Invalid Controller Index\n");
95 if (init == USB_INIT_DEVICE) {
96 usb_otg_ss.dr_mode = USB_DR_MODE_PERIPHERAL;
97 usb_otg_ss_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
99 usb_otg_ss.dr_mode = USB_DR_MODE_HOST;
100 usb_otg_ss_glue.vbus_id_status = OMAP_DWC3_ID_GROUND;
103 enable_usb_clocks(index);
104 ti_usb_phy_uboot_init(&usb_phy_device);
105 dwc3_omap_uboot_init(&usb_otg_ss_glue);
106 dwc3_uboot_init(&usb_otg_ss);
111 int board_usb_cleanup(int index, enum usb_init_type init)
114 printf("Invalid Controller Index\n");
118 ti_usb_phy_uboot_exit(index);
119 dwc3_uboot_exit(index);
120 dwc3_omap_uboot_exit(index);
121 disable_usb_clocks(index);
126 int usb_gadget_handle_interrupts(int index)
130 status = dwc3_omap_uboot_interrupt_status(index);
132 dwc3_uboot_handle_interrupt(index);
146 gd->bd->bi_arch_number = MACH_TYPE_OMAP5_SEVM;
147 gd->bd->bi_boot_params = (0x80000000 + 0x100); /* boot param addr */
149 tca642x_set_inital_state(CONFIG_SYS_I2C_TCA642X_ADDR, tca642x_init);
154 #if defined(CONFIG_SPL_OS_BOOT)
155 int spl_start_uboot(void)
157 /* break into full u-boot on 'c' */
158 if (serial_tstc() && serial_getc() == 'c')
163 #endif /* CONFIG_SPL_OS_BOOT */
165 int board_eth_init(struct bd_info *bis)
171 * @brief misc_init_r - Configure EVM board specific configurations
172 * such as power configurations, ethernet initialization as phase2 of
177 int misc_init_r(void)
179 #ifdef CONFIG_PALMAS_POWER
180 palmas_init_settings();
183 omap_die_id_usbethaddr();
188 void set_muxconf_regs(void)
190 do_set_mux((*ctrl)->control_padconf_core_base,
191 core_padconf_array_essential,
192 sizeof(core_padconf_array_essential) /
193 sizeof(struct pad_conf_entry));
195 do_set_mux((*ctrl)->control_padconf_wkup_base,
196 wkup_padconf_array_essential,
197 sizeof(wkup_padconf_array_essential) /
198 sizeof(struct pad_conf_entry));
201 #if defined(CONFIG_MMC)
202 int board_mmc_init(struct bd_info *bis)
204 omap_mmc_init(0, 0, 0, -1, -1);
205 omap_mmc_init(1, 0, 0, -1, -1);
210 #ifdef CONFIG_USB_XHCI_OMAP
212 * @brief board_usb_init - Configure EVM board specific configurations
213 * for the LDO's and clocks for the USB blocks.
217 int board_usb_init(int index, enum usb_init_type init)
220 #ifdef CONFIG_PALMAS_USB_SS_PWR
221 ret = palmas_enable_ss_ldo();