Guennadi Liakhovetski | 61525f2 | 2008-03-31 01:32:15 +0200 | [diff] [blame] | 1 | /* |
| 2 | * linkstation.c |
| 3 | * |
| 4 | * Misc LinkStation specific functions |
| 5 | * |
| 6 | * Copyright (C) 2006 Mihai Georgian <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 | |
| 36 | int checkboard (void) |
| 37 | { |
| 38 | DECLARE_GLOBAL_DATA_PTR; |
| 39 | char *p; |
| 40 | bd_t *bd = gd->bd; |
| 41 | |
| 42 | init_AVR_DUART(); |
| 43 | |
| 44 | if ((p = getenv ("console_nr")) != NULL) { |
| 45 | unsigned long con_nr = simple_strtoul (p, NULL, 10) & 3; |
| 46 | |
| 47 | bd->bi_baudrate &= ~3; |
| 48 | bd->bi_baudrate |= con_nr & 3; |
| 49 | } |
| 50 | return 0; |
| 51 | } |
| 52 | |
Becky Bruce | 9973e3c | 2008-06-09 16:03:40 -0500 | [diff] [blame] | 53 | phys_size_t initdram (int board_type) |
Guennadi Liakhovetski | 61525f2 | 2008-03-31 01:32:15 +0200 | [diff] [blame] | 54 | { |
| 55 | return (get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE)); |
| 56 | } |
| 57 | |
| 58 | /* |
| 59 | * Initialize PCI Devices |
| 60 | */ |
| 61 | #ifdef CONFIG_PCI |
| 62 | |
| 63 | #ifndef CONFIG_PCI_PNP |
| 64 | |
| 65 | static struct pci_config_table pci_linkstation_config_table[] = { |
| 66 | /* vendor, device, class */ |
| 67 | /* bus, dev, func */ |
| 68 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| 69 | PCI_ANY_ID, 0x0b, 0, /* AN983B or RTL8110S */ |
| 70 | /* ethernet controller */ |
| 71 | pci_cfgfunc_config_device, { PCI_ETH_IOADDR, |
| 72 | PCI_ETH_MEMADDR, |
| 73 | PCI_COMMAND_IO | |
| 74 | PCI_COMMAND_MEMORY | |
| 75 | PCI_COMMAND_MASTER }}, |
| 76 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| 77 | PCI_ANY_ID, 0x0c, 0, /* SII680 or IT8211AF */ |
| 78 | /* ide controller */ |
| 79 | pci_cfgfunc_config_device, { PCI_IDE_IOADDR, |
| 80 | PCI_IDE_MEMADDR, |
| 81 | PCI_COMMAND_IO | |
| 82 | PCI_COMMAND_MEMORY | |
| 83 | PCI_COMMAND_MASTER }}, |
| 84 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| 85 | PCI_ANY_ID, 0x0e, 0, /* D720101 USB controller, 1st USB 1.1 */ |
| 86 | pci_cfgfunc_config_device, { PCI_USB0_IOADDR, |
| 87 | PCI_USB0_MEMADDR, |
| 88 | PCI_COMMAND_MEMORY | |
| 89 | PCI_COMMAND_MASTER }}, |
| 90 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| 91 | PCI_ANY_ID, 0x0e, 1, /* D720101 USB controller, 2nd USB 1.1 */ |
| 92 | pci_cfgfunc_config_device, { PCI_USB1_IOADDR, |
| 93 | PCI_USB1_MEMADDR, |
| 94 | PCI_COMMAND_MEMORY | |
| 95 | PCI_COMMAND_MASTER }}, |
| 96 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| 97 | PCI_ANY_ID, 0x0e, 2, /* D720101 USB controller, USB 2.0 */ |
| 98 | pci_cfgfunc_config_device, { PCI_USB2_IOADDR, |
| 99 | PCI_USB2_MEMADDR, |
| 100 | PCI_COMMAND_MEMORY | |
| 101 | PCI_COMMAND_MASTER }}, |
| 102 | { } |
| 103 | }; |
| 104 | #endif |
| 105 | |
| 106 | struct pci_controller hose = { |
| 107 | #ifndef CONFIG_PCI_PNP |
| 108 | config_table:pci_linkstation_config_table, |
| 109 | #endif |
| 110 | }; |
| 111 | |
| 112 | void pci_init_board (void) |
| 113 | { |
| 114 | pci_mpc824x_init (&hose); |
| 115 | |
| 116 | /* Reset USB 1.1 */ |
| 117 | /* Haven't seen any change without these on a HG, maybe it is |
| 118 | * needed on other models */ |
| 119 | out_le32((volatile unsigned*)(PCI_USB0_MEMADDR + 8), 1); |
| 120 | out_le32((volatile unsigned*)(PCI_USB1_MEMADDR + 8), 1); |
| 121 | } |
| 122 | #endif /* CONFIG_PCI */ |
| 123 | |
| 124 | #define UART_DCR 0x80004511 |
| 125 | int board_early_init_f (void) |
| 126 | { |
| 127 | /* set DUART mode */ |
| 128 | out_8((volatile u8*)UART_DCR, 1); |
| 129 | return 0; |
| 130 | } |