2012-10-14 20:21:41 +00:00
|
|
|
#include <common.h>
|
|
|
|
#include <sizes.h>
|
2013-07-09 09:23:18 +00:00
|
|
|
#include <io.h>
|
|
|
|
#include <init.h>
|
2012-10-14 20:21:41 +00:00
|
|
|
#include <asm/barebox-arm-head.h>
|
|
|
|
#include <asm/barebox-arm.h>
|
2013-07-09 09:23:18 +00:00
|
|
|
#include <mach/am33xx-silicon.h>
|
|
|
|
#include <mach/am33xx-clock.h>
|
2013-07-09 09:23:20 +00:00
|
|
|
#include <mach/generic.h>
|
2013-07-09 09:23:18 +00:00
|
|
|
#include <mach/sdrc.h>
|
|
|
|
#include <mach/sys_info.h>
|
|
|
|
#include <mach/syslib.h>
|
|
|
|
#include <mach/am33xx-mux.h>
|
2013-08-22 18:39:29 +00:00
|
|
|
#include <mach/am33xx-generic.h>
|
2013-07-09 09:23:18 +00:00
|
|
|
#include <mach/wdt.h>
|
2013-11-25 09:49:15 +00:00
|
|
|
#include <debug_ll.h>
|
2013-07-09 09:23:18 +00:00
|
|
|
|
2014-05-12 12:24:19 +00:00
|
|
|
static const struct am33xx_cmd_control MT41J256M16HA15EIT_1x512MB_cmd = {
|
2013-08-23 07:00:21 +00:00
|
|
|
.slave_ratio0 = 0x40,
|
|
|
|
.dll_lock_diff0 = 0x0,
|
|
|
|
.invert_clkout0 = 0x1,
|
|
|
|
.slave_ratio1 = 0x40,
|
|
|
|
.dll_lock_diff1 = 0x0,
|
|
|
|
.invert_clkout1 = 0x1,
|
|
|
|
.slave_ratio2 = 0x40,
|
|
|
|
.dll_lock_diff2 = 0x0,
|
|
|
|
.invert_clkout2 = 0x1,
|
|
|
|
};
|
|
|
|
|
2014-05-12 12:24:19 +00:00
|
|
|
static const struct am33xx_emif_regs MT41J256M16HA15EIT_1x512MB_regs = {
|
2013-08-23 07:00:21 +00:00
|
|
|
.emif_read_latency = 0x6,
|
2014-05-12 12:24:19 +00:00
|
|
|
.emif_tim1 = 0x0888A39B,
|
|
|
|
.emif_tim2 = 0x26517FDA,
|
|
|
|
.emif_tim3 = 0x501F84EF,
|
|
|
|
.sdram_config = 0x61C04B32,
|
2013-08-23 07:00:21 +00:00
|
|
|
.zq_config = 0x50074BE4,
|
|
|
|
.sdram_ref_ctrl = 0x0000093B,
|
|
|
|
};
|
|
|
|
|
2014-05-12 12:24:19 +00:00
|
|
|
static const struct am33xx_ddr_data MT41J256M16HA15EIT_1x512MB_data = {
|
2013-08-23 07:00:21 +00:00
|
|
|
.rd_slave_ratio0 = 0x3B,
|
2014-05-12 12:24:19 +00:00
|
|
|
.wr_dqs_slave_ratio0 = 0x3B,
|
|
|
|
.fifo_we_slave_ratio0 = 0x96,
|
|
|
|
.wr_slave_ratio0 = 0x76,
|
2013-08-23 07:00:21 +00:00
|
|
|
};
|
2013-07-09 09:23:18 +00:00
|
|
|
|
2013-11-21 11:19:41 +00:00
|
|
|
extern char __dtb_am335x_phytec_phycore_start[];
|
|
|
|
|
2013-07-09 09:23:18 +00:00
|
|
|
/**
|
|
|
|
* @brief The basic entry point for board initialization.
|
|
|
|
*
|
|
|
|
* This is called as part of machine init (after arch init).
|
|
|
|
* This is again called with stack in SRAM, so not too many
|
|
|
|
* constructs possible here.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2013-11-21 11:19:41 +00:00
|
|
|
static noinline void pcm051_board_init(void)
|
2013-07-09 09:23:18 +00:00
|
|
|
{
|
2014-05-01 21:32:49 +00:00
|
|
|
void *fdt;
|
2013-11-21 11:19:41 +00:00
|
|
|
|
2013-07-09 09:23:18 +00:00
|
|
|
/* WDT1 is already running when the bootloader gets control
|
|
|
|
* Disable it to avoid "random" resets
|
|
|
|
*/
|
|
|
|
writel(WDT_DISABLE_CODE1, AM33XX_WDT_REG(WSPR));
|
|
|
|
while (readl(AM33XX_WDT_REG(WWPS)) != 0x0);
|
|
|
|
|
|
|
|
writel(WDT_DISABLE_CODE2, AM33XX_WDT_REG(WSPR));
|
|
|
|
while (readl(AM33XX_WDT_REG(WWPS)) != 0x0);
|
|
|
|
|
2013-11-18 13:08:47 +00:00
|
|
|
am33xx_pll_init(MPUPLL_M_600, 25, DDRPLL_M_303);
|
2013-08-23 07:00:21 +00:00
|
|
|
|
2014-05-12 12:24:19 +00:00
|
|
|
am335x_sdram_init(0x18B, &MT41J256M16HA15EIT_1x512MB_cmd,
|
|
|
|
&MT41J256M16HA15EIT_1x512MB_regs,
|
|
|
|
&MT41J256M16HA15EIT_1x512MB_data);
|
2013-08-23 07:00:21 +00:00
|
|
|
|
2014-05-15 08:18:28 +00:00
|
|
|
am33xx_uart_soft_reset((void *)AM33XX_UART0_BASE);
|
2013-08-23 07:00:21 +00:00
|
|
|
am33xx_enable_uart0_pin_mux();
|
2013-11-25 09:49:15 +00:00
|
|
|
omap_uart_lowlevel_init((void *)AM33XX_UART0_BASE);
|
|
|
|
putc_ll('>');
|
2013-07-09 09:23:18 +00:00
|
|
|
|
2014-05-01 21:32:52 +00:00
|
|
|
fdt = __dtb_am335x_phytec_phycore_start - get_runtime_offset();
|
2013-11-21 11:19:41 +00:00
|
|
|
|
2014-07-15 16:42:15 +00:00
|
|
|
barebox_arm_entry(0x80000000, SZ_256M, fdt);
|
2013-07-09 09:23:18 +00:00
|
|
|
}
|
2012-10-14 20:21:41 +00:00
|
|
|
|
2013-11-21 11:19:41 +00:00
|
|
|
ENTRY_FUNCTION(start_am33xx_phytec_phycore_sram, bootinfo, r1, r2)
|
2012-10-14 20:21:41 +00:00
|
|
|
{
|
2013-11-21 11:19:41 +00:00
|
|
|
am33xx_save_bootinfo((void *)bootinfo);
|
2013-07-09 09:23:20 +00:00
|
|
|
|
2013-02-05 13:45:26 +00:00
|
|
|
arm_cpu_lowlevel_init();
|
2012-10-14 20:21:41 +00:00
|
|
|
|
2013-11-21 11:19:41 +00:00
|
|
|
/*
|
|
|
|
* Setup C environment, the board init code uses global variables.
|
|
|
|
* Stackpointer has already been initialized by the ROM code.
|
|
|
|
*/
|
|
|
|
relocate_to_current_adr();
|
|
|
|
setup_c();
|
|
|
|
|
2013-07-09 09:23:18 +00:00
|
|
|
pcm051_board_init();
|
2013-11-21 11:19:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ENTRY_FUNCTION(start_am33xx_phytec_phycore_sdram, r0, r1, r2)
|
|
|
|
{
|
2014-05-01 21:32:49 +00:00
|
|
|
void *fdt;
|
2013-11-21 11:19:41 +00:00
|
|
|
|
2014-05-01 21:32:49 +00:00
|
|
|
fdt = __dtb_am335x_phytec_phycore_start - get_runtime_offset();
|
2013-07-09 09:23:18 +00:00
|
|
|
|
2014-07-15 16:42:15 +00:00
|
|
|
barebox_arm_entry(0x80000000, SZ_256M, fdt);
|
2012-10-14 20:21:41 +00:00
|
|
|
}
|