wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 1 | /* |
Detlev Zundel | a21fb98 | 2010-01-20 14:28:48 +0100 | [diff] [blame] | 2 | * (C) Copyright 2000-2010 |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 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 <common.h> |
| 25 | #include <mpc5xxx.h> |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 26 | #include <asm/io.h> |
Detlev Zundel | a21fb98 | 2010-01-20 14:28:48 +0100 | [diff] [blame] | 27 | #include <watchdog.h> |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 28 | |
Wolfgang Denk | d87080b | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 29 | DECLARE_GLOBAL_DATA_PTR; |
| 30 | |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 31 | /* |
| 32 | * Breath some life into the CPU... |
| 33 | * |
| 34 | * Set up the memory map, |
| 35 | * initialize a bunch of registers. |
| 36 | */ |
| 37 | void cpu_init_f (void) |
| 38 | { |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 39 | volatile struct mpc5xxx_mmap_ctl *mm = |
| 40 | (struct mpc5xxx_mmap_ctl *) CONFIG_SYS_MBAR; |
| 41 | volatile struct mpc5xxx_lpb *lpb = |
| 42 | (struct mpc5xxx_lpb *) MPC5XXX_LPB; |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 43 | volatile struct mpc5xxx_gpio *gpio = |
| 44 | (struct mpc5xxx_gpio *) MPC5XXX_GPIO; |
| 45 | volatile struct mpc5xxx_xlb *xlb = |
| 46 | (struct mpc5xxx_xlb *) MPC5XXX_XLBARB; |
Wolfgang Denk | 9461a93 | 2010-01-31 22:03:15 +0100 | [diff] [blame] | 47 | #if defined(CONFIG_SYS_IPBCLK_EQUALS_XLBCLK) |
| 48 | volatile struct mpc5xxx_cdm *cdm = |
| 49 | (struct mpc5xxx_cdm *) MPC5XXX_CDM; |
| 50 | #endif /* CONFIG_SYS_IPBCLK_EQUALS_XLBCLK */ |
Wolfgang Denk | 13d8bfe | 2010-01-31 21:58:48 +0100 | [diff] [blame] | 51 | #if defined(CONFIG_WATCHDOG) |
Detlev Zundel | a21fb98 | 2010-01-20 14:28:48 +0100 | [diff] [blame] | 52 | volatile struct mpc5xxx_gpt *gpt0 = |
| 53 | (struct mpc5xxx_gpt *) MPC5XXX_GPT; |
Wolfgang Denk | 13d8bfe | 2010-01-31 21:58:48 +0100 | [diff] [blame] | 54 | #endif /* CONFIG_WATCHDOG */ |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 55 | unsigned long addecr = (1 << 25); /* Boot_CS */ |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 56 | /* Pointer is writable since we allocated a register for it */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 57 | gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 58 | |
| 59 | /* Clear initial global data */ |
| 60 | memset ((void *) gd, 0, sizeof (gd_t)); |
| 61 | |
| 62 | /* |
| 63 | * Memory Controller: configure chip selects and enable them |
| 64 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 65 | #if defined(CONFIG_SYS_BOOTCS_START) && defined(CONFIG_SYS_BOOTCS_SIZE) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 66 | out_be32(&mm->boot_start, START_REG(CONFIG_SYS_BOOTCS_START)); |
| 67 | out_be32(&mm->boot_stop, STOP_REG(CONFIG_SYS_BOOTCS_START, |
| 68 | CONFIG_SYS_BOOTCS_SIZE)); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 69 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 70 | #if defined(CONFIG_SYS_BOOTCS_CFG) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 71 | out_be32(&lpb->cs0_cfg, CONFIG_SYS_BOOTCS_CFG); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 72 | #endif |
| 73 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 74 | #if defined(CONFIG_SYS_CS0_START) && defined(CONFIG_SYS_CS0_SIZE) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 75 | out_be32(&mm->cs0_start, START_REG(CONFIG_SYS_CS0_START)); |
| 76 | out_be32(&mm->cs0_stop, STOP_REG(CONFIG_SYS_CS0_START, |
| 77 | CONFIG_SYS_CS0_SIZE)); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 78 | /* CS0 and BOOT_CS cannot be enabled at once. */ |
| 79 | /* addecr |= (1 << 16); */ |
| 80 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 81 | #if defined(CONFIG_SYS_CS0_CFG) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 82 | out_be32(&lpb->cs0_cfg, CONFIG_SYS_CS0_CFG); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 83 | #endif |
| 84 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 85 | #if defined(CONFIG_SYS_CS1_START) && defined(CONFIG_SYS_CS1_SIZE) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 86 | out_be32(&mm->cs1_start, START_REG(CONFIG_SYS_CS1_START)); |
| 87 | out_be32(&mm->cs1_stop, STOP_REG(CONFIG_SYS_CS1_START, |
| 88 | CONFIG_SYS_CS1_SIZE)); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 89 | addecr |= (1 << 17); |
| 90 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 91 | #if defined(CONFIG_SYS_CS1_CFG) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 92 | out_be32(&lpb->cs1_cfg, CONFIG_SYS_CS1_CFG); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 93 | #endif |
| 94 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 95 | #if defined(CONFIG_SYS_CS2_START) && defined(CONFIG_SYS_CS2_SIZE) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 96 | out_be32(&mm->cs2_start, START_REG(CONFIG_SYS_CS2_START)); |
| 97 | out_be32(&mm->cs2_stop, STOP_REG(CONFIG_SYS_CS2_START, |
| 98 | CONFIG_SYS_CS2_SIZE)); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 99 | addecr |= (1 << 18); |
| 100 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 101 | #if defined(CONFIG_SYS_CS2_CFG) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 102 | out_be32(&lpb->cs2_cfg, CONFIG_SYS_CS2_CFG); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 103 | #endif |
| 104 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 105 | #if defined(CONFIG_SYS_CS3_START) && defined(CONFIG_SYS_CS3_SIZE) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 106 | out_be32(&mm->cs3_start, START_REG(CONFIG_SYS_CS3_START)); |
| 107 | out_be32(&mm->cs3_stop, STOP_REG(CONFIG_SYS_CS3_START, |
| 108 | CONFIG_SYS_CS3_SIZE)); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 109 | addecr |= (1 << 19); |
| 110 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 111 | #if defined(CONFIG_SYS_CS3_CFG) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 112 | out_be32(&lpb->cs3_cfg, CONFIG_SYS_CS3_CFG); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 113 | #endif |
| 114 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 115 | #if defined(CONFIG_SYS_CS4_START) && defined(CONFIG_SYS_CS4_SIZE) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 116 | out_be32(&mm->cs4_start, START_REG(CONFIG_SYS_CS4_START)); |
| 117 | out_be32(&mm->cs4_stop, STOP_REG(CONFIG_SYS_CS4_START, |
| 118 | CONFIG_SYS_CS4_SIZE)); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 119 | addecr |= (1 << 20); |
| 120 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 121 | #if defined(CONFIG_SYS_CS4_CFG) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 122 | out_be32(&lpb->cs4_cfg, CONFIG_SYS_CS4_CFG); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 123 | #endif |
| 124 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 125 | #if defined(CONFIG_SYS_CS5_START) && defined(CONFIG_SYS_CS5_SIZE) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 126 | out_be32(&mm->cs5_start, START_REG(CONFIG_SYS_CS5_START)); |
| 127 | out_be32(&mm->cs5_stop, STOP_REG(CONFIG_SYS_CS5_START, |
| 128 | CONFIG_SYS_CS5_SIZE)); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 129 | addecr |= (1 << 21); |
| 130 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 131 | #if defined(CONFIG_SYS_CS5_CFG) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 132 | out_be32(&lpb->cs5_cfg, CONFIG_SYS_CS5_CFG); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 133 | #endif |
| 134 | |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 135 | addecr |= 1; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 136 | #if defined(CONFIG_SYS_CS6_START) && defined(CONFIG_SYS_CS6_SIZE) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 137 | out_be32(&mm->cs6_start, START_REG(CONFIG_SYS_CS6_START)); |
| 138 | out_be32(&mm->cs6_stop, STOP_REG(CONFIG_SYS_CS6_START, |
| 139 | CONFIG_SYS_CS6_SIZE)); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 140 | addecr |= (1 << 26); |
| 141 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 142 | #if defined(CONFIG_SYS_CS6_CFG) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 143 | out_be32(&lpb->cs6_cfg, CONFIG_SYS_CS6_CFG); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 144 | #endif |
| 145 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 146 | #if defined(CONFIG_SYS_CS7_START) && defined(CONFIG_SYS_CS7_SIZE) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 147 | out_be32(&mm->cs7_start, START_REG(CONFIG_SYS_CS7_START)); |
| 148 | out_be32(&mm->cs7_stop, STOP_REG(CONFIG_SYS_CS7_START, |
| 149 | CONFIG_SYS_CS7_SIZE)); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 150 | addecr |= (1 << 27); |
| 151 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 152 | #if defined(CONFIG_SYS_CS7_CFG) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 153 | out_be32(&lpb->cs7_cfg, CONFIG_SYS_CS7_CFG); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 154 | #endif |
| 155 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 156 | #if defined(CONFIG_SYS_CS_BURST) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 157 | out_be32(&lpb->cs_burst, CONFIG_SYS_CS_BURST); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 158 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 159 | #if defined(CONFIG_SYS_CS_DEADCYCLE) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 160 | out_be32(&lpb->cs_deadcycle, CONFIG_SYS_CS_DEADCYCLE); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 161 | #endif |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 162 | |
| 163 | /* Enable chip selects */ |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 164 | out_be32(&mm->ipbi_ws_ctrl, addecr); |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 165 | out_be32(&lpb->cs_ctrl, (1 << 24)); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 166 | |
| 167 | /* Setup pin multiplexing */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 168 | #if defined(CONFIG_SYS_GPS_PORT_CONFIG) |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 169 | out_be32(&gpio->port_config, CONFIG_SYS_GPS_PORT_CONFIG); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 170 | #endif |
wdenk | 96dd9af | 2003-07-31 22:56:30 +0000 | [diff] [blame] | 171 | |
Anatolij Gustschin | d7903ae | 2012-08-12 23:38:10 +0000 | [diff] [blame] | 172 | /* Setup gpios */ |
| 173 | #if defined(CONFIG_SYS_GPIO_DATADIR) |
| 174 | out_be32(&gpio->simple_ddr, CONFIG_SYS_GPIO_DATADIR); |
| 175 | #endif |
| 176 | #if defined(CONFIG_SYS_GPIO_OPENDRAIN) |
| 177 | out_be32(&gpio->simple_ode, CONFIG_SYS_GPIO_OPENDRAIN); |
| 178 | #endif |
| 179 | #if defined(CONFIG_SYS_GPIO_DATAVALUE) |
| 180 | out_be32(&gpio->simple_dvo, CONFIG_SYS_GPIO_DATAVALUE); |
| 181 | #endif |
| 182 | #if defined(CONFIG_SYS_GPIO_ENABLE) |
| 183 | out_be32(&gpio->simple_gpioe, CONFIG_SYS_GPIO_ENABLE); |
| 184 | #endif |
| 185 | |
wdenk | 96dd9af | 2003-07-31 22:56:30 +0000 | [diff] [blame] | 186 | /* enable timebase */ |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 187 | setbits_be32(&xlb->config, (1 << 13)); |
wdenk | 7152b1d | 2003-09-05 23:19:14 +0000 | [diff] [blame] | 188 | |
Wolfgang Denk | 8419c01 | 2006-04-18 11:05:03 +0200 | [diff] [blame] | 189 | /* Enable snooping for RAM */ |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 190 | setbits_be32(&xlb->config, (1 << 15)); |
| 191 | out_be32(&xlb->snoop_window, CONFIG_SYS_SDRAM_BASE | 0x1d); |
Wolfgang Denk | 8419c01 | 2006-04-18 11:05:03 +0200 | [diff] [blame] | 192 | |
Detlev Zundel | fd428c0 | 2010-03-12 10:01:12 +0100 | [diff] [blame] | 193 | #if defined(CONFIG_SYS_IPBCLK_EQUALS_XLBCLK) |
wdenk | 7152b1d | 2003-09-05 23:19:14 +0000 | [diff] [blame] | 194 | /* Motorola reports IPB should better run at 133 MHz. */ |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 195 | setbits_be32(&mm->ipbi_ws_ctrl, 1); |
wdenk | 7152b1d | 2003-09-05 23:19:14 +0000 | [diff] [blame] | 196 | /* pci_clk_sel = 0x02, ipb_clk_sel = 0x00; */ |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 197 | addecr = in_be32(&cdm->cfg); |
wdenk | 7152b1d | 2003-09-05 23:19:14 +0000 | [diff] [blame] | 198 | addecr &= ~0x103; |
Detlev Zundel | fd428c0 | 2010-03-12 10:01:12 +0100 | [diff] [blame] | 199 | # if defined(CONFIG_SYS_PCICLK_EQUALS_IPBCLK_DIV2) |
wdenk | 56523f1 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 200 | /* pci_clk_sel = 0x01 -> IPB_CLK/2 */ |
| 201 | addecr |= 0x01; |
Detlev Zundel | fd428c0 | 2010-03-12 10:01:12 +0100 | [diff] [blame] | 202 | # else |
wdenk | 56523f1 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 203 | /* pci_clk_sel = 0x02 -> XLB_CLK/4 = IPB_CLK/4 */ |
wdenk | 7152b1d | 2003-09-05 23:19:14 +0000 | [diff] [blame] | 204 | addecr |= 0x02; |
Detlev Zundel | fd428c0 | 2010-03-12 10:01:12 +0100 | [diff] [blame] | 205 | # endif /* CONFIG_SYS_PCICLK_EQUALS_IPBCLK_DIV2 */ |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 206 | out_be32(&cdm->cfg, addecr); |
Detlev Zundel | fd428c0 | 2010-03-12 10:01:12 +0100 | [diff] [blame] | 207 | #endif /* CONFIG_SYS_IPBCLK_EQUALS_XLBCLK */ |
wdenk | 4aeb251 | 2003-09-16 17:06:05 +0000 | [diff] [blame] | 208 | /* Configure the XLB Arbiter */ |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 209 | out_be32(&xlb->master_pri_enable, 0xff); |
| 210 | out_be32(&xlb->master_priority, 0x11111111); |
wdenk | e1599e8 | 2004-10-10 23:27:33 +0000 | [diff] [blame] | 211 | |
Detlev Zundel | fd428c0 | 2010-03-12 10:01:12 +0100 | [diff] [blame] | 212 | #if defined(CONFIG_SYS_XLB_PIPELINING) |
wdenk | e1599e8 | 2004-10-10 23:27:33 +0000 | [diff] [blame] | 213 | /* Enable piplining */ |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 214 | clrbits_be32(&xlb->config, (1 << 31)); |
Detlev Zundel | fd428c0 | 2010-03-12 10:01:12 +0100 | [diff] [blame] | 215 | #endif |
Detlev Zundel | a21fb98 | 2010-01-20 14:28:48 +0100 | [diff] [blame] | 216 | |
| 217 | #if defined(CONFIG_WATCHDOG) |
| 218 | /* Charge the watchdog timer - prescaler = 64k, count = 64k*/ |
| 219 | out_be32(&gpt0->cir, 0x0000ffff); |
| 220 | out_be32(&gpt0->emsr, 0x9004); /* wden|ce|timer_ms */ |
| 221 | |
| 222 | reset_5xxx_watchdog(); |
| 223 | #endif /* CONFIG_WATCHDOG */ |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | /* |
| 227 | * initialize higher level parts of CPU like time base and timers |
| 228 | */ |
| 229 | int cpu_init_r (void) |
| 230 | { |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 231 | volatile struct mpc5xxx_intr *intr = |
| 232 | (struct mpc5xxx_intr *) MPC5XXX_ICTL; |
| 233 | |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 234 | /* mask all interrupts */ |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 235 | out_be32(&intr->per_mask, 0xffffff00); |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 236 | setbits_be32(&intr->main_mask, 0x0001ffff); |
| 237 | clrbits_be32(&intr->ctrl, 0x00000f00); |
wdenk | 4aeb251 | 2003-09-16 17:06:05 +0000 | [diff] [blame] | 238 | /* route critical ints to normal ints */ |
Detlev Zundel | 0f597bc | 2009-12-18 17:35:57 +0100 | [diff] [blame] | 239 | setbits_be32(&intr->ctrl, 0x00000001); |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 240 | |
Jon Loeliger | 4431283 | 2007-07-09 19:06:00 -0500 | [diff] [blame] | 241 | #if defined(CONFIG_CMD_NET) && defined(CONFIG_MPC5xxx_FEC) |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 242 | /* load FEC microcode */ |
| 243 | loadtask(0, 2); |
| 244 | #endif |
| 245 | |
| 246 | return (0); |
| 247 | } |