2010-06-07 19:20:43 +00:00
|
|
|
/*
|
|
|
|
* am3517evm.c - board file for TI's AM3517 family of devices.
|
|
|
|
*
|
|
|
|
* Author: Vaibhav Hiremath <hvaibhav@ti.com>
|
|
|
|
*
|
|
|
|
* Based on ti/evm/evm.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010
|
|
|
|
* Texas Instruments Incorporated - http://www.ti.com/
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2010-06-07 19:20:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/io.h>
|
2012-11-06 13:48:28 +00:00
|
|
|
#include <asm/omap_musb.h>
|
|
|
|
#include <asm/arch/am35x_def.h>
|
2010-06-07 19:20:43 +00:00
|
|
|
#include <asm/arch/mem.h>
|
|
|
|
#include <asm/arch/mux.h>
|
|
|
|
#include <asm/arch/sys_proto.h>
|
2011-09-04 01:47:44 +00:00
|
|
|
#include <asm/arch/mmc_host_def.h>
|
2012-11-06 13:48:28 +00:00
|
|
|
#include <asm/arch/musb.h>
|
2010-06-07 19:20:43 +00:00
|
|
|
#include <asm/mach-types.h>
|
2016-09-21 02:28:55 +00:00
|
|
|
#include <linux/errno.h>
|
2013-12-11 14:41:11 +00:00
|
|
|
#include <asm/gpio.h>
|
2012-11-06 13:48:28 +00:00
|
|
|
#include <linux/usb/ch9.h>
|
|
|
|
#include <linux/usb/gadget.h>
|
|
|
|
#include <linux/usb/musb.h>
|
2010-06-07 19:20:43 +00:00
|
|
|
#include <i2c.h>
|
2012-11-06 13:48:28 +00:00
|
|
|
#include <netdev.h>
|
2010-06-07 19:20:43 +00:00
|
|
|
#include "am3517evm.h"
|
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2013-12-11 14:41:11 +00:00
|
|
|
#define AM3517_IP_SW_RESET 0x48002598
|
|
|
|
#define CPGMACSS_SW_RST (1 << 1)
|
|
|
|
|
2010-06-07 19:20:43 +00:00
|
|
|
/*
|
|
|
|
* Routine: board_init
|
|
|
|
* Description: Early hardware init.
|
|
|
|
*/
|
|
|
|
int board_init(void)
|
|
|
|
{
|
|
|
|
gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
|
|
|
|
/* board id for Linux */
|
|
|
|
gd->bd->bi_arch_number = MACH_TYPE_OMAP3517EVM;
|
|
|
|
/* boot param addr */
|
|
|
|
gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-11-06 13:48:28 +00:00
|
|
|
#ifdef CONFIG_USB_MUSB_AM35X
|
|
|
|
static struct musb_hdrc_config musb_config = {
|
|
|
|
.multipoint = 1,
|
|
|
|
.dyn_fifo = 1,
|
|
|
|
.num_eps = 16,
|
|
|
|
.ram_bits = 12,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct omap_musb_board_data musb_board_data = {
|
|
|
|
.set_phy_power = am35x_musb_phy_power,
|
|
|
|
.clear_irq = am35x_musb_clear_irq,
|
|
|
|
.reset = am35x_musb_reset,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct musb_hdrc_platform_data musb_plat = {
|
2015-08-04 15:04:06 +00:00
|
|
|
#if defined(CONFIG_USB_MUSB_HOST)
|
2012-11-06 13:48:28 +00:00
|
|
|
.mode = MUSB_HOST,
|
2015-08-04 15:04:06 +00:00
|
|
|
#elif defined(CONFIG_USB_MUSB_GADGET)
|
2012-11-06 13:48:28 +00:00
|
|
|
.mode = MUSB_PERIPHERAL,
|
|
|
|
#else
|
2015-08-04 15:04:06 +00:00
|
|
|
#error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
|
2012-11-06 13:48:28 +00:00
|
|
|
#endif
|
|
|
|
.config = &musb_config,
|
|
|
|
.power = 250,
|
|
|
|
.platform_ops = &am35x_ops,
|
|
|
|
.board_data = &musb_board_data,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void am3517_evm_musb_init(void)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Set up USB clock/mode in the DEVCONF2 register.
|
|
|
|
* USB2.0 PHY reference clock is 13 MHz
|
|
|
|
*/
|
|
|
|
clrsetbits_le32(&am35x_scm_general_regs->devconf2,
|
|
|
|
CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE,
|
|
|
|
CONF2_REFFREQ_13MHZ | CONF2_SESENDEN |
|
|
|
|
CONF2_VBDTCTEN | CONF2_DATPOL);
|
|
|
|
|
|
|
|
musb_register(&musb_plat, &musb_board_data,
|
|
|
|
(void *)AM35XX_IPSS_USBOTGSS_BASE);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define am3517_evm_musb_init() do {} while (0)
|
|
|
|
#endif
|
|
|
|
|
2010-06-07 19:20:43 +00:00
|
|
|
/*
|
|
|
|
* Routine: misc_init_r
|
|
|
|
* Description: Init i2c, ethernet, etc... (done here so udelay works)
|
|
|
|
*/
|
|
|
|
int misc_init_r(void)
|
|
|
|
{
|
2013-12-11 14:41:11 +00:00
|
|
|
volatile unsigned int ctr;
|
|
|
|
u32 reset;
|
|
|
|
|
2013-10-22 09:03:18 +00:00
|
|
|
#ifdef CONFIG_SYS_I2C_OMAP34XX
|
|
|
|
i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
|
2010-06-07 19:20:43 +00:00
|
|
|
#endif
|
|
|
|
|
2015-08-27 17:37:13 +00:00
|
|
|
omap_die_id_display();
|
2010-06-07 19:20:43 +00:00
|
|
|
|
2012-11-06 13:48:28 +00:00
|
|
|
am3517_evm_musb_init();
|
|
|
|
|
2013-12-11 14:41:11 +00:00
|
|
|
/* activate PHY reset */
|
|
|
|
gpio_direction_output(30, 0);
|
|
|
|
gpio_set_value(30, 0);
|
|
|
|
|
|
|
|
ctr = 0;
|
|
|
|
do {
|
|
|
|
udelay(1000);
|
|
|
|
ctr++;
|
|
|
|
} while (ctr < 300);
|
|
|
|
|
|
|
|
/* deactivate PHY reset */
|
|
|
|
gpio_set_value(30, 1);
|
|
|
|
|
|
|
|
/* allow the PHY to stabilize and settle down */
|
|
|
|
ctr = 0;
|
|
|
|
do {
|
|
|
|
udelay(1000);
|
|
|
|
ctr++;
|
|
|
|
} while (ctr < 300);
|
|
|
|
|
|
|
|
/* ensure that the module is out of reset */
|
|
|
|
reset = readl(AM3517_IP_SW_RESET);
|
|
|
|
reset &= (~CPGMACSS_SW_RST);
|
|
|
|
writel(reset,AM3517_IP_SW_RESET);
|
|
|
|
|
2010-06-07 19:20:43 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Routine: set_muxconf_regs
|
|
|
|
* Description: Setting up the configuration Mux registers specific to the
|
|
|
|
* hardware. Many pins need to be moved from protect to primary
|
|
|
|
* mode.
|
|
|
|
*/
|
|
|
|
void set_muxconf_regs(void)
|
|
|
|
{
|
|
|
|
MUX_AM3517EVM();
|
|
|
|
}
|
2011-09-04 01:47:44 +00:00
|
|
|
|
2017-02-01 10:39:14 +00:00
|
|
|
#if defined(CONFIG_GENERIC_MMC)
|
2011-09-04 01:47:44 +00:00
|
|
|
int board_mmc_init(bd_t *bis)
|
|
|
|
{
|
2012-12-03 02:19:47 +00:00
|
|
|
return omap_mmc_init(0, 0, 0, -1, -1);
|
2011-09-04 01:47:44 +00:00
|
|
|
}
|
|
|
|
#endif
|
2012-11-06 13:48:28 +00:00
|
|
|
|
2015-08-04 15:04:06 +00:00
|
|
|
#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
|
2012-11-06 13:48:28 +00:00
|
|
|
int board_eth_init(bd_t *bis)
|
|
|
|
{
|
|
|
|
int rv, n = 0;
|
|
|
|
|
|
|
|
rv = cpu_eth_init(bis);
|
|
|
|
if (rv > 0)
|
|
|
|
n += rv;
|
|
|
|
|
|
|
|
rv = usb_eth_initialize(bis);
|
|
|
|
if (rv > 0)
|
|
|
|
n += rv;
|
|
|
|
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
#endif
|