1 // SPDX-License-Identifier: GPL-2.0+
3 * am3517evm.c - board file for TI's AM3517 family of devices.
5 * Author: Vaibhav Hiremath <hvaibhav@ti.com>
7 * Based on ti/evm/evm.c
10 * Texas Instruments Incorporated - http://www.ti.com/
20 #include <asm/omap_musb.h>
21 #include <asm/arch/am35x_def.h>
22 #include <asm/arch/mem.h>
23 #include <asm/arch/mux.h>
24 #include <asm/arch/sys_proto.h>
25 #include <asm/arch/mmc_host_def.h>
26 #include <asm/arch/musb.h>
27 #include <asm/mach-types.h>
28 #include <linux/errno.h>
30 #include <linux/usb/ch9.h>
31 #include <linux/usb/gadget.h>
32 #include <linux/usb/musb.h>
34 #include "am3517evm.h"
36 DECLARE_GLOBAL_DATA_PTR;
38 #define AM3517_IP_SW_RESET 0x48002598
39 #define CPGMACSS_SW_RST (1 << 1)
42 #if defined(CONFIG_SPL_BUILD)
43 #if defined(CONFIG_SPL_OS_BOOT)
44 int spl_start_uboot(void)
46 /* break into full u-boot on 'c' */
47 return serial_tstc() && serial_getc() == 'c';
54 * Description: Early hardware init.
58 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
59 /* board id for Linux */
60 gd->bd->bi_arch_number = MACH_TYPE_OMAP3517EVM;
62 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
67 #ifdef CONFIG_USB_MUSB_AM35X
68 static struct musb_hdrc_config musb_config = {
75 static struct omap_musb_board_data musb_board_data = {
76 .set_phy_power = am35x_musb_phy_power,
77 .clear_irq = am35x_musb_clear_irq,
78 .reset = am35x_musb_reset,
81 static struct musb_hdrc_platform_data musb_plat = {
82 #if defined(CONFIG_USB_MUSB_HOST)
84 #elif defined(CONFIG_USB_MUSB_GADGET)
85 .mode = MUSB_PERIPHERAL,
87 #error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
89 .config = &musb_config,
91 .platform_ops = &am35x_ops,
92 .board_data = &musb_board_data,
95 static void am3517_evm_musb_init(void)
98 * Set up USB clock/mode in the DEVCONF2 register.
99 * USB2.0 PHY reference clock is 13 MHz
101 clrsetbits_le32(&am35x_scm_general_regs->devconf2,
102 CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE,
103 CONF2_REFFREQ_13MHZ | CONF2_SESENDEN |
104 CONF2_VBDTCTEN | CONF2_DATPOL);
106 musb_register(&musb_plat, &musb_board_data,
107 (void *)AM35XX_IPSS_USBOTGSS_BASE);
110 #define am3517_evm_musb_init() do {} while (0)
114 * Routine: misc_init_r
115 * Description: Init i2c, ethernet, etc... (done here so udelay works)
117 int misc_init_r(void)
121 omap_die_id_display();
123 am3517_evm_musb_init();
125 /* ensure that the Ethernet module is out of reset */
126 reset = readl(AM3517_IP_SW_RESET);
127 reset &= (~CPGMACSS_SW_RST);
128 writel(reset, AM3517_IP_SW_RESET);
134 * Routine: set_muxconf_regs
135 * Description: Setting up the configuration Mux registers specific to the
136 * hardware. Many pins need to be moved from protect to primary
139 void set_muxconf_regs(void)
145 #if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
146 int board_eth_init(bd_t *bis)
150 rv = cpu_eth_init(bis);
154 rv = usb_eth_initialize(bis);