wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 1 | /* |
Srikanth Srinivasan | ab48ca1 | 2010-02-10 17:32:43 +0800 | [diff] [blame] | 2 | * Copyright 2004,2007-2010 Freescale Semiconductor, Inc. |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 3 | * (C) Copyright 2002, 2003 Motorola Inc. |
| 4 | * Xianghua Xiao (X.Xiao@motorola.com) |
| 5 | * |
| 6 | * (C) Copyright 2000 |
| 7 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 8 | * |
| 9 | * See file CREDITS for list of people who contributed to this |
| 10 | * project. |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License as |
| 14 | * published by the Free Software Foundation; either version 2 of |
| 15 | * the License, or (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 25 | * MA 02111-1307 USA |
| 26 | */ |
| 27 | |
Andy Fleming | 75b9d4a | 2008-08-31 16:33:26 -0500 | [diff] [blame] | 28 | #include <config.h> |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 29 | #include <common.h> |
| 30 | #include <watchdog.h> |
| 31 | #include <command.h> |
Andy Fleming | 80522dc | 2008-10-30 16:51:33 -0500 | [diff] [blame] | 32 | #include <fsl_esdhc.h> |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 33 | #include <asm/cache.h> |
Sergei Poselenov | 740280e | 2008-06-06 15:42:40 +0200 | [diff] [blame] | 34 | #include <asm/io.h> |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 35 | |
James Yang | 591933c | 2008-02-08 16:44:53 -0600 | [diff] [blame] | 36 | DECLARE_GLOBAL_DATA_PTR; |
| 37 | |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 38 | int checkcpu (void) |
| 39 | { |
wdenk | 97d80fc | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 40 | sys_info_t sysinfo; |
wdenk | 97d80fc | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 41 | uint pvr, svr; |
Jon Loeliger | d9b94f2 | 2005-07-25 14:05:07 -0500 | [diff] [blame] | 42 | uint fam; |
wdenk | 97d80fc | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 43 | uint ver; |
| 44 | uint major, minor; |
Kumar Gala | 4dbdb76 | 2008-06-10 16:53:46 -0500 | [diff] [blame] | 45 | struct cpu_type *cpu; |
Wolfgang Denk | 08ef89e | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 46 | char buf1[32], buf2[32]; |
Kumar Gala | 9ce3c22 | 2010-04-13 11:07:57 -0500 | [diff] [blame] | 47 | #if defined(CONFIG_DDR_CLK_FREQ) || defined(CONFIG_FSL_CORENET) |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 48 | volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); |
Kumar Gala | 9ce3c22 | 2010-04-13 11:07:57 -0500 | [diff] [blame] | 49 | #endif /* CONFIG_FSL_CORENET */ |
Srikanth Srinivasan | ab48ca1 | 2010-02-10 17:32:43 +0800 | [diff] [blame] | 50 | #ifdef CONFIG_DDR_CLK_FREQ |
| 51 | u32 ddr_ratio = ((gur->porpllsr) & MPC85xx_PORPLLSR_DDR_RATIO) |
| 52 | >> MPC85xx_PORPLLSR_DDR_RATIO_SHIFT; |
| 53 | #else |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 54 | #ifdef CONFIG_FSL_CORENET |
| 55 | u32 ddr_sync = ((gur->rcwsr[5]) & FSL_CORENET_RCWSR5_DDR_SYNC) |
| 56 | >> FSL_CORENET_RCWSR5_DDR_SYNC_SHIFT; |
| 57 | #else |
Kumar Gala | ee1e35b | 2008-05-29 01:21:24 -0500 | [diff] [blame] | 58 | u32 ddr_ratio = 0; |
Srikanth Srinivasan | ab48ca1 | 2010-02-10 17:32:43 +0800 | [diff] [blame] | 59 | #endif /* CONFIG_FSL_CORENET */ |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 60 | #endif /* CONFIG_DDR_CLK_FREQ */ |
Haiying Wang | 2fc7eb0 | 2009-01-15 11:58:35 -0500 | [diff] [blame] | 61 | int i; |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 62 | |
wdenk | 97d80fc | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 63 | svr = get_svr(); |
wdenk | 97d80fc | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 64 | major = SVR_MAJ(svr); |
Kumar Gala | ef50d6c | 2008-08-12 11:14:19 -0500 | [diff] [blame] | 65 | #ifdef CONFIG_MPC8536 |
| 66 | major &= 0x7; /* the msb of this nibble is a mfg code */ |
| 67 | #endif |
wdenk | 97d80fc | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 68 | minor = SVR_MIN(svr); |
| 69 | |
Poonam Aggrwal | 0e87098 | 2009-07-31 12:08:14 +0530 | [diff] [blame] | 70 | if (cpu_numcores() > 1) { |
Poonam Aggrwal | 21170c8 | 2009-09-03 19:42:40 +0530 | [diff] [blame] | 71 | #ifndef CONFIG_MP |
| 72 | puts("Unicore software on multiprocessor system!!\n" |
| 73 | "To enable mutlticore build define CONFIG_MP\n"); |
| 74 | #endif |
Poonam Aggrwal | 0e87098 | 2009-07-31 12:08:14 +0530 | [diff] [blame] | 75 | volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC85xx_PIC_ADDR); |
| 76 | printf("CPU%d: ", pic->whoami); |
| 77 | } else { |
| 78 | puts("CPU: "); |
| 79 | } |
Andy Fleming | 1ced121 | 2008-02-06 01:19:40 -0600 | [diff] [blame] | 80 | |
Poonam Aggrwal | 0e87098 | 2009-07-31 12:08:14 +0530 | [diff] [blame] | 81 | cpu = gd->cpu; |
| 82 | |
Poonam Aggrwal | 58442dc | 2009-09-02 13:35:21 +0530 | [diff] [blame] | 83 | puts(cpu->name); |
| 84 | if (IS_E_PROCESSOR(svr)) |
| 85 | puts("E"); |
Andy Fleming | 1ced121 | 2008-02-06 01:19:40 -0600 | [diff] [blame] | 86 | |
wdenk | 97d80fc | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 87 | printf(", Version: %d.%d, (0x%08x)\n", major, minor, svr); |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 88 | |
wdenk | 6c9e789 | 2005-03-15 22:56:53 +0000 | [diff] [blame] | 89 | pvr = get_pvr(); |
Jon Loeliger | d9b94f2 | 2005-07-25 14:05:07 -0500 | [diff] [blame] | 90 | fam = PVR_FAM(pvr); |
wdenk | 6c9e789 | 2005-03-15 22:56:53 +0000 | [diff] [blame] | 91 | ver = PVR_VER(pvr); |
| 92 | major = PVR_MAJ(pvr); |
| 93 | minor = PVR_MIN(pvr); |
| 94 | |
| 95 | printf("Core: "); |
Jon Loeliger | d9b94f2 | 2005-07-25 14:05:07 -0500 | [diff] [blame] | 96 | switch (fam) { |
| 97 | case PVR_FAM(PVR_85xx): |
wdenk | 6c9e789 | 2005-03-15 22:56:53 +0000 | [diff] [blame] | 98 | puts("E500"); |
| 99 | break; |
| 100 | default: |
| 101 | puts("Unknown"); |
| 102 | break; |
| 103 | } |
Kumar Gala | 0f060c3 | 2008-10-23 01:47:38 -0500 | [diff] [blame] | 104 | |
| 105 | if (PVR_MEM(pvr) == 0x03) |
| 106 | puts("MC"); |
| 107 | |
wdenk | 6c9e789 | 2005-03-15 22:56:53 +0000 | [diff] [blame] | 108 | printf(", Version: %d.%d, (0x%08x)\n", major, minor, pvr); |
| 109 | |
wdenk | 97d80fc | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 110 | get_sys_info(&sysinfo); |
| 111 | |
Kumar Gala | b29dee3 | 2009-02-04 09:35:57 -0600 | [diff] [blame] | 112 | puts("Clock Configuration:"); |
Poonam Aggrwal | 0e87098 | 2009-07-31 12:08:14 +0530 | [diff] [blame] | 113 | for (i = 0; i < cpu_numcores(); i++) { |
Wolfgang Denk | 1bba30e | 2009-02-19 00:41:08 +0100 | [diff] [blame] | 114 | if (!(i & 3)) |
| 115 | printf ("\n "); |
Haiying Wang | 2fc7eb0 | 2009-01-15 11:58:35 -0500 | [diff] [blame] | 116 | printf("CPU%d:%-4s MHz, ", |
| 117 | i,strmhz(buf1, sysinfo.freqProcessor[i])); |
Kumar Gala | b29dee3 | 2009-02-04 09:35:57 -0600 | [diff] [blame] | 118 | } |
| 119 | printf("\n CCB:%-4s MHz,\n", strmhz(buf1, sysinfo.freqSystemBus)); |
Kumar Gala | ee1e35b | 2008-05-29 01:21:24 -0500 | [diff] [blame] | 120 | |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 121 | #ifdef CONFIG_FSL_CORENET |
| 122 | if (ddr_sync == 1) { |
| 123 | printf(" DDR:%-4s MHz (%s MT/s data rate) " |
| 124 | "(Synchronous), ", |
| 125 | strmhz(buf1, sysinfo.freqDDRBus/2), |
| 126 | strmhz(buf2, sysinfo.freqDDRBus)); |
| 127 | } else { |
| 128 | printf(" DDR:%-4s MHz (%s MT/s data rate) " |
| 129 | "(Asynchronous), ", |
| 130 | strmhz(buf1, sysinfo.freqDDRBus/2), |
| 131 | strmhz(buf2, sysinfo.freqDDRBus)); |
| 132 | } |
| 133 | #else |
Kumar Gala | d435793 | 2007-12-07 04:59:26 -0600 | [diff] [blame] | 134 | switch (ddr_ratio) { |
| 135 | case 0x0: |
Wolfgang Denk | 08ef89e | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 136 | printf(" DDR:%-4s MHz (%s MT/s data rate), ", |
| 137 | strmhz(buf1, sysinfo.freqDDRBus/2), |
| 138 | strmhz(buf2, sysinfo.freqDDRBus)); |
Kumar Gala | d435793 | 2007-12-07 04:59:26 -0600 | [diff] [blame] | 139 | break; |
| 140 | case 0x7: |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 141 | printf(" DDR:%-4s MHz (%s MT/s data rate) " |
| 142 | "(Synchronous), ", |
Wolfgang Denk | 08ef89e | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 143 | strmhz(buf1, sysinfo.freqDDRBus/2), |
| 144 | strmhz(buf2, sysinfo.freqDDRBus)); |
Kumar Gala | d435793 | 2007-12-07 04:59:26 -0600 | [diff] [blame] | 145 | break; |
| 146 | default: |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 147 | printf(" DDR:%-4s MHz (%s MT/s data rate) " |
| 148 | "(Asynchronous), ", |
Wolfgang Denk | 08ef89e | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 149 | strmhz(buf1, sysinfo.freqDDRBus/2), |
| 150 | strmhz(buf2, sysinfo.freqDDRBus)); |
Kumar Gala | d435793 | 2007-12-07 04:59:26 -0600 | [diff] [blame] | 151 | break; |
| 152 | } |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 153 | #endif |
wdenk | 97d80fc | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 154 | |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 155 | if (sysinfo.freqLocalBus > LCRR_CLKDIV) { |
Trent Piepho | ada591d | 2008-12-03 15:16:37 -0800 | [diff] [blame] | 156 | printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freqLocalBus)); |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 157 | } else { |
Trent Piepho | ada591d | 2008-12-03 15:16:37 -0800 | [diff] [blame] | 158 | printf("LBC: unknown (LCRR[CLKDIV] = 0x%02lx)\n", |
| 159 | sysinfo.freqLocalBus); |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 160 | } |
wdenk | 97d80fc | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 161 | |
Andy Fleming | 1ced121 | 2008-02-06 01:19:40 -0600 | [diff] [blame] | 162 | #ifdef CONFIG_CPM2 |
Wolfgang Denk | 08ef89e | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 163 | printf("CPM: %s MHz\n", strmhz(buf1, sysinfo.freqSystemBus)); |
Andy Fleming | 1ced121 | 2008-02-06 01:19:40 -0600 | [diff] [blame] | 164 | #endif |
wdenk | 97d80fc | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 165 | |
Haiying Wang | b3d7f20 | 2009-05-20 12:30:29 -0400 | [diff] [blame] | 166 | #ifdef CONFIG_QE |
| 167 | printf(" QE:%-4s MHz\n", strmhz(buf1, sysinfo.freqQE)); |
| 168 | #endif |
| 169 | |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 170 | #ifdef CONFIG_SYS_DPAA_FMAN |
| 171 | for (i = 0; i < CONFIG_SYS_NUM_FMAN; i++) { |
| 172 | printf(" FMAN%d: %s MHz\n", i, |
| 173 | strmhz(buf1, sysinfo.freqFMan[i])); |
| 174 | } |
| 175 | #endif |
| 176 | |
| 177 | #ifdef CONFIG_SYS_DPAA_PME |
| 178 | printf(" PME: %s MHz\n", strmhz(buf1, sysinfo.freqPME)); |
| 179 | #endif |
| 180 | |
wdenk | 6c9e789 | 2005-03-15 22:56:53 +0000 | [diff] [blame] | 181 | puts("L1: D-cache 32 kB enabled\n I-cache 32 kB enabled\n"); |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 182 | |
| 183 | return 0; |
| 184 | } |
| 185 | |
| 186 | |
| 187 | /* ------------------------------------------------------------------------- */ |
| 188 | |
Wolfgang Denk | 54841ab | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 189 | int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char * const argv[]) |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 190 | { |
Kumar Gala | c348322 | 2009-09-08 13:46:46 -0500 | [diff] [blame] | 191 | /* Everything after the first generation of PQ3 parts has RSTCR */ |
| 192 | #if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \ |
| 193 | defined(CONFIG_MPC8555) || defined(CONFIG_MPC8560) |
Sergei Poselenov | 793670c | 2008-05-08 14:17:08 +0200 | [diff] [blame] | 194 | unsigned long val, msr; |
| 195 | |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 196 | /* |
| 197 | * Initiate hard reset in debug control register DBCR0 |
Kumar Gala | c348322 | 2009-09-08 13:46:46 -0500 | [diff] [blame] | 198 | * Make sure MSR[DE] = 1. This only resets the core. |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 199 | */ |
Sergei Poselenov | 793670c | 2008-05-08 14:17:08 +0200 | [diff] [blame] | 200 | msr = mfmsr (); |
| 201 | msr |= MSR_DE; |
| 202 | mtmsr (msr); |
urwithsughosh@gmail.com | df90968 | 2007-09-24 13:32:13 -0400 | [diff] [blame] | 203 | |
Sergei Poselenov | 793670c | 2008-05-08 14:17:08 +0200 | [diff] [blame] | 204 | val = mfspr(DBCR0); |
| 205 | val |= 0x70000000; |
| 206 | mtspr(DBCR0,val); |
Kumar Gala | c348322 | 2009-09-08 13:46:46 -0500 | [diff] [blame] | 207 | #else |
| 208 | volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); |
| 209 | out_be32(&gur->rstcr, 0x2); /* HRESET_REQ */ |
| 210 | udelay(100); |
| 211 | #endif |
Sergei Poselenov | 793670c | 2008-05-08 14:17:08 +0200 | [diff] [blame] | 212 | |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 213 | return 1; |
| 214 | } |
| 215 | |
| 216 | |
| 217 | /* |
| 218 | * Get timebase clock frequency |
| 219 | */ |
| 220 | unsigned long get_tbclk (void) |
| 221 | { |
Kumar Gala | 3c2a67e | 2009-09-17 01:52:37 -0500 | [diff] [blame] | 222 | #ifdef CONFIG_FSL_CORENET |
| 223 | return (gd->bus_clk + 8) / 16; |
| 224 | #else |
James Yang | 591933c | 2008-02-08 16:44:53 -0600 | [diff] [blame] | 225 | return (gd->bus_clk + 4UL)/8UL; |
Kumar Gala | 3c2a67e | 2009-09-17 01:52:37 -0500 | [diff] [blame] | 226 | #endif |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | |
| 230 | #if defined(CONFIG_WATCHDOG) |
| 231 | void |
| 232 | watchdog_reset(void) |
| 233 | { |
| 234 | int re_enable = disable_interrupts(); |
| 235 | reset_85xx_watchdog(); |
| 236 | if (re_enable) enable_interrupts(); |
| 237 | } |
| 238 | |
| 239 | void |
| 240 | reset_85xx_watchdog(void) |
| 241 | { |
| 242 | /* |
| 243 | * Clear TSR(WIS) bit by writing 1 |
| 244 | */ |
| 245 | unsigned long val; |
Andy Fleming | 03b81b4 | 2007-04-23 01:44:44 -0500 | [diff] [blame] | 246 | val = mfspr(SPRN_TSR); |
| 247 | val |= TSR_WIS; |
| 248 | mtspr(SPRN_TSR, val); |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 249 | } |
| 250 | #endif /* CONFIG_WATCHDOG */ |
| 251 | |
Sergei Poselenov | 740280e | 2008-06-06 15:42:40 +0200 | [diff] [blame] | 252 | /* |
Sergei Poselenov | 59f6305 | 2008-08-15 15:42:11 +0200 | [diff] [blame] | 253 | * Configures a UPM. The function requires the respective MxMR to be set |
| 254 | * before calling this function. "size" is the number or entries, not a sizeof. |
Sergei Poselenov | 740280e | 2008-06-06 15:42:40 +0200 | [diff] [blame] | 255 | */ |
| 256 | void upmconfig (uint upm, uint * table, uint size) |
| 257 | { |
| 258 | int i, mdr, mad, old_mad = 0; |
| 259 | volatile u32 *mxmr; |
Becky Bruce | f51cdaf | 2010-06-17 11:37:20 -0500 | [diff] [blame^] | 260 | volatile fsl_lbc_t *lbc = LBC_BASE_ADDR; |
Sergei Poselenov | 740280e | 2008-06-06 15:42:40 +0200 | [diff] [blame] | 261 | volatile u8* dummy = NULL; |
| 262 | int upmmask; |
| 263 | |
| 264 | switch (upm) { |
| 265 | case UPMA: |
| 266 | mxmr = &lbc->mamr; |
| 267 | upmmask = BR_MS_UPMA; |
| 268 | break; |
| 269 | case UPMB: |
| 270 | mxmr = &lbc->mbmr; |
| 271 | upmmask = BR_MS_UPMB; |
| 272 | break; |
| 273 | case UPMC: |
| 274 | mxmr = &lbc->mcmr; |
| 275 | upmmask = BR_MS_UPMC; |
| 276 | break; |
| 277 | default: |
| 278 | printf("%s: Bad UPM index %d to configure\n", __FUNCTION__, upm); |
| 279 | hang(); |
| 280 | } |
| 281 | |
| 282 | /* Find the address for the dummy write transaction */ |
Becky Bruce | f51cdaf | 2010-06-17 11:37:20 -0500 | [diff] [blame^] | 283 | for (i = 0; i < 8; i++) { |
| 284 | if ((get_lbc_br(i) & (BR_V | BR_MSEL)) == (BR_V | upmmask)) { |
| 285 | dummy = (volatile u8 *)(get_lbc_br(i) & BR_BA); |
Sergei Poselenov | 740280e | 2008-06-06 15:42:40 +0200 | [diff] [blame] | 286 | break; |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | if (i == 8) { |
| 291 | printf("Error: %s() could not find matching BR\n", __FUNCTION__); |
| 292 | hang(); |
| 293 | } |
| 294 | |
| 295 | for (i = 0; i < size; i++) { |
| 296 | /* 1 */ |
Sergei Poselenov | 59f6305 | 2008-08-15 15:42:11 +0200 | [diff] [blame] | 297 | out_be32(mxmr, (in_be32(mxmr) & 0x4fffffc0) | MxMR_OP_WARR | i); |
Sergei Poselenov | 740280e | 2008-06-06 15:42:40 +0200 | [diff] [blame] | 298 | /* 2 */ |
| 299 | out_be32(&lbc->mdr, table[i]); |
| 300 | /* 3 */ |
| 301 | mdr = in_be32(&lbc->mdr); |
| 302 | /* 4 */ |
| 303 | *(volatile u8 *)dummy = 0; |
| 304 | /* 5 */ |
| 305 | do { |
Sergei Poselenov | 59f6305 | 2008-08-15 15:42:11 +0200 | [diff] [blame] | 306 | mad = in_be32(mxmr) & MxMR_MAD_MSK; |
Sergei Poselenov | 740280e | 2008-06-06 15:42:40 +0200 | [diff] [blame] | 307 | } while (mad <= old_mad && !(!mad && i == (size-1))); |
| 308 | old_mad = mad; |
| 309 | } |
Sergei Poselenov | 59f6305 | 2008-08-15 15:42:11 +0200 | [diff] [blame] | 310 | out_be32(mxmr, (in_be32(mxmr) & 0x4fffffc0) | MxMR_OP_NORM); |
Sergei Poselenov | 740280e | 2008-06-06 15:42:40 +0200 | [diff] [blame] | 311 | } |
Ben Warren | dd35479 | 2008-06-23 22:57:27 -0700 | [diff] [blame] | 312 | |
Andy Fleming | 80522dc | 2008-10-30 16:51:33 -0500 | [diff] [blame] | 313 | /* |
| 314 | * Initializes on-chip MMC controllers. |
| 315 | * to override, implement board_mmc_init() |
| 316 | */ |
| 317 | int cpu_mmc_init(bd_t *bis) |
| 318 | { |
| 319 | #ifdef CONFIG_FSL_ESDHC |
| 320 | return fsl_esdhc_mmc_init(bis); |
| 321 | #else |
| 322 | return 0; |
| 323 | #endif |
| 324 | } |