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)
43 * Description: Early hardware init.
47 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
48 /* board id for Linux */
49 gd->bd->bi_arch_number = MACH_TYPE_OMAP3517EVM;
51 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
56 #ifdef CONFIG_USB_MUSB_AM35X
57 static struct musb_hdrc_config musb_config = {
64 static struct omap_musb_board_data musb_board_data = {
65 .set_phy_power = am35x_musb_phy_power,
66 .clear_irq = am35x_musb_clear_irq,
67 .reset = am35x_musb_reset,
70 static struct musb_hdrc_platform_data musb_plat = {
71 #if defined(CONFIG_USB_MUSB_HOST)
73 #elif defined(CONFIG_USB_MUSB_GADGET)
74 .mode = MUSB_PERIPHERAL,
76 #error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
78 .config = &musb_config,
80 .platform_ops = &am35x_ops,
81 .board_data = &musb_board_data,
84 static void am3517_evm_musb_init(void)
87 * Set up USB clock/mode in the DEVCONF2 register.
88 * USB2.0 PHY reference clock is 13 MHz
90 clrsetbits_le32(&am35x_scm_general_regs->devconf2,
91 CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE,
92 CONF2_REFFREQ_13MHZ | CONF2_SESENDEN |
93 CONF2_VBDTCTEN | CONF2_DATPOL);
95 musb_register(&musb_plat, &musb_board_data,
96 (void *)AM35XX_IPSS_USBOTGSS_BASE);
99 #define am3517_evm_musb_init() do {} while (0)
103 * Routine: misc_init_r
104 * Description: Init i2c, ethernet, etc... (done here so udelay works)
106 int misc_init_r(void)
108 volatile unsigned int ctr;
111 #if !defined(CONFIG_DM_I2C)
112 #ifdef CONFIG_SYS_I2C_OMAP24XX
113 i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
116 omap_die_id_display();
118 am3517_evm_musb_init();
120 if (gpio_request(PHY_GPIO, "gpio_30") == 0) {
121 /* activate PHY reset */
122 gpio_direction_output(PHY_GPIO, 0);
123 gpio_set_value(PHY_GPIO, 0);
131 /* deactivate PHY reset */
132 gpio_set_value(PHY_GPIO, 1);
134 /* allow the PHY to stabilize and settle down */
141 /* ensure that the module is out of reset */
142 reset = readl(AM3517_IP_SW_RESET);
143 reset &= (~CPGMACSS_SW_RST);
144 writel(reset, AM3517_IP_SW_RESET);
146 /* Free requested GPIO */
154 * Routine: set_muxconf_regs
155 * Description: Setting up the configuration Mux registers specific to the
156 * hardware. Many pins need to be moved from protect to primary
159 void set_muxconf_regs(void)
164 #if defined(CONFIG_MMC)
165 int board_mmc_init(bd_t *bis)
167 return omap_mmc_init(0, 0, 0, -1, -1);
171 #if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
172 int board_eth_init(bd_t *bis)
176 rv = cpu_eth_init(bis);
180 rv = usb_eth_initialize(bis);