Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2000-2002 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
| 8 | /* |
| 9 | * m8xx.c |
| 10 | * |
| 11 | * CPU specific code |
| 12 | * |
| 13 | * written or collected and sometimes rewritten by |
| 14 | * Magnus Damm <damm@bitsmart.com> |
| 15 | * |
| 16 | * minor modifications by |
| 17 | * Wolfgang Denk <wd@denx.de> |
| 18 | */ |
| 19 | |
| 20 | #include <common.h> |
| 21 | #include <watchdog.h> |
| 22 | #include <command.h> |
| 23 | #include <mpc8xx.h> |
| 24 | #include <commproc.h> |
| 25 | #include <netdev.h> |
| 26 | #include <asm/cache.h> |
| 27 | #include <linux/compiler.h> |
| 28 | #include <asm/io.h> |
| 29 | |
| 30 | #if defined(CONFIG_OF_LIBFDT) |
Masahiro Yamada | 75f82d0 | 2018-03-05 01:20:11 +0900 | [diff] [blame] | 31 | #include <linux/libfdt.h> |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 32 | #include <fdt_support.h> |
| 33 | #endif |
| 34 | |
| 35 | DECLARE_GLOBAL_DATA_PTR; |
| 36 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 37 | static int check_CPU(long clock, uint pvr, uint immr) |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 38 | { |
Christophe Leroy | 5c59bdf | 2018-03-16 17:20:33 +0100 | [diff] [blame] | 39 | immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR; |
Christophe Leroy | ea31cb2 | 2017-07-13 15:09:58 +0200 | [diff] [blame] | 40 | uint k; |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 41 | char buf[32]; |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 42 | |
| 43 | /* the highest 16 bits should be 0x0050 for a 860 */ |
| 44 | |
Christophe Leroy | 0a121f7 | 2018-03-16 17:20:35 +0100 | [diff] [blame] | 45 | if (PVR_VER(pvr) != PVR_VER(PVR_8xx)) |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 46 | return -1; |
| 47 | |
| 48 | k = (immr << 16) | |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 49 | in_be16(&immap->im_cpm.cp_dparam16[PROFF_REVNUM / sizeof(u16)]); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 50 | |
| 51 | /* |
| 52 | * Some boards use sockets so different CPUs can be used. |
| 53 | * We have to check chip version in run time. |
| 54 | */ |
| 55 | switch (k) { |
| 56 | /* MPC866P/MPC866T/MPC859T/MPC859DSL/MPC852T */ |
| 57 | case 0x08010004: /* Rev. A.0 */ |
Christophe Leroy | ea31cb2 | 2017-07-13 15:09:58 +0200 | [diff] [blame] | 58 | printf("MPC866xxxZPnnA"); |
| 59 | break; |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 60 | case 0x08000003: /* Rev. 0.3 */ |
Christophe Leroy | ea31cb2 | 2017-07-13 15:09:58 +0200 | [diff] [blame] | 61 | printf("MPC866xxxZPnn"); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 62 | break; |
Christophe Leroy | ea31cb2 | 2017-07-13 15:09:58 +0200 | [diff] [blame] | 63 | case 0x09000000: /* 870/875/880/885 */ |
| 64 | puts("MPC885ZPnn"); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 65 | break; |
| 66 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 67 | default: |
Christophe Leroy | ea31cb2 | 2017-07-13 15:09:58 +0200 | [diff] [blame] | 68 | printf("unknown MPC86x (0x%08x)", k); |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 69 | break; |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 70 | } |
| 71 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 72 | printf(" at %s MHz: ", strmhz(buf, clock)); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 73 | |
| 74 | print_size(checkicache(), " I-Cache "); |
| 75 | print_size(checkdcache(), " D-Cache"); |
| 76 | |
| 77 | /* do we have a FEC (860T/P or 852/859/866/885)? */ |
| 78 | |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 79 | out_be32(&immap->im_cpm.cp_fec.fec_addr_low, 0x12345678); |
| 80 | if (in_be32(&immap->im_cpm.cp_fec.fec_addr_low) == 0x12345678) |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 81 | printf(" FEC present"); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 82 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 83 | putc('\n'); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 84 | |
| 85 | return 0; |
| 86 | } |
| 87 | |
| 88 | /* ------------------------------------------------------------------------- */ |
| 89 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 90 | int checkcpu(void) |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 91 | { |
| 92 | ulong clock = gd->cpu_clk; |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 93 | uint immr = get_immr(0); /* Return full IMMR contents */ |
| 94 | uint pvr = get_pvr(); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 95 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 96 | puts("CPU: "); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 97 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 98 | return check_CPU(clock, pvr, immr); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | /* ------------------------------------------------------------------------- */ |
| 102 | /* L1 i-cache */ |
| 103 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 104 | int checkicache(void) |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 105 | { |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 106 | immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR; |
| 107 | memctl8xx_t __iomem *memctl = &immap->im_memctl; |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 108 | u32 cacheon = rd_ic_cst() & IDC_ENABLED; |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 109 | /* probe in flash memoryarea */ |
| 110 | u32 k = in_be32(&memctl->memc_br0) & ~0x00007fff; |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 111 | u32 m; |
| 112 | u32 lines = -1; |
| 113 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 114 | wr_ic_cst(IDC_UNALL); |
| 115 | wr_ic_cst(IDC_INVALL); |
| 116 | wr_ic_cst(IDC_DISABLE); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 117 | __asm__ volatile ("isync"); |
| 118 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 119 | while (!((m = rd_ic_cst()) & IDC_CERR2)) { |
| 120 | wr_ic_adr(k); |
| 121 | wr_ic_cst(IDC_LDLCK); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 122 | __asm__ volatile ("isync"); |
| 123 | |
| 124 | lines++; |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 125 | k += 0x10; /* the number of bytes in a cacheline */ |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 126 | } |
| 127 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 128 | wr_ic_cst(IDC_UNALL); |
| 129 | wr_ic_cst(IDC_INVALL); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 130 | |
| 131 | if (cacheon) |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 132 | wr_ic_cst(IDC_ENABLE); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 133 | else |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 134 | wr_ic_cst(IDC_DISABLE); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 135 | |
| 136 | __asm__ volatile ("isync"); |
| 137 | |
| 138 | return lines << 4; |
| 139 | }; |
| 140 | |
| 141 | /* ------------------------------------------------------------------------- */ |
| 142 | /* L1 d-cache */ |
| 143 | /* call with cache disabled */ |
| 144 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 145 | int checkdcache(void) |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 146 | { |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 147 | immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR; |
| 148 | memctl8xx_t __iomem *memctl = &immap->im_memctl; |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 149 | u32 cacheon = rd_dc_cst() & IDC_ENABLED; |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 150 | /* probe in flash memoryarea */ |
| 151 | u32 k = in_be32(&memctl->memc_br0) & ~0x00007fff; |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 152 | u32 m; |
| 153 | u32 lines = -1; |
| 154 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 155 | wr_dc_cst(IDC_UNALL); |
| 156 | wr_dc_cst(IDC_INVALL); |
| 157 | wr_dc_cst(IDC_DISABLE); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 158 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 159 | while (!((m = rd_dc_cst()) & IDC_CERR2)) { |
| 160 | wr_dc_adr(k); |
| 161 | wr_dc_cst(IDC_LDLCK); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 162 | lines++; |
| 163 | k += 0x10; /* the number of bytes in a cacheline */ |
| 164 | } |
| 165 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 166 | wr_dc_cst(IDC_UNALL); |
| 167 | wr_dc_cst(IDC_INVALL); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 168 | |
| 169 | if (cacheon) |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 170 | wr_dc_cst(IDC_ENABLE); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 171 | else |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 172 | wr_dc_cst(IDC_DISABLE); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 173 | |
| 174 | return lines << 4; |
| 175 | }; |
| 176 | |
| 177 | /* ------------------------------------------------------------------------- */ |
| 178 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 179 | void upmconfig(uint upm, uint *table, uint size) |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 180 | { |
| 181 | uint i; |
| 182 | uint addr = 0; |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 183 | immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR; |
| 184 | memctl8xx_t __iomem *memctl = &immap->im_memctl; |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 185 | |
| 186 | for (i = 0; i < size; i++) { |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 187 | out_be32(&memctl->memc_mdr, table[i]); /* (16-15) */ |
| 188 | out_be32(&memctl->memc_mcr, addr | upm); /* (16-16) */ |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 189 | addr++; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | /* ------------------------------------------------------------------------- */ |
| 194 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 195 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 196 | { |
| 197 | ulong msr, addr; |
| 198 | |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 199 | immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR; |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 200 | |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 201 | /* Checkstop Reset enable */ |
| 202 | setbits_be32(&immap->im_clkrst.car_plprcr, PLPRCR_CSR); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 203 | |
| 204 | /* Interrupts and MMU off */ |
| 205 | __asm__ volatile ("mtspr 81, 0"); |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 206 | __asm__ volatile ("mfmsr %0" : "=r" (msr)); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 207 | |
| 208 | msr &= ~0x1030; |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 209 | __asm__ volatile ("mtmsr %0" : : "r" (msr)); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 210 | |
| 211 | /* |
| 212 | * Trying to execute the next instruction at a non-existing address |
| 213 | * should cause a machine check, resulting in reset |
| 214 | */ |
| 215 | #ifdef CONFIG_SYS_RESET_ADDRESS |
| 216 | addr = CONFIG_SYS_RESET_ADDRESS; |
| 217 | #else |
| 218 | /* |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 219 | * note: when CONFIG_SYS_MONITOR_BASE points to a RAM address, |
| 220 | * CONFIG_SYS_MONITOR_BASE - sizeof (ulong) is usually a valid address. |
| 221 | * Better pick an address known to be invalid on your system and assign |
| 222 | * it to CONFIG_SYS_RESET_ADDRESS. |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 223 | * "(ulong)-1" used to be a good choice for many systems... |
| 224 | */ |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 225 | addr = CONFIG_SYS_MONITOR_BASE - sizeof(ulong); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 226 | #endif |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 227 | ((void (*)(void)) addr)(); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 228 | return 1; |
| 229 | } |
| 230 | |
| 231 | /* ------------------------------------------------------------------------- */ |
| 232 | |
| 233 | /* |
| 234 | * Get timebase clock frequency (like cpu_clk in Hz) |
| 235 | * |
| 236 | * See sections 14.2 and 14.6 of the User's Manual |
| 237 | */ |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 238 | unsigned long get_tbclk(void) |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 239 | { |
Christophe Leroy | 5c59bdf | 2018-03-16 17:20:33 +0100 | [diff] [blame] | 240 | immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR; |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 241 | ulong oscclk, factor, pll; |
| 242 | |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 243 | if (in_be32(&immap->im_clkrst.car_sccr) & SCCR_TBS) |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 244 | return gd->cpu_clk / 16; |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 245 | |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 246 | pll = in_be32(&immap->im_clkrst.car_plprcr); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 247 | |
| 248 | #define PLPRCR_val(a) ((pll & PLPRCR_ ## a ## _MSK) >> PLPRCR_ ## a ## _SHIFT) |
| 249 | |
| 250 | /* |
| 251 | * For newer PQ1 chips (MPC866/87x/88x families), PLL multiplication |
| 252 | * factor is calculated as follows: |
| 253 | * |
| 254 | * MFN |
| 255 | * MFI + ------- |
| 256 | * MFD + 1 |
| 257 | * factor = ----------------- |
| 258 | * (PDF + 1) * 2^S |
| 259 | * |
| 260 | */ |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 261 | factor = (PLPRCR_val(MFI) + PLPRCR_val(MFN) / (PLPRCR_val(MFD) + 1)) / |
| 262 | (PLPRCR_val(PDF) + 1) / (1 << PLPRCR_val(S)); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 263 | |
| 264 | oscclk = gd->cpu_clk / factor; |
| 265 | |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 266 | if ((in_be32(&immap->im_clkrst.car_sccr) & SCCR_RTSEL) == 0 || |
| 267 | factor > 2) |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 268 | return oscclk / 4; |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 269 | |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 270 | return oscclk / 16; |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | /* ------------------------------------------------------------------------- */ |
| 274 | |
| 275 | #if defined(CONFIG_WATCHDOG) |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 276 | void watchdog_reset(void) |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 277 | { |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 278 | int re_enable = disable_interrupts(); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 279 | |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 280 | reset_8xx_watchdog((immap_t __iomem *)CONFIG_SYS_IMMR); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 281 | if (re_enable) |
Christophe Leroy | 48f896d | 2017-07-06 10:33:17 +0200 | [diff] [blame] | 282 | enable_interrupts(); |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 283 | } |
| 284 | #endif /* CONFIG_WATCHDOG */ |
| 285 | |
| 286 | #if defined(CONFIG_WATCHDOG) |
| 287 | |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 288 | void reset_8xx_watchdog(immap_t __iomem *immr) |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 289 | { |
| 290 | /* |
| 291 | * All other boards use the MPC8xx Internal Watchdog |
| 292 | */ |
Christophe Leroy | 394f9b3 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 293 | out_be16(&immr->im_siu_conf.sc_swsr, 0x556c); /* write magic1 */ |
| 294 | out_be16(&immr->im_siu_conf.sc_swsr, 0xaa39); /* write magic2 */ |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 295 | } |
| 296 | #endif /* CONFIG_WATCHDOG */ |
| 297 | |
| 298 | /* |
| 299 | * Initializes on-chip ethernet controllers. |
| 300 | * to override, implement board_eth_init() |
| 301 | */ |
| 302 | int cpu_eth_init(bd_t *bis) |
| 303 | { |
Christophe Leroy | 56ef30a | 2017-07-06 10:33:23 +0200 | [diff] [blame] | 304 | #if defined(CONFIG_MPC8XX_FEC) |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 305 | fec_initialize(bis); |
| 306 | #endif |
| 307 | return 0; |
| 308 | } |