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/
17 #include <asm/omap_musb.h>
18 #include <asm/arch/am35x_def.h>
19 #include <asm/arch/mem.h>
20 #include <asm/arch/mux.h>
21 #include <asm/arch/sys_proto.h>
22 #include <asm/arch/mmc_host_def.h>
23 #include <asm/arch/musb.h>
24 #include <asm/mach-types.h>
25 #include <linux/errno.h>
27 #include <linux/usb/ch9.h>
28 #include <linux/usb/gadget.h>
29 #include <linux/usb/musb.h>
32 #include "am3517evm.h"
34 DECLARE_GLOBAL_DATA_PTR;
36 #define AM3517_IP_SW_RESET 0x48002598
37 #define CPGMACSS_SW_RST (1 << 1)
40 /* This is only needed until SPL gets OF support */
41 #ifdef CONFIG_SPL_BUILD
42 static const struct ns16550_platdata am3517_serial = {
43 .base = OMAP34XX_UART3,
45 .clock = V_NS16550_CLK,
46 .fcr = UART_FCR_DEFVAL,
49 U_BOOT_DEVICE(am3517_uart) = {
57 * Description: Early hardware init.
61 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
62 /* board id for Linux */
63 gd->bd->bi_arch_number = MACH_TYPE_OMAP3517EVM;
65 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
70 #ifdef CONFIG_USB_MUSB_AM35X
71 static struct musb_hdrc_config musb_config = {
78 static struct omap_musb_board_data musb_board_data = {
79 .set_phy_power = am35x_musb_phy_power,
80 .clear_irq = am35x_musb_clear_irq,
81 .reset = am35x_musb_reset,
84 static struct musb_hdrc_platform_data musb_plat = {
85 #if defined(CONFIG_USB_MUSB_HOST)
87 #elif defined(CONFIG_USB_MUSB_GADGET)
88 .mode = MUSB_PERIPHERAL,
90 #error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
92 .config = &musb_config,
94 .platform_ops = &am35x_ops,
95 .board_data = &musb_board_data,
98 static void am3517_evm_musb_init(void)
101 * Set up USB clock/mode in the DEVCONF2 register.
102 * USB2.0 PHY reference clock is 13 MHz
104 clrsetbits_le32(&am35x_scm_general_regs->devconf2,
105 CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE,
106 CONF2_REFFREQ_13MHZ | CONF2_SESENDEN |
107 CONF2_VBDTCTEN | CONF2_DATPOL);
109 musb_register(&musb_plat, &musb_board_data,
110 (void *)AM35XX_IPSS_USBOTGSS_BASE);
113 #define am3517_evm_musb_init() do {} while (0)
117 * Routine: misc_init_r
118 * Description: Init i2c, ethernet, etc... (done here so udelay works)
120 int misc_init_r(void)
122 volatile unsigned int ctr;
125 #ifdef CONFIG_SYS_I2C_OMAP24XX
126 i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
129 omap_die_id_display();
131 am3517_evm_musb_init();
133 if (gpio_request(PHY_GPIO, "gpio_30") == 0) {
134 /* activate PHY reset */
135 gpio_direction_output(PHY_GPIO, 0);
136 gpio_set_value(PHY_GPIO, 0);
144 /* deactivate PHY reset */
145 gpio_set_value(PHY_GPIO, 1);
147 /* allow the PHY to stabilize and settle down */
154 /* ensure that the module is out of reset */
155 reset = readl(AM3517_IP_SW_RESET);
156 reset &= (~CPGMACSS_SW_RST);
157 writel(reset, AM3517_IP_SW_RESET);
159 /* Free requested GPIO */
167 * Routine: set_muxconf_regs
168 * Description: Setting up the configuration Mux registers specific to the
169 * hardware. Many pins need to be moved from protect to primary
172 void set_muxconf_regs(void)
177 #if defined(CONFIG_MMC)
178 int board_mmc_init(bd_t *bis)
180 return omap_mmc_init(0, 0, 0, -1, -1);
184 #if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
185 int board_eth_init(bd_t *bis)
189 rv = cpu_eth_init(bis);
193 rv = usb_eth_initialize(bis);