2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2009-08-23 10:56:42 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2004-2008
|
|
|
|
* Texas Instruments, <www.ti.com>
|
|
|
|
*
|
|
|
|
* Author :
|
|
|
|
* Sunil Kumar <sunilsaini05@gmail.com>
|
|
|
|
* Shashi Ranjan <shashiranjanmca05@gmail.com>
|
|
|
|
*
|
|
|
|
* (C) Copyright 2009
|
|
|
|
* Frederik Kriewitz <frederik@kriewitz.eu>
|
|
|
|
*
|
|
|
|
* Derived from Beagle Board and 3430 SDP code by
|
|
|
|
* Richard Woodruff <r-woodruff2@ti.com>
|
|
|
|
* Syed Mohammed Khasim <khasim@ti.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include <common.h>
|
2015-01-01 23:35:43 +00:00
|
|
|
#include <dm.h>
|
2019-08-01 15:46:51 +00:00
|
|
|
#include <env.h>
|
2015-01-01 23:35:43 +00:00
|
|
|
#include <ns16550.h>
|
2009-08-23 10:56:42 +00:00
|
|
|
#include <twl4030.h>
|
|
|
|
#include <asm/io.h>
|
2011-09-04 01:52:45 +00:00
|
|
|
#include <asm/arch/mmc_host_def.h>
|
2009-08-23 10:56:42 +00:00
|
|
|
#include <asm/arch/mux.h>
|
|
|
|
#include <asm/arch/sys_proto.h>
|
|
|
|
#include <asm/arch/mem.h>
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include "devkit8000.h"
|
2012-03-15 04:01:40 +00:00
|
|
|
#include <asm/gpio.h>
|
2009-08-23 10:56:42 +00:00
|
|
|
#ifdef CONFIG_DRIVER_DM9000
|
|
|
|
#include <net.h>
|
|
|
|
#include <netdev.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2011-12-13 05:54:17 +00:00
|
|
|
static u32 gpmc_net_config[GPMC_MAX_REG] = {
|
|
|
|
NET_GPMC_CONFIG1,
|
|
|
|
NET_GPMC_CONFIG2,
|
|
|
|
NET_GPMC_CONFIG3,
|
|
|
|
NET_GPMC_CONFIG4,
|
|
|
|
NET_GPMC_CONFIG5,
|
|
|
|
NET_GPMC_CONFIG6,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2015-01-01 23:35:43 +00:00
|
|
|
static const struct ns16550_platdata devkit8000_serial = {
|
2016-03-08 03:08:49 +00:00
|
|
|
.base = OMAP34XX_UART3,
|
|
|
|
.reg_shift = 2,
|
2017-01-18 07:05:49 +00:00
|
|
|
.clock = V_NS16550_CLK,
|
|
|
|
.fcr = UART_FCR_DEFVAL,
|
2015-01-01 23:35:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_DEVICE(devkit8000_uart) = {
|
2015-11-19 13:48:12 +00:00
|
|
|
"ns16550_serial",
|
2015-01-01 23:35:43 +00:00
|
|
|
&devkit8000_serial
|
|
|
|
};
|
|
|
|
|
2009-08-23 10:56:42 +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_DEVKIT8000;
|
|
|
|
/* boot param addr */
|
|
|
|
gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-03-15 04:01:37 +00:00
|
|
|
/* Configure GPMC registers for DM9000 */
|
|
|
|
static void gpmc_dm9000_config(void)
|
|
|
|
{
|
|
|
|
enable_gpmc_cs_config(gpmc_net_config, &gpmc_cfg->cs[6],
|
|
|
|
CONFIG_DM9000_BASE, GPMC_SIZE_16M);
|
|
|
|
}
|
|
|
|
|
2009-08-23 10:56:42 +00:00
|
|
|
/*
|
|
|
|
* Routine: misc_init_r
|
|
|
|
* Description: Configure board specific parts
|
|
|
|
*/
|
|
|
|
int misc_init_r(void)
|
|
|
|
{
|
|
|
|
struct ctrl_id *id_base = (struct ctrl_id *)OMAP34XX_ID_L4_IO_BASE;
|
|
|
|
#ifdef CONFIG_DRIVER_DM9000
|
|
|
|
uchar enetaddr[6];
|
|
|
|
u32 die_id_0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
twl4030_power_init();
|
|
|
|
#ifdef CONFIG_TWL4030_LED
|
2009-12-10 15:10:21 +00:00
|
|
|
twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
|
2009-08-23 10:56:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_DRIVER_DM9000
|
|
|
|
/* Configure GPMC registers for DM9000 */
|
2011-12-13 05:54:17 +00:00
|
|
|
enable_gpmc_cs_config(gpmc_net_config, &gpmc_cfg->cs[6],
|
|
|
|
CONFIG_DM9000_BASE, GPMC_SIZE_16M);
|
2009-08-23 10:56:42 +00:00
|
|
|
|
|
|
|
/* Use OMAP DIE_ID as MAC address */
|
2017-08-03 18:22:14 +00:00
|
|
|
if (!eth_env_get_enetaddr("ethaddr", enetaddr)) {
|
2009-08-23 10:56:42 +00:00
|
|
|
printf("ethaddr not set, using Die ID\n");
|
|
|
|
die_id_0 = readl(&id_base->die_id_0);
|
|
|
|
enetaddr[0] = 0x02; /* locally administered */
|
|
|
|
enetaddr[1] = readl(&id_base->die_id_1) & 0xff;
|
|
|
|
enetaddr[2] = (die_id_0 & 0xff000000) >> 24;
|
|
|
|
enetaddr[3] = (die_id_0 & 0x00ff0000) >> 16;
|
|
|
|
enetaddr[4] = (die_id_0 & 0x0000ff00) >> 8;
|
|
|
|
enetaddr[5] = (die_id_0 & 0x000000ff);
|
2017-08-03 18:22:11 +00:00
|
|
|
eth_env_set_enetaddr("ethaddr", enetaddr);
|
2009-08-23 10:56:42 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-08-27 17:37:13 +00:00
|
|
|
omap_die_id_display();
|
2009-08-23 10:56:42 +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_DEVKIT8000();
|
|
|
|
}
|
|
|
|
|
2017-05-09 11:31:39 +00:00
|
|
|
#if defined(CONFIG_MMC)
|
2011-09-04 01:52:45 +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:52:45 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-05-09 11:31:39 +00:00
|
|
|
#if defined(CONFIG_MMC)
|
2014-11-08 19:55:47 +00:00
|
|
|
void board_mmc_power_init(void)
|
|
|
|
{
|
|
|
|
twl4030_power_mmc_init(0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-09-14 19:32:17 +00:00
|
|
|
#if defined(CONFIG_DRIVER_DM9000) & !defined(CONFIG_SPL_BUILD)
|
2009-08-23 10:56:42 +00:00
|
|
|
/*
|
|
|
|
* Routine: board_eth_init
|
|
|
|
* Description: Setting up the Ethernet hardware.
|
|
|
|
*/
|
|
|
|
int board_eth_init(bd_t *bis)
|
|
|
|
{
|
|
|
|
return dm9000_initialize(bis);
|
|
|
|
}
|
|
|
|
#endif
|
2011-11-18 12:48:06 +00:00
|
|
|
|
2012-03-15 04:01:37 +00:00
|
|
|
#ifdef CONFIG_SPL_OS_BOOT
|
|
|
|
/*
|
2016-09-07 18:27:59 +00:00
|
|
|
* Do board specific preparation before SPL
|
2012-03-15 04:01:37 +00:00
|
|
|
* Linux boot
|
|
|
|
*/
|
|
|
|
void spl_board_prepare_for_linux(void)
|
|
|
|
{
|
|
|
|
gpmc_dm9000_config();
|
|
|
|
}
|
|
|
|
|
2012-03-15 04:01:40 +00:00
|
|
|
/*
|
|
|
|
* devkit8000 specific implementation of spl_start_uboot()
|
|
|
|
*
|
|
|
|
* RETURN
|
|
|
|
* 0 if the button is not pressed
|
|
|
|
* 1 if the button is pressed
|
|
|
|
*/
|
|
|
|
int spl_start_uboot(void)
|
|
|
|
{
|
|
|
|
int val = 0;
|
2013-02-23 00:53:26 +00:00
|
|
|
if (!gpio_request(SPL_OS_BOOT_KEY, "U-Boot key")) {
|
|
|
|
gpio_direction_input(SPL_OS_BOOT_KEY);
|
|
|
|
val = gpio_get_value(SPL_OS_BOOT_KEY);
|
|
|
|
gpio_free(SPL_OS_BOOT_KEY);
|
2012-03-15 04:01:40 +00:00
|
|
|
}
|
|
|
|
return !val;
|
|
|
|
}
|
2012-03-15 04:01:37 +00:00
|
|
|
#endif
|
|
|
|
|
2011-11-18 12:48:06 +00:00
|
|
|
/*
|
|
|
|
* Routine: get_board_mem_timings
|
|
|
|
* Description: If we use SPL then there is no x-loader nor config header
|
|
|
|
* so we have to setup the DDR timings ourself on the first bank. This
|
|
|
|
* provides the timing values back to the function that configures
|
|
|
|
* the memory. We have either one or two banks of 128MB DDR.
|
|
|
|
*/
|
2012-11-13 07:40:28 +00:00
|
|
|
void get_board_mem_timings(struct board_sdrc_timings *timings)
|
2011-11-18 12:48:06 +00:00
|
|
|
{
|
|
|
|
/* General SDRC config */
|
2012-11-13 07:40:28 +00:00
|
|
|
timings->mcfg = MICRON_V_MCFG_165(128 << 20);
|
|
|
|
timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
|
2011-11-18 12:48:06 +00:00
|
|
|
|
|
|
|
/* AC timings */
|
2012-11-13 07:40:28 +00:00
|
|
|
timings->ctrla = MICRON_V_ACTIMA_165;
|
|
|
|
timings->ctrlb = MICRON_V_ACTIMB_165;
|
2011-11-18 12:48:06 +00:00
|
|
|
|
2012-11-13 07:40:28 +00:00
|
|
|
timings->mr = MICRON_V_MR_165;
|
2011-11-18 12:48:06 +00:00
|
|
|
}
|