2 * am3517evm.c - board file for TI's AM3517 family of devices.
4 * Author: Vaibhav Hiremath <hvaibhav@ti.com>
6 * Based on ti/evm/evm.c
9 * Texas Instruments Incorporated - http://www.ti.com/
11 * SPDX-License-Identifier: GPL-2.0+
18 #include <asm/omap_musb.h>
19 #include <asm/arch/am35x_def.h>
20 #include <asm/arch/mem.h>
21 #include <asm/arch/mux.h>
22 #include <asm/arch/sys_proto.h>
23 #include <asm/arch/mmc_host_def.h>
24 #include <asm/arch/musb.h>
25 #include <asm/mach-types.h>
26 #include <linux/errno.h>
28 #include <linux/usb/ch9.h>
29 #include <linux/usb/gadget.h>
30 #include <linux/usb/musb.h>
33 #include "am3517evm.h"
35 DECLARE_GLOBAL_DATA_PTR;
37 #define AM3517_IP_SW_RESET 0x48002598
38 #define CPGMACSS_SW_RST (1 << 1)
41 /* This is only needed until SPL gets OF support */
42 #ifdef CONFIG_SPL_BUILD
43 static const struct ns16550_platdata am3517_serial = {
44 .base = OMAP34XX_UART3,
46 .clock = V_NS16550_CLK,
47 .fcr = UART_FCR_DEFVAL,
50 U_BOOT_DEVICE(am3517_uart) = {
58 * Description: Early hardware init.
62 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
63 /* board id for Linux */
64 gd->bd->bi_arch_number = MACH_TYPE_OMAP3517EVM;
66 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
71 #ifdef CONFIG_USB_MUSB_AM35X
72 static struct musb_hdrc_config musb_config = {
79 static struct omap_musb_board_data musb_board_data = {
80 .set_phy_power = am35x_musb_phy_power,
81 .clear_irq = am35x_musb_clear_irq,
82 .reset = am35x_musb_reset,
85 static struct musb_hdrc_platform_data musb_plat = {
86 #if defined(CONFIG_USB_MUSB_HOST)
88 #elif defined(CONFIG_USB_MUSB_GADGET)
89 .mode = MUSB_PERIPHERAL,
91 #error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
93 .config = &musb_config,
95 .platform_ops = &am35x_ops,
96 .board_data = &musb_board_data,
99 static void am3517_evm_musb_init(void)
102 * Set up USB clock/mode in the DEVCONF2 register.
103 * USB2.0 PHY reference clock is 13 MHz
105 clrsetbits_le32(&am35x_scm_general_regs->devconf2,
106 CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE,
107 CONF2_REFFREQ_13MHZ | CONF2_SESENDEN |
108 CONF2_VBDTCTEN | CONF2_DATPOL);
110 musb_register(&musb_plat, &musb_board_data,
111 (void *)AM35XX_IPSS_USBOTGSS_BASE);
114 #define am3517_evm_musb_init() do {} while (0)
118 * Routine: misc_init_r
119 * Description: Init i2c, ethernet, etc... (done here so udelay works)
121 int misc_init_r(void)
123 volatile unsigned int ctr;
126 #ifdef CONFIG_SYS_I2C_OMAP24XX
127 i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
130 omap_die_id_display();
132 am3517_evm_musb_init();
134 if (gpio_request(PHY_GPIO, "gpio_30") == 0) {
135 /* activate PHY reset */
136 gpio_direction_output(PHY_GPIO, 0);
137 gpio_set_value(PHY_GPIO, 0);
145 /* deactivate PHY reset */
146 gpio_set_value(PHY_GPIO, 1);
148 /* allow the PHY to stabilize and settle down */
155 /* ensure that the module is out of reset */
156 reset = readl(AM3517_IP_SW_RESET);
157 reset &= (~CPGMACSS_SW_RST);
158 writel(reset, AM3517_IP_SW_RESET);
160 /* Free requested GPIO */
168 * Routine: set_muxconf_regs
169 * Description: Setting up the configuration Mux registers specific to the
170 * hardware. Many pins need to be moved from protect to primary
173 void set_muxconf_regs(void)
178 #if defined(CONFIG_MMC)
179 int board_mmc_init(bd_t *bis)
181 return omap_mmc_init(0, 0, 0, -1, -1);
185 #if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
186 int board_eth_init(bd_t *bis)
190 rv = cpu_eth_init(bis);
194 rv = usb_eth_initialize(bis);