1 /* 2 * am3517evm.c - board file for TI's AM3517 family of devices. 3 * 4 * Author: Vaibhav Hiremath <hvaibhav@ti.com> 5 * 6 * Based on ti/evm/evm.c 7 * 8 * Copyright (C) 2010 9 * Texas Instruments Incorporated - http://www.ti.com/ 10 * 11 * SPDX-License-Identifier: GPL-2.0+ 12 */ 13 14 #include <common.h> 15 #include <asm/io.h> 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 <asm/errno.h> 25 #include <linux/usb/ch9.h> 26 #include <linux/usb/gadget.h> 27 #include <linux/usb/musb.h> 28 #include <i2c.h> 29 #include <netdev.h> 30 #include "am3517evm.h" 31 32 DECLARE_GLOBAL_DATA_PTR; 33 34 /* 35 * Routine: board_init 36 * Description: Early hardware init. 37 */ 38 int board_init(void) 39 { 40 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ 41 /* board id for Linux */ 42 gd->bd->bi_arch_number = MACH_TYPE_OMAP3517EVM; 43 /* boot param addr */ 44 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); 45 46 return 0; 47 } 48 49 #ifdef CONFIG_USB_MUSB_AM35X 50 static struct musb_hdrc_config musb_config = { 51 .multipoint = 1, 52 .dyn_fifo = 1, 53 .num_eps = 16, 54 .ram_bits = 12, 55 }; 56 57 static struct omap_musb_board_data musb_board_data = { 58 .set_phy_power = am35x_musb_phy_power, 59 .clear_irq = am35x_musb_clear_irq, 60 .reset = am35x_musb_reset, 61 }; 62 63 static struct musb_hdrc_platform_data musb_plat = { 64 #if defined(CONFIG_MUSB_HOST) 65 .mode = MUSB_HOST, 66 #elif defined(CONFIG_MUSB_GADGET) 67 .mode = MUSB_PERIPHERAL, 68 #else 69 #error "Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET" 70 #endif 71 .config = &musb_config, 72 .power = 250, 73 .platform_ops = &am35x_ops, 74 .board_data = &musb_board_data, 75 }; 76 77 static void am3517_evm_musb_init(void) 78 { 79 /* 80 * Set up USB clock/mode in the DEVCONF2 register. 81 * USB2.0 PHY reference clock is 13 MHz 82 */ 83 clrsetbits_le32(&am35x_scm_general_regs->devconf2, 84 CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE, 85 CONF2_REFFREQ_13MHZ | CONF2_SESENDEN | 86 CONF2_VBDTCTEN | CONF2_DATPOL); 87 88 musb_register(&musb_plat, &musb_board_data, 89 (void *)AM35XX_IPSS_USBOTGSS_BASE); 90 } 91 #else 92 #define am3517_evm_musb_init() do {} while (0) 93 #endif 94 95 /* 96 * Routine: misc_init_r 97 * Description: Init i2c, ethernet, etc... (done here so udelay works) 98 */ 99 int misc_init_r(void) 100 { 101 #ifdef CONFIG_DRIVER_OMAP34XX_I2C 102 i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); 103 #endif 104 105 dieid_num_r(); 106 107 am3517_evm_musb_init(); 108 109 return 0; 110 } 111 112 /* 113 * Routine: set_muxconf_regs 114 * Description: Setting up the configuration Mux registers specific to the 115 * hardware. Many pins need to be moved from protect to primary 116 * mode. 117 */ 118 void set_muxconf_regs(void) 119 { 120 MUX_AM3517EVM(); 121 } 122 123 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD) 124 int board_mmc_init(bd_t *bis) 125 { 126 return omap_mmc_init(0, 0, 0, -1, -1); 127 } 128 #endif 129 130 #if defined(CONFIG_USB_ETHER) && defined(CONFIG_MUSB_GADGET) 131 int board_eth_init(bd_t *bis) 132 { 133 int rv, n = 0; 134 135 rv = cpu_eth_init(bis); 136 if (rv > 0) 137 n += rv; 138 139 rv = usb_eth_initialize(bis); 140 if (rv > 0) 141 n += rv; 142 143 return n; 144 } 145 #endif 146