3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #include <linux/mtd/doc2000.h>
36 #include "fpga_serial.h"
38 DECLARE_GLOBAL_DATA_PTR;
40 #if defined(CONFIG_WATCHDOG)
42 static int pcippc2_wdt_init_done = 0;
44 void pcippc2_wdt_init (void);
48 /* Check board identity
53 puts ("Board: Gespac PCIPPC-2\n");
55 puts ("Board: Gespac PCIPPC-6\n");
60 /* RAM size is stored in CPC0_RGBAN1
62 u32 pcippc2_sdram_size (void)
64 return in32 (REG (CPC0, RGBAN1));
67 phys_size_t initdram (int board_type)
69 return cpc710_ram_init ();
72 int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
74 out32 (REG (CPC0, SPOR), 0);
81 int board_early_init_f (void)
83 out32 (REG (CPC0, RSTR), 0xC0000000);
86 out32 (REG (CPC0, RSTR), 0xF0000000);
89 out32 (REG (CPC0, UCTL), 0x00F80000);
91 out32 (REG (CPC0, SIOC0), 0x30000000);
93 out32 (REG (CPC0, ABCNTL), 0x00000000);
95 out32 (REG (CPC0, SESR), 0x00000000);
96 out32 (REG (CPC0, SEAR), 0x00000000);
98 /* Detect IBM Avignon CPC710 Revision */
99 if ((in32 (REG (CPC0, UCTL)) & 0x000000F0) == CPC710_TYPE_100P)
100 out32 (REG (CPC0, PGCHP), 0xA0000040);
102 out32 (REG (CPC0, PGCHP), 0x80800040);
105 out32 (REG (CPC0, ATAS), 0x709C2508);
112 void after_reloc (ulong dest_addr)
114 /* Jump to the main U-Boot board init code
116 board_init_r ((gd_t *)gd, dest_addr);
119 int misc_init_r (void)
121 pcippc2_fpga_init ();
123 pcippc2_cpci3264_init ();
125 #if defined(CONFIG_WATCHDOG)
129 fpga_serial_init (sconsole_get_baudrate ());
131 sconsole_putc = fpga_serial_putc;
132 sconsole_puts = fpga_serial_puts;
133 sconsole_getc = fpga_serial_getc;
134 sconsole_tstc = fpga_serial_tstc;
135 sconsole_setbrg = fpga_serial_setbrg;
141 void pci_init_board (void)
145 /* FPGA requires no retry timeouts to be enabled
147 cpc710_pci_enable_timeout ();
150 #ifdef CONFIG_CMD_DOC
153 doc_probe (pcippc2_fpga1_phys + HW_FPGA1_DOC);
157 void pcippc2_cpci3264_init (void)
159 pci_dev_t bdf = pci_find_device(FPGA_VENDOR_ID, FPGA_DEVICE_ID, 0);
163 puts("Unable to find FPGA !\n");
167 if((in32(pcippc2_fpga0_phys + HW_FPGA0_BOARD) & 0x01000000) == 0x01000000)
168 /* 32-bits Compact PCI bus - LSB bit */
171 out32(BRIDGE(CPCI, PCIDG), 0x40000000); /* 32-bits bridge, Pipeline */
176 #if defined(CONFIG_WATCHDOG)
178 void pcippc2_wdt_init (void)
180 out16r (FPGA (WDT, PROG), 0xffff);
181 out8 (FPGA (WDT, CTRL), 0x1);
183 pcippc2_wdt_init_done = 1;
186 void pcippc2_wdt_done (void)
188 out8 (FPGA (WDT, CTRL), 0x0);
190 pcippc2_wdt_init_done = 0;
193 void pcippc2_wdt_reset (void)
195 if (pcippc2_wdt_init_done == 1)
196 out8 (FPGA (WDT, REFRESH), 0x56);
199 void watchdog_reset (void)
201 int re_enable = disable_interrupts ();
203 pcippc2_wdt_reset ();
205 enable_interrupts ();
208 #if defined(CONFIG_CMD_BSP)
209 int do_wd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
213 printf ("Watchdog timer status is %s\n",
214 pcippc2_wdt_init_done == 1 ? "on" : "off");
218 if (!strcmp(argv[1],"on")) {
220 printf("Watchdog timer now is on\n");
224 } else if (!strcmp(argv[1],"off")) {
226 printf("Watchdog timer now is off\n");
235 return cmd_usage(cmdtp);
240 "check and set watchdog",
241 "on - switch watchDog on\n"
242 "wd off - switch watchdog off\n"
243 "wd - print current status"
247 #endif /* CONFIG_WATCHDOG */
249 int board_eth_init(bd_t *bis)
251 return pci_eth_init(bis);