]> git.ipfire.org Git - people/ms/u-boot.git/blob - board/total5200/total5200.c
Patch by Mark Jonas, 01 Jul 2004:
[people/ms/u-boot.git] / board / total5200 / total5200.c
1 /*
2 * (C) Copyright 2003-2004
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * (C) Copyright 2004
6 * Mark Jonas, Freescale Semiconductor, mark.jonas@freescale.com.
7 *
8 * See file CREDITS for list of people who contributed to this
9 * project.
10 *
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.
15 *
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.
20 *
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,
24 * MA 02111-1307 USA
25 */
26
27 #include <common.h>
28 #include <mpc5xxx.h>
29 #include <pci.h>
30
31 #include "sdram.h"
32
33 #if CONFIG_TOTAL5200_REV==2
34 #include "mt48lc32m16a2-75.h"
35 #else
36 #include "mt48lc16m16a2-75.h"
37 #endif
38
39 long int initdram (int board_type)
40 {
41 sdram_conf_t sdram_conf;
42
43 sdram_conf.ddr = SDRAM_DDR;
44 sdram_conf.mode = SDRAM_MODE;
45 sdram_conf.emode = 0;
46 sdram_conf.control = SDRAM_CONTROL;
47 sdram_conf.config1 = SDRAM_CONFIG1;
48 sdram_conf.config2 = SDRAM_CONFIG2;
49 #if defined(CONFIG_MPC5200)
50 sdram_conf.tapdelay = 0;
51 #endif
52 #if defined(CONFIG_MGT5100)
53 sdram_conf.addrsel = SDRAM_ADDRSEL;
54 #endif
55 return mpc5xxx_sdram_init (&sdram_conf);
56 }
57
58 int checkboard (void)
59 {
60 #if defined(CONFIG_MPC5200)
61 #if CONFIG_TOTAL5200_REV==2
62 puts ("Board: Total5200 Rev.2 ");
63 #else
64 puts ("Board: Total5200 ");
65 #endif
66 #elif defined(CONFIG_MGT5100)
67 puts ("Board: Total5100 ");
68 #endif
69
70 /*
71 * Retrieve FPGA Revision.
72 */
73 printf ("(FPGA %08X)\n", *(vu_long *) (CFG_FPGA_BASE + 0x400));
74
75 /*
76 * Take all peripherals in power-up mode.
77 */
78 #if CONFIG_TOTAL5200_REV==2
79 *(vu_char *) (CFG_CPLD_BASE + 0x46) = 0x70;
80 #else
81 *(vu_long *) (CFG_CPLD_BASE + 0x400) = 0x70;
82 #endif
83
84 return 0;
85 }
86
87 #if defined(CONFIG_MGT5100)
88 int board_early_init_r(void)
89 {
90 /*
91 * Now, when we are in RAM, enable CS0
92 * because CS_BOOT cannot be written.
93 */
94 *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 25); /* disable CS_BOOT */
95 *(vu_long *)MPC5XXX_ADDECR |= (1 << 16); /* enable CS0 */
96
97 return 0;
98 }
99 #endif
100
101 #ifdef CONFIG_PCI
102 static struct pci_controller hose;
103
104 extern void pci_mpc5xxx_init(struct pci_controller *);
105
106 void pci_init_board(void)
107 {
108 pci_mpc5xxx_init(&hose);
109 }
110 #endif
111
112 #if defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET)
113
114 /* IRDA_1 aka PSC6_3 (pin C13) */
115 #define GPIO_IRDA_1 0x20000000UL
116
117 void init_ide_reset (void)
118 {
119 debug ("init_ide_reset\n");
120
121 /* Configure IRDA_1 (PSC6_3) as GPIO output for ATA reset */
122 *(vu_long *) MPC5XXX_GPIO_ENABLE |= GPIO_IRDA_1;
123 *(vu_long *) MPC5XXX_GPIO_DIR |= GPIO_IRDA_1;
124 }
125
126 void ide_set_reset (int idereset)
127 {
128 debug ("ide_reset(%d)\n", idereset);
129
130 if (idereset) {
131 *(vu_long *) MPC5XXX_GPIO_DATA_O &= ~GPIO_IRDA_1;
132 } else {
133 *(vu_long *) MPC5XXX_GPIO_DATA_O |= GPIO_IRDA_1;
134 }
135 }
136 #endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */