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 * SPDX-License-Identifier: GPL-2.0+
12 #include <asm/processor.h>
17 DECLARE_GLOBAL_DATA_PTR;
19 extern void lxt971_no_sleep(void);
21 int board_early_init_f (void)
24 * IRQ 0-15 405GP internally generated; active high; level sensitive
25 * IRQ 16 405GP internally generated; active low; level sensitive
27 * IRQ 25 (EXT IRQ 0) CAN0; active low; level sensitive
28 * IRQ 26 (EXT IRQ 1) SER0 ; active low; level sensitive
29 * IRQ 27 (EXT IRQ 2) SER1; active low; level sensitive
30 * IRQ 28 (EXT IRQ 3) FPGA 0; active low; level sensitive
31 * IRQ 29 (EXT IRQ 4) FPGA 1; active low; level sensitive
32 * IRQ 30 (EXT IRQ 5) PCI INTA; active low; level sensitive
33 * IRQ 31 (EXT IRQ 6) COMPACT FLASH; active high; level sensitive
35 mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */
36 mtdcr(UIC0ER, 0x00000000); /* disable all ints */
37 mtdcr(UIC0CR, 0x00000000); /* set all to be non-critical*/
38 mtdcr(UIC0PR, 0xFFFFFF81); /* set int polarities */
39 mtdcr(UIC0TR, 0x10000000); /* set int trigger levels */
40 mtdcr(UIC0VCR, 0x00000001); /* set vect base=0, INT0 highest priority */
41 mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */
44 * EBC Configuration Register:
45 * set ready timeout to 512 ebc-clks -> ca. 15 us
47 mtebc (EBC0_CFG, 0xa8400000);
52 mtdcr(CPC0_CR0, mfdcr(CPC0_CR0) | ((CONFIG_SYS_FPGA_INIT |
53 CONFIG_SYS_FPGA_DONE |
55 CONFIG_SYS_NONMONARCH |
56 CONFIG_SYS_REV1_2) << 5));
58 if (!(in_be32((void *)GPIO0_IR) & CONFIG_SYS_REV1_2)) {
60 mtdcr(CPC0_CR0, mfdcr(CPC0_CR0) | ((CONFIG_SYS_INTA_FAKE |
61 CONFIG_SYS_SELF_RST) << 5));
64 out_be32((void *)GPIO0_OR, CONFIG_SYS_VPEN);
65 /* setup for output */
66 out_be32((void *)GPIO0_TCR, CONFIG_SYS_FPGA_PRG | CONFIG_SYS_FPGA_CLK |
67 CONFIG_SYS_FPGA_DATA | CONFIG_SYS_XEREADY | CONFIG_SYS_VPEN);
70 * - check if rev1_2 is low, then:
71 * - set/reset CONFIG_SYS_INTA_FAKE/CONFIG_SYS_SELF_RST
72 * in TCR to assert INTA# or SELFRST#
77 int misc_init_r (void)
79 /* adjust flash start and offset */
80 gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
81 gd->bd->bi_flashoffset = 0;
83 /* deassert EREADY# */
84 out_be32((void *)GPIO0_OR,
85 in_be32((void *)GPIO0_OR) | CONFIG_SYS_XEREADY);
89 ushort pmc405_pci_subsys_deviceid(void)
93 val = in_be32((void *)GPIO0_IR);
94 if (!(val & CONFIG_SYS_REV1_2)) { /* low=rev1.2 */
95 /* check monarch# signal */
96 if (val & CONFIG_SYS_NONMONARCH)
97 return CONFIG_SYS_PCI_SUBSYS_DEVICEID_NONMONARCH;
98 return CONFIG_SYS_PCI_SUBSYS_DEVICEID_MONARCH;
100 return CONFIG_SYS_PCI_SUBSYS_DEVICEID_NONMONARCH;
104 * Check Board Identity
106 int checkboard (void)
110 int i = getenv_f("serial#", str, sizeof(str));
115 puts ("### No HW ID - assuming PMC405");
119 val = in_be32((void *)GPIO0_IR);
120 if (!(val & CONFIG_SYS_REV1_2)) { /* low=rev1.2 */
122 if (val & CONFIG_SYS_NONMONARCH) /* monarch# signal */
135 #ifdef CONFIG_LXT971_NO_SLEEP
138 * Disable sleep mode in LXT971