2006-09-07 09:51:23 +00:00
|
|
|
/*
|
2009-04-08 08:36:22 +00:00
|
|
|
* (C) Copyright 2006-2009
|
2006-09-07 09:51:23 +00:00
|
|
|
* Stefan Roese, DENX Software Engineering, sr@denx.de.
|
|
|
|
*
|
|
|
|
* (C) Copyright 2006
|
|
|
|
* Jacqueline Pira-Ferriol, AMCC/IBM, jpira-ferriol@fr.ibm.com
|
2008-01-23 13:31:17 +00:00
|
|
|
* Alain Saurel, AMCC/IBM, alain.saurel@fr.ibm.com
|
2006-09-07 09:51:23 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2007-12-13 13:52:53 +00:00
|
|
|
#include <libfdt.h>
|
|
|
|
#include <fdt_support.h>
|
2010-09-09 17:18:00 +00:00
|
|
|
#include <asm/ppc4xx.h>
|
2010-09-16 12:30:37 +00:00
|
|
|
#include <asm/ppc4xx-gpio.h>
|
2006-09-07 09:51:23 +00:00
|
|
|
#include <asm/processor.h>
|
2007-10-15 09:29:33 +00:00
|
|
|
#include <asm/io.h>
|
2008-01-16 09:33:46 +00:00
|
|
|
#include <asm/bitops.h>
|
2006-09-07 09:51:23 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2009-05-11 11:46:14 +00:00
|
|
|
#if !defined(CONFIG_SYS_NO_FLASH)
|
2008-10-16 13:01:15 +00:00
|
|
|
extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
2009-05-11 11:46:14 +00:00
|
|
|
#endif
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2009-04-08 08:36:22 +00:00
|
|
|
extern void __ft_board_setup(void *blob, bd_t *bd);
|
|
|
|
ulong flash_get_size(ulong base, int banknum);
|
2006-12-22 13:29:40 +00:00
|
|
|
|
2009-10-19 12:10:50 +00:00
|
|
|
static inline u32 get_async_pci_freq(void)
|
|
|
|
{
|
|
|
|
if (in_8((void *)(CONFIG_SYS_BCSR_BASE + 5)) &
|
|
|
|
CONFIG_SYS_BCSR5_PCI66EN)
|
|
|
|
return 66666666;
|
|
|
|
else
|
|
|
|
return 33333333;
|
|
|
|
}
|
|
|
|
|
2006-09-07 09:51:23 +00:00
|
|
|
int board_early_init_f(void)
|
|
|
|
{
|
2007-01-05 09:40:36 +00:00
|
|
|
u32 sdr0_cust0;
|
|
|
|
u32 sdr0_pfc1, sdr0_pfc2;
|
|
|
|
u32 reg;
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2009-09-09 14:25:29 +00:00
|
|
|
mtdcr(EBC0_CFGADDR, EBC0_CFG);
|
|
|
|
mtdcr(EBC0_CFGDATA, 0xb8400000);
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2008-01-16 09:33:46 +00:00
|
|
|
/*
|
2006-09-07 09:51:23 +00:00
|
|
|
* Setup the interrupt controller polarities, triggers, etc.
|
2008-01-16 09:33:46 +00:00
|
|
|
*/
|
2009-09-24 07:55:50 +00:00
|
|
|
mtdcr(UIC0SR, 0xffffffff); /* clear all */
|
|
|
|
mtdcr(UIC0ER, 0x00000000); /* disable all */
|
|
|
|
mtdcr(UIC0CR, 0x00000005); /* ATI & UIC1 crit are critical */
|
|
|
|
mtdcr(UIC0PR, 0xfffff7ff); /* per ref-board manual */
|
|
|
|
mtdcr(UIC0TR, 0x00000000); /* per ref-board manual */
|
|
|
|
mtdcr(UIC0VR, 0x00000000); /* int31 highest, base=0x000 */
|
|
|
|
mtdcr(UIC0SR, 0xffffffff); /* clear all */
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2009-09-24 07:55:50 +00:00
|
|
|
mtdcr(UIC1SR, 0xffffffff); /* clear all */
|
|
|
|
mtdcr(UIC1ER, 0x00000000); /* disable all */
|
|
|
|
mtdcr(UIC1CR, 0x00000000); /* all non-critical */
|
|
|
|
mtdcr(UIC1PR, 0xffffffff); /* per ref-board manual */
|
|
|
|
mtdcr(UIC1TR, 0x00000000); /* per ref-board manual */
|
|
|
|
mtdcr(UIC1VR, 0x00000000); /* int31 highest, base=0x000 */
|
|
|
|
mtdcr(UIC1SR, 0xffffffff); /* clear all */
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2009-09-24 07:55:50 +00:00
|
|
|
mtdcr(UIC2SR, 0xffffffff); /* clear all */
|
|
|
|
mtdcr(UIC2ER, 0x00000000); /* disable all */
|
|
|
|
mtdcr(UIC2CR, 0x00000000); /* all non-critical */
|
|
|
|
mtdcr(UIC2PR, 0xffffffff); /* per ref-board manual */
|
|
|
|
mtdcr(UIC2TR, 0x00000000); /* per ref-board manual */
|
|
|
|
mtdcr(UIC2VR, 0x00000000); /* int31 highest, base=0x000 */
|
|
|
|
mtdcr(UIC2SR, 0xffffffff); /* clear all */
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2009-10-19 12:10:50 +00:00
|
|
|
/* Check and reconfigure the PCI sync clock if necessary */
|
|
|
|
ppc4xx_pci_sync_clock_config(get_async_pci_freq());
|
|
|
|
|
2006-09-07 09:51:23 +00:00
|
|
|
/* 50MHz tmrclk */
|
2008-10-16 13:01:15 +00:00
|
|
|
out_8((u8 *) CONFIG_SYS_BCSR_BASE + 0x04, 0x00);
|
2006-09-07 09:51:23 +00:00
|
|
|
|
|
|
|
/* clear write protects */
|
2008-10-16 13:01:15 +00:00
|
|
|
out_8((u8 *) CONFIG_SYS_BCSR_BASE + 0x07, 0x00);
|
2006-09-07 09:51:23 +00:00
|
|
|
|
|
|
|
/* enable Ethernet */
|
2008-10-16 13:01:15 +00:00
|
|
|
out_8((u8 *) CONFIG_SYS_BCSR_BASE + 0x08, 0x00);
|
2006-09-07 09:51:23 +00:00
|
|
|
|
|
|
|
/* enable USB device */
|
2008-10-16 13:01:15 +00:00
|
|
|
out_8((u8 *) CONFIG_SYS_BCSR_BASE + 0x09, 0x20);
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2008-02-06 16:10:11 +00:00
|
|
|
/* select Ethernet (and optionally IIC1) pins */
|
2006-09-07 09:51:23 +00:00
|
|
|
mfsdr(SDR0_PFC1, sdr0_pfc1);
|
2008-01-16 09:33:46 +00:00
|
|
|
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SELECT_MASK) |
|
|
|
|
SDR0_PFC1_SELECT_CONFIG_4;
|
2008-02-06 16:10:11 +00:00
|
|
|
#ifdef CONFIG_I2C_MULTI_BUS
|
|
|
|
sdr0_pfc1 |= ((sdr0_pfc1 & ~SDR0_PFC1_SIS_MASK) | SDR0_PFC1_SIS_IIC1_SEL);
|
|
|
|
#endif
|
2008-08-06 19:42:52 +00:00
|
|
|
/* Two UARTs, so we need 4-pin mode. Also, we want CTS/RTS mode. */
|
|
|
|
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0IM_MASK) | SDR0_PFC1_U0IM_4PINS;
|
|
|
|
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0ME_MASK) | SDR0_PFC1_U0ME_CTS_RTS;
|
|
|
|
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U1ME_MASK) | SDR0_PFC1_U1ME_CTS_RTS;
|
|
|
|
|
2006-09-07 09:51:23 +00:00
|
|
|
mfsdr(SDR0_PFC2, sdr0_pfc2);
|
2008-01-16 09:33:46 +00:00
|
|
|
sdr0_pfc2 = (sdr0_pfc2 & ~SDR0_PFC2_SELECT_MASK) |
|
|
|
|
SDR0_PFC2_SELECT_CONFIG_4;
|
2006-09-07 09:51:23 +00:00
|
|
|
mtsdr(SDR0_PFC2, sdr0_pfc2);
|
|
|
|
mtsdr(SDR0_PFC1, sdr0_pfc1);
|
|
|
|
|
|
|
|
/* PCI arbiter enabled */
|
2009-09-09 14:25:29 +00:00
|
|
|
mfsdr(SDR0_PCI0, reg);
|
|
|
|
mtsdr(SDR0_PCI0, 0x80000000 | reg);
|
2006-09-07 09:51:23 +00:00
|
|
|
|
|
|
|
/* setup NAND FLASH */
|
|
|
|
mfsdr(SDR0_CUST0, sdr0_cust0);
|
2006-10-08 22:42:01 +00:00
|
|
|
sdr0_cust0 = SDR0_CUST0_MUX_NDFC_SEL |
|
2006-09-07 09:51:23 +00:00
|
|
|
SDR0_CUST0_NDFC_ENABLE |
|
|
|
|
SDR0_CUST0_NDFC_BW_8_BIT |
|
|
|
|
SDR0_CUST0_NDFC_ARE_MASK |
|
2008-10-16 13:01:15 +00:00
|
|
|
(0x80000000 >> (28 + CONFIG_SYS_NAND_CS));
|
2006-10-08 22:42:01 +00:00
|
|
|
mtsdr(SDR0_CUST0, sdr0_cust0);
|
2006-09-07 09:51:23 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int misc_init_r(void)
|
|
|
|
{
|
2009-05-11 11:46:14 +00:00
|
|
|
#if !defined(CONFIG_SYS_NO_FLASH)
|
2006-09-07 09:51:23 +00:00
|
|
|
uint pbcr;
|
|
|
|
int size_val = 0;
|
2009-05-11 11:46:14 +00:00
|
|
|
#endif
|
2006-09-13 11:51:58 +00:00
|
|
|
#ifdef CONFIG_440EPX
|
2006-09-07 09:51:23 +00:00
|
|
|
unsigned long usb2d0cr = 0;
|
|
|
|
unsigned long usb2phy0cr, usb2h0cr = 0;
|
|
|
|
unsigned long sdr0_pfc1;
|
|
|
|
char *act = getenv("usbact");
|
2006-09-13 11:51:58 +00:00
|
|
|
#endif
|
2009-05-11 11:46:14 +00:00
|
|
|
u32 reg;
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2009-05-11 11:46:14 +00:00
|
|
|
#if !defined(CONFIG_SYS_NO_FLASH)
|
2008-01-16 09:33:46 +00:00
|
|
|
/* Re-do flash sizing to get full correct info */
|
2006-12-22 13:29:40 +00:00
|
|
|
|
|
|
|
/* adjust flash start and offset */
|
|
|
|
gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
|
|
|
|
gd->bd->bi_flashoffset = 0;
|
|
|
|
|
2010-10-11 13:50:10 +00:00
|
|
|
#if defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL) || \
|
|
|
|
defined(CONFIG_SYS_RAMBOOT)
|
2009-09-09 14:25:29 +00:00
|
|
|
mtdcr(EBC0_CFGADDR, PB3CR);
|
2006-09-07 09:51:23 +00:00
|
|
|
#else
|
2009-09-09 14:25:29 +00:00
|
|
|
mtdcr(EBC0_CFGADDR, PB0CR);
|
2006-09-07 09:51:23 +00:00
|
|
|
#endif
|
2009-09-09 14:25:29 +00:00
|
|
|
pbcr = mfdcr(EBC0_CFGDATA);
|
2008-01-23 13:31:17 +00:00
|
|
|
size_val = ffs(gd->bd->bi_flashsize) - 21;
|
2006-09-07 09:51:23 +00:00
|
|
|
pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17);
|
2010-10-11 13:50:10 +00:00
|
|
|
#if defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL) || \
|
|
|
|
defined(CONFIG_SYS_RAMBOOT)
|
2009-09-09 14:25:29 +00:00
|
|
|
mtdcr(EBC0_CFGADDR, PB3CR);
|
2006-09-07 09:51:23 +00:00
|
|
|
#else
|
2009-09-09 14:25:29 +00:00
|
|
|
mtdcr(EBC0_CFGADDR, PB0CR);
|
2006-09-07 09:51:23 +00:00
|
|
|
#endif
|
2009-09-09 14:25:29 +00:00
|
|
|
mtdcr(EBC0_CFGDATA, pbcr);
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2006-12-22 13:29:40 +00:00
|
|
|
/*
|
|
|
|
* Re-check to get correct base address
|
|
|
|
*/
|
|
|
|
flash_get_size(gd->bd->bi_flashstart, 0);
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2008-09-10 20:48:04 +00:00
|
|
|
#ifdef CONFIG_ENV_IS_IN_FLASH
|
2006-09-07 09:51:23 +00:00
|
|
|
/* Monitor protection ON by default */
|
|
|
|
(void)flash_protect(FLAG_PROTECT_SET,
|
2008-10-16 13:01:15 +00:00
|
|
|
-CONFIG_SYS_MONITOR_LEN,
|
2006-09-07 09:51:23 +00:00
|
|
|
0xffffffff,
|
|
|
|
&flash_info[0]);
|
|
|
|
|
|
|
|
/* Env protection ON by default */
|
|
|
|
(void)flash_protect(FLAG_PROTECT_SET,
|
2008-09-10 20:48:06 +00:00
|
|
|
CONFIG_ENV_ADDR_REDUND,
|
|
|
|
CONFIG_ENV_ADDR_REDUND + 2*CONFIG_ENV_SECT_SIZE - 1,
|
2006-09-07 09:51:23 +00:00
|
|
|
&flash_info[0]);
|
|
|
|
#endif
|
2009-05-11 11:46:14 +00:00
|
|
|
#endif /* CONFIG_SYS_NO_FLASH */
|
2006-09-07 09:51:23 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* USB suff...
|
|
|
|
*/
|
2006-09-13 11:51:58 +00:00
|
|
|
#ifdef CONFIG_440EPX
|
2008-01-16 09:33:46 +00:00
|
|
|
if (act == NULL || strcmp(act, "hostdev") == 0) {
|
2006-09-07 09:51:23 +00:00
|
|
|
/* SDR Setting */
|
2006-10-08 22:42:01 +00:00
|
|
|
mfsdr(SDR0_PFC1, sdr0_pfc1);
|
2007-06-27 16:11:38 +00:00
|
|
|
mfsdr(SDR0_USB2D0CR, usb2d0cr);
|
2006-10-08 22:42:01 +00:00
|
|
|
mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
|
|
|
|
mfsdr(SDR0_USB2H0CR, usb2h0cr);
|
2006-09-07 09:51:23 +00:00
|
|
|
|
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_XOCLK_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;
|
2006-10-08 22:42:01 +00:00
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_WDINT_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_WDINT_16BIT_30MHZ;
|
2006-09-07 09:51:23 +00:00
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DVBUS_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PURDIS;
|
2006-09-07 09:51:23 +00:00
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DWNSTR_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_HOST;
|
2006-09-07 09:51:23 +00:00
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_UTMICN_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_HOST;
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2008-01-16 09:33:46 +00:00
|
|
|
/*
|
|
|
|
* An 8-bit/60MHz interface is the only possible alternative
|
|
|
|
* when connecting the Device to the PHY
|
|
|
|
*/
|
2006-10-08 22:42:01 +00:00
|
|
|
usb2h0cr = usb2h0cr &~SDR0_USB2H0CR_WDINT_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2h0cr = usb2h0cr | SDR0_USB2H0CR_WDINT_16BIT_30MHZ;
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2008-01-16 09:33:46 +00:00
|
|
|
/*
|
|
|
|
* To enable the USB 2.0 Device function
|
|
|
|
* through the UTMI interface
|
|
|
|
*/
|
2006-10-08 22:42:01 +00:00
|
|
|
usb2d0cr = usb2d0cr &~SDR0_USB2D0CR_USB2DEV_EBC_SEL_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2d0cr = usb2d0cr | SDR0_USB2D0CR_USB2DEV_SELECTION;
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2006-10-08 22:42:01 +00:00
|
|
|
sdr0_pfc1 = sdr0_pfc1 &~SDR0_PFC1_UES_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
sdr0_pfc1 = sdr0_pfc1 | SDR0_PFC1_UES_USB2D_SEL;
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2006-10-08 22:42:01 +00:00
|
|
|
mtsdr(SDR0_PFC1, sdr0_pfc1);
|
2007-06-27 16:11:38 +00:00
|
|
|
mtsdr(SDR0_USB2D0CR, usb2d0cr);
|
2006-10-08 22:42:01 +00:00
|
|
|
mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
|
|
|
|
mtsdr(SDR0_USB2H0CR, usb2h0cr);
|
2006-09-07 09:51:23 +00:00
|
|
|
|
|
|
|
/*clear resets*/
|
|
|
|
udelay (1000);
|
|
|
|
mtsdr(SDR0_SRST1, 0x00000000);
|
|
|
|
udelay (1000);
|
|
|
|
mtsdr(SDR0_SRST0, 0x00000000);
|
|
|
|
|
|
|
|
printf("USB: Host(int phy) Device(ext phy)\n");
|
|
|
|
|
|
|
|
} else if (strcmp(act, "dev") == 0) {
|
|
|
|
/*-------------------PATCH-------------------------------*/
|
|
|
|
mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
|
|
|
|
|
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_XOCLK_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;
|
2006-09-07 09:51:23 +00:00
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DVBUS_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PURDIS;
|
2006-09-07 09:51:23 +00:00
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DWNSTR_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_HOST;
|
2006-09-07 09:51:23 +00:00
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_UTMICN_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_HOST;
|
2006-09-07 09:51:23 +00:00
|
|
|
mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
|
|
|
|
|
|
|
|
udelay (1000);
|
|
|
|
mtsdr(SDR0_SRST1, 0x672c6000);
|
|
|
|
|
|
|
|
udelay (1000);
|
|
|
|
mtsdr(SDR0_SRST0, 0x00000080);
|
|
|
|
|
|
|
|
udelay (1000);
|
|
|
|
mtsdr(SDR0_SRST1, 0x60206000);
|
|
|
|
|
|
|
|
*(unsigned int *)(0xe0000350) = 0x00000001;
|
|
|
|
|
|
|
|
udelay (1000);
|
|
|
|
mtsdr(SDR0_SRST1, 0x60306000);
|
|
|
|
/*-------------------PATCH-------------------------------*/
|
|
|
|
|
|
|
|
/* SDR Setting */
|
2006-10-08 22:42:01 +00:00
|
|
|
mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
|
2006-09-07 09:51:23 +00:00
|
|
|
mfsdr(SDR0_USB2H0CR, usb2h0cr);
|
2007-06-27 16:11:38 +00:00
|
|
|
mfsdr(SDR0_USB2D0CR, usb2d0cr);
|
2006-09-07 09:51:23 +00:00
|
|
|
mfsdr(SDR0_PFC1, sdr0_pfc1);
|
|
|
|
|
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_XOCLK_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;
|
2006-10-08 22:42:01 +00:00
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_WDINT_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_WDINT_8BIT_60MHZ;
|
2006-09-07 09:51:23 +00:00
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DVBUS_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PUREN;
|
2006-09-07 09:51:23 +00:00
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DWNSTR_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_DEV;
|
2006-09-07 09:51:23 +00:00
|
|
|
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_UTMICN_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_DEV;
|
2006-09-07 09:51:23 +00:00
|
|
|
|
|
|
|
usb2h0cr = usb2h0cr &~SDR0_USB2H0CR_WDINT_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2h0cr = usb2h0cr | SDR0_USB2H0CR_WDINT_8BIT_60MHZ;
|
2006-09-07 09:51:23 +00:00
|
|
|
|
|
|
|
usb2d0cr = usb2d0cr &~SDR0_USB2D0CR_USB2DEV_EBC_SEL_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
usb2d0cr = usb2d0cr | SDR0_USB2D0CR_EBC_SELECTION;
|
2006-09-07 09:51:23 +00:00
|
|
|
|
|
|
|
sdr0_pfc1 = sdr0_pfc1 &~SDR0_PFC1_UES_MASK;
|
2008-01-16 09:33:46 +00:00
|
|
|
sdr0_pfc1 = sdr0_pfc1 | SDR0_PFC1_UES_EBCHR_SEL;
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2006-10-08 22:42:01 +00:00
|
|
|
mtsdr(SDR0_USB2H0CR, usb2h0cr);
|
|
|
|
mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
|
2007-06-27 16:11:38 +00:00
|
|
|
mtsdr(SDR0_USB2D0CR, usb2d0cr);
|
2006-09-07 09:51:23 +00:00
|
|
|
mtsdr(SDR0_PFC1, sdr0_pfc1);
|
|
|
|
|
2008-01-16 09:33:46 +00:00
|
|
|
/* clear resets */
|
2006-09-07 09:51:23 +00:00
|
|
|
udelay (1000);
|
|
|
|
mtsdr(SDR0_SRST1, 0x00000000);
|
|
|
|
udelay (1000);
|
|
|
|
mtsdr(SDR0_SRST0, 0x00000000);
|
|
|
|
|
|
|
|
printf("USB: Device(int phy)\n");
|
|
|
|
}
|
2006-09-13 11:51:58 +00:00
|
|
|
#endif /* CONFIG_440EPX */
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2007-03-08 15:39:48 +00:00
|
|
|
mfsdr(SDR0_SRST1, reg); /* enable security/kasumi engines */
|
|
|
|
reg &= ~(SDR0_SRST1_CRYP0 | SDR0_SRST1_KASU0);
|
|
|
|
mtsdr(SDR0_SRST1, reg);
|
|
|
|
|
2007-01-05 09:40:36 +00:00
|
|
|
/*
|
|
|
|
* Clear PLB4A0_ACR[WRP]
|
|
|
|
* This fix will make the MAL burst disabling patch for the Linux
|
|
|
|
* EMAC driver obsolete.
|
|
|
|
*/
|
2010-09-11 07:31:43 +00:00
|
|
|
reg = mfdcr(PLB4A0_ACR) & ~PLB4Ax_ACR_WRP_MASK;
|
|
|
|
mtdcr(PLB4A0_ACR, reg);
|
2007-01-05 09:40:36 +00:00
|
|
|
|
2006-09-07 09:51:23 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int checkboard(void)
|
|
|
|
{
|
2011-05-04 10:32:28 +00:00
|
|
|
char buf[64];
|
|
|
|
int i = getenv_f("serial#", buf, sizeof(buf));
|
2007-01-13 06:57:51 +00:00
|
|
|
u8 rev;
|
2009-10-19 12:10:50 +00:00
|
|
|
u32 clock = get_async_pci_freq();
|
2006-09-07 09:51:23 +00:00
|
|
|
|
2006-09-13 11:51:58 +00:00
|
|
|
#ifdef CONFIG_440EPX
|
2006-09-07 09:51:23 +00:00
|
|
|
printf("Board: Sequoia - AMCC PPC440EPx Evaluation Board");
|
2006-09-13 11:51:58 +00:00
|
|
|
#else
|
|
|
|
printf("Board: Rainier - AMCC PPC440GRx Evaluation Board");
|
|
|
|
#endif
|
2007-01-13 06:57:51 +00:00
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
rev = in_8((void *)(CONFIG_SYS_BCSR_BASE + 0));
|
2009-10-19 12:10:50 +00:00
|
|
|
printf(", Rev. %X, PCI-Async=%d MHz", rev, clock / 1000000);
|
2007-01-13 06:57:51 +00:00
|
|
|
|
2011-05-04 10:32:28 +00:00
|
|
|
if (i > 0) {
|
2006-09-07 09:51:23 +00:00
|
|
|
puts(", serial# ");
|
2011-05-04 10:32:28 +00:00
|
|
|
puts(buf);
|
2006-09-07 09:51:23 +00:00
|
|
|
}
|
|
|
|
putc('\n');
|
|
|
|
|
2009-10-19 12:10:50 +00:00
|
|
|
/*
|
|
|
|
* Reconfiguration of the PCI sync clock is already done,
|
|
|
|
* now check again if everything is in range:
|
|
|
|
*/
|
|
|
|
if (ppc4xx_pci_sync_clock_config(clock)) {
|
|
|
|
printf("ERROR: PCI clocking incorrect (async=%d "
|
|
|
|
"sync=%ld)!\n", clock, get_PCI_freq());
|
|
|
|
}
|
|
|
|
|
2006-09-07 09:51:23 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2008-01-08 14:40:09 +00:00
|
|
|
#if defined(CONFIG_PCI) && defined(CONFIG_PCI_PNP)
|
|
|
|
/*
|
|
|
|
* Assign interrupts to PCI devices.
|
|
|
|
*/
|
2009-11-12 15:41:09 +00:00
|
|
|
void board_pci_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
|
2008-01-08 14:40:09 +00:00
|
|
|
{
|
2008-06-26 11:40:57 +00:00
|
|
|
pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, VECNUM_EIRQ2);
|
2008-01-08 14:40:09 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-05-11 11:46:14 +00:00
|
|
|
#if defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_SYS_RAMBOOT)
|
2009-04-08 08:36:22 +00:00
|
|
|
/*
|
|
|
|
* On NAND-booting sequoia, we need to patch the chips select numbers
|
|
|
|
* in the dtb (CS0 - NAND, CS3 - NOR)
|
|
|
|
*/
|
|
|
|
void ft_board_setup(void *blob, bd_t *bd)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
int len;
|
|
|
|
int nodeoffset;
|
|
|
|
struct fdt_property *prop;
|
|
|
|
u32 *reg;
|
|
|
|
char path[32];
|
|
|
|
|
|
|
|
/* First do common fdt setup */
|
|
|
|
__ft_board_setup(blob, bd);
|
|
|
|
|
|
|
|
/* And now configure NOR chip select to 3 instead of 0 */
|
|
|
|
strcpy(path, "/plb/opb/ebc/nor_flash@0,0");
|
|
|
|
nodeoffset = fdt_path_offset(blob, path);
|
|
|
|
prop = fdt_get_property_w(blob, nodeoffset, "reg", &len);
|
|
|
|
if (prop == NULL) {
|
|
|
|
printf("Unable to update NOR chip select for NAND booting\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
reg = (u32 *)&prop->data[0];
|
|
|
|
reg[0] = 3;
|
|
|
|
rc = fdt_find_and_setprop(blob, path, "reg", reg, 3 * sizeof(u32), 1);
|
|
|
|
if (rc) {
|
|
|
|
printf("Unable to update property NOR mappings, err=%s\n",
|
|
|
|
fdt_strerror(rc));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* And now configure NAND chip select to 0 instead of 3 */
|
|
|
|
strcpy(path, "/plb/opb/ebc/ndfc@3,0");
|
|
|
|
nodeoffset = fdt_path_offset(blob, path);
|
|
|
|
prop = fdt_get_property_w(blob, nodeoffset, "reg", &len);
|
|
|
|
if (prop == NULL) {
|
|
|
|
printf("Unable to update NDFC chip select for NAND booting\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
reg = (u32 *)&prop->data[0];
|
|
|
|
reg[0] = 0;
|
|
|
|
rc = fdt_find_and_setprop(blob, path, "reg", reg, 3 * sizeof(u32), 1);
|
|
|
|
if (rc) {
|
|
|
|
printf("Unable to update property NDFC mappings, err=%s\n",
|
|
|
|
fdt_strerror(rc));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_NAND_U_BOOT */
|