2 * (C) Copyright 2001-2003
3 * Stefan Roese, DENX Software Engineering, sr@denx.de.
5 * (C) Copyright 2005-2009
6 * Matthias Fuchs, esd gmbh germany, matthias.fuchs@esd-electronics.com
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #include <asm/processor.h>
33 DECLARE_GLOBAL_DATA_PTR;
35 extern void lxt971_no_sleep(void);
37 int board_early_init_f (void)
40 * IRQ 0-15 405GP internally generated; active high; level sensitive
41 * IRQ 16 405GP internally generated; active low; level sensitive
43 * IRQ 25 (EXT IRQ 0) CAN0; active low; level sensitive
44 * IRQ 26 (EXT IRQ 1) SER0 ; active low; level sensitive
45 * IRQ 27 (EXT IRQ 2) SER1; active low; level sensitive
46 * IRQ 28 (EXT IRQ 3) FPGA 0; active low; level sensitive
47 * IRQ 29 (EXT IRQ 4) FPGA 1; active low; level sensitive
48 * IRQ 30 (EXT IRQ 5) PCI INTA; active low; level sensitive
49 * IRQ 31 (EXT IRQ 6) COMPACT FLASH; active high; level sensitive
51 mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
52 mtdcr(uicer, 0x00000000); /* disable all ints */
53 mtdcr(uiccr, 0x00000000); /* set all to be non-critical*/
54 mtdcr(uicpr, 0xFFFFFF81); /* set int polarities */
55 mtdcr(uictr, 0x10000000); /* set int trigger levels */
56 mtdcr(uicvcr, 0x00000001); /* set vect base=0, INT0 highest priority */
57 mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
60 * EBC Configuration Register:
61 * set ready timeout to 512 ebc-clks -> ca. 15 us
63 mtebc (epcr, 0xa8400000);
68 mtdcr(cntrl0, mfdcr(cntrl0) | ((CONFIG_SYS_FPGA_INIT |
69 CONFIG_SYS_FPGA_DONE |
71 CONFIG_SYS_NONMONARCH |
72 CONFIG_SYS_REV1_2) << 5));
74 if (!(in_be32((void *)GPIO0_IR) & CONFIG_SYS_REV1_2)) {
76 mtdcr(cntrl0, mfdcr(cntrl0) | ((CONFIG_SYS_INTA_FAKE |
77 CONFIG_SYS_SELF_RST) << 5));
80 out_be32((void *)GPIO0_OR, CONFIG_SYS_VPEN);
81 /* setup for output */
82 out_be32((void *)GPIO0_TCR, CONFIG_SYS_FPGA_PRG | CONFIG_SYS_FPGA_CLK |
83 CONFIG_SYS_FPGA_DATA | CONFIG_SYS_XEREADY | CONFIG_SYS_VPEN);
86 * - check if rev1_2 is low, then:
87 * - set/reset CONFIG_SYS_INTA_FAKE/CONFIG_SYS_SELF_RST
88 * in TCR to assert INTA# or SELFRST#
93 int misc_init_r (void)
95 /* adjust flash start and offset */
96 gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
97 gd->bd->bi_flashoffset = 0;
99 /* deassert EREADY# */
100 out_be32((void *)GPIO0_OR,
101 in_be32((void *)GPIO0_OR) | CONFIG_SYS_XEREADY);
105 ushort pmc405_pci_subsys_deviceid(void)
109 val = in_be32((void *)GPIO0_IR);
110 if (!(val & CONFIG_SYS_REV1_2)) { /* low=rev1.2 */
111 /* check monarch# signal */
112 if (val & CONFIG_SYS_NONMONARCH)
113 return CONFIG_SYS_PCI_SUBSYS_DEVICEID_NONMONARCH;
114 return CONFIG_SYS_PCI_SUBSYS_DEVICEID_MONARCH;
116 return CONFIG_SYS_PCI_SUBSYS_DEVICEID_NONMONARCH;
120 * Check Board Identity
122 int checkboard (void)
126 int i = getenv_r("serial#", str, sizeof(str));
131 puts ("### No HW ID - assuming PMC405");
135 val = in_be32((void *)GPIO0_IR);
136 if (!(val & CONFIG_SYS_REV1_2)) { /* low=rev1.2 */
138 if (val & CONFIG_SYS_NONMONARCH) /* monarch# signal */
151 #ifdef CONFIG_LXT971_NO_SLEEP
154 * Disable sleep mode in LXT971