wdenk | 21136db | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 5 | * (C) Copyright 2004 |
| 6 | * Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com. |
| 7 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 8 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 21136db | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <common.h> |
| 12 | #include <mpc5xxx.h> |
wdenk | 0237902 | 2003-08-05 18:22:44 +0000 | [diff] [blame] | 13 | #include <pci.h> |
Rafal Jaworowski | 0b892e8 | 2006-03-29 13:17:09 +0200 | [diff] [blame] | 14 | #include <asm/processor.h> |
Grant Likely | 8d1e6e7 | 2007-09-06 09:46:23 -0600 | [diff] [blame] | 15 | #include <libfdt.h> |
Ben Warren | f2c1acb | 2008-08-31 10:03:22 -0700 | [diff] [blame] | 16 | #include <netdev.h> |
Stefan Roese | fb34787 | 2006-11-28 17:55:49 +0100 | [diff] [blame] | 17 | |
Wolfgang Denk | 315b46a | 2006-03-17 11:42:53 +0100 | [diff] [blame] | 18 | #if defined(CONFIG_LITE5200B) |
| 19 | #include "mt46v32m16.h" |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 20 | #else |
Wolfgang Denk | 315b46a | 2006-03-17 11:42:53 +0100 | [diff] [blame] | 21 | # if defined(CONFIG_MPC5200_DDR) |
| 22 | # include "mt46v16m16-75.h" |
| 23 | # else |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 24 | #include "mt48lc16m16a2-75.h" |
Wolfgang Denk | 315b46a | 2006-03-17 11:42:53 +0100 | [diff] [blame] | 25 | # endif |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 26 | #endif |
Domen Puncer | 64b89ae | 2007-04-16 14:00:13 +0200 | [diff] [blame] | 27 | |
| 28 | #ifdef CONFIG_LITE5200B_PM |
| 29 | /* u-boot part of low-power mode implementation */ |
| 30 | #define SAVED_ADDR (*(void **)0x00000000) |
| 31 | #define PSC2_4 0x02 |
| 32 | |
| 33 | void lite5200b_wakeup(void) |
| 34 | { |
| 35 | unsigned char wakeup_pin; |
| 36 | void (*linux_wakeup)(void); |
| 37 | |
| 38 | /* check PSC2_4, if it's down "QT" is signaling we have a wakeup |
| 39 | * from low power mode */ |
| 40 | *(vu_char *)MPC5XXX_WU_GPIO_ENABLE = PSC2_4; |
| 41 | __asm__ volatile ("sync"); |
| 42 | |
| 43 | wakeup_pin = *(vu_char *)MPC5XXX_WU_GPIO_DATA_I; |
| 44 | if (wakeup_pin & PSC2_4) |
| 45 | return; |
| 46 | |
| 47 | /* acknowledge to "QT" |
| 48 | * by holding pin at 1 for 10 uS */ |
| 49 | *(vu_char *)MPC5XXX_WU_GPIO_DIR = PSC2_4; |
| 50 | __asm__ volatile ("sync"); |
| 51 | *(vu_char *)MPC5XXX_WU_GPIO_DATA_O = PSC2_4; |
| 52 | __asm__ volatile ("sync"); |
| 53 | udelay(10); |
| 54 | |
| 55 | /* put ram out of self-refresh */ |
| 56 | *(vu_long *)MPC5XXX_SDRAM_CTRL |= 0x80000000; /* mode_en */ |
| 57 | __asm__ volatile ("sync"); |
| 58 | *(vu_long *)MPC5XXX_SDRAM_CTRL |= 0x50000000; /* cke ref_en */ |
| 59 | __asm__ volatile ("sync"); |
| 60 | *(vu_long *)MPC5XXX_SDRAM_CTRL &= ~0x80000000; /* !mode_en */ |
| 61 | __asm__ volatile ("sync"); |
| 62 | udelay(10); /* wait a bit */ |
| 63 | |
| 64 | /* jump back to linux kernel code */ |
| 65 | linux_wakeup = SAVED_ADDR; |
| 66 | printf("\n\nLooks like we just woke, transferring control to 0x%08lx\n", |
Wolfgang Denk | 8196e3a | 2010-10-24 15:37:12 +0200 | [diff] [blame] | 67 | (unsigned long)linux_wakeup); |
Domen Puncer | 64b89ae | 2007-04-16 14:00:13 +0200 | [diff] [blame] | 68 | linux_wakeup(); |
| 69 | } |
| 70 | #else |
| 71 | #define lite5200b_wakeup() |
| 72 | #endif |
| 73 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 74 | #ifndef CONFIG_SYS_RAMBOOT |
wdenk | 5d84173 | 2003-08-17 18:55:18 +0000 | [diff] [blame] | 75 | static void sdram_start (int hi_addr) |
| 76 | { |
| 77 | long hi_addr_bit = hi_addr ? 0x01000000 : 0; |
wdenk | 21136db | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 78 | |
wdenk | 236d3fc | 2003-12-20 22:45:10 +0000 | [diff] [blame] | 79 | /* unlock mode register */ |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 80 | *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 | hi_addr_bit; |
| 81 | __asm__ volatile ("sync"); |
wdenk | 20c98a6 | 2004-04-23 20:32:05 +0000 | [diff] [blame] | 82 | |
wdenk | 236d3fc | 2003-12-20 22:45:10 +0000 | [diff] [blame] | 83 | /* precharge all banks */ |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 84 | *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit; |
| 85 | __asm__ volatile ("sync"); |
| 86 | |
| 87 | #if SDRAM_DDR |
wdenk | 236d3fc | 2003-12-20 22:45:10 +0000 | [diff] [blame] | 88 | /* set mode register: extended mode */ |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 89 | *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE; |
| 90 | __asm__ volatile ("sync"); |
| 91 | |
wdenk | 236d3fc | 2003-12-20 22:45:10 +0000 | [diff] [blame] | 92 | /* set mode register: reset DLL */ |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 93 | *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000; |
| 94 | __asm__ volatile ("sync"); |
wdenk | 5d84173 | 2003-08-17 18:55:18 +0000 | [diff] [blame] | 95 | #endif |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 96 | |
| 97 | /* precharge all banks */ |
| 98 | *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit; |
| 99 | __asm__ volatile ("sync"); |
| 100 | |
wdenk | 0e2874cb | 2004-03-02 14:05:39 +0000 | [diff] [blame] | 101 | /* auto refresh */ |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 102 | *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | hi_addr_bit; |
| 103 | __asm__ volatile ("sync"); |
| 104 | |
wdenk | 21136db | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 105 | /* set mode register */ |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 106 | *(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE; |
| 107 | __asm__ volatile ("sync"); |
wdenk | 20c98a6 | 2004-04-23 20:32:05 +0000 | [diff] [blame] | 108 | |
wdenk | 21136db | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 109 | /* normal operation */ |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 110 | *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit; |
| 111 | __asm__ volatile ("sync"); |
wdenk | 5d84173 | 2003-08-17 18:55:18 +0000 | [diff] [blame] | 112 | } |
wdenk | b10ba6b | 2003-08-28 09:41:22 +0000 | [diff] [blame] | 113 | #endif |
wdenk | 5d84173 | 2003-08-17 18:55:18 +0000 | [diff] [blame] | 114 | |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 115 | /* |
| 116 | * ATTENTION: Although partially referenced initdram does NOT make real use |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 117 | * use of CONFIG_SYS_SDRAM_BASE. The code does not work if CONFIG_SYS_SDRAM_BASE |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 118 | * is something else than 0x00000000. |
| 119 | */ |
| 120 | |
Becky Bruce | bd99ae7 | 2008-06-09 16:03:40 -0500 | [diff] [blame] | 121 | phys_size_t initdram (int board_type) |
wdenk | 5d84173 | 2003-08-17 18:55:18 +0000 | [diff] [blame] | 122 | { |
wdenk | b10ba6b | 2003-08-28 09:41:22 +0000 | [diff] [blame] | 123 | ulong dramsize = 0; |
wdenk | 236d3fc | 2003-12-20 22:45:10 +0000 | [diff] [blame] | 124 | ulong dramsize2 = 0; |
Rafal Jaworowski | 0b892e8 | 2006-03-29 13:17:09 +0200 | [diff] [blame] | 125 | uint svr, pvr; |
| 126 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 127 | #ifndef CONFIG_SYS_RAMBOOT |
wdenk | b10ba6b | 2003-08-28 09:41:22 +0000 | [diff] [blame] | 128 | ulong test1, test2; |
wdenk | 20c98a6 | 2004-04-23 20:32:05 +0000 | [diff] [blame] | 129 | |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 130 | /* setup SDRAM chip selects */ |
wdenk | 5d84173 | 2003-08-17 18:55:18 +0000 | [diff] [blame] | 131 | *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001e;/* 2G at 0x0 */ |
| 132 | *(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x80000000;/* disabled */ |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 133 | __asm__ volatile ("sync"); |
wdenk | 5d84173 | 2003-08-17 18:55:18 +0000 | [diff] [blame] | 134 | |
wdenk | 236d3fc | 2003-12-20 22:45:10 +0000 | [diff] [blame] | 135 | /* setup config registers */ |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 136 | *(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1; |
| 137 | *(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2; |
| 138 | __asm__ volatile ("sync"); |
wdenk | 1ebf41e | 2004-01-02 14:00:00 +0000 | [diff] [blame] | 139 | |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 140 | #if SDRAM_DDR |
| 141 | /* set tap delay */ |
| 142 | *(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY; |
| 143 | __asm__ volatile ("sync"); |
wdenk | 236d3fc | 2003-12-20 22:45:10 +0000 | [diff] [blame] | 144 | #endif |
wdenk | 5d84173 | 2003-08-17 18:55:18 +0000 | [diff] [blame] | 145 | |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 146 | /* find RAM size using SDRAM CS0 only */ |
wdenk | 5d84173 | 2003-08-17 18:55:18 +0000 | [diff] [blame] | 147 | sdram_start(0); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 148 | test1 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x80000000); |
wdenk | 5d84173 | 2003-08-17 18:55:18 +0000 | [diff] [blame] | 149 | sdram_start(1); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 150 | test2 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x80000000); |
wdenk | 5d84173 | 2003-08-17 18:55:18 +0000 | [diff] [blame] | 151 | if (test1 > test2) { |
| 152 | sdram_start(0); |
| 153 | dramsize = test1; |
| 154 | } else { |
| 155 | dramsize = test2; |
| 156 | } |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 157 | |
| 158 | /* memory smaller than 1MB is impossible */ |
| 159 | if (dramsize < (1 << 20)) { |
| 160 | dramsize = 0; |
| 161 | } |
wdenk | 20c98a6 | 2004-04-23 20:32:05 +0000 | [diff] [blame] | 162 | |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 163 | /* set SDRAM CS0 size according to the amount of RAM found */ |
| 164 | if (dramsize > 0) { |
| 165 | *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 + __builtin_ffs(dramsize >> 20) - 1; |
| 166 | } else { |
| 167 | *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */ |
| 168 | } |
| 169 | |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 170 | /* let SDRAM CS1 start right after CS0 */ |
wdenk | 236d3fc | 2003-12-20 22:45:10 +0000 | [diff] [blame] | 171 | *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001e;/* 2G */ |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 172 | |
| 173 | /* find RAM size using SDRAM CS1 only */ |
wdenk | e84ec90 | 2005-05-05 00:04:14 +0000 | [diff] [blame] | 174 | if (!dramsize) |
wdenk | faaa602 | 2005-04-21 21:10:22 +0000 | [diff] [blame] | 175 | sdram_start(0); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 176 | test2 = test1 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x80000000); |
wdenk | faaa602 | 2005-04-21 21:10:22 +0000 | [diff] [blame] | 177 | if (!dramsize) { |
| 178 | sdram_start(1); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 179 | test2 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x80000000); |
wdenk | faaa602 | 2005-04-21 21:10:22 +0000 | [diff] [blame] | 180 | } |
wdenk | 236d3fc | 2003-12-20 22:45:10 +0000 | [diff] [blame] | 181 | if (test1 > test2) { |
| 182 | sdram_start(0); |
| 183 | dramsize2 = test1; |
| 184 | } else { |
| 185 | dramsize2 = test2; |
| 186 | } |
wdenk | 20c98a6 | 2004-04-23 20:32:05 +0000 | [diff] [blame] | 187 | |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 188 | /* memory smaller than 1MB is impossible */ |
| 189 | if (dramsize2 < (1 << 20)) { |
| 190 | dramsize2 = 0; |
| 191 | } |
wdenk | 20c98a6 | 2004-04-23 20:32:05 +0000 | [diff] [blame] | 192 | |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 193 | /* set SDRAM CS1 size according to the amount of RAM found */ |
| 194 | if (dramsize2 > 0) { |
| 195 | *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize |
| 196 | | (0x13 + __builtin_ffs(dramsize2 >> 20) - 1); |
| 197 | } else { |
| 198 | *(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */ |
| 199 | } |
| 200 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 201 | #else /* CONFIG_SYS_RAMBOOT */ |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 202 | |
| 203 | /* retrieve size of memory connected to SDRAM CS0 */ |
| 204 | dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF; |
| 205 | if (dramsize >= 0x13) { |
| 206 | dramsize = (1 << (dramsize - 0x13)) << 20; |
| 207 | } else { |
| 208 | dramsize = 0; |
| 209 | } |
| 210 | |
| 211 | /* retrieve size of memory connected to SDRAM CS1 */ |
| 212 | dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF; |
| 213 | if (dramsize2 >= 0x13) { |
| 214 | dramsize2 = (1 << (dramsize2 - 0x13)) << 20; |
| 215 | } else { |
| 216 | dramsize2 = 0; |
| 217 | } |
| 218 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 219 | #endif /* CONFIG_SYS_RAMBOOT */ |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 220 | |
Rafal Jaworowski | 0b892e8 | 2006-03-29 13:17:09 +0200 | [diff] [blame] | 221 | /* |
Wolfgang Denk | ebd3deb | 2006-04-16 10:51:58 +0200 | [diff] [blame] | 222 | * On MPC5200B we need to set the special configuration delay in the |
| 223 | * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM |
Rafal Jaworowski | 0b892e8 | 2006-03-29 13:17:09 +0200 | [diff] [blame] | 224 | * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190: |
| 225 | * |
Wolfgang Denk | ebd3deb | 2006-04-16 10:51:58 +0200 | [diff] [blame] | 226 | * "The SDelay should be written to a value of 0x00000004. It is |
| 227 | * required to account for changes caused by normal wafer processing |
Rafal Jaworowski | 0b892e8 | 2006-03-29 13:17:09 +0200 | [diff] [blame] | 228 | * parameters." |
Wolfgang Denk | ebd3deb | 2006-04-16 10:51:58 +0200 | [diff] [blame] | 229 | */ |
Rafal Jaworowski | 0b892e8 | 2006-03-29 13:17:09 +0200 | [diff] [blame] | 230 | svr = get_svr(); |
| 231 | pvr = get_pvr(); |
Wolfgang Denk | ebd3deb | 2006-04-16 10:51:58 +0200 | [diff] [blame] | 232 | if ((SVR_MJREV(svr) >= 2) && |
Rafal Jaworowski | 0b892e8 | 2006-03-29 13:17:09 +0200 | [diff] [blame] | 233 | (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) { |
| 234 | |
| 235 | *(vu_long *)MPC5XXX_SDRAM_SDELAY = 0x04; |
| 236 | __asm__ volatile ("sync"); |
| 237 | } |
| 238 | |
Domen Puncer | 64b89ae | 2007-04-16 14:00:13 +0200 | [diff] [blame] | 239 | lite5200b_wakeup(); |
| 240 | |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 241 | return dramsize + dramsize2; |
| 242 | } |
| 243 | |
wdenk | 21136db | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 244 | int checkboard (void) |
| 245 | { |
Wolfgang Denk | 315b46a | 2006-03-17 11:42:53 +0100 | [diff] [blame] | 246 | #if defined (CONFIG_LITE5200B) |
| 247 | puts ("Board: Freescale Lite5200B\n"); |
Detlev Zundel | a414c7a | 2010-03-12 10:01:12 +0100 | [diff] [blame] | 248 | #else |
wdenk | 21136db | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 249 | puts ("Board: Motorola MPC5200 (IceCube)\n"); |
wdenk | 21136db | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 250 | #endif |
| 251 | return 0; |
| 252 | } |
| 253 | |
| 254 | void flash_preinit(void) |
| 255 | { |
| 256 | /* |
| 257 | * Now, when we are in RAM, enable flash write |
| 258 | * access for detection process. |
| 259 | * Note that CS_BOOT cannot be cleared when |
| 260 | * executing in flash. |
| 261 | */ |
wdenk | 21136db | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 262 | *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */ |
| 263 | } |
wdenk | 0237902 | 2003-08-05 18:22:44 +0000 | [diff] [blame] | 264 | |
wdenk | eb20ad3 | 2003-09-05 23:19:14 +0000 | [diff] [blame] | 265 | void flash_afterinit(ulong size) |
| 266 | { |
| 267 | if (size == 0x800000) { /* adjust mapping */ |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 268 | *(vu_long *)MPC5XXX_BOOTCS_START = *(vu_long *)MPC5XXX_CS0_START = |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 269 | START_REG(CONFIG_SYS_BOOTCS_START | size); |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 270 | *(vu_long *)MPC5XXX_BOOTCS_STOP = *(vu_long *)MPC5XXX_CS0_STOP = |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 271 | STOP_REG(CONFIG_SYS_BOOTCS_START | size, size); |
wdenk | eb20ad3 | 2003-09-05 23:19:14 +0000 | [diff] [blame] | 272 | } |
| 273 | } |
| 274 | |
wdenk | 0237902 | 2003-08-05 18:22:44 +0000 | [diff] [blame] | 275 | #ifdef CONFIG_PCI |
| 276 | static struct pci_controller hose; |
| 277 | |
| 278 | extern void pci_mpc5xxx_init(struct pci_controller *); |
| 279 | |
| 280 | void pci_init_board(void) |
| 281 | { |
| 282 | pci_mpc5xxx_init(&hose); |
| 283 | } |
| 284 | #endif |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 285 | |
Jon Loeliger | 13f7599 | 2007-07-10 10:39:10 -0500 | [diff] [blame] | 286 | #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET) |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 287 | |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 288 | void init_ide_reset (void) |
| 289 | { |
wdenk | 369d43d | 2004-03-14 14:09:05 +0000 | [diff] [blame] | 290 | debug ("init_ide_reset\n"); |
wdenk | c35ba4e | 2004-03-14 22:25:36 +0000 | [diff] [blame] | 291 | |
Wolfgang Denk | 87b3d4b | 2006-11-30 18:02:20 +0100 | [diff] [blame] | 292 | /* Configure PSC1_4 as GPIO output for ATA reset */ |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 293 | *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4; |
wdenk | 369d43d | 2004-03-14 14:09:05 +0000 | [diff] [blame] | 294 | *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4; |
wdenk | e2d6d74 | 2004-09-28 20:34:50 +0000 | [diff] [blame] | 295 | /* Deassert reset */ |
Bartlomiej Sieka | 79eecbfb | 2006-11-01 01:38:16 +0100 | [diff] [blame] | 296 | *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4; |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | void ide_set_reset (int idereset) |
| 300 | { |
wdenk | 369d43d | 2004-03-14 14:09:05 +0000 | [diff] [blame] | 301 | debug ("ide_reset(%d)\n", idereset); |
| 302 | |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 303 | if (idereset) { |
Bartlomiej Sieka | 79eecbfb | 2006-11-01 01:38:16 +0100 | [diff] [blame] | 304 | *(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4; |
wdenk | e2d6d74 | 2004-09-28 20:34:50 +0000 | [diff] [blame] | 305 | /* Make a delay. MPC5200 spec says 25 usec min */ |
| 306 | udelay(500000); |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 307 | } else { |
Bartlomiej Sieka | 79eecbfb | 2006-11-01 01:38:16 +0100 | [diff] [blame] | 308 | *(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4; |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 309 | } |
| 310 | } |
Jon Loeliger | 13f7599 | 2007-07-10 10:39:10 -0500 | [diff] [blame] | 311 | #endif |
Stefan Roese | fb34787 | 2006-11-28 17:55:49 +0100 | [diff] [blame] | 312 | |
Grant Likely | 8d1e6e7 | 2007-09-06 09:46:23 -0600 | [diff] [blame] | 313 | #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) |
Simon Glass | 2aec3cc | 2014-10-23 18:58:47 -0600 | [diff] [blame] | 314 | int ft_board_setup(void *blob, bd_t *bd) |
Stefan Roese | fb34787 | 2006-11-28 17:55:49 +0100 | [diff] [blame] | 315 | { |
| 316 | ft_cpu_setup(blob, bd); |
Simon Glass | 2aec3cc | 2014-10-23 18:58:47 -0600 | [diff] [blame] | 317 | |
| 318 | return 0; |
Stefan Roese | fb34787 | 2006-11-28 17:55:49 +0100 | [diff] [blame] | 319 | } |
| 320 | #endif |
Ben Warren | f2c1acb | 2008-08-31 10:03:22 -0700 | [diff] [blame] | 321 | |
| 322 | int board_eth_init(bd_t *bis) |
| 323 | { |
Ben Warren | cba8851 | 2008-08-31 10:39:12 -0700 | [diff] [blame] | 324 | cpu_eth_init(bis); /* Built in FEC comes first */ |
Ben Warren | f2c1acb | 2008-08-31 10:03:22 -0700 | [diff] [blame] | 325 | return pci_eth_init(bis); |
| 326 | } |