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/
19 #include <asm/omap_musb.h>
20 #include <asm/arch/am35x_def.h>
21 #include <asm/arch/mem.h>
22 #include <asm/arch/mux.h>
23 #include <asm/arch/sys_proto.h>
24 #include <asm/arch/mmc_host_def.h>
25 #include <asm/arch/musb.h>
26 #include <asm/mach-types.h>
27 #include <linux/errno.h>
29 #include <linux/usb/ch9.h>
30 #include <linux/usb/gadget.h>
31 #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 #if defined(CONFIG_SPL_BUILD)
42 #if defined(CONFIG_SPL_OS_BOOT)
43 int spl_start_uboot(void)
45 /* break into full u-boot on 'c' */
46 return serial_tstc() && serial_getc() == 'c';
53 * Description: Early hardware init.
57 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
58 /* board id for Linux */
59 gd
->bd
->bi_arch_number
= MACH_TYPE_OMAP3517EVM
;
61 gd
->bd
->bi_boot_params
= (OMAP34XX_SDRC_CS0
+ 0x100);
66 #ifdef CONFIG_USB_MUSB_AM35X
67 static struct musb_hdrc_config musb_config
= {
74 static struct omap_musb_board_data musb_board_data
= {
75 .set_phy_power
= am35x_musb_phy_power
,
76 .clear_irq
= am35x_musb_clear_irq
,
77 .reset
= am35x_musb_reset
,
80 static struct musb_hdrc_platform_data musb_plat
= {
81 #if defined(CONFIG_USB_MUSB_HOST)
83 #elif defined(CONFIG_USB_MUSB_GADGET)
84 .mode
= MUSB_PERIPHERAL
,
86 #error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
88 .config
= &musb_config
,
90 .platform_ops
= &am35x_ops
,
91 .board_data
= &musb_board_data
,
94 static void am3517_evm_musb_init(void)
97 * Set up USB clock/mode in the DEVCONF2 register.
98 * USB2.0 PHY reference clock is 13 MHz
100 clrsetbits_le32(&am35x_scm_general_regs
->devconf2
,
101 CONF2_REFFREQ
| CONF2_OTGMODE
| CONF2_PHY_GPIOMODE
,
102 CONF2_REFFREQ_13MHZ
| CONF2_SESENDEN
|
103 CONF2_VBDTCTEN
| CONF2_DATPOL
);
105 musb_register(&musb_plat
, &musb_board_data
,
106 (void *)AM35XX_IPSS_USBOTGSS_BASE
);
109 #define am3517_evm_musb_init() do {} while (0)
113 * Routine: misc_init_r
114 * Description: Init i2c, ethernet, etc... (done here so udelay works)
116 int misc_init_r(void)
120 omap_die_id_display();
122 am3517_evm_musb_init();
124 /* ensure that the Ethernet module is out of reset */
125 reset
= readl(AM3517_IP_SW_RESET
);
126 reset
&= (~CPGMACSS_SW_RST
);
127 writel(reset
, AM3517_IP_SW_RESET
);
133 * Routine: set_muxconf_regs
134 * Description: Setting up the configuration Mux registers specific to the
135 * hardware. Many pins need to be moved from protect to primary
138 void set_muxconf_regs(void)
144 #if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
145 int board_eth_init(bd_t
*bis
)
149 rv
= cpu_eth_init(bis
);
153 rv
= usb_eth_initialize(bis
);