blob: 0b3721ed854004f9110d2a4a490f71dc7f060cc0 [file] [log] [blame]
Vaibhav Hiremathdb5c5582010-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 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#include <common.h>
27#include <asm/io.h>
Ilya Yanoke484f8e2012-11-06 13:48:28 +000028#include <asm/omap_musb.h>
29#include <asm/arch/am35x_def.h>
Vaibhav Hiremathdb5c5582010-06-07 15:20:43 -040030#include <asm/arch/mem.h>
31#include <asm/arch/mux.h>
32#include <asm/arch/sys_proto.h>
Vaibhav Hiremath1e05ff82011-09-03 21:47:44 -040033#include <asm/arch/mmc_host_def.h>
Ilya Yanoke484f8e2012-11-06 13:48:28 +000034#include <asm/arch/musb.h>
Vaibhav Hiremathdb5c5582010-06-07 15:20:43 -040035#include <asm/mach-types.h>
Ilya Yanoke484f8e2012-11-06 13:48:28 +000036#include <asm/errno.h>
37#include <linux/usb/ch9.h>
38#include <linux/usb/gadget.h>
39#include <linux/usb/musb.h>
Vaibhav Hiremathdb5c5582010-06-07 15:20:43 -040040#include <i2c.h>
Ilya Yanoke484f8e2012-11-06 13:48:28 +000041#include <netdev.h>
Vaibhav Hiremathdb5c5582010-06-07 15:20:43 -040042#include "am3517evm.h"
43
44DECLARE_GLOBAL_DATA_PTR;
45
46/*
47 * Routine: board_init
48 * Description: Early hardware init.
49 */
50int board_init(void)
51{
52 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
53 /* board id for Linux */
54 gd->bd->bi_arch_number = MACH_TYPE_OMAP3517EVM;
55 /* boot param addr */
56 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
57
58 return 0;
59}
60
Ilya Yanoke484f8e2012-11-06 13:48:28 +000061#ifdef CONFIG_USB_MUSB_AM35X
62static struct musb_hdrc_config musb_config = {
63 .multipoint = 1,
64 .dyn_fifo = 1,
65 .num_eps = 16,
66 .ram_bits = 12,
67};
68
69static struct omap_musb_board_data musb_board_data = {
70 .set_phy_power = am35x_musb_phy_power,
71 .clear_irq = am35x_musb_clear_irq,
72 .reset = am35x_musb_reset,
73};
74
75static struct musb_hdrc_platform_data musb_plat = {
76#if defined(CONFIG_MUSB_HOST)
77 .mode = MUSB_HOST,
78#elif defined(CONFIG_MUSB_GADGET)
79 .mode = MUSB_PERIPHERAL,
80#else
81#error "Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET"
82#endif
83 .config = &musb_config,
84 .power = 250,
85 .platform_ops = &am35x_ops,
86 .board_data = &musb_board_data,
87};
88
89static void am3517_evm_musb_init(void)
90{
91 /*
92 * Set up USB clock/mode in the DEVCONF2 register.
93 * USB2.0 PHY reference clock is 13 MHz
94 */
95 clrsetbits_le32(&am35x_scm_general_regs->devconf2,
96 CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE,
97 CONF2_REFFREQ_13MHZ | CONF2_SESENDEN |
98 CONF2_VBDTCTEN | CONF2_DATPOL);
99
100 musb_register(&musb_plat, &musb_board_data,
101 (void *)AM35XX_IPSS_USBOTGSS_BASE);
102}
103#else
104#define am3517_evm_musb_init() do {} while (0)
105#endif
106
Vaibhav Hiremathdb5c5582010-06-07 15:20:43 -0400107/*
108 * Routine: misc_init_r
109 * Description: Init i2c, ethernet, etc... (done here so udelay works)
110 */
111int misc_init_r(void)
112{
113#ifdef CONFIG_DRIVER_OMAP34XX_I2C
114 i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
115#endif
116
117 dieid_num_r();
118
Ilya Yanoke484f8e2012-11-06 13:48:28 +0000119 am3517_evm_musb_init();
120
Vaibhav Hiremathdb5c5582010-06-07 15:20:43 -0400121 return 0;
122}
123
124/*
125 * Routine: set_muxconf_regs
126 * Description: Setting up the configuration Mux registers specific to the
127 * hardware. Many pins need to be moved from protect to primary
128 * mode.
129 */
130void set_muxconf_regs(void)
131{
132 MUX_AM3517EVM();
133}
Vaibhav Hiremath1e05ff82011-09-03 21:47:44 -0400134
Tom Rini5e0771c2011-11-18 12:48:10 +0000135#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
Vaibhav Hiremath1e05ff82011-09-03 21:47:44 -0400136int board_mmc_init(bd_t *bis)
137{
Jonathan Solnita9b05562012-02-24 11:30:18 +0000138 omap_mmc_init(0, 0, 0);
Vaibhav Hiremath1e05ff82011-09-03 21:47:44 -0400139 return 0;
140}
141#endif
Ilya Yanoke484f8e2012-11-06 13:48:28 +0000142
143#if defined(CONFIG_USB_ETHER) && defined(CONFIG_MUSB_GADGET)
144int board_eth_init(bd_t *bis)
145{
146 int rv, n = 0;
147
148 rv = cpu_eth_init(bis);
149 if (rv > 0)
150 n += rv;
151
152 rv = usb_eth_initialize(bis);
153 if (rv > 0)
154 n += rv;
155
156 return n;
157}
158#endif
159