blob: f4a387266708e931b4723c31339f0a53b0ddf770 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
wdenke65527f2004-02-12 00:47:09 +00002/*
3 * (C) Copyright 2003
4 * Josef Baumgartner <josef.baumgartner@telex.de>
5 *
Heiko Schocherac1956e2006-04-20 08:42:42 +02006 * MCF5282 additionals
7 * (C) Copyright 2005
8 * BuS Elektronik GmbH & Co. KG <esw@bus-elektronik.de>
Michael Durranta4991f22010-01-20 19:33:02 -06009 * (c) Copyright 2010
10 * Arcturus Networks Inc. <www.arcturusnetworks.com>
Heiko Schocherac1956e2006-04-20 08:42:42 +020011 *
Alison Wang95bed1f2012-03-26 21:49:04 +000012 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
TsiChungLiew34674692007-08-16 13:20:50 -050013 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
14 * Hayden Fraser (Hayden.Fraser@freescale.com)
15 *
Matthew Fettke761e2e92008-02-04 15:38:20 -060016 * MCF5275 additions
17 * Copyright (C) 2008 Arthur Shipkowski (art@videon-central.com)
wdenke65527f2004-02-12 00:47:09 +000018 */
19
20#include <common.h>
21#include <watchdog.h>
TsiChungLiew8cd73be2007-08-15 19:21:21 -050022#include <asm/immap.h>
Alison Wang95bed1f2012-03-26 21:49:04 +000023#include <asm/io.h>
stroese53395a22004-12-16 18:09:49 +000024
TsiChung Liew69b17572008-10-21 13:47:54 +000025#if defined(CONFIG_CMD_NET)
26#include <config.h>
27#include <net.h>
28#include <asm/fec.h>
29#endif
30
TsiChung Liew7f1a0462008-10-21 10:03:07 +000031#ifndef CONFIG_M5272
32/* Only 5272 Flexbus chipselect is different from the rest */
33void init_fbcs(void)
34{
Alison Wang95bed1f2012-03-26 21:49:04 +000035 fbcs_t *fbcs = (fbcs_t *) (MMAP_FBCS);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000036
37#if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) \
38 && defined(CONFIG_SYS_CS0_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000039 out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE);
40 out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL);
41 out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000042#else
43#warning "Chip Select 0 are not initialized/used"
44#endif
45#if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) \
46 && defined(CONFIG_SYS_CS1_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000047 out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE);
48 out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL);
49 out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000050#endif
51#if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) \
52 && defined(CONFIG_SYS_CS2_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000053 out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE);
54 out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL);
55 out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000056#endif
57#if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) \
58 && defined(CONFIG_SYS_CS3_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000059 out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE);
60 out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL);
61 out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000062#endif
63#if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) \
64 && defined(CONFIG_SYS_CS4_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000065 out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE);
66 out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL);
67 out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000068#endif
69#if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) \
70 && defined(CONFIG_SYS_CS5_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000071 out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE);
72 out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL);
73 out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000074#endif
75#if (defined(CONFIG_SYS_CS6_BASE) && defined(CONFIG_SYS_CS6_MASK) \
76 && defined(CONFIG_SYS_CS6_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000077 out_be32(&fbcs->csar6, CONFIG_SYS_CS6_BASE);
78 out_be32(&fbcs->cscr6, CONFIG_SYS_CS6_CTRL);
79 out_be32(&fbcs->csmr6, CONFIG_SYS_CS6_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000080#endif
81#if (defined(CONFIG_SYS_CS7_BASE) && defined(CONFIG_SYS_CS7_MASK) \
82 && defined(CONFIG_SYS_CS7_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000083 out_be32(&fbcs->csar7, CONFIG_SYS_CS7_BASE);
84 out_be32(&fbcs->cscr7, CONFIG_SYS_CS7_CTRL);
85 out_be32(&fbcs->csmr7, CONFIG_SYS_CS7_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000086#endif
87}
88#endif
89
TsiChung Liewb354aef2009-06-12 11:29:00 +000090#if defined(CONFIG_M5208)
91void cpu_init_f(void)
92{
Alison Wang95bed1f2012-03-26 21:49:04 +000093 scm1_t *scm1 = (scm1_t *) MMAP_SCM1;
TsiChung Liewb354aef2009-06-12 11:29:00 +000094
95#ifndef CONFIG_WATCHDOG
Alison Wang95bed1f2012-03-26 21:49:04 +000096 wdog_t *wdg = (wdog_t *) MMAP_WDOG;
TsiChung Liewb354aef2009-06-12 11:29:00 +000097
98 /* Disable the watchdog if we aren't using it */
Alison Wang95bed1f2012-03-26 21:49:04 +000099 out_be16(&wdg->cr, 0);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000100#endif
101
Alison Wang95bed1f2012-03-26 21:49:04 +0000102 out_be32(&scm1->mpr, 0x77777777);
103 out_be32(&scm1->pacra, 0);
104 out_be32(&scm1->pacrb, 0);
105 out_be32(&scm1->pacrc, 0);
106 out_be32(&scm1->pacrd, 0);
107 out_be32(&scm1->pacre, 0);
108 out_be32(&scm1->pacrf, 0);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000109
110 /* FlexBus Chipselect */
111 init_fbcs();
112
113 icache_enable();
114}
115
116/* initialize higher level parts of CPU like timers */
117int cpu_init_r(void)
118{
119 return (0);
120}
121
TsiChung Liewf9556a72010-03-09 19:17:52 -0600122void uart_port_conf(int port)
TsiChung Liewb354aef2009-06-12 11:29:00 +0000123{
Alison Wang95bed1f2012-03-26 21:49:04 +0000124 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liewb354aef2009-06-12 11:29:00 +0000125
126 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600127 switch (port) {
TsiChung Liewb354aef2009-06-12 11:29:00 +0000128 case 0:
Alison Wang95bed1f2012-03-26 21:49:04 +0000129 clrbits_be16(&gpio->par_uart, ~GPIO_PAR_UART0_UNMASK);
130 setbits_be16(&gpio->par_uart, GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000131 break;
132 case 1:
Alison Wang95bed1f2012-03-26 21:49:04 +0000133 clrbits_be16(&gpio->par_uart, ~GPIO_PAR_UART0_UNMASK);
134 setbits_be16(&gpio->par_uart, GPIO_PAR_UART_U1TXD | GPIO_PAR_UART_U1RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000135 break;
136 case 2:
137#ifdef CONFIG_SYS_UART2_PRI_GPIO
Alison Wang95bed1f2012-03-26 21:49:04 +0000138 clrbits_8(&gpio->par_timer,
139 ~(GPIO_PAR_TMR_TIN0_UNMASK | GPIO_PAR_TMR_TIN1_UNMASK));
140 setbits_8(&gpio->par_timer,
141 GPIO_PAR_TMR_TIN0_U2TXD | GPIO_PAR_TMR_TIN1_U2RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000142#endif
143#ifdef CONFIG_SYS_UART2_ALT1_GPIO
Alison Wang95bed1f2012-03-26 21:49:04 +0000144 clrbits_8(&gpio->par_feci2c,
145 ~(GPIO_PAR_FECI2C_MDC_UNMASK | GPIO_PAR_FECI2C_MDIO_UNMASK));
146 setbits_8(&gpio->par_feci2c,
147 GPIO_PAR_FECI2C_MDC_U2TXD | GPIO_PAR_FECI2C_MDIO_U2RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000148#endif
149#ifdef CONFIG_SYS_UART2_ALT1_GPIO
Alison Wang95bed1f2012-03-26 21:49:04 +0000150 clrbits_8(&gpio->par_feci2c,
151 ~(GPIO_PAR_FECI2C_SDA_UNMASK | GPIO_PAR_FECI2C_SCL_UNMASK));
152 setbits_8(&gpio->par_feci2c,
153 GPIO_PAR_FECI2C_SDA_U2TXD | GPIO_PAR_FECI2C_SCL_U2RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000154#endif
155 break;
156 }
157}
158
159#if defined(CONFIG_CMD_NET)
160int fecpin_setclear(struct eth_device *dev, int setclear)
161{
Alison Wang95bed1f2012-03-26 21:49:04 +0000162 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liewb354aef2009-06-12 11:29:00 +0000163
164 if (setclear) {
Alison Wang95bed1f2012-03-26 21:49:04 +0000165 setbits_8(&gpio->par_fec,
166 GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC);
167 setbits_8(&gpio->par_feci2c,
168 GPIO_PAR_FECI2C_MDC_MDC | GPIO_PAR_FECI2C_MDIO_MDIO);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000169 } else {
Alison Wang95bed1f2012-03-26 21:49:04 +0000170 clrbits_8(&gpio->par_fec,
171 ~(GPIO_PAR_FEC_7W_UNMASK & GPIO_PAR_FEC_MII_UNMASK));
172 clrbits_8(&gpio->par_feci2c, ~GPIO_PAR_FECI2C_RMII_UNMASK);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000173 }
174 return 0;
175}
176#endif /* CONFIG_CMD_NET */
177#endif /* CONFIG_M5208 */
178
TsiChungLiew34674692007-08-16 13:20:50 -0500179#if defined(CONFIG_M5253)
180/*
181 * Breath some life into the CPU...
182 *
183 * Set up the memory map,
184 * initialize a bunch of registers,
185 * initialize the UPM's
186 */
187void cpu_init_f(void)
188{
189 mbar_writeByte(MCFSIM_MPARK, 0x40); /* 5249 Internal Core takes priority over DMA */
190 mbar_writeByte(MCFSIM_SYPCR, 0x00);
191 mbar_writeByte(MCFSIM_SWIVR, 0x0f);
192 mbar_writeByte(MCFSIM_SWSR, 0x00);
193 mbar_writeByte(MCFSIM_SWDICR, 0x00);
194 mbar_writeByte(MCFSIM_TIMER1ICR, 0x00);
195 mbar_writeByte(MCFSIM_TIMER2ICR, 0x88);
196 mbar_writeByte(MCFSIM_I2CICR, 0x00);
197 mbar_writeByte(MCFSIM_UART1ICR, 0x00);
198 mbar_writeByte(MCFSIM_UART2ICR, 0x00);
199 mbar_writeByte(MCFSIM_ICR6, 0x00);
200 mbar_writeByte(MCFSIM_ICR7, 0x00);
201 mbar_writeByte(MCFSIM_ICR8, 0x00);
202 mbar_writeByte(MCFSIM_ICR9, 0x00);
203 mbar_writeByte(MCFSIM_QSPIICR, 0x00);
204
205 mbar2_writeLong(MCFSIM_GPIO_INT_EN, 0x00000080);
206 mbar2_writeByte(MCFSIM_INTBASE, 0x40); /* Base interrupts at 64 */
207 mbar2_writeByte(MCFSIM_SPURVEC, 0x00);
208
Wolfgang Denk55334c72008-12-16 01:02:17 +0100209 /*mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020); */ /* Enable a 1 cycle pre-drive cycle on CS1 */
TsiChungLiew34674692007-08-16 13:20:50 -0500210
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000211 /* FlexBus Chipselect */
212 init_fbcs();
TsiChungLiew34674692007-08-16 13:20:50 -0500213
Heiko Schocherf2850742012-10-24 13:48:22 +0200214#ifdef CONFIG_SYS_I2C_FSL
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000215 CONFIG_SYS_I2C_PINMUX_REG =
216 CONFIG_SYS_I2C_PINMUX_REG & CONFIG_SYS_I2C_PINMUX_CLR;
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200217 CONFIG_SYS_I2C_PINMUX_REG |= CONFIG_SYS_I2C_PINMUX_SET;
218#ifdef CONFIG_SYS_I2C2_OFFSET
219 CONFIG_SYS_I2C2_PINMUX_REG &= CONFIG_SYS_I2C2_PINMUX_CLR;
220 CONFIG_SYS_I2C2_PINMUX_REG |= CONFIG_SYS_I2C2_PINMUX_SET;
TsiChung Liew0c1e3252008-08-19 03:01:19 +0600221#endif
222#endif
223
TsiChungLiew34674692007-08-16 13:20:50 -0500224 /* enable instruction cache now */
225 icache_enable();
226}
227
228/*initialize higher level parts of CPU like timers */
229int cpu_init_r(void)
230{
231 return (0);
232}
233
TsiChung Liewf9556a72010-03-09 19:17:52 -0600234void uart_port_conf(int port)
TsiChungLiew34674692007-08-16 13:20:50 -0500235{
Alison Wang95bed1f2012-03-26 21:49:04 +0000236 u32 *par = (u32 *) MMAP_PAR;
TsiChung Liewf9556a72010-03-09 19:17:52 -0600237
TsiChungLiew34674692007-08-16 13:20:50 -0500238 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600239 switch (port) {
TsiChungLiew34674692007-08-16 13:20:50 -0500240 case 1:
Alison Wang95bed1f2012-03-26 21:49:04 +0000241 clrbits_be32(par, 0x00180000);
242 setbits_be32(par, 0x00180000);
TsiChungLiew34674692007-08-16 13:20:50 -0500243 break;
244 case 2:
Alison Wang95bed1f2012-03-26 21:49:04 +0000245 clrbits_be32(par, 0x00000003);
246 clrbits_be32(par, 0xFFFFFFFC);
TsiChungLiew34674692007-08-16 13:20:50 -0500247 break;
248 }
249}
250#endif /* #if defined(CONFIG_M5253) */
251
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500252#if defined(CONFIG_M5271)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500253void cpu_init_f(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500254{
255#ifndef CONFIG_WATCHDOG
256 /* Disable the watchdog if we aren't using it */
257 mbar_writeShort(MCF_WTM_WCR, 0);
258#endif
259
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000260 /* FlexBus Chipselect */
261 init_fbcs();
262
Richard Retanubunfbb55212009-01-29 14:36:06 -0500263#ifdef CONFIG_SYS_MCF_SYNCR
264 /* Set clockspeed according to board header file */
265 mbar_writeLong(MCF_FMPLL_SYNCR, CONFIG_SYS_MCF_SYNCR);
266#else
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500267 /* Set clockspeed to 100MHz */
Richard Retanubunfbb55212009-01-29 14:36:06 -0500268 mbar_writeLong(MCF_FMPLL_SYNCR,
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500269 MCF_FMPLL_SYNCR_MFD(0) | MCF_FMPLL_SYNCR_RFD(0));
Richard Retanubunfbb55212009-01-29 14:36:06 -0500270#endif
Mike Frysinger9b728282011-10-15 10:10:42 +0000271 while (!(mbar_readByte(MCF_FMPLL_SYNSR) & MCF_FMPLL_SYNSR_LOCK)) ;
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500272}
273
274/*
275 * initialize higher level parts of CPU like timers
276 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500277int cpu_init_r(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500278{
279 return (0);
280}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500281
TsiChung Liewf9556a72010-03-09 19:17:52 -0600282void uart_port_conf(int port)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500283{
TsiChung Liewf9556a72010-03-09 19:17:52 -0600284 u16 temp;
285
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500286 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600287 switch (port) {
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500288 case 0:
TsiChung Liewf9556a72010-03-09 19:17:52 -0600289 temp = mbar_readShort(MCF_GPIO_PAR_UART) & 0xFFF3;
290 temp |= (MCF_GPIO_PAR_UART_U0TXD | MCF_GPIO_PAR_UART_U0RXD);
291 mbar_writeShort(MCF_GPIO_PAR_UART, temp);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500292 break;
293 case 1:
TsiChung Liewf9556a72010-03-09 19:17:52 -0600294 temp = mbar_readShort(MCF_GPIO_PAR_UART) & 0xF0FF;
295 temp |= (MCF_GPIO_PAR_UART_U1RXD_UART1 | MCF_GPIO_PAR_UART_U1TXD_UART1);
296 mbar_writeShort(MCF_GPIO_PAR_UART, temp);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500297 break;
298 case 2:
TsiChung Liewf9556a72010-03-09 19:17:52 -0600299 temp = mbar_readShort(MCF_GPIO_PAR_UART) & 0xCFFF;
300 temp |= (0x3000);
301 mbar_writeShort(MCF_GPIO_PAR_UART, temp);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500302 break;
303 }
TsiChung Liew69b17572008-10-21 13:47:54 +0000304}
305
306#if defined(CONFIG_CMD_NET)
307int fecpin_setclear(struct eth_device *dev, int setclear)
308{
309 if (setclear) {
310 /* Enable Ethernet pins */
Richard Retanubun0ad94fd2009-01-23 10:47:13 -0500311 mbar_writeByte(MCF_GPIO_PAR_FECI2C,
312 (mbar_readByte(MCF_GPIO_PAR_FECI2C) | 0xF0));
TsiChung Liew69b17572008-10-21 13:47:54 +0000313 } else {
314 }
315
316 return 0;
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500317}
TsiChung Liew69b17572008-10-21 13:47:54 +0000318#endif /* CONFIG_CMD_NET */
Richard Retanubun93241382011-03-24 08:58:11 +0000319
Richard Retanubun93241382011-03-24 08:58:11 +0000320#endif /* CONFIG_M5271 */
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500321
stroese53395a22004-12-16 18:09:49 +0000322#if defined(CONFIG_M5272)
wdenke65527f2004-02-12 00:47:09 +0000323/*
324 * Breath some life into the CPU...
325 *
326 * Set up the memory map,
327 * initialize a bunch of registers,
328 * initialize the UPM's
329 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500330void cpu_init_f(void)
wdenke65527f2004-02-12 00:47:09 +0000331{
332 /* if we come from RAM we assume the CPU is
333 * already initialized.
334 */
335#ifndef CONFIG_MONITOR_IS_IN_RAM
Alison Wang95bed1f2012-03-26 21:49:04 +0000336 sysctrl_t *sysctrl = (sysctrl_t *) (CONFIG_SYS_MBAR);
337 gpio_t *gpio = (gpio_t *) (MMAP_GPIO);
338 csctrl_t *csctrl = (csctrl_t *) (MMAP_FBCS);
wdenke65527f2004-02-12 00:47:09 +0000339
Alison Wang95bed1f2012-03-26 21:49:04 +0000340 out_be16(&sysctrl->sc_scr, CONFIG_SYS_SCR);
341 out_be16(&sysctrl->sc_spr, CONFIG_SYS_SPR);
wdenke65527f2004-02-12 00:47:09 +0000342
Wolfgang Denkc2c49442006-05-10 17:43:20 +0200343 /* Setup Ports: */
Alison Wang95bed1f2012-03-26 21:49:04 +0000344 out_be32(&gpio->gpio_pacnt, CONFIG_SYS_PACNT);
345 out_be16(&gpio->gpio_paddr, CONFIG_SYS_PADDR);
346 out_be16(&gpio->gpio_padat, CONFIG_SYS_PADAT);
347 out_be32(&gpio->gpio_pbcnt, CONFIG_SYS_PBCNT);
348 out_be16(&gpio->gpio_pbddr, CONFIG_SYS_PBDDR);
349 out_be16(&gpio->gpio_pbdat, CONFIG_SYS_PBDAT);
350 out_be32(&gpio->gpio_pdcnt, CONFIG_SYS_PDCNT);
wdenke65527f2004-02-12 00:47:09 +0000351
352 /* Memory Controller: */
Alison Wang95bed1f2012-03-26 21:49:04 +0000353 out_be32(&csctrl->cs_br0, CONFIG_SYS_BR0_PRELIM);
354 out_be32(&csctrl->cs_or0, CONFIG_SYS_OR0_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000355
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200356#if (defined(CONFIG_SYS_OR1_PRELIM) && defined(CONFIG_SYS_BR1_PRELIM))
Alison Wang95bed1f2012-03-26 21:49:04 +0000357 out_be32(&csctrl->cs_br1, CONFIG_SYS_BR1_PRELIM);
358 out_be32(&csctrl->cs_or1, CONFIG_SYS_OR1_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000359#endif
360
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200361#if defined(CONFIG_SYS_OR2_PRELIM) && defined(CONFIG_SYS_BR2_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000362 out_be32(&csctrl->cs_br2, CONFIG_SYS_BR2_PRELIM);
363 out_be32(&csctrl->cs_or2, CONFIG_SYS_OR2_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000364#endif
365
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200366#if defined(CONFIG_SYS_OR3_PRELIM) && defined(CONFIG_SYS_BR3_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000367 out_be32(&csctrl->cs_br3, CONFIG_SYS_BR3_PRELIM);
368 out_be32(&csctrl->cs_or3, CONFIG_SYS_OR3_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000369#endif
370
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200371#if defined(CONFIG_SYS_OR4_PRELIM) && defined(CONFIG_SYS_BR4_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000372 out_be32(&csctrl->cs_br4, CONFIG_SYS_BR4_PRELIM);
373 out_be32(&csctrl->cs_or4, CONFIG_SYS_OR4_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000374#endif
375
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200376#if defined(CONFIG_SYS_OR5_PRELIM) && defined(CONFIG_SYS_BR5_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000377 out_be32(&csctrl->cs_br5, CONFIG_SYS_BR5_PRELIM);
378 out_be32(&csctrl->cs_or5, CONFIG_SYS_OR5_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000379#endif
380
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200381#if defined(CONFIG_SYS_OR6_PRELIM) && defined(CONFIG_SYS_BR6_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000382 out_be32(&csctrl->cs_br6, CONFIG_SYS_BR6_PRELIM);
383 out_be32(&csctrl->cs_or6, CONFIG_SYS_OR6_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000384#endif
385
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200386#if defined(CONFIG_SYS_OR7_PRELIM) && defined(CONFIG_SYS_BR7_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000387 out_be32(&csctrl->cs_br7, CONFIG_SYS_BR7_PRELIM);
388 out_be32(&csctrl->cs_or7, CONFIG_SYS_OR7_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000389#endif
390
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500391#endif /* #ifndef CONFIG_MONITOR_IS_IN_RAM */
wdenke65527f2004-02-12 00:47:09 +0000392
Wolfgang Denkc2c49442006-05-10 17:43:20 +0200393 /* enable instruction cache now */
394 icache_enable();
wdenke65527f2004-02-12 00:47:09 +0000395
396}
397
398/*
399 * initialize higher level parts of CPU like timers
400 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500401int cpu_init_r(void)
wdenke65527f2004-02-12 00:47:09 +0000402{
403 return (0);
404}
wdenke65527f2004-02-12 00:47:09 +0000405
TsiChung Liewf9556a72010-03-09 19:17:52 -0600406void uart_port_conf(int port)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500407{
Alison Wang95bed1f2012-03-26 21:49:04 +0000408 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
wdenke65527f2004-02-12 00:47:09 +0000409
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500410 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600411 switch (port) {
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500412 case 0:
Alison Wang95bed1f2012-03-26 21:49:04 +0000413 clrbits_be32(&gpio->gpio_pbcnt,
414 GPIO_PBCNT_PB0MSK | GPIO_PBCNT_PB1MSK);
415 setbits_be32(&gpio->gpio_pbcnt,
416 GPIO_PBCNT_URT0_TXD | GPIO_PBCNT_URT0_RXD);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500417 break;
418 case 1:
Alison Wang95bed1f2012-03-26 21:49:04 +0000419 clrbits_be32(&gpio->gpio_pdcnt,
420 GPIO_PDCNT_PD1MSK | GPIO_PDCNT_PD4MSK);
421 setbits_be32(&gpio->gpio_pdcnt,
422 GPIO_PDCNT_URT1_RXD | GPIO_PDCNT_URT1_TXD);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500423 break;
424 }
425}
TsiChung Liew69b17572008-10-21 13:47:54 +0000426
427#if defined(CONFIG_CMD_NET)
428int fecpin_setclear(struct eth_device *dev, int setclear)
429{
Alison Wang95bed1f2012-03-26 21:49:04 +0000430 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liew69b17572008-10-21 13:47:54 +0000431
432 if (setclear) {
Alison Wang95bed1f2012-03-26 21:49:04 +0000433 setbits_be32(&gpio->gpio_pbcnt,
434 GPIO_PBCNT_E_MDC | GPIO_PBCNT_E_RXER |
435 GPIO_PBCNT_E_RXD1 | GPIO_PBCNT_E_RXD2 |
436 GPIO_PBCNT_E_RXD3 | GPIO_PBCNT_E_TXD1 |
437 GPIO_PBCNT_E_TXD2 | GPIO_PBCNT_E_TXD3);
TsiChung Liew69b17572008-10-21 13:47:54 +0000438 } else {
439 }
440 return 0;
441}
442#endif /* CONFIG_CMD_NET */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500443#endif /* #if defined(CONFIG_M5272) */
444
Matthew Fettke761e2e92008-02-04 15:38:20 -0600445#if defined(CONFIG_M5275)
446
447/*
448 * Breathe some life into the CPU...
449 *
450 * Set up the memory map,
451 * initialize a bunch of registers,
452 * initialize the UPM's
453 */
454void cpu_init_f(void)
455{
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000456 /*
457 * if we come from RAM we assume the CPU is
Matthew Fettke761e2e92008-02-04 15:38:20 -0600458 * already initialized.
459 */
460
461#ifndef CONFIG_MONITOR_IS_IN_RAM
Alison Wang95bed1f2012-03-26 21:49:04 +0000462 wdog_t *wdog_reg = (wdog_t *) (MMAP_WDOG);
463 gpio_t *gpio_reg = (gpio_t *) (MMAP_GPIO);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600464
465 /* Kill watchdog so we can initialize the PLL */
Alison Wang95bed1f2012-03-26 21:49:04 +0000466 out_be16(&wdog_reg->wcr, 0);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600467
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000468 /* FlexBus Chipselect */
469 init_fbcs();
Matthew Fettke761e2e92008-02-04 15:38:20 -0600470#endif /* #ifndef CONFIG_MONITOR_IS_IN_RAM */
471
Heiko Schocherf2850742012-10-24 13:48:22 +0200472#ifdef CONFIG_SYS_I2C_FSL
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200473 CONFIG_SYS_I2C_PINMUX_REG &= CONFIG_SYS_I2C_PINMUX_CLR;
474 CONFIG_SYS_I2C_PINMUX_REG |= CONFIG_SYS_I2C_PINMUX_SET;
Matthew Fettke761e2e92008-02-04 15:38:20 -0600475#endif
476
477 /* enable instruction cache now */
478 icache_enable();
479}
480
481/*
482 * initialize higher level parts of CPU like timers
483 */
484int cpu_init_r(void)
485{
486 return (0);
487}
488
TsiChung Liewf9556a72010-03-09 19:17:52 -0600489void uart_port_conf(int port)
Matthew Fettke761e2e92008-02-04 15:38:20 -0600490{
Alison Wang95bed1f2012-03-26 21:49:04 +0000491 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
Matthew Fettke761e2e92008-02-04 15:38:20 -0600492
493 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600494 switch (port) {
Matthew Fettke761e2e92008-02-04 15:38:20 -0600495 case 0:
Alison Wang95bed1f2012-03-26 21:49:04 +0000496 clrbits_be16(&gpio->par_uart, UART0_ENABLE_MASK);
497 setbits_be16(&gpio->par_uart, UART0_ENABLE_MASK);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600498 break;
499 case 1:
Alison Wang95bed1f2012-03-26 21:49:04 +0000500 clrbits_be16(&gpio->par_uart, UART1_ENABLE_MASK);
501 setbits_be16(&gpio->par_uart, UART1_ENABLE_MASK);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600502 break;
503 case 2:
Alison Wang95bed1f2012-03-26 21:49:04 +0000504 clrbits_be16(&gpio->par_uart, UART2_ENABLE_MASK);
505 setbits_be16(&gpio->par_uart, UART2_ENABLE_MASK);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600506 break;
507 }
508}
TsiChung Liew69b17572008-10-21 13:47:54 +0000509
510#if defined(CONFIG_CMD_NET)
511int fecpin_setclear(struct eth_device *dev, int setclear)
512{
513 struct fec_info_s *info = (struct fec_info_s *) dev->priv;
Alison Wang95bed1f2012-03-26 21:49:04 +0000514 gpio_t *gpio = (gpio_t *)MMAP_GPIO;
TsiChung Liew69b17572008-10-21 13:47:54 +0000515
516 if (setclear) {
517 /* Enable Ethernet pins */
518 if (info->iobase == CONFIG_SYS_FEC0_IOBASE) {
Alison Wang95bed1f2012-03-26 21:49:04 +0000519 setbits_be16(&gpio->par_feci2c, 0x0f00);
520 setbits_8(&gpio->par_fec0hl, 0xc0);
TsiChung Liew69b17572008-10-21 13:47:54 +0000521 } else {
Alison Wang95bed1f2012-03-26 21:49:04 +0000522 setbits_be16(&gpio->par_feci2c, 0x00a0);
523 setbits_8(&gpio->par_fec1hl, 0xc0);
TsiChung Liew69b17572008-10-21 13:47:54 +0000524 }
525 } else {
526 if (info->iobase == CONFIG_SYS_FEC0_IOBASE) {
Alison Wang95bed1f2012-03-26 21:49:04 +0000527 clrbits_be16(&gpio->par_feci2c, 0x0f00);
528 clrbits_8(&gpio->par_fec0hl, 0xc0);
TsiChung Liew69b17572008-10-21 13:47:54 +0000529 } else {
Alison Wang95bed1f2012-03-26 21:49:04 +0000530 clrbits_be16(&gpio->par_feci2c, 0x00a0);
531 clrbits_8(&gpio->par_fec1hl, 0xc0);
TsiChung Liew69b17572008-10-21 13:47:54 +0000532 }
533 }
534
535 return 0;
536}
537#endif /* CONFIG_CMD_NET */
Matthew Fettke761e2e92008-02-04 15:38:20 -0600538#endif /* #if defined(CONFIG_M5275) */
539
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500540#if defined(CONFIG_M5282)
wdenke65527f2004-02-12 00:47:09 +0000541/*
542 * Breath some life into the CPU...
543 *
544 * Set up the memory map,
545 * initialize a bunch of registers,
546 * initialize the UPM's
547 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500548void cpu_init_f(void)
wdenke65527f2004-02-12 00:47:09 +0000549{
Heiko Schocherac1956e2006-04-20 08:42:42 +0200550#ifndef CONFIG_WATCHDOG
551 /* disable watchdog if we aren't using it */
552 MCFWTM_WCR = 0;
553#endif
554
555#ifndef CONFIG_MONITOR_IS_IN_RAM
556 /* Set speed /PLL */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500557 MCFCLOCK_SYNCR =
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000558 MCFCLOCK_SYNCR_MFD(CONFIG_SYS_MFD) |
559 MCFCLOCK_SYNCR_RFD(CONFIG_SYS_RFD);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500560 while (!(MCFCLOCK_SYNSR & MCFCLOCK_SYNSR_LOCK)) ;
561
562 MCFGPIO_PBCDPAR = 0xc0;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200563
564 /* Set up the GPIO ports */
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200565#ifdef CONFIG_SYS_PEPAR
566 MCFGPIO_PEPAR = CONFIG_SYS_PEPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200567#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200568#ifdef CONFIG_SYS_PFPAR
569 MCFGPIO_PFPAR = CONFIG_SYS_PFPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200570#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200571#ifdef CONFIG_SYS_PJPAR
572 MCFGPIO_PJPAR = CONFIG_SYS_PJPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200573#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200574#ifdef CONFIG_SYS_PSDPAR
575 MCFGPIO_PSDPAR = CONFIG_SYS_PSDPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200576#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200577#ifdef CONFIG_SYS_PASPAR
578 MCFGPIO_PASPAR = CONFIG_SYS_PASPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200579#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200580#ifdef CONFIG_SYS_PEHLPAR
581 MCFGPIO_PEHLPAR = CONFIG_SYS_PEHLPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200582#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200583#ifdef CONFIG_SYS_PQSPAR
584 MCFGPIO_PQSPAR = CONFIG_SYS_PQSPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200585#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200586#ifdef CONFIG_SYS_PTCPAR
587 MCFGPIO_PTCPAR = CONFIG_SYS_PTCPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200588#endif
Michael Durranta4991f22010-01-20 19:33:02 -0600589#if defined(CONFIG_SYS_PORTTC)
590 MCFGPIO_PORTTC = CONFIG_SYS_PORTTC;
591#endif
592#if defined(CONFIG_SYS_DDRTC)
593 MCFGPIO_DDRTC = CONFIG_SYS_DDRTC;
594#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200595#ifdef CONFIG_SYS_PTDPAR
596 MCFGPIO_PTDPAR = CONFIG_SYS_PTDPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200597#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200598#ifdef CONFIG_SYS_PUAPAR
599 MCFGPIO_PUAPAR = CONFIG_SYS_PUAPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200600#endif
601
Michael Durranta4991f22010-01-20 19:33:02 -0600602#if defined(CONFIG_SYS_DDRD)
603 MCFGPIO_DDRD = CONFIG_SYS_DDRD;
604#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200605#ifdef CONFIG_SYS_DDRUA
606 MCFGPIO_DDRUA = CONFIG_SYS_DDRUA;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200607#endif
Heiko Schocherac1956e2006-04-20 08:42:42 +0200608
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000609 /* FlexBus Chipselect */
610 init_fbcs();
Heiko Schocherac1956e2006-04-20 08:42:42 +0200611
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500612#endif /* CONFIG_MONITOR_IS_IN_RAM */
wdenke65527f2004-02-12 00:47:09 +0000613
Heiko Schocherac1956e2006-04-20 08:42:42 +0200614 /* defer enabling cache until boot (see do_go) */
615 /* icache_enable(); */
wdenke65527f2004-02-12 00:47:09 +0000616}
617
618/*
619 * initialize higher level parts of CPU like timers
620 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500621int cpu_init_r(void)
wdenke65527f2004-02-12 00:47:09 +0000622{
623 return (0);
624}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500625
TsiChung Liewf9556a72010-03-09 19:17:52 -0600626void uart_port_conf(int port)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500627{
628 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600629 switch (port) {
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500630 case 0:
631 MCFGPIO_PUAPAR &= 0xFc;
632 MCFGPIO_PUAPAR |= 0x03;
633 break;
634 case 1:
635 MCFGPIO_PUAPAR &= 0xF3;
636 MCFGPIO_PUAPAR |= 0x0C;
637 break;
638 case 2:
639 MCFGPIO_PASPAR &= 0xFF0F;
640 MCFGPIO_PASPAR |= 0x00A0;
641 break;
642 }
TsiChung Liew69b17572008-10-21 13:47:54 +0000643}
644
645#if defined(CONFIG_CMD_NET)
646int fecpin_setclear(struct eth_device *dev, int setclear)
647{
648 if (setclear) {
649 MCFGPIO_PASPAR |= 0x0F00;
650 MCFGPIO_PEHLPAR = CONFIG_SYS_PEHLPAR;
651 } else {
652 MCFGPIO_PASPAR &= 0xF0FF;
653 MCFGPIO_PEHLPAR &= ~CONFIG_SYS_PEHLPAR;
654 }
655 return 0;
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500656}
TsiChung Liew69b17572008-10-21 13:47:54 +0000657#endif /* CONFIG_CMD_NET */
wdenke65527f2004-02-12 00:47:09 +0000658#endif
stroese53395a22004-12-16 18:09:49 +0000659
660#if defined(CONFIG_M5249)
661/*
662 * Breath some life into the CPU...
663 *
664 * Set up the memory map,
665 * initialize a bunch of registers,
666 * initialize the UPM's
667 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500668void cpu_init_f(void)
stroese53395a22004-12-16 18:09:49 +0000669{
stroese53395a22004-12-16 18:09:49 +0000670 /*
671 * NOTE: by setting the GPIO_FUNCTION registers, we ensure that the UART pins
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500672 * (UART0: gpio 30,27, UART1: gpio 31, 28) will be used as UART pins
673 * which is their primary function.
674 * ~Jeremy
stroese53395a22004-12-16 18:09:49 +0000675 */
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200676 mbar2_writeLong(MCFSIM_GPIO_FUNC, CONFIG_SYS_GPIO_FUNC);
677 mbar2_writeLong(MCFSIM_GPIO1_FUNC, CONFIG_SYS_GPIO1_FUNC);
678 mbar2_writeLong(MCFSIM_GPIO_EN, CONFIG_SYS_GPIO_EN);
679 mbar2_writeLong(MCFSIM_GPIO1_EN, CONFIG_SYS_GPIO1_EN);
680 mbar2_writeLong(MCFSIM_GPIO_OUT, CONFIG_SYS_GPIO_OUT);
681 mbar2_writeLong(MCFSIM_GPIO1_OUT, CONFIG_SYS_GPIO1_OUT);
stroese53395a22004-12-16 18:09:49 +0000682
683 /*
684 * dBug Compliance:
685 * You can verify these values by using dBug's 'ird'
686 * (Internal Register Display) command
687 * ~Jeremy
688 *
Wolfgang Denkc2c49442006-05-10 17:43:20 +0200689 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500690 mbar_writeByte(MCFSIM_MPARK, 0x30); /* 5249 Internal Core takes priority over DMA */
stroese53395a22004-12-16 18:09:49 +0000691 mbar_writeByte(MCFSIM_SYPCR, 0x00);
692 mbar_writeByte(MCFSIM_SWIVR, 0x0f);
693 mbar_writeByte(MCFSIM_SWSR, 0x00);
694 mbar_writeLong(MCFSIM_IMR, 0xfffffbff);
695 mbar_writeByte(MCFSIM_SWDICR, 0x00);
696 mbar_writeByte(MCFSIM_TIMER1ICR, 0x00);
697 mbar_writeByte(MCFSIM_TIMER2ICR, 0x88);
698 mbar_writeByte(MCFSIM_I2CICR, 0x00);
699 mbar_writeByte(MCFSIM_UART1ICR, 0x00);
700 mbar_writeByte(MCFSIM_UART2ICR, 0x00);
701 mbar_writeByte(MCFSIM_ICR6, 0x00);
702 mbar_writeByte(MCFSIM_ICR7, 0x00);
703 mbar_writeByte(MCFSIM_ICR8, 0x00);
704 mbar_writeByte(MCFSIM_ICR9, 0x00);
705 mbar_writeByte(MCFSIM_QSPIICR, 0x00);
706
707 mbar2_writeLong(MCFSIM_GPIO_INT_EN, 0x00000080);
Wolfgang Denkc2c49442006-05-10 17:43:20 +0200708 mbar2_writeByte(MCFSIM_INTBASE, 0x40); /* Base interrupts at 64 */
stroese53395a22004-12-16 18:09:49 +0000709 mbar2_writeByte(MCFSIM_SPURVEC, 0x00);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500710 mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020); /* Enable a 1 cycle pre-drive cycle on CS1 */
stroese53395a22004-12-16 18:09:49 +0000711
712 /* Setup interrupt priorities for gpio7 */
713 /* mbar2_writeLong(MCFSIM_INTLEV5, 0x70000000); */
714
715 /* IDE Config registers */
716 mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020);
717 mbar2_writeLong(MCFSIM_IDECONFIG2, 0x00000000);
718
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000719 /* FlexBus Chipselect */
720 init_fbcs();
stroese53395a22004-12-16 18:09:49 +0000721
722 /* enable instruction cache now */
723 icache_enable();
724}
725
726/*
727 * initialize higher level parts of CPU like timers
728 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500729int cpu_init_r(void)
stroese53395a22004-12-16 18:09:49 +0000730{
731 return (0);
732}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500733
TsiChung Liewf9556a72010-03-09 19:17:52 -0600734void uart_port_conf(int port)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500735{
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500736}
737#endif /* #if defined(CONFIG_M5249) */