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+
16 #include <asm/omap_musb.h>
17 #include <asm/arch/am35x_def.h>
18 #include <asm/arch/mem.h>
19 #include <asm/arch/mux.h>
20 #include <asm/arch/sys_proto.h>
21 #include <asm/arch/mmc_host_def.h>
22 #include <asm/arch/musb.h>
23 #include <asm/mach-types.h>
24 #include <linux/errno.h>
26 #include <linux/usb/ch9.h>
27 #include <linux/usb/gadget.h>
28 #include <linux/usb/musb.h>
31 #include "am3517evm.h"
33 DECLARE_GLOBAL_DATA_PTR;
35 #define AM3517_IP_SW_RESET 0x48002598
36 #define CPGMACSS_SW_RST (1 << 1)
40 * Description: Early hardware init.
44 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
45 /* board id for Linux */
46 gd->bd->bi_arch_number = MACH_TYPE_OMAP3517EVM;
48 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
53 #ifdef CONFIG_USB_MUSB_AM35X
54 static struct musb_hdrc_config musb_config = {
61 static struct omap_musb_board_data musb_board_data = {
62 .set_phy_power = am35x_musb_phy_power,
63 .clear_irq = am35x_musb_clear_irq,
64 .reset = am35x_musb_reset,
67 static struct musb_hdrc_platform_data musb_plat = {
68 #if defined(CONFIG_USB_MUSB_HOST)
70 #elif defined(CONFIG_USB_MUSB_GADGET)
71 .mode = MUSB_PERIPHERAL,
73 #error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
75 .config = &musb_config,
77 .platform_ops = &am35x_ops,
78 .board_data = &musb_board_data,
81 static void am3517_evm_musb_init(void)
84 * Set up USB clock/mode in the DEVCONF2 register.
85 * USB2.0 PHY reference clock is 13 MHz
87 clrsetbits_le32(&am35x_scm_general_regs->devconf2,
88 CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE,
89 CONF2_REFFREQ_13MHZ | CONF2_SESENDEN |
90 CONF2_VBDTCTEN | CONF2_DATPOL);
92 musb_register(&musb_plat, &musb_board_data,
93 (void *)AM35XX_IPSS_USBOTGSS_BASE);
96 #define am3517_evm_musb_init() do {} while (0)
100 * Routine: misc_init_r
101 * Description: Init i2c, ethernet, etc... (done here so udelay works)
103 int misc_init_r(void)
105 volatile unsigned int ctr;
108 #ifdef CONFIG_SYS_I2C_OMAP34XX
109 i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
112 omap_die_id_display();
114 am3517_evm_musb_init();
116 /* activate PHY reset */
117 gpio_direction_output(30, 0);
118 gpio_set_value(30, 0);
126 /* deactivate PHY reset */
127 gpio_set_value(30, 1);
129 /* allow the PHY to stabilize and settle down */
136 /* ensure that the module is out of reset */
137 reset = readl(AM3517_IP_SW_RESET);
138 reset &= (~CPGMACSS_SW_RST);
139 writel(reset,AM3517_IP_SW_RESET);
145 * Routine: set_muxconf_regs
146 * Description: Setting up the configuration Mux registers specific to the
147 * hardware. Many pins need to be moved from protect to primary
150 void set_muxconf_regs(void)
155 #if defined(CONFIG_GENERIC_MMC)
156 int board_mmc_init(bd_t *bis)
158 return omap_mmc_init(0, 0, 0, -1, -1);
162 #if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
163 int board_eth_init(bd_t *bis)
167 rv = cpu_eth_init(bis);
171 rv = usb_eth_initialize(bis);