2007-03-21 12:39:57 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2007
|
|
|
|
* Stefan Roese, DENX Software Engineering, sr@denx.de.
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2007-03-21 12:39:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/processor.h>
|
|
|
|
|
|
|
|
extern void board_pll_init_f(void);
|
|
|
|
|
2007-04-18 10:07:47 +00:00
|
|
|
static void acadia_gpio_init(void)
|
2007-03-21 12:39:57 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* GPIO0 setup (select GPIO or alternate function)
|
|
|
|
*/
|
2008-10-16 13:01:15 +00:00
|
|
|
out32(GPIO0_OSRL, CONFIG_SYS_GPIO0_OSRL);
|
|
|
|
out32(GPIO0_OSRH, CONFIG_SYS_GPIO0_OSRH); /* output select */
|
|
|
|
out32(GPIO0_ISR1L, CONFIG_SYS_GPIO0_ISR1L);
|
|
|
|
out32(GPIO0_ISR1H, CONFIG_SYS_GPIO0_ISR1H); /* input select */
|
|
|
|
out32(GPIO0_TSRL, CONFIG_SYS_GPIO0_TSRL);
|
|
|
|
out32(GPIO0_TSRH, CONFIG_SYS_GPIO0_TSRH); /* three-state select */
|
|
|
|
out32(GPIO0_TCR, CONFIG_SYS_GPIO0_TCR); /* enable output driver for outputs */
|
2007-03-21 12:39:57 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ultra (405EZ) was nice enough to add another GPIO controller
|
|
|
|
*/
|
2008-10-16 13:01:15 +00:00
|
|
|
out32(GPIO1_OSRH, CONFIG_SYS_GPIO1_OSRH); /* output select */
|
|
|
|
out32(GPIO1_OSRL, CONFIG_SYS_GPIO1_OSRL);
|
|
|
|
out32(GPIO1_ISR1H, CONFIG_SYS_GPIO1_ISR1H); /* input select */
|
|
|
|
out32(GPIO1_ISR1L, CONFIG_SYS_GPIO1_ISR1L);
|
|
|
|
out32(GPIO1_TSRH, CONFIG_SYS_GPIO1_TSRH); /* three-state select */
|
|
|
|
out32(GPIO1_TSRL, CONFIG_SYS_GPIO1_TSRL);
|
|
|
|
out32(GPIO1_TCR, CONFIG_SYS_GPIO1_TCR); /* enable output driver for outputs */
|
2007-03-21 12:39:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int board_early_init_f(void)
|
|
|
|
{
|
|
|
|
unsigned int reg;
|
|
|
|
|
2007-04-18 10:07:47 +00:00
|
|
|
/* don't reinit PLL when booting via I2C bootstrap option */
|
2009-09-09 14:25:29 +00:00
|
|
|
mfsdr(SDR0_PINSTP, reg);
|
2007-04-18 10:07:47 +00:00
|
|
|
if (reg != 0xf0000000)
|
|
|
|
board_pll_init_f();
|
|
|
|
|
|
|
|
acadia_gpio_init();
|
2007-03-21 12:39:57 +00:00
|
|
|
|
2007-05-24 06:22:09 +00:00
|
|
|
/* Configure 405EZ for NAND usage */
|
2009-09-09 14:25:29 +00:00
|
|
|
mtsdr(SDR0_NAND0, SDR_NAND0_NDEN | SDR_NAND0_NDAREN | SDR_NAND0_NDRBEN);
|
|
|
|
mfsdr(SDR0_ULTRA0, reg);
|
2007-06-06 09:42:13 +00:00
|
|
|
reg &= ~SDR_ULTRA0_CSN_MASK;
|
2008-10-16 13:01:15 +00:00
|
|
|
reg |= (SDR_ULTRA0_CSNSEL0 >> CONFIG_SYS_NAND_CS) |
|
2007-06-06 09:42:13 +00:00
|
|
|
SDR_ULTRA0_NDGPIOBP |
|
|
|
|
SDR_ULTRA0_EBCRDYEN |
|
|
|
|
SDR_ULTRA0_NFSRSTEN;
|
2009-09-09 14:25:29 +00:00
|
|
|
mtsdr(SDR0_ULTRA0, reg);
|
2007-05-24 06:22:09 +00:00
|
|
|
|
2007-03-21 12:39:57 +00:00
|
|
|
/* USB Host core needs this bit set */
|
2009-09-09 14:25:29 +00:00
|
|
|
mfsdr(SDR0_ULTRA1, reg);
|
|
|
|
mtsdr(SDR0_ULTRA1, reg | SDR_ULTRA1_LEDNENABLE);
|
2007-03-21 12:39:57 +00:00
|
|
|
|
2009-09-24 07:55:50 +00:00
|
|
|
mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */
|
|
|
|
mtdcr(UIC0ER, 0x00000000); /* disable all ints */
|
|
|
|
mtdcr(UIC0CR, 0x00000010);
|
|
|
|
mtdcr(UIC0PR, 0xFE7FFFF0); /* set int polarities */
|
|
|
|
mtdcr(UIC0TR, 0x00000010); /* set int trigger levels */
|
|
|
|
mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */
|
2007-03-21 12:39:57 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int misc_init_f(void)
|
|
|
|
{
|
|
|
|
/* Set EPLD to take PHY out of reset */
|
2008-10-16 13:01:15 +00:00
|
|
|
out8(CONFIG_SYS_CPLD_BASE + 0x05, 0x00);
|
2007-03-21 12:39:57 +00:00
|
|
|
udelay(100000);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check Board Identity:
|
|
|
|
*/
|
|
|
|
int checkboard(void)
|
|
|
|
{
|
2011-05-04 10:32:28 +00:00
|
|
|
char buf[64];
|
|
|
|
int i = getenv_f("serial#", buf, sizeof(buf));
|
2007-05-24 06:22:09 +00:00
|
|
|
u8 rev;
|
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
rev = in8(CONFIG_SYS_CPLD_BASE + 0);
|
2007-05-24 06:22:09 +00:00
|
|
|
printf("Board: Acadia - AMCC PPC405EZ Evaluation Board, Rev. %X", rev);
|
2007-03-21 12:39:57 +00:00
|
|
|
|
2011-05-04 10:32:28 +00:00
|
|
|
if (i > 0) {
|
2007-03-21 12:39:57 +00:00
|
|
|
puts(", serial# ");
|
2011-05-04 10:32:28 +00:00
|
|
|
puts(buf);
|
2007-03-21 12:39:57 +00:00
|
|
|
}
|
|
|
|
putc('\n');
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|