2 * (C) Copyright 2014 CompuLab, Ltd. <www.compulab.co.il>
4 * Authors: Igor Grinberg <grinberg@compulab.co.il>
6 * SPDX-License-Identifier: GPL-2.0+
10 #include <status_led.h>
13 #include <linux/compiler.h>
14 #include <linux/usb/musb.h>
17 #include <asm/arch/mem.h>
18 #include <asm/arch/am35x_def.h>
19 #include <asm/arch/mmc_host_def.h>
20 #include <asm/arch/sys_proto.h>
21 #include <asm/arch/musb.h>
22 #include <asm/omap_musb.h>
23 #include <asm/ehci-omap.h>
25 #include "../common/common.h"
27 DECLARE_GLOBAL_DATA_PTR;
29 const omap3_sysinfo sysinfo = {
35 #ifdef CONFIG_USB_MUSB_AM35X
36 static struct musb_hdrc_config cm_t3517_musb_config = {
43 static struct omap_musb_board_data cm_t3517_musb_board_data = {
44 .set_phy_power = am35x_musb_phy_power,
45 .clear_irq = am35x_musb_clear_irq,
46 .reset = am35x_musb_reset,
49 static struct musb_hdrc_platform_data cm_t3517_musb_pdata = {
50 #if defined(CONFIG_MUSB_HOST)
52 #elif defined(CONFIG_MUSB_GADGET)
53 .mode = MUSB_PERIPHERAL,
55 #error "Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET"
57 .config = &cm_t3517_musb_config,
59 .platform_ops = &am35x_ops,
60 .board_data = &cm_t3517_musb_board_data,
63 static void cm_t3517_musb_init(void)
66 * Set up USB clock/mode in the DEVCONF2 register.
67 * USB2.0 PHY reference clock is 13 MHz
69 clrsetbits_le32(&am35x_scm_general_regs->devconf2,
70 CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE,
71 CONF2_REFFREQ_13MHZ | CONF2_SESENDEN |
72 CONF2_VBDTCTEN | CONF2_DATPOL);
74 if (musb_register(&cm_t3517_musb_pdata, &cm_t3517_musb_board_data,
75 (void *)AM35XX_IPSS_USBOTGSS_BASE))
76 printf("Failed initializing AM35x MUSB!\n");
79 static inline void am3517_evm_musb_init(void) {}
84 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
87 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
89 #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
90 status_led_set(STATUS_LED_BOOT, STATUS_LED_ON);
106 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
107 #define SB_T35_CD_GPIO 144
108 #define SB_T35_WP_GPIO 59
110 int board_mmc_init(bd_t *bis)
112 return omap_mmc_init(0, 0, 0, SB_T35_CD_GPIO, SB_T35_WP_GPIO);
116 #ifdef CONFIG_USB_EHCI_OMAP
117 static struct omap_usbhs_board_data cm_t3517_usbhs_bdata = {
118 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
119 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
120 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
123 #define CM_T3517_USB_HUB_RESET_GPIO 152
124 #define SB_T35_USB_HUB_RESET_GPIO 98
126 int ehci_hcd_init(int index, enum usb_init_type init,
127 struct ehci_hccr **hccr, struct ehci_hcor **hcor)
129 cl_usb_hub_init(CM_T3517_USB_HUB_RESET_GPIO, "cm-t3517 hub rst");
130 cl_usb_hub_init(SB_T35_USB_HUB_RESET_GPIO, "sb-t35 hub rst");
132 return omap_ehci_hcd_init(index, &cm_t3517_usbhs_bdata, hccr, hcor);
135 int ehci_hcd_stop(void)
137 cl_usb_hub_deinit(CM_T3517_USB_HUB_RESET_GPIO);
138 cl_usb_hub_deinit(SB_T35_USB_HUB_RESET_GPIO);
140 return omap_ehci_hcd_stop();
142 #endif /* CONFIG_USB_EHCI_OMAP */