wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 1 | /* |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 2 | * (C) Copyright 2001-2003 |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
| 5 | * Modified during 2001 by |
| 6 | * Advanced Communications Technologies (Australia) Pty. Ltd. |
| 7 | * Howard Walker, Tuong Vu-Dinh |
| 8 | * |
| 9 | * (C) Copyright 2001, Stuart Hughes, Lineo Inc, stuarth@lineo.com |
| 10 | * Added support for the 16M dram simm on the 8260ads boards |
| 11 | * |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 12 | * (C) Copyright 2003-2004 Arabella Software Ltd. |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 13 | * Yuli Barcohen <yuli@arabellasw.com> |
| 14 | * Added support for SDRAM DIMMs SPD EEPROM, MII, Ethernet PHY init. |
| 15 | * |
Wolfgang Denk | 716c1dc | 2005-09-25 18:49:35 +0200 | [diff] [blame] | 16 | * Copyright (c) 2005 MontaVista Software, Inc. |
Wolfgang Denk | 1972dc0 | 2005-09-25 16:27:55 +0200 | [diff] [blame] | 17 | * Vitaly Bordug <vbordug@ru.mvista.com> |
| 18 | * Added support for PCI. |
| 19 | * |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 20 | * See file CREDITS for list of people who contributed to this |
| 21 | * project. |
| 22 | * |
| 23 | * This program is free software; you can redistribute it and/or |
| 24 | * modify it under the terms of the GNU General Public License as |
| 25 | * published by the Free Software Foundation; either version 2 of |
| 26 | * the License, or (at your option) any later version. |
| 27 | * |
| 28 | * This program is distributed in the hope that it will be useful, |
| 29 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 30 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 31 | * GNU General Public License for more details. |
| 32 | * |
| 33 | * You should have received a copy of the GNU General Public License |
| 34 | * along with this program; if not, write to the Free Software |
| 35 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 36 | * MA 02111-1307 USA |
| 37 | */ |
| 38 | |
| 39 | #include <common.h> |
| 40 | #include <ioports.h> |
| 41 | #include <mpc8260.h> |
wdenk | 326428c | 2003-08-31 18:37:54 +0000 | [diff] [blame] | 42 | #include <asm/m8260_pci.h> |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 43 | #include <i2c.h> |
| 44 | #include <spd.h> |
wdenk | cceb871 | 2003-06-23 18:12:28 +0000 | [diff] [blame] | 45 | #include <miiphy.h> |
Wolfgang Denk | 1972dc0 | 2005-09-25 16:27:55 +0200 | [diff] [blame] | 46 | #ifdef CONFIG_PCI |
| 47 | #include <pci.h> |
| 48 | #endif |
Matvejchikov Ilya | 0e6989b | 2008-07-06 13:57:00 +0400 | [diff] [blame] | 49 | #ifdef CONFIG_OF_LIBFDT |
| 50 | #include <libfdt.h> |
| 51 | #include <fdt_support.h> |
| 52 | #endif |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 53 | |
| 54 | /* |
| 55 | * I/O Port configuration table |
| 56 | * |
| 57 | * if conf is 1, then that port pin will be configured at boot time |
| 58 | * according to the five values podr/pdir/ppar/psor/pdat for that entry |
| 59 | */ |
| 60 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 61 | #define CONFIG_SYS_FCC1 (CONFIG_ETHER_INDEX == 1) |
| 62 | #define CONFIG_SYS_FCC2 (CONFIG_ETHER_INDEX == 2) |
| 63 | #define CONFIG_SYS_FCC3 (CONFIG_ETHER_INDEX == 3) |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 64 | |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 65 | const iop_conf_t iop_conf_tab[4][32] = { |
| 66 | |
| 67 | /* Port A configuration */ |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 68 | { /* conf ppar psor pdir podr pdat */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 69 | /* PA31 */ { CONFIG_SYS_FCC1, 1, 1, 0, 0, 0 }, /* FCC1 MII COL */ |
| 70 | /* PA30 */ { CONFIG_SYS_FCC1, 1, 1, 0, 0, 0 }, /* FCC1 MII CRS */ |
| 71 | /* PA29 */ { CONFIG_SYS_FCC1, 1, 1, 1, 0, 0 }, /* FCC1 MII TX_ER */ |
| 72 | /* PA28 */ { CONFIG_SYS_FCC1, 1, 1, 1, 0, 0 }, /* FCC1 MII TX_EN */ |
| 73 | /* PA27 */ { CONFIG_SYS_FCC1, 1, 1, 0, 0, 0 }, /* FCC1 MII RX_DV */ |
| 74 | /* PA26 */ { CONFIG_SYS_FCC1, 1, 1, 0, 0, 0 }, /* FCC1 MII RX_ER */ |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 75 | /* PA25 */ { 0, 0, 0, 0, 0, 0 }, /* PA25 */ |
| 76 | /* PA24 */ { 0, 0, 0, 0, 0, 0 }, /* PA24 */ |
| 77 | /* PA23 */ { 0, 0, 0, 0, 0, 0 }, /* PA23 */ |
| 78 | /* PA22 */ { 0, 0, 0, 0, 0, 0 }, /* PA22 */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 79 | /* PA21 */ { CONFIG_SYS_FCC1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[3] */ |
| 80 | /* PA20 */ { CONFIG_SYS_FCC1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[2] */ |
| 81 | /* PA19 */ { CONFIG_SYS_FCC1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[1] */ |
| 82 | /* PA18 */ { CONFIG_SYS_FCC1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[0] */ |
| 83 | /* PA17 */ { CONFIG_SYS_FCC1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[0] */ |
| 84 | /* PA16 */ { CONFIG_SYS_FCC1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[1] */ |
| 85 | /* PA15 */ { CONFIG_SYS_FCC1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[2] */ |
| 86 | /* PA14 */ { CONFIG_SYS_FCC1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[3] */ |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 87 | /* PA13 */ { 0, 0, 0, 0, 0, 0 }, /* PA13 */ |
| 88 | /* PA12 */ { 0, 0, 0, 0, 0, 0 }, /* PA12 */ |
| 89 | /* PA11 */ { 0, 0, 0, 0, 0, 0 }, /* PA11 */ |
| 90 | /* PA10 */ { 0, 0, 0, 0, 0, 0 }, /* PA10 */ |
| 91 | /* PA9 */ { 0, 0, 0, 0, 0, 0 }, /* PA9 */ |
| 92 | /* PA8 */ { 0, 0, 0, 0, 0, 0 }, /* PA8 */ |
| 93 | /* PA7 */ { 0, 0, 0, 1, 0, 0 }, /* PA7 */ |
| 94 | /* PA6 */ { 0, 0, 0, 0, 0, 0 }, /* PA6 */ |
| 95 | /* PA5 */ { 0, 0, 0, 1, 0, 0 }, /* PA5 */ |
| 96 | /* PA4 */ { 0, 0, 0, 1, 0, 0 }, /* PA4 */ |
| 97 | /* PA3 */ { 0, 0, 0, 1, 0, 0 }, /* PA3 */ |
| 98 | /* PA2 */ { 0, 0, 0, 1, 0, 0 }, /* PA2 */ |
| 99 | /* PA1 */ { 0, 0, 0, 0, 0, 0 }, /* PA1 */ |
| 100 | /* PA0 */ { 0, 0, 0, 1, 0, 0 } /* PA0 */ |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 101 | }, |
| 102 | |
| 103 | /* Port B configuration */ |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 104 | { /* conf ppar psor pdir podr pdat */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 105 | /* PB31 */ { CONFIG_SYS_FCC2, 1, 0, 1, 0, 0 }, /* FCC2 MII TX_ER */ |
| 106 | /* PB30 */ { CONFIG_SYS_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_DV */ |
| 107 | /* PB29 */ { CONFIG_SYS_FCC2, 1, 1, 1, 0, 0 }, /* FCC2 MII TX_EN */ |
| 108 | /* PB28 */ { CONFIG_SYS_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_ER */ |
| 109 | /* PB27 */ { CONFIG_SYS_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII COL */ |
| 110 | /* PB26 */ { CONFIG_SYS_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII CRS */ |
| 111 | /* PB25 */ { CONFIG_SYS_FCC2, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[3] */ |
| 112 | /* PB24 */ { CONFIG_SYS_FCC2, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[2] */ |
| 113 | /* PB23 */ { CONFIG_SYS_FCC2, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[1] */ |
| 114 | /* PB22 */ { CONFIG_SYS_FCC2, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[0] */ |
| 115 | /* PB21 */ { CONFIG_SYS_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[0] */ |
| 116 | /* PB20 */ { CONFIG_SYS_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[1] */ |
| 117 | /* PB19 */ { CONFIG_SYS_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[2] */ |
| 118 | /* PB18 */ { CONFIG_SYS_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[3] */ |
| 119 | /* PB17 */ { CONFIG_SYS_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:RX_DIV */ |
| 120 | /* PB16 */ { CONFIG_SYS_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:RX_ERR */ |
| 121 | /* PB15 */ { CONFIG_SYS_FCC3, 1, 0, 1, 0, 0 }, /* FCC3:TX_ERR */ |
| 122 | /* PB14 */ { CONFIG_SYS_FCC3, 1, 0, 1, 0, 0 }, /* FCC3:TX_EN */ |
| 123 | /* PB13 */ { CONFIG_SYS_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:COL */ |
| 124 | /* PB12 */ { CONFIG_SYS_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:CRS */ |
| 125 | /* PB11 */ { CONFIG_SYS_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:RXD */ |
| 126 | /* PB10 */ { CONFIG_SYS_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:RXD */ |
| 127 | /* PB9 */ { CONFIG_SYS_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:RXD */ |
| 128 | /* PB8 */ { CONFIG_SYS_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:RXD */ |
| 129 | /* PB7 */ { CONFIG_SYS_FCC3, 1, 0, 1, 0, 0 }, /* FCC3:TXD */ |
| 130 | /* PB6 */ { CONFIG_SYS_FCC3, 1, 0, 1, 0, 0 }, /* FCC3:TXD */ |
| 131 | /* PB5 */ { CONFIG_SYS_FCC3, 1, 0, 1, 0, 0 }, /* FCC3:TXD */ |
| 132 | /* PB4 */ { CONFIG_SYS_FCC3, 1, 0, 1, 0, 0 }, /* FCC3:TXD */ |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 133 | /* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */ |
| 134 | /* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */ |
| 135 | /* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */ |
| 136 | /* PB0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */ |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 137 | }, |
| 138 | |
| 139 | /* Port C */ |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 140 | { /* conf ppar psor pdir podr pdat */ |
| 141 | /* PC31 */ { 0, 0, 0, 0, 0, 0 }, /* PC31 */ |
| 142 | /* PC30 */ { 0, 0, 0, 0, 0, 0 }, /* PC30 */ |
| 143 | /* PC29 */ { 0, 0, 0, 0, 0, 0 }, /* PC29 */ |
| 144 | /* PC28 */ { 0, 0, 0, 0, 0, 0 }, /* PC28 */ |
| 145 | /* PC27 */ { 0, 0, 0, 0, 0, 0 }, /* PC27 */ |
| 146 | /* PC26 */ { 0, 0, 0, 0, 0, 0 }, /* PC26 */ |
| 147 | /* PC25 */ { 0, 0, 0, 0, 0, 0 }, /* PC25 */ |
| 148 | /* PC24 */ { 0, 0, 0, 0, 0, 0 }, /* PC24 */ |
| 149 | /* PC23 */ { 0, 0, 0, 0, 0, 0 }, /* PC23 */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 150 | /* PC22 */ { CONFIG_SYS_FCC1, 1, 0, 0, 0, 0 }, /* FCC1 MII Tx Clock (CLK10) */ |
| 151 | /* PC21 */ { CONFIG_SYS_FCC1, 1, 0, 0, 0, 0 }, /* FCC1 MII Rx Clock (CLK11) */ |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 152 | /* PC20 */ { 0, 0, 0, 0, 0, 0 }, /* PC20 */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 153 | #if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 154 | /* PC19 */ { 1, 0, 0, 1, 0, 0 }, /* FETHMDC */ |
| 155 | /* PC18 */ { 1, 0, 0, 0, 0, 0 }, /* FETHMDIO */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 156 | /* PC17 */ { CONFIG_SYS_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII Rx Clock (CLK15) */ |
| 157 | /* PC16 */ { CONFIG_SYS_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII Tx Clock (CLK16) */ |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 158 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 159 | /* PC19 */ { CONFIG_SYS_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII Rx Clock (CLK13) */ |
| 160 | /* PC18 */ { CONFIG_SYS_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII Tx Clock (CLK14) */ |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 161 | /* PC17 */ { 0, 0, 0, 0, 0, 0 }, /* PC17 */ |
| 162 | /* PC16 */ { 0, 0, 0, 0, 0, 0 }, /* PC16 */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 163 | #endif /* CONFIG_ADSTYPE == CONFIG_SYS_8272ADS */ |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 164 | /* PC15 */ { 0, 0, 0, 0, 0, 0 }, /* PC15 */ |
| 165 | /* PC14 */ { 0, 0, 0, 0, 0, 0 }, /* PC14 */ |
| 166 | /* PC13 */ { 0, 0, 0, 0, 0, 0 }, /* PC13 */ |
| 167 | /* PC12 */ { 0, 0, 0, 0, 0, 0 }, /* PC12 */ |
| 168 | /* PC11 */ { 0, 0, 0, 0, 0, 0 }, /* PC11 */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 169 | #if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 170 | /* PC10 */ { 0, 0, 0, 0, 0, 0 }, /* PC10 */ |
| 171 | /* PC9 */ { 0, 0, 0, 0, 0, 0 }, /* PC9 */ |
| 172 | #else |
| 173 | /* PC10 */ { 1, 0, 0, 1, 0, 0 }, /* FETHMDC */ |
| 174 | /* PC9 */ { 1, 0, 0, 0, 0, 0 }, /* FETHMDIO */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 175 | #endif /* CONFIG_ADSTYPE == CONFIG_SYS_8272ADS */ |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 176 | /* PC8 */ { 0, 0, 0, 0, 0, 0 }, /* PC8 */ |
| 177 | /* PC7 */ { 0, 0, 0, 0, 0, 0 }, /* PC7 */ |
| 178 | /* PC6 */ { 0, 0, 0, 0, 0, 0 }, /* PC6 */ |
| 179 | /* PC5 */ { 0, 0, 0, 0, 0, 0 }, /* PC5 */ |
| 180 | /* PC4 */ { 0, 0, 0, 0, 0, 0 }, /* PC4 */ |
| 181 | /* PC3 */ { 0, 0, 0, 0, 0, 0 }, /* PC3 */ |
| 182 | /* PC2 */ { 0, 0, 0, 0, 0, 0 }, /* PC2 */ |
| 183 | /* PC1 */ { 0, 0, 0, 0, 0, 0 }, /* PC1 */ |
| 184 | /* PC0 */ { 0, 0, 0, 0, 0, 0 }, /* PC0 */ |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 185 | }, |
| 186 | |
| 187 | /* Port D */ |
| 188 | { /* conf ppar psor pdir podr pdat */ |
wdenk | cceb871 | 2003-06-23 18:12:28 +0000 | [diff] [blame] | 189 | /* PD31 */ { 1, 1, 0, 0, 0, 0 }, /* SCC1 UART RxD */ |
| 190 | /* PD30 */ { 1, 1, 1, 1, 0, 0 }, /* SCC1 UART TxD */ |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 191 | /* PD29 */ { 0, 0, 0, 0, 0, 0 }, /* PD29 */ |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 192 | /* PD28 */ { 0, 1, 0, 0, 0, 0 }, /* PD28 */ |
| 193 | /* PD27 */ { 0, 1, 1, 1, 0, 0 }, /* PD27 */ |
| 194 | /* PD26 */ { 0, 0, 0, 1, 0, 0 }, /* PD26 */ |
| 195 | /* PD25 */ { 0, 0, 0, 1, 0, 0 }, /* PD25 */ |
| 196 | /* PD24 */ { 0, 0, 0, 1, 0, 0 }, /* PD24 */ |
| 197 | /* PD23 */ { 0, 0, 0, 1, 0, 0 }, /* PD23 */ |
| 198 | /* PD22 */ { 0, 0, 0, 1, 0, 0 }, /* PD22 */ |
| 199 | /* PD21 */ { 0, 0, 0, 1, 0, 0 }, /* PD21 */ |
| 200 | /* PD20 */ { 0, 0, 0, 1, 0, 0 }, /* PD20 */ |
| 201 | /* PD19 */ { 0, 0, 0, 1, 0, 0 }, /* PD19 */ |
| 202 | /* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD18 */ |
| 203 | /* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXPRTY */ |
| 204 | /* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXPRTY */ |
wdenk | cceb871 | 2003-06-23 18:12:28 +0000 | [diff] [blame] | 205 | /* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */ |
| 206 | /* PD14 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SCL */ |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 207 | /* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */ |
| 208 | /* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */ |
| 209 | /* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */ |
| 210 | /* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */ |
wdenk | cceb871 | 2003-06-23 18:12:28 +0000 | [diff] [blame] | 211 | /* PD9 */ { 0, 1, 0, 1, 0, 0 }, /* SMC1 TXD */ |
| 212 | /* PD8 */ { 0, 1, 0, 0, 0, 0 }, /* SMC1 RXD */ |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 213 | /* PD7 */ { 0, 0, 0, 1, 0, 1 }, /* PD7 */ |
| 214 | /* PD6 */ { 0, 0, 0, 1, 0, 1 }, /* PD6 */ |
| 215 | /* PD5 */ { 0, 0, 0, 1, 0, 1 }, /* PD5 */ |
| 216 | /* PD4 */ { 0, 0, 0, 1, 0, 1 }, /* PD4 */ |
| 217 | /* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */ |
| 218 | /* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */ |
| 219 | /* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */ |
| 220 | /* PD0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */ |
| 221 | } |
| 222 | }; |
| 223 | |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 224 | void reset_phy (void) |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 225 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 226 | vu_long *bcsr = (vu_long *)CONFIG_SYS_BCSR; |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 227 | |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 228 | /* Reset the PHY */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 229 | #if CONFIG_SYS_PHY_ADDR == 0 |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 230 | bcsr[1] &= ~(FETHIEN1 | FETH1_RST); |
wdenk | cceb871 | 2003-06-23 18:12:28 +0000 | [diff] [blame] | 231 | udelay(2); |
wdenk | 2535d60 | 2003-07-17 23:16:40 +0000 | [diff] [blame] | 232 | bcsr[1] |= FETH1_RST; |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 233 | #else |
| 234 | bcsr[3] &= ~(FETHIEN2 | FETH2_RST); |
| 235 | udelay(2); |
| 236 | bcsr[3] |= FETH2_RST; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 237 | #endif /* CONFIG_SYS_PHY_ADDR == 0 */ |
wdenk | cceb871 | 2003-06-23 18:12:28 +0000 | [diff] [blame] | 238 | udelay(1000); |
| 239 | #ifdef CONFIG_MII |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 240 | #if CONFIG_ADSTYPE >= CONFIG_SYS_PQ2FADS |
wdenk | 2535d60 | 2003-07-17 23:16:40 +0000 | [diff] [blame] | 241 | /* |
| 242 | * Do not bypass Rx/Tx (de)scrambler (fix configuration error) |
| 243 | * Enable autonegotiation. |
| 244 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 245 | bb_miiphy_write(NULL, CONFIG_SYS_PHY_ADDR, 16, 0x610); |
Mike Frysinger | 8ef583a | 2010-12-23 15:40:12 -0500 | [diff] [blame] | 246 | bb_miiphy_write(NULL, CONFIG_SYS_PHY_ADDR, MII_BMCR, |
| 247 | BMCR_ANENABLE | BMCR_ANRESTART); |
wdenk | 2535d60 | 2003-07-17 23:16:40 +0000 | [diff] [blame] | 248 | #else |
wdenk | cceb871 | 2003-06-23 18:12:28 +0000 | [diff] [blame] | 249 | /* |
| 250 | * Ethernet PHY is configured (by means of configuration pins) |
| 251 | * to work at 10Mb/s only. We reconfigure it using MII |
| 252 | * to advertise all capabilities, including 100Mb/s, and |
| 253 | * restart autonegotiation. |
| 254 | */ |
Marian Balakowicz | 63ff004 | 2005-10-28 22:30:33 +0200 | [diff] [blame] | 255 | |
| 256 | /* Advertise all capabilities */ |
Mike Frysinger | 8ef583a | 2010-12-23 15:40:12 -0500 | [diff] [blame] | 257 | bb_miiphy_write(NULL, CONFIG_SYS_PHY_ADDR, MII_ADVERTISE, 0x01E1); |
Wolfgang Denk | f013dac | 2005-12-04 00:40:34 +0100 | [diff] [blame] | 258 | |
Marian Balakowicz | 63ff004 | 2005-10-28 22:30:33 +0200 | [diff] [blame] | 259 | /* Do not bypass Rx/Tx (de)scrambler */ |
Mike Frysinger | 8ef583a | 2010-12-23 15:40:12 -0500 | [diff] [blame] | 260 | bb_miiphy_write(NULL, CONFIG_SYS_PHY_ADDR, MII_FCSCOUNTER, 0x0000); |
Marian Balakowicz | 63ff004 | 2005-10-28 22:30:33 +0200 | [diff] [blame] | 261 | |
Mike Frysinger | 8ef583a | 2010-12-23 15:40:12 -0500 | [diff] [blame] | 262 | bb_miiphy_write(NULL, CONFIG_SYS_PHY_ADDR, MII_BMCR, |
| 263 | BMCR_ANENABLE | BMCR_ANRESTART); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 264 | #endif /* CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS */ |
wdenk | cceb871 | 2003-06-23 18:12:28 +0000 | [diff] [blame] | 265 | #endif /* CONFIG_MII */ |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 266 | } |
| 267 | |
Wolfgang Denk | 1972dc0 | 2005-09-25 16:27:55 +0200 | [diff] [blame] | 268 | #ifdef CONFIG_PCI |
| 269 | typedef struct pci_ic_s { |
| 270 | unsigned long pci_int_stat; |
| 271 | unsigned long pci_int_mask; |
| 272 | }pci_ic_t; |
| 273 | #endif |
| 274 | |
wdenk | c837dcb | 2004-01-20 23:12:12 +0000 | [diff] [blame] | 275 | int board_early_init_f (void) |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 276 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 277 | vu_long *bcsr = (vu_long *)CONFIG_SYS_BCSR; |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 278 | |
Wolfgang Denk | 1972dc0 | 2005-09-25 16:27:55 +0200 | [diff] [blame] | 279 | #ifdef CONFIG_PCI |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 280 | volatile pci_ic_t* pci_ic = (pci_ic_t *) CONFIG_SYS_PCI_INT; |
Wolfgang Denk | 716c1dc | 2005-09-25 18:49:35 +0200 | [diff] [blame] | 281 | |
Wolfgang Denk | 1972dc0 | 2005-09-25 16:27:55 +0200 | [diff] [blame] | 282 | /* mask alll the PCI interrupts */ |
| 283 | pci_ic->pci_int_mask |= 0xfff00000; |
| 284 | #endif |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 285 | #if (CONFIG_CONS_INDEX == 1) || (CONFIG_KGDB_INDEX == 1) |
| 286 | bcsr[1] &= ~RS232EN_1; |
| 287 | #endif |
| 288 | #if (CONFIG_CONS_INDEX > 1) || (CONFIG_KGDB_INDEX > 1) |
| 289 | bcsr[1] &= ~RS232EN_2; |
| 290 | #endif |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 291 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 292 | #if CONFIG_ADSTYPE != CONFIG_SYS_8260ADS /* PCI mode can be selected */ |
| 293 | #if CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS |
wdenk | ef5a967 | 2003-12-07 00:46:27 +0000 | [diff] [blame] | 294 | if ((bcsr[3] & BCSR_PCI_MODE) == 0) /* PCI mode selected by JP9 */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 295 | #endif /* CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS */ |
wdenk | ef5a967 | 2003-12-07 00:46:27 +0000 | [diff] [blame] | 296 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 297 | volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; |
wdenk | ef5a967 | 2003-12-07 00:46:27 +0000 | [diff] [blame] | 298 | |
| 299 | immap->im_clkrst.car_sccr |= M826X_SCCR_PCI_MODE_EN; |
| 300 | immap->im_siu_conf.sc_siumcr = |
| 301 | (immap->im_siu_conf.sc_siumcr & ~SIUMCR_LBPC11) |
| 302 | | SIUMCR_LBPC01; |
| 303 | } |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 304 | #endif /* CONFIG_ADSTYPE != CONFIG_SYS_8260ADS */ |
wdenk | ef5a967 | 2003-12-07 00:46:27 +0000 | [diff] [blame] | 305 | |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 306 | return 0; |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 307 | } |
| 308 | |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 309 | #define ns2clk(ns) (ns / (1000000000 / CONFIG_8260_CLKIN) + 1) |
| 310 | |
Becky Bruce | 9973e3c | 2008-06-09 16:03:40 -0500 | [diff] [blame] | 311 | phys_size_t initdram (int board_type) |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 312 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 313 | #if CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS |
wdenk | ef5a967 | 2003-12-07 00:46:27 +0000 | [diff] [blame] | 314 | long int msize = 32; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 315 | #elif CONFIG_ADSTYPE == CONFIG_SYS_8272ADS |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 316 | long int msize = 64; |
wdenk | ef5a967 | 2003-12-07 00:46:27 +0000 | [diff] [blame] | 317 | #else |
| 318 | long int msize = 16; |
wdenk | 149dded | 2003-09-10 18:20:28 +0000 | [diff] [blame] | 319 | #endif |
wdenk | ef5a967 | 2003-12-07 00:46:27 +0000 | [diff] [blame] | 320 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 321 | #ifndef CONFIG_SYS_RAMBOOT |
| 322 | volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 323 | volatile memctl8260_t *memctl = &immap->im_memctl; |
| 324 | volatile uchar *ramaddr, c = 0xff; |
wdenk | 2535d60 | 2003-07-17 23:16:40 +0000 | [diff] [blame] | 325 | uint or; |
| 326 | uint psdmr; |
| 327 | uint psrt; |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 328 | |
| 329 | int i; |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 330 | |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 331 | immap->im_siu_conf.sc_ppc_acr = 0x00000002; |
| 332 | immap->im_siu_conf.sc_ppc_alrh = 0x01267893; |
| 333 | immap->im_siu_conf.sc_tescr1 = 0x00004000; |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 334 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 335 | memctl->memc_mptpr = CONFIG_SYS_MPTPR; |
| 336 | #ifdef CONFIG_SYS_LSDRAM_BASE |
wdenk | 326428c | 2003-08-31 18:37:54 +0000 | [diff] [blame] | 337 | /* |
| 338 | Initialise local bus SDRAM only if the pins |
| 339 | are configured as local bus pins and not as PCI. |
| 340 | The configuration is determined by the HRCW. |
| 341 | */ |
| 342 | if ((immap->im_siu_conf.sc_siumcr & SIUMCR_LBPC11) == SIUMCR_LBPC00) { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 343 | memctl->memc_lsrt = CONFIG_SYS_LSRT; |
| 344 | #if CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS /* CS3 */ |
wdenk | 326428c | 2003-08-31 18:37:54 +0000 | [diff] [blame] | 345 | memctl->memc_or3 = 0xFF803280; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 346 | memctl->memc_br3 = CONFIG_SYS_LSDRAM_BASE | 0x00001861; |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 347 | #else /* CS4 */ |
wdenk | 326428c | 2003-08-31 18:37:54 +0000 | [diff] [blame] | 348 | memctl->memc_or4 = 0xFFC01480; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 349 | memctl->memc_br4 = CONFIG_SYS_LSDRAM_BASE | 0x00001861; |
| 350 | #endif /* CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS */ |
| 351 | memctl->memc_lsdmr = CONFIG_SYS_LSDMR | 0x28000000; |
| 352 | ramaddr = (uchar *) CONFIG_SYS_LSDRAM_BASE; |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 353 | *ramaddr = c; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 354 | memctl->memc_lsdmr = CONFIG_SYS_LSDMR | 0x08000000; |
wdenk | 326428c | 2003-08-31 18:37:54 +0000 | [diff] [blame] | 355 | for (i = 0; i < 8; i++) |
| 356 | *ramaddr = c; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 357 | memctl->memc_lsdmr = CONFIG_SYS_LSDMR | 0x18000000; |
wdenk | 326428c | 2003-08-31 18:37:54 +0000 | [diff] [blame] | 358 | *ramaddr = c; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 359 | memctl->memc_lsdmr = CONFIG_SYS_LSDMR | 0x40000000; |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 360 | } |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 361 | #endif /* CONFIG_SYS_LSDRAM_BASE */ |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 362 | |
wdenk | 2535d60 | 2003-07-17 23:16:40 +0000 | [diff] [blame] | 363 | /* Init 60x bus SDRAM */ |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 364 | #ifdef CONFIG_SPD_EEPROM |
| 365 | { |
| 366 | spd_eeprom_t spd; |
| 367 | uint pbi, bsel, rowst, lsb, tmp; |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 368 | |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 369 | i2c_read (CONFIG_SPD_ADDR, 0, 1, (uchar *) & spd, sizeof (spd)); |
| 370 | |
| 371 | /* Bank-based interleaving is not supported for physical bank |
| 372 | sizes greater than 128MB which is encoded as 0x20 in SPD |
| 373 | */ |
| 374 | pbi = (spd.row_dens > 32) ? 1 : CONFIG_SDRAM_PBI; |
| 375 | msize = spd.nrows * (4 * spd.row_dens); /* Mixed size not supported */ |
| 376 | or = ~(msize - 1) << 20; /* SDAM */ |
| 377 | switch (spd.nbanks) { /* BPD */ |
| 378 | case 2: |
| 379 | bsel = 1; |
| 380 | break; |
| 381 | case 4: |
| 382 | bsel = 2; |
| 383 | or |= 0x00002000; |
| 384 | break; |
| 385 | case 8: |
| 386 | bsel = 3; |
| 387 | or |= 0x00004000; |
| 388 | break; |
| 389 | } |
| 390 | lsb = 3; /* For 64-bit port, lsb is 3 bits */ |
| 391 | |
| 392 | if (pbi) { /* Bus partition depends on interleaving */ |
| 393 | rowst = 32 - (spd.nrow_addr + spd.ncol_addr + bsel + lsb); |
| 394 | or |= (rowst << 9); /* ROWST */ |
| 395 | } else { |
| 396 | rowst = 32 - (spd.nrow_addr + spd.ncol_addr + lsb); |
| 397 | or |= ((rowst * 2 - 12) << 9); /* ROWST */ |
| 398 | } |
| 399 | or |= ((spd.nrow_addr - 9) << 6); /* NUMR */ |
| 400 | |
| 401 | psdmr = (pbi << 31); /* PBI */ |
| 402 | /* Bus multiplexing parameters */ |
| 403 | tmp = 32 - (lsb + spd.nrow_addr); /* Tables 10-19 and 10-20 */ |
| 404 | psdmr |= ((tmp - (rowst - 5) - 13) << 24); /* SDAM */ |
| 405 | psdmr |= ((tmp - 3 - 12) << 21); /* BSMA */ |
| 406 | |
| 407 | tmp = (31 - lsb - 10) - tmp; |
| 408 | /* Pin connected to SDA10 is (31 - lsb - 10). |
| 409 | rowst is multiplexed over (32 - (lsb + spd.nrow_addr)), |
| 410 | so (rowst + tmp) alternates with AP. |
| 411 | */ |
| 412 | if (pbi) /* Table 10-7 */ |
| 413 | psdmr |= ((10 - (rowst + tmp)) << 18); /* SDA10 */ |
| 414 | else |
| 415 | psdmr |= ((12 - (rowst + tmp)) << 18); /* SDA10 */ |
| 416 | |
| 417 | /* SDRAM device-specific parameters */ |
| 418 | tmp = ns2clk (70); /* Refresh recovery is not in SPD, so assume 70ns */ |
| 419 | switch (tmp) { /* RFRC */ |
| 420 | case 1: |
| 421 | case 2: |
| 422 | psdmr |= (1 << 15); |
| 423 | break; |
| 424 | case 3: |
| 425 | case 4: |
| 426 | case 5: |
| 427 | case 6: |
| 428 | case 7: |
| 429 | case 8: |
| 430 | psdmr |= ((tmp - 2) << 15); |
| 431 | break; |
| 432 | default: |
| 433 | psdmr |= (7 << 15); |
| 434 | } |
| 435 | psdmr |= (ns2clk (spd.trp) % 8 << 12); /* PRETOACT */ |
| 436 | psdmr |= (ns2clk (spd.trcd) % 8 << 9); /* ACTTORW */ |
| 437 | /* BL=0 because for 64-bit SDRAM burst length must be 4 */ |
| 438 | /* LDOTOPRE ??? */ |
| 439 | for (i = 0, tmp = spd.write_lat; (i < 4) && ((tmp & 1) == 0); i++) |
| 440 | tmp >>= 1; |
| 441 | switch (i) { /* WRC */ |
| 442 | case 0: |
| 443 | case 1: |
| 444 | psdmr |= (1 << 4); |
| 445 | break; |
| 446 | case 2: |
| 447 | case 3: |
| 448 | psdmr |= (i << 4); |
| 449 | break; |
| 450 | } |
| 451 | /* EAMUX=0 - no external address multiplexing */ |
| 452 | /* BUFCMD=0 - no external buffers */ |
| 453 | for (i = 1, tmp = spd.cas_lat; (i < 3) && ((tmp & 1) == 0); i++) |
| 454 | tmp >>= 1; |
| 455 | psdmr |= i; /* CL */ |
| 456 | |
| 457 | switch (spd.refresh & 0x7F) { |
| 458 | case 1: |
| 459 | tmp = 3900; |
| 460 | break; |
| 461 | case 2: |
| 462 | tmp = 7800; |
| 463 | break; |
| 464 | case 3: |
| 465 | tmp = 31300; |
| 466 | break; |
| 467 | case 4: |
| 468 | tmp = 62500; |
| 469 | break; |
| 470 | case 5: |
| 471 | tmp = 125000; |
| 472 | break; |
| 473 | default: |
| 474 | tmp = 15625; |
| 475 | } |
| 476 | psrt = tmp / (1000000000 / CONFIG_8260_CLKIN * |
| 477 | ((memctl->memc_mptpr >> 8) + 1)) - 1; |
| 478 | #ifdef SPD_DEBUG |
| 479 | printf ("\nDIMM type: %-18.18s\n", spd.mpart); |
| 480 | printf ("SPD size: %d\n", spd.info_size); |
| 481 | printf ("EEPROM size: %d\n", 1 << spd.chip_size); |
| 482 | printf ("Memory type: %d\n", spd.mem_type); |
| 483 | printf ("Row addr: %d\n", spd.nrow_addr); |
| 484 | printf ("Column addr: %d\n", spd.ncol_addr); |
| 485 | printf ("# of rows: %d\n", spd.nrows); |
| 486 | printf ("Row density: %d\n", spd.row_dens); |
| 487 | printf ("# of banks: %d\n", spd.nbanks); |
| 488 | printf ("Data width: %d\n", |
| 489 | 256 * spd.dataw_msb + spd.dataw_lsb); |
| 490 | printf ("Chip width: %d\n", spd.primw); |
| 491 | printf ("Refresh rate: %02X\n", spd.refresh); |
| 492 | printf ("CAS latencies: %02X\n", spd.cas_lat); |
| 493 | printf ("Write latencies: %02X\n", spd.write_lat); |
| 494 | printf ("tRP: %d\n", spd.trp); |
| 495 | printf ("tRCD: %d\n", spd.trcd); |
| 496 | |
| 497 | printf ("OR=%X, PSDMR=%08X, PSRT=%0X\n", or, psdmr, psrt); |
| 498 | #endif /* SPD_DEBUG */ |
| 499 | } |
wdenk | 2535d60 | 2003-07-17 23:16:40 +0000 | [diff] [blame] | 500 | #else /* !CONFIG_SPD_EEPROM */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 501 | or = CONFIG_SYS_OR2; |
| 502 | psdmr = CONFIG_SYS_PSDMR; |
| 503 | psrt = CONFIG_SYS_PSRT; |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 504 | #endif /* CONFIG_SPD_EEPROM */ |
| 505 | memctl->memc_psrt = psrt; |
| 506 | memctl->memc_or2 = or; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 507 | memctl->memc_br2 = CONFIG_SYS_SDRAM_BASE | 0x00000041; |
| 508 | ramaddr = (uchar *) CONFIG_SYS_SDRAM_BASE; |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 509 | memctl->memc_psdmr = psdmr | 0x28000000; /* Precharge all banks */ |
| 510 | *ramaddr = c; |
| 511 | memctl->memc_psdmr = psdmr | 0x08000000; /* CBR refresh */ |
| 512 | for (i = 0; i < 8; i++) |
| 513 | *ramaddr = c; |
| 514 | |
| 515 | memctl->memc_psdmr = psdmr | 0x18000000; /* Mode Register write */ |
| 516 | *ramaddr = c; |
| 517 | memctl->memc_psdmr = psdmr | 0x40000000; /* Refresh enable */ |
| 518 | *ramaddr = c; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 519 | #endif /* CONFIG_SYS_RAMBOOT */ |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 520 | |
wdenk | 2535d60 | 2003-07-17 23:16:40 +0000 | [diff] [blame] | 521 | /* return total 60x bus SDRAM size */ |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 522 | return (msize * 1024 * 1024); |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 523 | } |
| 524 | |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 525 | int checkboard (void) |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 526 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 527 | #if CONFIG_ADSTYPE == CONFIG_SYS_8260ADS |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 528 | puts ("Board: Motorola MPC8260ADS\n"); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 529 | #elif CONFIG_ADSTYPE == CONFIG_SYS_8266ADS |
wdenk | 2535d60 | 2003-07-17 23:16:40 +0000 | [diff] [blame] | 530 | puts ("Board: Motorola MPC8266ADS\n"); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 531 | #elif CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS |
wdenk | 2535d60 | 2003-07-17 23:16:40 +0000 | [diff] [blame] | 532 | puts ("Board: Motorola PQ2FADS-ZU\n"); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 533 | #elif CONFIG_ADSTYPE == CONFIG_SYS_8272ADS |
wdenk | 04a85b3 | 2004-04-15 18:22:41 +0000 | [diff] [blame] | 534 | puts ("Board: Motorola MPC8272ADS\n"); |
wdenk | 2535d60 | 2003-07-17 23:16:40 +0000 | [diff] [blame] | 535 | #else |
| 536 | puts ("Board: unknown\n"); |
| 537 | #endif |
wdenk | db2f721f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 538 | return 0; |
wdenk | 67c4f48 | 2002-08-26 22:23:10 +0000 | [diff] [blame] | 539 | } |
Wolfgang Denk | 1972dc0 | 2005-09-25 16:27:55 +0200 | [diff] [blame] | 540 | |
| 541 | #ifdef CONFIG_PCI |
| 542 | struct pci_controller hose; |
| 543 | |
| 544 | extern void pci_mpc8250_init(struct pci_controller *); |
| 545 | |
| 546 | void pci_init_board(void) |
| 547 | { |
| 548 | pci_mpc8250_init(&hose); |
| 549 | } |
| 550 | #endif |
Matvejchikov Ilya | 0e6989b | 2008-07-06 13:57:00 +0400 | [diff] [blame] | 551 | |
| 552 | #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) |
Matvejchikov Ilya | 0e6989b | 2008-07-06 13:57:00 +0400 | [diff] [blame] | 553 | void ft_board_setup(void *blob, bd_t *bd) |
| 554 | { |
| 555 | ft_cpu_setup(blob, bd); |
| 556 | #ifdef CONFIG_PCI |
| 557 | ft_pci_setup(blob, bd); |
| 558 | #endif |
Matvejchikov Ilya | 0e6989b | 2008-07-06 13:57:00 +0400 | [diff] [blame] | 559 | } |
| 560 | #endif |