blob: 7b667203723629d91dbbb2cc5e1a47c41a906b38 [file] [log] [blame]
wdenke65527f2004-02-12 00:47:09 +00001/*
2 * (C) Copyright 2003
3 * Josef Baumgartner <josef.baumgartner@telex.de>
4 *
Heiko Schocherac1956e2006-04-20 08:42:42 +02005 * MCF5282 additionals
6 * (C) Copyright 2005
7 * BuS Elektronik GmbH & Co. KG <esw@bus-elektronik.de>
Michael Durranta4991f22010-01-20 19:33:02 -06008 * (c) Copyright 2010
9 * Arcturus Networks Inc. <www.arcturusnetworks.com>
Heiko Schocherac1956e2006-04-20 08:42:42 +020010 *
Alison Wang95bed1f2012-03-26 21:49:04 +000011 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
TsiChungLiew34674692007-08-16 13:20:50 -050012 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
13 * Hayden Fraser (Hayden.Fraser@freescale.com)
14 *
Matthew Fettke761e2e92008-02-04 15:38:20 -060015 * MCF5275 additions
16 * Copyright (C) 2008 Arthur Shipkowski (art@videon-central.com)
17 *
Wolfgang Denkbd8ec7e2013-10-07 13:07:26 +020018 * SPDX-License-Identifier: GPL-2.0+
wdenke65527f2004-02-12 00:47:09 +000019 */
20
21#include <common.h>
22#include <watchdog.h>
TsiChungLiew8cd73be2007-08-15 19:21:21 -050023#include <asm/immap.h>
Alison Wang95bed1f2012-03-26 21:49:04 +000024#include <asm/io.h>
stroese53395a22004-12-16 18:09:49 +000025
TsiChung Liew69b17572008-10-21 13:47:54 +000026#if defined(CONFIG_CMD_NET)
27#include <config.h>
28#include <net.h>
29#include <asm/fec.h>
30#endif
31
TsiChung Liew7f1a0462008-10-21 10:03:07 +000032#ifndef CONFIG_M5272
33/* Only 5272 Flexbus chipselect is different from the rest */
34void init_fbcs(void)
35{
Alison Wang95bed1f2012-03-26 21:49:04 +000036 fbcs_t *fbcs = (fbcs_t *) (MMAP_FBCS);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000037
38#if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) \
39 && defined(CONFIG_SYS_CS0_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000040 out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE);
41 out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL);
42 out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000043#else
44#warning "Chip Select 0 are not initialized/used"
45#endif
46#if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) \
47 && defined(CONFIG_SYS_CS1_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000048 out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE);
49 out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL);
50 out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000051#endif
52#if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) \
53 && defined(CONFIG_SYS_CS2_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000054 out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE);
55 out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL);
56 out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000057#endif
58#if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) \
59 && defined(CONFIG_SYS_CS3_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000060 out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE);
61 out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL);
62 out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000063#endif
64#if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) \
65 && defined(CONFIG_SYS_CS4_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000066 out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE);
67 out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL);
68 out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000069#endif
70#if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) \
71 && defined(CONFIG_SYS_CS5_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000072 out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE);
73 out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL);
74 out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000075#endif
76#if (defined(CONFIG_SYS_CS6_BASE) && defined(CONFIG_SYS_CS6_MASK) \
77 && defined(CONFIG_SYS_CS6_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000078 out_be32(&fbcs->csar6, CONFIG_SYS_CS6_BASE);
79 out_be32(&fbcs->cscr6, CONFIG_SYS_CS6_CTRL);
80 out_be32(&fbcs->csmr6, CONFIG_SYS_CS6_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000081#endif
82#if (defined(CONFIG_SYS_CS7_BASE) && defined(CONFIG_SYS_CS7_MASK) \
83 && defined(CONFIG_SYS_CS7_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000084 out_be32(&fbcs->csar7, CONFIG_SYS_CS7_BASE);
85 out_be32(&fbcs->cscr7, CONFIG_SYS_CS7_CTRL);
86 out_be32(&fbcs->csmr7, CONFIG_SYS_CS7_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000087#endif
88}
89#endif
90
TsiChung Liewb354aef2009-06-12 11:29:00 +000091#if defined(CONFIG_M5208)
92void cpu_init_f(void)
93{
Alison Wang95bed1f2012-03-26 21:49:04 +000094 scm1_t *scm1 = (scm1_t *) MMAP_SCM1;
TsiChung Liewb354aef2009-06-12 11:29:00 +000095
96#ifndef CONFIG_WATCHDOG
Alison Wang95bed1f2012-03-26 21:49:04 +000097 wdog_t *wdg = (wdog_t *) MMAP_WDOG;
TsiChung Liewb354aef2009-06-12 11:29:00 +000098
99 /* Disable the watchdog if we aren't using it */
Alison Wang95bed1f2012-03-26 21:49:04 +0000100 out_be16(&wdg->cr, 0);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000101#endif
102
Alison Wang95bed1f2012-03-26 21:49:04 +0000103 out_be32(&scm1->mpr, 0x77777777);
104 out_be32(&scm1->pacra, 0);
105 out_be32(&scm1->pacrb, 0);
106 out_be32(&scm1->pacrc, 0);
107 out_be32(&scm1->pacrd, 0);
108 out_be32(&scm1->pacre, 0);
109 out_be32(&scm1->pacrf, 0);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000110
111 /* FlexBus Chipselect */
112 init_fbcs();
113
114 icache_enable();
115}
116
117/* initialize higher level parts of CPU like timers */
118int cpu_init_r(void)
119{
120 return (0);
121}
122
TsiChung Liewf9556a72010-03-09 19:17:52 -0600123void uart_port_conf(int port)
TsiChung Liewb354aef2009-06-12 11:29:00 +0000124{
Alison Wang95bed1f2012-03-26 21:49:04 +0000125 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liewb354aef2009-06-12 11:29:00 +0000126
127 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600128 switch (port) {
TsiChung Liewb354aef2009-06-12 11:29:00 +0000129 case 0:
Alison Wang95bed1f2012-03-26 21:49:04 +0000130 clrbits_be16(&gpio->par_uart, ~GPIO_PAR_UART0_UNMASK);
131 setbits_be16(&gpio->par_uart, GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000132 break;
133 case 1:
Alison Wang95bed1f2012-03-26 21:49:04 +0000134 clrbits_be16(&gpio->par_uart, ~GPIO_PAR_UART0_UNMASK);
135 setbits_be16(&gpio->par_uart, GPIO_PAR_UART_U1TXD | GPIO_PAR_UART_U1RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000136 break;
137 case 2:
138#ifdef CONFIG_SYS_UART2_PRI_GPIO
Alison Wang95bed1f2012-03-26 21:49:04 +0000139 clrbits_8(&gpio->par_timer,
140 ~(GPIO_PAR_TMR_TIN0_UNMASK | GPIO_PAR_TMR_TIN1_UNMASK));
141 setbits_8(&gpio->par_timer,
142 GPIO_PAR_TMR_TIN0_U2TXD | GPIO_PAR_TMR_TIN1_U2RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000143#endif
144#ifdef CONFIG_SYS_UART2_ALT1_GPIO
Alison Wang95bed1f2012-03-26 21:49:04 +0000145 clrbits_8(&gpio->par_feci2c,
146 ~(GPIO_PAR_FECI2C_MDC_UNMASK | GPIO_PAR_FECI2C_MDIO_UNMASK));
147 setbits_8(&gpio->par_feci2c,
148 GPIO_PAR_FECI2C_MDC_U2TXD | GPIO_PAR_FECI2C_MDIO_U2RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000149#endif
150#ifdef CONFIG_SYS_UART2_ALT1_GPIO
Alison Wang95bed1f2012-03-26 21:49:04 +0000151 clrbits_8(&gpio->par_feci2c,
152 ~(GPIO_PAR_FECI2C_SDA_UNMASK | GPIO_PAR_FECI2C_SCL_UNMASK));
153 setbits_8(&gpio->par_feci2c,
154 GPIO_PAR_FECI2C_SDA_U2TXD | GPIO_PAR_FECI2C_SCL_U2RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000155#endif
156 break;
157 }
158}
159
160#if defined(CONFIG_CMD_NET)
161int fecpin_setclear(struct eth_device *dev, int setclear)
162{
Alison Wang95bed1f2012-03-26 21:49:04 +0000163 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liewb354aef2009-06-12 11:29:00 +0000164
165 if (setclear) {
Alison Wang95bed1f2012-03-26 21:49:04 +0000166 setbits_8(&gpio->par_fec,
167 GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC);
168 setbits_8(&gpio->par_feci2c,
169 GPIO_PAR_FECI2C_MDC_MDC | GPIO_PAR_FECI2C_MDIO_MDIO);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000170 } else {
Alison Wang95bed1f2012-03-26 21:49:04 +0000171 clrbits_8(&gpio->par_fec,
172 ~(GPIO_PAR_FEC_7W_UNMASK & GPIO_PAR_FEC_MII_UNMASK));
173 clrbits_8(&gpio->par_feci2c, ~GPIO_PAR_FECI2C_RMII_UNMASK);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000174 }
175 return 0;
176}
177#endif /* CONFIG_CMD_NET */
178#endif /* CONFIG_M5208 */
179
TsiChungLiew34674692007-08-16 13:20:50 -0500180#if defined(CONFIG_M5253)
181/*
182 * Breath some life into the CPU...
183 *
184 * Set up the memory map,
185 * initialize a bunch of registers,
186 * initialize the UPM's
187 */
188void cpu_init_f(void)
189{
190 mbar_writeByte(MCFSIM_MPARK, 0x40); /* 5249 Internal Core takes priority over DMA */
191 mbar_writeByte(MCFSIM_SYPCR, 0x00);
192 mbar_writeByte(MCFSIM_SWIVR, 0x0f);
193 mbar_writeByte(MCFSIM_SWSR, 0x00);
194 mbar_writeByte(MCFSIM_SWDICR, 0x00);
195 mbar_writeByte(MCFSIM_TIMER1ICR, 0x00);
196 mbar_writeByte(MCFSIM_TIMER2ICR, 0x88);
197 mbar_writeByte(MCFSIM_I2CICR, 0x00);
198 mbar_writeByte(MCFSIM_UART1ICR, 0x00);
199 mbar_writeByte(MCFSIM_UART2ICR, 0x00);
200 mbar_writeByte(MCFSIM_ICR6, 0x00);
201 mbar_writeByte(MCFSIM_ICR7, 0x00);
202 mbar_writeByte(MCFSIM_ICR8, 0x00);
203 mbar_writeByte(MCFSIM_ICR9, 0x00);
204 mbar_writeByte(MCFSIM_QSPIICR, 0x00);
205
206 mbar2_writeLong(MCFSIM_GPIO_INT_EN, 0x00000080);
207 mbar2_writeByte(MCFSIM_INTBASE, 0x40); /* Base interrupts at 64 */
208 mbar2_writeByte(MCFSIM_SPURVEC, 0x00);
209
Wolfgang Denk55334c72008-12-16 01:02:17 +0100210 /*mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020); */ /* Enable a 1 cycle pre-drive cycle on CS1 */
TsiChungLiew34674692007-08-16 13:20:50 -0500211
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000212 /* FlexBus Chipselect */
213 init_fbcs();
TsiChungLiew34674692007-08-16 13:20:50 -0500214
Heiko Schocherf2850742012-10-24 13:48:22 +0200215#ifdef CONFIG_SYS_I2C_FSL
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000216 CONFIG_SYS_I2C_PINMUX_REG =
217 CONFIG_SYS_I2C_PINMUX_REG & CONFIG_SYS_I2C_PINMUX_CLR;
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200218 CONFIG_SYS_I2C_PINMUX_REG |= CONFIG_SYS_I2C_PINMUX_SET;
219#ifdef CONFIG_SYS_I2C2_OFFSET
220 CONFIG_SYS_I2C2_PINMUX_REG &= CONFIG_SYS_I2C2_PINMUX_CLR;
221 CONFIG_SYS_I2C2_PINMUX_REG |= CONFIG_SYS_I2C2_PINMUX_SET;
TsiChung Liew0c1e3252008-08-19 03:01:19 +0600222#endif
223#endif
224
TsiChungLiew34674692007-08-16 13:20:50 -0500225 /* enable instruction cache now */
226 icache_enable();
227}
228
229/*initialize higher level parts of CPU like timers */
230int cpu_init_r(void)
231{
232 return (0);
233}
234
TsiChung Liewf9556a72010-03-09 19:17:52 -0600235void uart_port_conf(int port)
TsiChungLiew34674692007-08-16 13:20:50 -0500236{
Alison Wang95bed1f2012-03-26 21:49:04 +0000237 u32 *par = (u32 *) MMAP_PAR;
TsiChung Liewf9556a72010-03-09 19:17:52 -0600238
TsiChungLiew34674692007-08-16 13:20:50 -0500239 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600240 switch (port) {
TsiChungLiew34674692007-08-16 13:20:50 -0500241 case 1:
Alison Wang95bed1f2012-03-26 21:49:04 +0000242 clrbits_be32(par, 0x00180000);
243 setbits_be32(par, 0x00180000);
TsiChungLiew34674692007-08-16 13:20:50 -0500244 break;
245 case 2:
Alison Wang95bed1f2012-03-26 21:49:04 +0000246 clrbits_be32(par, 0x00000003);
247 clrbits_be32(par, 0xFFFFFFFC);
TsiChungLiew34674692007-08-16 13:20:50 -0500248 break;
249 }
250}
251#endif /* #if defined(CONFIG_M5253) */
252
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500253#if defined(CONFIG_M5271)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500254void cpu_init_f(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500255{
256#ifndef CONFIG_WATCHDOG
257 /* Disable the watchdog if we aren't using it */
258 mbar_writeShort(MCF_WTM_WCR, 0);
259#endif
260
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000261 /* FlexBus Chipselect */
262 init_fbcs();
263
Richard Retanubunfbb55212009-01-29 14:36:06 -0500264#ifdef CONFIG_SYS_MCF_SYNCR
265 /* Set clockspeed according to board header file */
266 mbar_writeLong(MCF_FMPLL_SYNCR, CONFIG_SYS_MCF_SYNCR);
267#else
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500268 /* Set clockspeed to 100MHz */
Richard Retanubunfbb55212009-01-29 14:36:06 -0500269 mbar_writeLong(MCF_FMPLL_SYNCR,
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500270 MCF_FMPLL_SYNCR_MFD(0) | MCF_FMPLL_SYNCR_RFD(0));
Richard Retanubunfbb55212009-01-29 14:36:06 -0500271#endif
Mike Frysinger9b728282011-10-15 10:10:42 +0000272 while (!(mbar_readByte(MCF_FMPLL_SYNSR) & MCF_FMPLL_SYNSR_LOCK)) ;
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500273}
274
275/*
276 * initialize higher level parts of CPU like timers
277 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500278int cpu_init_r(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500279{
280 return (0);
281}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500282
TsiChung Liewf9556a72010-03-09 19:17:52 -0600283void uart_port_conf(int port)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500284{
TsiChung Liewf9556a72010-03-09 19:17:52 -0600285 u16 temp;
286
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500287 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600288 switch (port) {
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500289 case 0:
TsiChung Liewf9556a72010-03-09 19:17:52 -0600290 temp = mbar_readShort(MCF_GPIO_PAR_UART) & 0xFFF3;
291 temp |= (MCF_GPIO_PAR_UART_U0TXD | MCF_GPIO_PAR_UART_U0RXD);
292 mbar_writeShort(MCF_GPIO_PAR_UART, temp);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500293 break;
294 case 1:
TsiChung Liewf9556a72010-03-09 19:17:52 -0600295 temp = mbar_readShort(MCF_GPIO_PAR_UART) & 0xF0FF;
296 temp |= (MCF_GPIO_PAR_UART_U1RXD_UART1 | MCF_GPIO_PAR_UART_U1TXD_UART1);
297 mbar_writeShort(MCF_GPIO_PAR_UART, temp);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500298 break;
299 case 2:
TsiChung Liewf9556a72010-03-09 19:17:52 -0600300 temp = mbar_readShort(MCF_GPIO_PAR_UART) & 0xCFFF;
301 temp |= (0x3000);
302 mbar_writeShort(MCF_GPIO_PAR_UART, temp);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500303 break;
304 }
TsiChung Liew69b17572008-10-21 13:47:54 +0000305}
306
307#if defined(CONFIG_CMD_NET)
308int fecpin_setclear(struct eth_device *dev, int setclear)
309{
310 if (setclear) {
311 /* Enable Ethernet pins */
Richard Retanubun0ad94fd2009-01-23 10:47:13 -0500312 mbar_writeByte(MCF_GPIO_PAR_FECI2C,
313 (mbar_readByte(MCF_GPIO_PAR_FECI2C) | 0xF0));
TsiChung Liew69b17572008-10-21 13:47:54 +0000314 } else {
315 }
316
317 return 0;
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500318}
TsiChung Liew69b17572008-10-21 13:47:54 +0000319#endif /* CONFIG_CMD_NET */
Richard Retanubun93241382011-03-24 08:58:11 +0000320
Richard Retanubun93241382011-03-24 08:58:11 +0000321#endif /* CONFIG_M5271 */
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500322
stroese53395a22004-12-16 18:09:49 +0000323#if defined(CONFIG_M5272)
wdenke65527f2004-02-12 00:47:09 +0000324/*
325 * Breath some life into the CPU...
326 *
327 * Set up the memory map,
328 * initialize a bunch of registers,
329 * initialize the UPM's
330 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500331void cpu_init_f(void)
wdenke65527f2004-02-12 00:47:09 +0000332{
333 /* if we come from RAM we assume the CPU is
334 * already initialized.
335 */
336#ifndef CONFIG_MONITOR_IS_IN_RAM
Alison Wang95bed1f2012-03-26 21:49:04 +0000337 sysctrl_t *sysctrl = (sysctrl_t *) (CONFIG_SYS_MBAR);
338 gpio_t *gpio = (gpio_t *) (MMAP_GPIO);
339 csctrl_t *csctrl = (csctrl_t *) (MMAP_FBCS);
wdenke65527f2004-02-12 00:47:09 +0000340
Alison Wang95bed1f2012-03-26 21:49:04 +0000341 out_be16(&sysctrl->sc_scr, CONFIG_SYS_SCR);
342 out_be16(&sysctrl->sc_spr, CONFIG_SYS_SPR);
wdenke65527f2004-02-12 00:47:09 +0000343
Wolfgang Denkc2c49442006-05-10 17:43:20 +0200344 /* Setup Ports: */
Alison Wang95bed1f2012-03-26 21:49:04 +0000345 out_be32(&gpio->gpio_pacnt, CONFIG_SYS_PACNT);
346 out_be16(&gpio->gpio_paddr, CONFIG_SYS_PADDR);
347 out_be16(&gpio->gpio_padat, CONFIG_SYS_PADAT);
348 out_be32(&gpio->gpio_pbcnt, CONFIG_SYS_PBCNT);
349 out_be16(&gpio->gpio_pbddr, CONFIG_SYS_PBDDR);
350 out_be16(&gpio->gpio_pbdat, CONFIG_SYS_PBDAT);
351 out_be32(&gpio->gpio_pdcnt, CONFIG_SYS_PDCNT);
wdenke65527f2004-02-12 00:47:09 +0000352
353 /* Memory Controller: */
Alison Wang95bed1f2012-03-26 21:49:04 +0000354 out_be32(&csctrl->cs_br0, CONFIG_SYS_BR0_PRELIM);
355 out_be32(&csctrl->cs_or0, CONFIG_SYS_OR0_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000356
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200357#if (defined(CONFIG_SYS_OR1_PRELIM) && defined(CONFIG_SYS_BR1_PRELIM))
Alison Wang95bed1f2012-03-26 21:49:04 +0000358 out_be32(&csctrl->cs_br1, CONFIG_SYS_BR1_PRELIM);
359 out_be32(&csctrl->cs_or1, CONFIG_SYS_OR1_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000360#endif
361
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200362#if defined(CONFIG_SYS_OR2_PRELIM) && defined(CONFIG_SYS_BR2_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000363 out_be32(&csctrl->cs_br2, CONFIG_SYS_BR2_PRELIM);
364 out_be32(&csctrl->cs_or2, CONFIG_SYS_OR2_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000365#endif
366
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200367#if defined(CONFIG_SYS_OR3_PRELIM) && defined(CONFIG_SYS_BR3_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000368 out_be32(&csctrl->cs_br3, CONFIG_SYS_BR3_PRELIM);
369 out_be32(&csctrl->cs_or3, CONFIG_SYS_OR3_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000370#endif
371
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200372#if defined(CONFIG_SYS_OR4_PRELIM) && defined(CONFIG_SYS_BR4_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000373 out_be32(&csctrl->cs_br4, CONFIG_SYS_BR4_PRELIM);
374 out_be32(&csctrl->cs_or4, CONFIG_SYS_OR4_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000375#endif
376
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200377#if defined(CONFIG_SYS_OR5_PRELIM) && defined(CONFIG_SYS_BR5_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000378 out_be32(&csctrl->cs_br5, CONFIG_SYS_BR5_PRELIM);
379 out_be32(&csctrl->cs_or5, CONFIG_SYS_OR5_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000380#endif
381
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200382#if defined(CONFIG_SYS_OR6_PRELIM) && defined(CONFIG_SYS_BR6_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000383 out_be32(&csctrl->cs_br6, CONFIG_SYS_BR6_PRELIM);
384 out_be32(&csctrl->cs_or6, CONFIG_SYS_OR6_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000385#endif
386
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200387#if defined(CONFIG_SYS_OR7_PRELIM) && defined(CONFIG_SYS_BR7_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000388 out_be32(&csctrl->cs_br7, CONFIG_SYS_BR7_PRELIM);
389 out_be32(&csctrl->cs_or7, CONFIG_SYS_OR7_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000390#endif
391
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500392#endif /* #ifndef CONFIG_MONITOR_IS_IN_RAM */
wdenke65527f2004-02-12 00:47:09 +0000393
Wolfgang Denkc2c49442006-05-10 17:43:20 +0200394 /* enable instruction cache now */
395 icache_enable();
wdenke65527f2004-02-12 00:47:09 +0000396
397}
398
399/*
400 * initialize higher level parts of CPU like timers
401 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500402int cpu_init_r(void)
wdenke65527f2004-02-12 00:47:09 +0000403{
404 return (0);
405}
wdenke65527f2004-02-12 00:47:09 +0000406
TsiChung Liewf9556a72010-03-09 19:17:52 -0600407void uart_port_conf(int port)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500408{
Alison Wang95bed1f2012-03-26 21:49:04 +0000409 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
wdenke65527f2004-02-12 00:47:09 +0000410
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500411 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600412 switch (port) {
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500413 case 0:
Alison Wang95bed1f2012-03-26 21:49:04 +0000414 clrbits_be32(&gpio->gpio_pbcnt,
415 GPIO_PBCNT_PB0MSK | GPIO_PBCNT_PB1MSK);
416 setbits_be32(&gpio->gpio_pbcnt,
417 GPIO_PBCNT_URT0_TXD | GPIO_PBCNT_URT0_RXD);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500418 break;
419 case 1:
Alison Wang95bed1f2012-03-26 21:49:04 +0000420 clrbits_be32(&gpio->gpio_pdcnt,
421 GPIO_PDCNT_PD1MSK | GPIO_PDCNT_PD4MSK);
422 setbits_be32(&gpio->gpio_pdcnt,
423 GPIO_PDCNT_URT1_RXD | GPIO_PDCNT_URT1_TXD);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500424 break;
425 }
426}
TsiChung Liew69b17572008-10-21 13:47:54 +0000427
428#if defined(CONFIG_CMD_NET)
429int fecpin_setclear(struct eth_device *dev, int setclear)
430{
Alison Wang95bed1f2012-03-26 21:49:04 +0000431 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liew69b17572008-10-21 13:47:54 +0000432
433 if (setclear) {
Alison Wang95bed1f2012-03-26 21:49:04 +0000434 setbits_be32(&gpio->gpio_pbcnt,
435 GPIO_PBCNT_E_MDC | GPIO_PBCNT_E_RXER |
436 GPIO_PBCNT_E_RXD1 | GPIO_PBCNT_E_RXD2 |
437 GPIO_PBCNT_E_RXD3 | GPIO_PBCNT_E_TXD1 |
438 GPIO_PBCNT_E_TXD2 | GPIO_PBCNT_E_TXD3);
TsiChung Liew69b17572008-10-21 13:47:54 +0000439 } else {
440 }
441 return 0;
442}
443#endif /* CONFIG_CMD_NET */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500444#endif /* #if defined(CONFIG_M5272) */
445
Matthew Fettke761e2e92008-02-04 15:38:20 -0600446#if defined(CONFIG_M5275)
447
448/*
449 * Breathe some life into the CPU...
450 *
451 * Set up the memory map,
452 * initialize a bunch of registers,
453 * initialize the UPM's
454 */
455void cpu_init_f(void)
456{
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000457 /*
458 * if we come from RAM we assume the CPU is
Matthew Fettke761e2e92008-02-04 15:38:20 -0600459 * already initialized.
460 */
461
462#ifndef CONFIG_MONITOR_IS_IN_RAM
Alison Wang95bed1f2012-03-26 21:49:04 +0000463 wdog_t *wdog_reg = (wdog_t *) (MMAP_WDOG);
464 gpio_t *gpio_reg = (gpio_t *) (MMAP_GPIO);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600465
466 /* Kill watchdog so we can initialize the PLL */
Alison Wang95bed1f2012-03-26 21:49:04 +0000467 out_be16(&wdog_reg->wcr, 0);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600468
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000469 /* FlexBus Chipselect */
470 init_fbcs();
Matthew Fettke761e2e92008-02-04 15:38:20 -0600471#endif /* #ifndef CONFIG_MONITOR_IS_IN_RAM */
472
Heiko Schocherf2850742012-10-24 13:48:22 +0200473#ifdef CONFIG_SYS_I2C_FSL
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200474 CONFIG_SYS_I2C_PINMUX_REG &= CONFIG_SYS_I2C_PINMUX_CLR;
475 CONFIG_SYS_I2C_PINMUX_REG |= CONFIG_SYS_I2C_PINMUX_SET;
Matthew Fettke761e2e92008-02-04 15:38:20 -0600476#endif
477
478 /* enable instruction cache now */
479 icache_enable();
480}
481
482/*
483 * initialize higher level parts of CPU like timers
484 */
485int cpu_init_r(void)
486{
487 return (0);
488}
489
TsiChung Liewf9556a72010-03-09 19:17:52 -0600490void uart_port_conf(int port)
Matthew Fettke761e2e92008-02-04 15:38:20 -0600491{
Alison Wang95bed1f2012-03-26 21:49:04 +0000492 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
Matthew Fettke761e2e92008-02-04 15:38:20 -0600493
494 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600495 switch (port) {
Matthew Fettke761e2e92008-02-04 15:38:20 -0600496 case 0:
Alison Wang95bed1f2012-03-26 21:49:04 +0000497 clrbits_be16(&gpio->par_uart, UART0_ENABLE_MASK);
498 setbits_be16(&gpio->par_uart, UART0_ENABLE_MASK);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600499 break;
500 case 1:
Alison Wang95bed1f2012-03-26 21:49:04 +0000501 clrbits_be16(&gpio->par_uart, UART1_ENABLE_MASK);
502 setbits_be16(&gpio->par_uart, UART1_ENABLE_MASK);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600503 break;
504 case 2:
Alison Wang95bed1f2012-03-26 21:49:04 +0000505 clrbits_be16(&gpio->par_uart, UART2_ENABLE_MASK);
506 setbits_be16(&gpio->par_uart, UART2_ENABLE_MASK);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600507 break;
508 }
509}
TsiChung Liew69b17572008-10-21 13:47:54 +0000510
511#if defined(CONFIG_CMD_NET)
512int fecpin_setclear(struct eth_device *dev, int setclear)
513{
514 struct fec_info_s *info = (struct fec_info_s *) dev->priv;
Alison Wang95bed1f2012-03-26 21:49:04 +0000515 gpio_t *gpio = (gpio_t *)MMAP_GPIO;
TsiChung Liew69b17572008-10-21 13:47:54 +0000516
517 if (setclear) {
518 /* Enable Ethernet pins */
519 if (info->iobase == CONFIG_SYS_FEC0_IOBASE) {
Alison Wang95bed1f2012-03-26 21:49:04 +0000520 setbits_be16(&gpio->par_feci2c, 0x0f00);
521 setbits_8(&gpio->par_fec0hl, 0xc0);
TsiChung Liew69b17572008-10-21 13:47:54 +0000522 } else {
Alison Wang95bed1f2012-03-26 21:49:04 +0000523 setbits_be16(&gpio->par_feci2c, 0x00a0);
524 setbits_8(&gpio->par_fec1hl, 0xc0);
TsiChung Liew69b17572008-10-21 13:47:54 +0000525 }
526 } else {
527 if (info->iobase == CONFIG_SYS_FEC0_IOBASE) {
Alison Wang95bed1f2012-03-26 21:49:04 +0000528 clrbits_be16(&gpio->par_feci2c, 0x0f00);
529 clrbits_8(&gpio->par_fec0hl, 0xc0);
TsiChung Liew69b17572008-10-21 13:47:54 +0000530 } else {
Alison Wang95bed1f2012-03-26 21:49:04 +0000531 clrbits_be16(&gpio->par_feci2c, 0x00a0);
532 clrbits_8(&gpio->par_fec1hl, 0xc0);
TsiChung Liew69b17572008-10-21 13:47:54 +0000533 }
534 }
535
536 return 0;
537}
538#endif /* CONFIG_CMD_NET */
Matthew Fettke761e2e92008-02-04 15:38:20 -0600539#endif /* #if defined(CONFIG_M5275) */
540
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500541#if defined(CONFIG_M5282)
wdenke65527f2004-02-12 00:47:09 +0000542/*
543 * Breath some life into the CPU...
544 *
545 * Set up the memory map,
546 * initialize a bunch of registers,
547 * initialize the UPM's
548 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500549void cpu_init_f(void)
wdenke65527f2004-02-12 00:47:09 +0000550{
Heiko Schocherac1956e2006-04-20 08:42:42 +0200551#ifndef CONFIG_WATCHDOG
552 /* disable watchdog if we aren't using it */
553 MCFWTM_WCR = 0;
554#endif
555
556#ifndef CONFIG_MONITOR_IS_IN_RAM
557 /* Set speed /PLL */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500558 MCFCLOCK_SYNCR =
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000559 MCFCLOCK_SYNCR_MFD(CONFIG_SYS_MFD) |
560 MCFCLOCK_SYNCR_RFD(CONFIG_SYS_RFD);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500561 while (!(MCFCLOCK_SYNSR & MCFCLOCK_SYNSR_LOCK)) ;
562
563 MCFGPIO_PBCDPAR = 0xc0;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200564
565 /* Set up the GPIO ports */
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200566#ifdef CONFIG_SYS_PEPAR
567 MCFGPIO_PEPAR = CONFIG_SYS_PEPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200568#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200569#ifdef CONFIG_SYS_PFPAR
570 MCFGPIO_PFPAR = CONFIG_SYS_PFPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200571#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200572#ifdef CONFIG_SYS_PJPAR
573 MCFGPIO_PJPAR = CONFIG_SYS_PJPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200574#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200575#ifdef CONFIG_SYS_PSDPAR
576 MCFGPIO_PSDPAR = CONFIG_SYS_PSDPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200577#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200578#ifdef CONFIG_SYS_PASPAR
579 MCFGPIO_PASPAR = CONFIG_SYS_PASPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200580#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200581#ifdef CONFIG_SYS_PEHLPAR
582 MCFGPIO_PEHLPAR = CONFIG_SYS_PEHLPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200583#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200584#ifdef CONFIG_SYS_PQSPAR
585 MCFGPIO_PQSPAR = CONFIG_SYS_PQSPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200586#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200587#ifdef CONFIG_SYS_PTCPAR
588 MCFGPIO_PTCPAR = CONFIG_SYS_PTCPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200589#endif
Michael Durranta4991f22010-01-20 19:33:02 -0600590#if defined(CONFIG_SYS_PORTTC)
591 MCFGPIO_PORTTC = CONFIG_SYS_PORTTC;
592#endif
593#if defined(CONFIG_SYS_DDRTC)
594 MCFGPIO_DDRTC = CONFIG_SYS_DDRTC;
595#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200596#ifdef CONFIG_SYS_PTDPAR
597 MCFGPIO_PTDPAR = CONFIG_SYS_PTDPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200598#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200599#ifdef CONFIG_SYS_PUAPAR
600 MCFGPIO_PUAPAR = CONFIG_SYS_PUAPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200601#endif
602
Michael Durranta4991f22010-01-20 19:33:02 -0600603#if defined(CONFIG_SYS_DDRD)
604 MCFGPIO_DDRD = CONFIG_SYS_DDRD;
605#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200606#ifdef CONFIG_SYS_DDRUA
607 MCFGPIO_DDRUA = CONFIG_SYS_DDRUA;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200608#endif
Heiko Schocherac1956e2006-04-20 08:42:42 +0200609
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000610 /* FlexBus Chipselect */
611 init_fbcs();
Heiko Schocherac1956e2006-04-20 08:42:42 +0200612
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500613#endif /* CONFIG_MONITOR_IS_IN_RAM */
wdenke65527f2004-02-12 00:47:09 +0000614
Heiko Schocherac1956e2006-04-20 08:42:42 +0200615 /* defer enabling cache until boot (see do_go) */
616 /* icache_enable(); */
wdenke65527f2004-02-12 00:47:09 +0000617}
618
619/*
620 * initialize higher level parts of CPU like timers
621 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500622int cpu_init_r(void)
wdenke65527f2004-02-12 00:47:09 +0000623{
624 return (0);
625}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500626
TsiChung Liewf9556a72010-03-09 19:17:52 -0600627void uart_port_conf(int port)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500628{
629 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600630 switch (port) {
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500631 case 0:
632 MCFGPIO_PUAPAR &= 0xFc;
633 MCFGPIO_PUAPAR |= 0x03;
634 break;
635 case 1:
636 MCFGPIO_PUAPAR &= 0xF3;
637 MCFGPIO_PUAPAR |= 0x0C;
638 break;
639 case 2:
640 MCFGPIO_PASPAR &= 0xFF0F;
641 MCFGPIO_PASPAR |= 0x00A0;
642 break;
643 }
TsiChung Liew69b17572008-10-21 13:47:54 +0000644}
645
646#if defined(CONFIG_CMD_NET)
647int fecpin_setclear(struct eth_device *dev, int setclear)
648{
649 if (setclear) {
650 MCFGPIO_PASPAR |= 0x0F00;
651 MCFGPIO_PEHLPAR = CONFIG_SYS_PEHLPAR;
652 } else {
653 MCFGPIO_PASPAR &= 0xF0FF;
654 MCFGPIO_PEHLPAR &= ~CONFIG_SYS_PEHLPAR;
655 }
656 return 0;
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500657}
TsiChung Liew69b17572008-10-21 13:47:54 +0000658#endif /* CONFIG_CMD_NET */
wdenke65527f2004-02-12 00:47:09 +0000659#endif
stroese53395a22004-12-16 18:09:49 +0000660
661#if defined(CONFIG_M5249)
662/*
663 * Breath some life into the CPU...
664 *
665 * Set up the memory map,
666 * initialize a bunch of registers,
667 * initialize the UPM's
668 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500669void cpu_init_f(void)
stroese53395a22004-12-16 18:09:49 +0000670{
stroese53395a22004-12-16 18:09:49 +0000671 /*
672 * NOTE: by setting the GPIO_FUNCTION registers, we ensure that the UART pins
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500673 * (UART0: gpio 30,27, UART1: gpio 31, 28) will be used as UART pins
674 * which is their primary function.
675 * ~Jeremy
stroese53395a22004-12-16 18:09:49 +0000676 */
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200677 mbar2_writeLong(MCFSIM_GPIO_FUNC, CONFIG_SYS_GPIO_FUNC);
678 mbar2_writeLong(MCFSIM_GPIO1_FUNC, CONFIG_SYS_GPIO1_FUNC);
679 mbar2_writeLong(MCFSIM_GPIO_EN, CONFIG_SYS_GPIO_EN);
680 mbar2_writeLong(MCFSIM_GPIO1_EN, CONFIG_SYS_GPIO1_EN);
681 mbar2_writeLong(MCFSIM_GPIO_OUT, CONFIG_SYS_GPIO_OUT);
682 mbar2_writeLong(MCFSIM_GPIO1_OUT, CONFIG_SYS_GPIO1_OUT);
stroese53395a22004-12-16 18:09:49 +0000683
684 /*
685 * dBug Compliance:
686 * You can verify these values by using dBug's 'ird'
687 * (Internal Register Display) command
688 * ~Jeremy
689 *
Wolfgang Denkc2c49442006-05-10 17:43:20 +0200690 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500691 mbar_writeByte(MCFSIM_MPARK, 0x30); /* 5249 Internal Core takes priority over DMA */
stroese53395a22004-12-16 18:09:49 +0000692 mbar_writeByte(MCFSIM_SYPCR, 0x00);
693 mbar_writeByte(MCFSIM_SWIVR, 0x0f);
694 mbar_writeByte(MCFSIM_SWSR, 0x00);
695 mbar_writeLong(MCFSIM_IMR, 0xfffffbff);
696 mbar_writeByte(MCFSIM_SWDICR, 0x00);
697 mbar_writeByte(MCFSIM_TIMER1ICR, 0x00);
698 mbar_writeByte(MCFSIM_TIMER2ICR, 0x88);
699 mbar_writeByte(MCFSIM_I2CICR, 0x00);
700 mbar_writeByte(MCFSIM_UART1ICR, 0x00);
701 mbar_writeByte(MCFSIM_UART2ICR, 0x00);
702 mbar_writeByte(MCFSIM_ICR6, 0x00);
703 mbar_writeByte(MCFSIM_ICR7, 0x00);
704 mbar_writeByte(MCFSIM_ICR8, 0x00);
705 mbar_writeByte(MCFSIM_ICR9, 0x00);
706 mbar_writeByte(MCFSIM_QSPIICR, 0x00);
707
708 mbar2_writeLong(MCFSIM_GPIO_INT_EN, 0x00000080);
Wolfgang Denkc2c49442006-05-10 17:43:20 +0200709 mbar2_writeByte(MCFSIM_INTBASE, 0x40); /* Base interrupts at 64 */
stroese53395a22004-12-16 18:09:49 +0000710 mbar2_writeByte(MCFSIM_SPURVEC, 0x00);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500711 mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020); /* Enable a 1 cycle pre-drive cycle on CS1 */
stroese53395a22004-12-16 18:09:49 +0000712
713 /* Setup interrupt priorities for gpio7 */
714 /* mbar2_writeLong(MCFSIM_INTLEV5, 0x70000000); */
715
716 /* IDE Config registers */
717 mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020);
718 mbar2_writeLong(MCFSIM_IDECONFIG2, 0x00000000);
719
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000720 /* FlexBus Chipselect */
721 init_fbcs();
stroese53395a22004-12-16 18:09:49 +0000722
723 /* enable instruction cache now */
724 icache_enable();
725}
726
727/*
728 * initialize higher level parts of CPU like timers
729 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500730int cpu_init_r(void)
stroese53395a22004-12-16 18:09:49 +0000731{
732 return (0);
733}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500734
TsiChung Liewf9556a72010-03-09 19:17:52 -0600735void uart_port_conf(int port)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500736{
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500737}
738#endif /* #if defined(CONFIG_M5249) */