blob: b6c68da7a89e5d31b012a6cfc12e408ee677f978 [file] [log] [blame]
Vaibhav Hiremathed01e452010-06-07 15:20:43 -04001/*
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 *
Wolfgang Denk1a459662013-07-08 09:37:19 +020011 * SPDX-License-Identifier: GPL-2.0+
Vaibhav Hiremathed01e452010-06-07 15:20:43 -040012 */
13
14#include <common.h>
15#include <asm/io.h>
Ilya Yanok88919ff2012-11-06 13:48:28 +000016#include <asm/omap_musb.h>
17#include <asm/arch/am35x_def.h>
Vaibhav Hiremathed01e452010-06-07 15:20:43 -040018#include <asm/arch/mem.h>
19#include <asm/arch/mux.h>
20#include <asm/arch/sys_proto.h>
Vaibhav Hiremath122e6e02011-09-03 21:47:44 -040021#include <asm/arch/mmc_host_def.h>
Ilya Yanok88919ff2012-11-06 13:48:28 +000022#include <asm/arch/musb.h>
Vaibhav Hiremathed01e452010-06-07 15:20:43 -040023#include <asm/mach-types.h>
Ilya Yanok88919ff2012-11-06 13:48:28 +000024#include <asm/errno.h>
25#include <linux/usb/ch9.h>
26#include <linux/usb/gadget.h>
27#include <linux/usb/musb.h>
Vaibhav Hiremathed01e452010-06-07 15:20:43 -040028#include <i2c.h>
Ilya Yanok88919ff2012-11-06 13:48:28 +000029#include <netdev.h>
Vaibhav Hiremathed01e452010-06-07 15:20:43 -040030#include "am3517evm.h"
31
32DECLARE_GLOBAL_DATA_PTR;
33
34/*
35 * Routine: board_init
36 * Description: Early hardware init.
37 */
38int 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
Ilya Yanok88919ff2012-11-06 13:48:28 +000049#ifdef CONFIG_USB_MUSB_AM35X
50static struct musb_hdrc_config musb_config = {
51 .multipoint = 1,
52 .dyn_fifo = 1,
53 .num_eps = 16,
54 .ram_bits = 12,
55};
56
57static 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
63static 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
77static 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
Vaibhav Hiremathed01e452010-06-07 15:20:43 -040095/*
96 * Routine: misc_init_r
97 * Description: Init i2c, ethernet, etc... (done here so udelay works)
98 */
99int 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
Ilya Yanok88919ff2012-11-06 13:48:28 +0000107 am3517_evm_musb_init();
108
Vaibhav Hiremathed01e452010-06-07 15:20:43 -0400109 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 */
118void set_muxconf_regs(void)
119{
120 MUX_AM3517EVM();
121}
Vaibhav Hiremath122e6e02011-09-03 21:47:44 -0400122
Tom Rini5059a2a2011-11-18 12:48:10 +0000123#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
Vaibhav Hiremath122e6e02011-09-03 21:47:44 -0400124int board_mmc_init(bd_t *bis)
125{
Nikita Kiryanove3913f52012-12-03 02:19:47 +0000126 return omap_mmc_init(0, 0, 0, -1, -1);
Vaibhav Hiremath122e6e02011-09-03 21:47:44 -0400127}
128#endif
Ilya Yanok88919ff2012-11-06 13:48:28 +0000129
130#if defined(CONFIG_USB_ETHER) && defined(CONFIG_MUSB_GADGET)
131int 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