TEXT_BASE is in board/sandpoint/config.mk so say so...
[u-boot.git] / board / linkstation / linkstation.c
1 /*
2  * linkstation.c
3  *
4  * Misc LinkStation specific functions
5  *
6  * Copyright (C) 2006 Mihai Georgin <u-boot@linuxnotincluded.org.uk>
7  *
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.
12  *
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.
17  *
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,
21  * MA 02111-1307 USA
22  */
23
24 #include <version.h>
25 #include <common.h>
26 #include <mpc824x.h>
27 #include <asm/io.h>
28 #include <ns16550.h>
29
30 #ifdef CONFIG_PCI
31 #include <pci.h>
32 #endif
33
34 extern void init_AVR_DUART(void);
35 extern void hw_watchdog_reset(void);
36
37 int checkboard (void)
38 {
39         DECLARE_GLOBAL_DATA_PTR;
40         ulong busfreq = get_bus_freq (0);
41         char buf[32];
42         char *p;
43         bd_t *bd = gd->bd;
44
45         init_AVR_DUART();
46         hw_watchdog_reset();
47
48         if ((p = getenv ("console_nr")) != NULL) {
49                 unsigned long con_nr = simple_strtoul (p, NULL, 10) & 3;
50
51                 bd->bi_baudrate &= ~3;
52                 bd->bi_baudrate |= con_nr & 3;
53         }
54         return 0;
55 }
56
57 long int initdram (int board_type)
58 {
59         return (get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE));
60 }
61
62 /*
63  * Initialize PCI Devices
64  */
65 #ifdef CONFIG_PCI
66
67 #ifndef CONFIG_PCI_PNP
68
69 static struct pci_config_table pci_linkstation_config_table[] = {
70         /* vendor, device, class */
71         /* bus, dev, func */
72         { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
73           PCI_ANY_ID, 0x0b, 0,          /* AN983B or RTL8110S  */
74                                                                 /* ethernet controller */
75           pci_cfgfunc_config_device, { PCI_ETH_IOADDR,
76                                        PCI_ETH_MEMADDR,
77                                        PCI_COMMAND_IO |
78                                        PCI_COMMAND_MEMORY |
79                                        PCI_COMMAND_MASTER }},
80         { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
81           PCI_ANY_ID, 0x0c, 0,          /* SII680 or IT8211AF */
82                                                                 /* ide controller     */
83           pci_cfgfunc_config_device, { PCI_IDE_IOADDR,
84                                        PCI_IDE_MEMADDR,
85                                        PCI_COMMAND_IO |
86                                        PCI_COMMAND_MEMORY |
87                                        PCI_COMMAND_MASTER }},
88         { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
89           PCI_ANY_ID, 0x0e, 0,          /* D720101 USB controller, 1st USB 1.1 */
90           pci_cfgfunc_config_device, { PCI_USB0_IOADDR,
91                                        PCI_USB0_MEMADDR,
92                                        PCI_COMMAND_MEMORY |
93                                        PCI_COMMAND_MASTER }},
94         { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
95           PCI_ANY_ID, 0x0e, 1,          /* D720101 USB controller, 2nd USB 1.1 */
96           pci_cfgfunc_config_device, { PCI_USB1_IOADDR,
97                                        PCI_USB1_MEMADDR,
98                                        PCI_COMMAND_MEMORY |
99                                        PCI_COMMAND_MASTER }},
100         { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
101           PCI_ANY_ID, 0x0e, 2,          /* D720101 USB controller, USB 2.0 */
102           pci_cfgfunc_config_device, { PCI_USB2_IOADDR,
103                                        PCI_USB2_MEMADDR,
104                                        PCI_COMMAND_MEMORY |
105                                        PCI_COMMAND_MASTER }},
106         { }
107 };
108 #endif
109
110 struct pci_controller hose = {
111 #ifndef CONFIG_PCI_PNP
112         config_table:pci_linkstation_config_table,
113 #endif
114 };
115
116 void pci_init_board (void)
117 {
118         pci_mpc824x_init (&hose);
119
120         /* Reset USB 1.1 */
121         out_le32(PCI_USB0_MEMADDR+8, 1);
122         out_le32(PCI_USB1_MEMADDR+8, 1);
123
124 }
125 #endif /* CONFIG_PCI */
126
127 /* vim: set ts=4: */