blob: 99eb61f16758dbcef1fd21af8940d815b526fc93 [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>
Simon Glass1d91ba72019-11-14 12:57:37 -070021#include <cpu_func.h>
Simon Glass97589732020-05-10 11:40:02 -060022#include <init.h>
wdenke65527f2004-02-12 00:47:09 +000023#include <watchdog.h>
TsiChungLiew8cd73be2007-08-15 19:21:21 -050024#include <asm/immap.h>
Alison Wang95bed1f2012-03-26 21:49:04 +000025#include <asm/io.h>
stroese53395a22004-12-16 18:09:49 +000026
TsiChung Liew69b17572008-10-21 13:47:54 +000027#if defined(CONFIG_CMD_NET)
28#include <config.h>
29#include <net.h>
30#include <asm/fec.h>
31#endif
32
TsiChung Liew7f1a0462008-10-21 10:03:07 +000033#ifndef CONFIG_M5272
34/* Only 5272 Flexbus chipselect is different from the rest */
35void init_fbcs(void)
36{
Alison Wang95bed1f2012-03-26 21:49:04 +000037 fbcs_t *fbcs = (fbcs_t *) (MMAP_FBCS);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000038
Tom Rini6a5dccc2022-11-16 13:10:41 -050039#if (defined(CFG_SYS_CS0_BASE) && defined(CFG_SYS_CS0_MASK) \
40 && defined(CFG_SYS_CS0_CTRL))
41 out_be32(&fbcs->csar0, CFG_SYS_CS0_BASE);
42 out_be32(&fbcs->cscr0, CFG_SYS_CS0_CTRL);
43 out_be32(&fbcs->csmr0, CFG_SYS_CS0_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000044#else
45#warning "Chip Select 0 are not initialized/used"
46#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050047#if (defined(CFG_SYS_CS1_BASE) && defined(CFG_SYS_CS1_MASK) \
48 && defined(CFG_SYS_CS1_CTRL))
49 out_be32(&fbcs->csar1, CFG_SYS_CS1_BASE);
50 out_be32(&fbcs->cscr1, CFG_SYS_CS1_CTRL);
51 out_be32(&fbcs->csmr1, CFG_SYS_CS1_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000052#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050053#if (defined(CFG_SYS_CS2_BASE) && defined(CFG_SYS_CS2_MASK) \
54 && defined(CFG_SYS_CS2_CTRL))
55 out_be32(&fbcs->csar2, CFG_SYS_CS2_BASE);
56 out_be32(&fbcs->cscr2, CFG_SYS_CS2_CTRL);
57 out_be32(&fbcs->csmr2, CFG_SYS_CS2_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000058#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050059#if (defined(CFG_SYS_CS3_BASE) && defined(CFG_SYS_CS3_MASK) \
60 && defined(CFG_SYS_CS3_CTRL))
61 out_be32(&fbcs->csar3, CFG_SYS_CS3_BASE);
62 out_be32(&fbcs->cscr3, CFG_SYS_CS3_CTRL);
63 out_be32(&fbcs->csmr3, CFG_SYS_CS3_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000064#endif
65#if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) \
66 && defined(CONFIG_SYS_CS4_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000067 out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE);
68 out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL);
69 out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000070#endif
71#if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) \
72 && defined(CONFIG_SYS_CS5_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000073 out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE);
74 out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL);
75 out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000076#endif
77#if (defined(CONFIG_SYS_CS6_BASE) && defined(CONFIG_SYS_CS6_MASK) \
78 && defined(CONFIG_SYS_CS6_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000079 out_be32(&fbcs->csar6, CONFIG_SYS_CS6_BASE);
80 out_be32(&fbcs->cscr6, CONFIG_SYS_CS6_CTRL);
81 out_be32(&fbcs->csmr6, CONFIG_SYS_CS6_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000082#endif
83#if (defined(CONFIG_SYS_CS7_BASE) && defined(CONFIG_SYS_CS7_MASK) \
84 && defined(CONFIG_SYS_CS7_CTRL))
Alison Wang95bed1f2012-03-26 21:49:04 +000085 out_be32(&fbcs->csar7, CONFIG_SYS_CS7_BASE);
86 out_be32(&fbcs->cscr7, CONFIG_SYS_CS7_CTRL);
87 out_be32(&fbcs->csmr7, CONFIG_SYS_CS7_MASK);
TsiChung Liew7f1a0462008-10-21 10:03:07 +000088#endif
89}
90#endif
91
TsiChung Liewb354aef2009-06-12 11:29:00 +000092#if defined(CONFIG_M5208)
93void cpu_init_f(void)
94{
Alison Wang95bed1f2012-03-26 21:49:04 +000095 scm1_t *scm1 = (scm1_t *) MMAP_SCM1;
TsiChung Liewb354aef2009-06-12 11:29:00 +000096
97#ifndef CONFIG_WATCHDOG
Alison Wang95bed1f2012-03-26 21:49:04 +000098 wdog_t *wdg = (wdog_t *) MMAP_WDOG;
TsiChung Liewb354aef2009-06-12 11:29:00 +000099
100 /* Disable the watchdog if we aren't using it */
Alison Wang95bed1f2012-03-26 21:49:04 +0000101 out_be16(&wdg->cr, 0);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000102#endif
103
Alison Wang95bed1f2012-03-26 21:49:04 +0000104 out_be32(&scm1->mpr, 0x77777777);
105 out_be32(&scm1->pacra, 0);
106 out_be32(&scm1->pacrb, 0);
107 out_be32(&scm1->pacrc, 0);
108 out_be32(&scm1->pacrd, 0);
109 out_be32(&scm1->pacre, 0);
110 out_be32(&scm1->pacrf, 0);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000111
112 /* FlexBus Chipselect */
113 init_fbcs();
114
115 icache_enable();
116}
117
118/* initialize higher level parts of CPU like timers */
119int cpu_init_r(void)
120{
121 return (0);
122}
123
TsiChung Liewf9556a72010-03-09 19:17:52 -0600124void uart_port_conf(int port)
TsiChung Liewb354aef2009-06-12 11:29:00 +0000125{
Alison Wang95bed1f2012-03-26 21:49:04 +0000126 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liewb354aef2009-06-12 11:29:00 +0000127
128 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600129 switch (port) {
TsiChung Liewb354aef2009-06-12 11:29:00 +0000130 case 0:
Alison Wang95bed1f2012-03-26 21:49:04 +0000131 clrbits_be16(&gpio->par_uart, ~GPIO_PAR_UART0_UNMASK);
132 setbits_be16(&gpio->par_uart, GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000133 break;
134 case 1:
Alison Wang95bed1f2012-03-26 21:49:04 +0000135 clrbits_be16(&gpio->par_uart, ~GPIO_PAR_UART0_UNMASK);
136 setbits_be16(&gpio->par_uart, GPIO_PAR_UART_U1TXD | GPIO_PAR_UART_U1RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000137 break;
138 case 2:
139#ifdef CONFIG_SYS_UART2_PRI_GPIO
Alison Wang95bed1f2012-03-26 21:49:04 +0000140 clrbits_8(&gpio->par_timer,
141 ~(GPIO_PAR_TMR_TIN0_UNMASK | GPIO_PAR_TMR_TIN1_UNMASK));
142 setbits_8(&gpio->par_timer,
143 GPIO_PAR_TMR_TIN0_U2TXD | GPIO_PAR_TMR_TIN1_U2RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000144#endif
145#ifdef CONFIG_SYS_UART2_ALT1_GPIO
Alison Wang95bed1f2012-03-26 21:49:04 +0000146 clrbits_8(&gpio->par_feci2c,
147 ~(GPIO_PAR_FECI2C_MDC_UNMASK | GPIO_PAR_FECI2C_MDIO_UNMASK));
148 setbits_8(&gpio->par_feci2c,
149 GPIO_PAR_FECI2C_MDC_U2TXD | GPIO_PAR_FECI2C_MDIO_U2RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000150#endif
151#ifdef CONFIG_SYS_UART2_ALT1_GPIO
Alison Wang95bed1f2012-03-26 21:49:04 +0000152 clrbits_8(&gpio->par_feci2c,
153 ~(GPIO_PAR_FECI2C_SDA_UNMASK | GPIO_PAR_FECI2C_SCL_UNMASK));
154 setbits_8(&gpio->par_feci2c,
155 GPIO_PAR_FECI2C_SDA_U2TXD | GPIO_PAR_FECI2C_SCL_U2RXD);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000156#endif
157 break;
158 }
159}
160
161#if defined(CONFIG_CMD_NET)
Angelo Durgehello8ff47f72019-11-15 23:54:16 +0100162int fecpin_setclear(fec_info_t *info, int setclear)
TsiChung Liewb354aef2009-06-12 11:29:00 +0000163{
Alison Wang95bed1f2012-03-26 21:49:04 +0000164 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liewb354aef2009-06-12 11:29:00 +0000165
166 if (setclear) {
Alison Wang95bed1f2012-03-26 21:49:04 +0000167 setbits_8(&gpio->par_fec,
168 GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC);
169 setbits_8(&gpio->par_feci2c,
170 GPIO_PAR_FECI2C_MDC_MDC | GPIO_PAR_FECI2C_MDIO_MDIO);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000171 } else {
Alison Wang95bed1f2012-03-26 21:49:04 +0000172 clrbits_8(&gpio->par_fec,
173 ~(GPIO_PAR_FEC_7W_UNMASK & GPIO_PAR_FEC_MII_UNMASK));
174 clrbits_8(&gpio->par_feci2c, ~GPIO_PAR_FECI2C_RMII_UNMASK);
TsiChung Liewb354aef2009-06-12 11:29:00 +0000175 }
176 return 0;
177}
178#endif /* CONFIG_CMD_NET */
179#endif /* CONFIG_M5208 */
180
TsiChungLiew34674692007-08-16 13:20:50 -0500181#if defined(CONFIG_M5253)
182/*
183 * Breath some life into the CPU...
184 *
185 * Set up the memory map,
186 * initialize a bunch of registers,
187 * initialize the UPM's
188 */
189void cpu_init_f(void)
190{
191 mbar_writeByte(MCFSIM_MPARK, 0x40); /* 5249 Internal Core takes priority over DMA */
192 mbar_writeByte(MCFSIM_SYPCR, 0x00);
193 mbar_writeByte(MCFSIM_SWIVR, 0x0f);
194 mbar_writeByte(MCFSIM_SWSR, 0x00);
195 mbar_writeByte(MCFSIM_SWDICR, 0x00);
196 mbar_writeByte(MCFSIM_TIMER1ICR, 0x00);
197 mbar_writeByte(MCFSIM_TIMER2ICR, 0x88);
198 mbar_writeByte(MCFSIM_I2CICR, 0x00);
199 mbar_writeByte(MCFSIM_UART1ICR, 0x00);
200 mbar_writeByte(MCFSIM_UART2ICR, 0x00);
201 mbar_writeByte(MCFSIM_ICR6, 0x00);
202 mbar_writeByte(MCFSIM_ICR7, 0x00);
203 mbar_writeByte(MCFSIM_ICR8, 0x00);
204 mbar_writeByte(MCFSIM_ICR9, 0x00);
205 mbar_writeByte(MCFSIM_QSPIICR, 0x00);
206
207 mbar2_writeLong(MCFSIM_GPIO_INT_EN, 0x00000080);
208 mbar2_writeByte(MCFSIM_INTBASE, 0x40); /* Base interrupts at 64 */
209 mbar2_writeByte(MCFSIM_SPURVEC, 0x00);
210
Wolfgang Denk55334c72008-12-16 01:02:17 +0100211 /*mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020); */ /* Enable a 1 cycle pre-drive cycle on CS1 */
TsiChungLiew34674692007-08-16 13:20:50 -0500212
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000213 /* FlexBus Chipselect */
214 init_fbcs();
TsiChungLiew34674692007-08-16 13:20:50 -0500215
Heiko Schocherf2850742012-10-24 13:48:22 +0200216#ifdef CONFIG_SYS_I2C_FSL
Tom Rini6a5dccc2022-11-16 13:10:41 -0500217 CFG_SYS_I2C_PINMUX_REG =
218 CFG_SYS_I2C_PINMUX_REG & CFG_SYS_I2C_PINMUX_CLR;
219 CFG_SYS_I2C_PINMUX_REG |= CFG_SYS_I2C_PINMUX_SET;
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200220#ifdef CONFIG_SYS_I2C2_OFFSET
221 CONFIG_SYS_I2C2_PINMUX_REG &= CONFIG_SYS_I2C2_PINMUX_CLR;
222 CONFIG_SYS_I2C2_PINMUX_REG |= CONFIG_SYS_I2C2_PINMUX_SET;
TsiChung Liew0c1e3252008-08-19 03:01:19 +0600223#endif
224#endif
225
TsiChungLiew34674692007-08-16 13:20:50 -0500226 /* enable instruction cache now */
227 icache_enable();
228}
229
230/*initialize higher level parts of CPU like timers */
231int cpu_init_r(void)
232{
233 return (0);
234}
235
TsiChung Liewf9556a72010-03-09 19:17:52 -0600236void uart_port_conf(int port)
TsiChungLiew34674692007-08-16 13:20:50 -0500237{
Alison Wang95bed1f2012-03-26 21:49:04 +0000238 u32 *par = (u32 *) MMAP_PAR;
TsiChung Liewf9556a72010-03-09 19:17:52 -0600239
TsiChungLiew34674692007-08-16 13:20:50 -0500240 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600241 switch (port) {
TsiChungLiew34674692007-08-16 13:20:50 -0500242 case 1:
Alison Wang95bed1f2012-03-26 21:49:04 +0000243 clrbits_be32(par, 0x00180000);
244 setbits_be32(par, 0x00180000);
TsiChungLiew34674692007-08-16 13:20:50 -0500245 break;
246 case 2:
Alison Wang95bed1f2012-03-26 21:49:04 +0000247 clrbits_be32(par, 0x00000003);
248 clrbits_be32(par, 0xFFFFFFFC);
TsiChungLiew34674692007-08-16 13:20:50 -0500249 break;
250 }
251}
252#endif /* #if defined(CONFIG_M5253) */
253
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500254#if defined(CONFIG_M5271)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500255void cpu_init_f(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500256{
257#ifndef CONFIG_WATCHDOG
258 /* Disable the watchdog if we aren't using it */
259 mbar_writeShort(MCF_WTM_WCR, 0);
260#endif
261
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000262 /* FlexBus Chipselect */
263 init_fbcs();
264
Richard Retanubunfbb55212009-01-29 14:36:06 -0500265#ifdef CONFIG_SYS_MCF_SYNCR
266 /* Set clockspeed according to board header file */
267 mbar_writeLong(MCF_FMPLL_SYNCR, CONFIG_SYS_MCF_SYNCR);
268#else
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500269 /* Set clockspeed to 100MHz */
Richard Retanubunfbb55212009-01-29 14:36:06 -0500270 mbar_writeLong(MCF_FMPLL_SYNCR,
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500271 MCF_FMPLL_SYNCR_MFD(0) | MCF_FMPLL_SYNCR_RFD(0));
Richard Retanubunfbb55212009-01-29 14:36:06 -0500272#endif
Mike Frysinger9b728282011-10-15 10:10:42 +0000273 while (!(mbar_readByte(MCF_FMPLL_SYNSR) & MCF_FMPLL_SYNSR_LOCK)) ;
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500274}
275
276/*
277 * initialize higher level parts of CPU like timers
278 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500279int cpu_init_r(void)
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500280{
281 return (0);
282}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500283
TsiChung Liewf9556a72010-03-09 19:17:52 -0600284void uart_port_conf(int port)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500285{
TsiChung Liewf9556a72010-03-09 19:17:52 -0600286 u16 temp;
287
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500288 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600289 switch (port) {
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500290 case 0:
TsiChung Liewf9556a72010-03-09 19:17:52 -0600291 temp = mbar_readShort(MCF_GPIO_PAR_UART) & 0xFFF3;
292 temp |= (MCF_GPIO_PAR_UART_U0TXD | MCF_GPIO_PAR_UART_U0RXD);
293 mbar_writeShort(MCF_GPIO_PAR_UART, temp);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500294 break;
295 case 1:
TsiChung Liewf9556a72010-03-09 19:17:52 -0600296 temp = mbar_readShort(MCF_GPIO_PAR_UART) & 0xF0FF;
297 temp |= (MCF_GPIO_PAR_UART_U1RXD_UART1 | MCF_GPIO_PAR_UART_U1TXD_UART1);
298 mbar_writeShort(MCF_GPIO_PAR_UART, temp);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500299 break;
300 case 2:
TsiChung Liewf9556a72010-03-09 19:17:52 -0600301 temp = mbar_readShort(MCF_GPIO_PAR_UART) & 0xCFFF;
302 temp |= (0x3000);
303 mbar_writeShort(MCF_GPIO_PAR_UART, temp);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500304 break;
305 }
TsiChung Liew69b17572008-10-21 13:47:54 +0000306}
307
308#if defined(CONFIG_CMD_NET)
Angelo Durgehello8ff47f72019-11-15 23:54:16 +0100309int fecpin_setclear(fec_info_t *info, int setclear)
TsiChung Liew69b17572008-10-21 13:47:54 +0000310{
311 if (setclear) {
312 /* Enable Ethernet pins */
Richard Retanubun0ad94fd2009-01-23 10:47:13 -0500313 mbar_writeByte(MCF_GPIO_PAR_FECI2C,
314 (mbar_readByte(MCF_GPIO_PAR_FECI2C) | 0xF0));
TsiChung Liew69b17572008-10-21 13:47:54 +0000315 } else {
316 }
317
318 return 0;
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500319}
TsiChung Liew69b17572008-10-21 13:47:54 +0000320#endif /* CONFIG_CMD_NET */
Richard Retanubun93241382011-03-24 08:58:11 +0000321
Richard Retanubun93241382011-03-24 08:58:11 +0000322#endif /* CONFIG_M5271 */
Zachary P. Landau0bba8622006-01-26 17:35:56 -0500323
stroese53395a22004-12-16 18:09:49 +0000324#if defined(CONFIG_M5272)
wdenke65527f2004-02-12 00:47:09 +0000325/*
326 * Breath some life into the CPU...
327 *
328 * Set up the memory map,
329 * initialize a bunch of registers,
330 * initialize the UPM's
331 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500332void cpu_init_f(void)
wdenke65527f2004-02-12 00:47:09 +0000333{
334 /* if we come from RAM we assume the CPU is
335 * already initialized.
336 */
337#ifndef CONFIG_MONITOR_IS_IN_RAM
Tom Rini6a5dccc2022-11-16 13:10:41 -0500338 sysctrl_t *sysctrl = (sysctrl_t *) (CFG_SYS_MBAR);
Alison Wang95bed1f2012-03-26 21:49:04 +0000339 gpio_t *gpio = (gpio_t *) (MMAP_GPIO);
340 csctrl_t *csctrl = (csctrl_t *) (MMAP_FBCS);
wdenke65527f2004-02-12 00:47:09 +0000341
Tom Rini6a5dccc2022-11-16 13:10:41 -0500342 out_be16(&sysctrl->sc_scr, CFG_SYS_SCR);
343 out_be16(&sysctrl->sc_spr, CFG_SYS_SPR);
wdenke65527f2004-02-12 00:47:09 +0000344
Wolfgang Denkc2c49442006-05-10 17:43:20 +0200345 /* Setup Ports: */
Tom Rini6a5dccc2022-11-16 13:10:41 -0500346 out_be32(&gpio->gpio_pacnt, CFG_SYS_PACNT);
347 out_be16(&gpio->gpio_paddr, CFG_SYS_PADDR);
348 out_be16(&gpio->gpio_padat, CFG_SYS_PADAT);
349 out_be32(&gpio->gpio_pbcnt, CFG_SYS_PBCNT);
350 out_be16(&gpio->gpio_pbddr, CFG_SYS_PBDDR);
351 out_be16(&gpio->gpio_pbdat, CFG_SYS_PBDAT);
352 out_be32(&gpio->gpio_pdcnt, CFG_SYS_PDCNT);
wdenke65527f2004-02-12 00:47:09 +0000353
354 /* Memory Controller: */
Alison Wang95bed1f2012-03-26 21:49:04 +0000355 out_be32(&csctrl->cs_br0, CONFIG_SYS_BR0_PRELIM);
356 out_be32(&csctrl->cs_or0, CONFIG_SYS_OR0_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000357
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200358#if (defined(CONFIG_SYS_OR1_PRELIM) && defined(CONFIG_SYS_BR1_PRELIM))
Alison Wang95bed1f2012-03-26 21:49:04 +0000359 out_be32(&csctrl->cs_br1, CONFIG_SYS_BR1_PRELIM);
360 out_be32(&csctrl->cs_or1, CONFIG_SYS_OR1_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000361#endif
362
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200363#if defined(CONFIG_SYS_OR2_PRELIM) && defined(CONFIG_SYS_BR2_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000364 out_be32(&csctrl->cs_br2, CONFIG_SYS_BR2_PRELIM);
365 out_be32(&csctrl->cs_or2, CONFIG_SYS_OR2_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000366#endif
367
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200368#if defined(CONFIG_SYS_OR3_PRELIM) && defined(CONFIG_SYS_BR3_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000369 out_be32(&csctrl->cs_br3, CONFIG_SYS_BR3_PRELIM);
370 out_be32(&csctrl->cs_or3, CONFIG_SYS_OR3_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000371#endif
372
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200373#if defined(CONFIG_SYS_OR4_PRELIM) && defined(CONFIG_SYS_BR4_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000374 out_be32(&csctrl->cs_br4, CONFIG_SYS_BR4_PRELIM);
375 out_be32(&csctrl->cs_or4, CONFIG_SYS_OR4_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000376#endif
377
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200378#if defined(CONFIG_SYS_OR5_PRELIM) && defined(CONFIG_SYS_BR5_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000379 out_be32(&csctrl->cs_br5, CONFIG_SYS_BR5_PRELIM);
380 out_be32(&csctrl->cs_or5, CONFIG_SYS_OR5_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000381#endif
382
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200383#if defined(CONFIG_SYS_OR6_PRELIM) && defined(CONFIG_SYS_BR6_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000384 out_be32(&csctrl->cs_br6, CONFIG_SYS_BR6_PRELIM);
385 out_be32(&csctrl->cs_or6, CONFIG_SYS_OR6_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000386#endif
387
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200388#if defined(CONFIG_SYS_OR7_PRELIM) && defined(CONFIG_SYS_BR7_PRELIM)
Alison Wang95bed1f2012-03-26 21:49:04 +0000389 out_be32(&csctrl->cs_br7, CONFIG_SYS_BR7_PRELIM);
390 out_be32(&csctrl->cs_or7, CONFIG_SYS_OR7_PRELIM);
wdenke65527f2004-02-12 00:47:09 +0000391#endif
392
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500393#endif /* #ifndef CONFIG_MONITOR_IS_IN_RAM */
wdenke65527f2004-02-12 00:47:09 +0000394
Wolfgang Denkc2c49442006-05-10 17:43:20 +0200395 /* enable instruction cache now */
396 icache_enable();
wdenke65527f2004-02-12 00:47:09 +0000397
398}
399
400/*
401 * initialize higher level parts of CPU like timers
402 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500403int cpu_init_r(void)
wdenke65527f2004-02-12 00:47:09 +0000404{
405 return (0);
406}
wdenke65527f2004-02-12 00:47:09 +0000407
TsiChung Liewf9556a72010-03-09 19:17:52 -0600408void uart_port_conf(int port)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500409{
Alison Wang95bed1f2012-03-26 21:49:04 +0000410 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
wdenke65527f2004-02-12 00:47:09 +0000411
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500412 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600413 switch (port) {
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500414 case 0:
Alison Wang95bed1f2012-03-26 21:49:04 +0000415 clrbits_be32(&gpio->gpio_pbcnt,
416 GPIO_PBCNT_PB0MSK | GPIO_PBCNT_PB1MSK);
417 setbits_be32(&gpio->gpio_pbcnt,
418 GPIO_PBCNT_URT0_TXD | GPIO_PBCNT_URT0_RXD);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500419 break;
420 case 1:
Alison Wang95bed1f2012-03-26 21:49:04 +0000421 clrbits_be32(&gpio->gpio_pdcnt,
422 GPIO_PDCNT_PD1MSK | GPIO_PDCNT_PD4MSK);
423 setbits_be32(&gpio->gpio_pdcnt,
424 GPIO_PDCNT_URT1_RXD | GPIO_PDCNT_URT1_TXD);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500425 break;
426 }
427}
TsiChung Liew69b17572008-10-21 13:47:54 +0000428
429#if defined(CONFIG_CMD_NET)
Angelo Durgehello8ff47f72019-11-15 23:54:16 +0100430int fecpin_setclear(fec_info_t *info, int setclear)
TsiChung Liew69b17572008-10-21 13:47:54 +0000431{
Alison Wang95bed1f2012-03-26 21:49:04 +0000432 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liew69b17572008-10-21 13:47:54 +0000433
434 if (setclear) {
Alison Wang95bed1f2012-03-26 21:49:04 +0000435 setbits_be32(&gpio->gpio_pbcnt,
436 GPIO_PBCNT_E_MDC | GPIO_PBCNT_E_RXER |
437 GPIO_PBCNT_E_RXD1 | GPIO_PBCNT_E_RXD2 |
438 GPIO_PBCNT_E_RXD3 | GPIO_PBCNT_E_TXD1 |
439 GPIO_PBCNT_E_TXD2 | GPIO_PBCNT_E_TXD3);
TsiChung Liew69b17572008-10-21 13:47:54 +0000440 } else {
441 }
442 return 0;
443}
444#endif /* CONFIG_CMD_NET */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500445#endif /* #if defined(CONFIG_M5272) */
446
Matthew Fettke761e2e92008-02-04 15:38:20 -0600447#if defined(CONFIG_M5275)
448
449/*
450 * Breathe some life into the CPU...
451 *
452 * Set up the memory map,
453 * initialize a bunch of registers,
454 * initialize the UPM's
455 */
456void cpu_init_f(void)
457{
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000458 /*
459 * if we come from RAM we assume the CPU is
Matthew Fettke761e2e92008-02-04 15:38:20 -0600460 * already initialized.
461 */
462
463#ifndef CONFIG_MONITOR_IS_IN_RAM
Alison Wang95bed1f2012-03-26 21:49:04 +0000464 wdog_t *wdog_reg = (wdog_t *) (MMAP_WDOG);
465 gpio_t *gpio_reg = (gpio_t *) (MMAP_GPIO);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600466
467 /* Kill watchdog so we can initialize the PLL */
Alison Wang95bed1f2012-03-26 21:49:04 +0000468 out_be16(&wdog_reg->wcr, 0);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600469
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000470 /* FlexBus Chipselect */
471 init_fbcs();
Matthew Fettke761e2e92008-02-04 15:38:20 -0600472#endif /* #ifndef CONFIG_MONITOR_IS_IN_RAM */
473
Heiko Schocherf2850742012-10-24 13:48:22 +0200474#ifdef CONFIG_SYS_I2C_FSL
Tom Rini6a5dccc2022-11-16 13:10:41 -0500475 CFG_SYS_I2C_PINMUX_REG &= CFG_SYS_I2C_PINMUX_CLR;
476 CFG_SYS_I2C_PINMUX_REG |= CFG_SYS_I2C_PINMUX_SET;
Matthew Fettke761e2e92008-02-04 15:38:20 -0600477#endif
478
479 /* enable instruction cache now */
480 icache_enable();
481}
482
483/*
484 * initialize higher level parts of CPU like timers
485 */
486int cpu_init_r(void)
487{
488 return (0);
489}
490
TsiChung Liewf9556a72010-03-09 19:17:52 -0600491void uart_port_conf(int port)
Matthew Fettke761e2e92008-02-04 15:38:20 -0600492{
Alison Wang95bed1f2012-03-26 21:49:04 +0000493 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
Matthew Fettke761e2e92008-02-04 15:38:20 -0600494
495 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600496 switch (port) {
Matthew Fettke761e2e92008-02-04 15:38:20 -0600497 case 0:
Alison Wang95bed1f2012-03-26 21:49:04 +0000498 clrbits_be16(&gpio->par_uart, UART0_ENABLE_MASK);
499 setbits_be16(&gpio->par_uart, UART0_ENABLE_MASK);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600500 break;
501 case 1:
Alison Wang95bed1f2012-03-26 21:49:04 +0000502 clrbits_be16(&gpio->par_uart, UART1_ENABLE_MASK);
503 setbits_be16(&gpio->par_uart, UART1_ENABLE_MASK);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600504 break;
505 case 2:
Alison Wang95bed1f2012-03-26 21:49:04 +0000506 clrbits_be16(&gpio->par_uart, UART2_ENABLE_MASK);
507 setbits_be16(&gpio->par_uart, UART2_ENABLE_MASK);
Matthew Fettke761e2e92008-02-04 15:38:20 -0600508 break;
509 }
510}
TsiChung Liew69b17572008-10-21 13:47:54 +0000511
512#if defined(CONFIG_CMD_NET)
Angelo Durgehello8ff47f72019-11-15 23:54:16 +0100513int fecpin_setclear(fec_info_t *info, int setclear)
TsiChung Liew69b17572008-10-21 13:47:54 +0000514{
Alison Wang95bed1f2012-03-26 21:49:04 +0000515 gpio_t *gpio = (gpio_t *)MMAP_GPIO;
Angelo Durgehello8ff47f72019-11-15 23:54:16 +0100516 u32 fec0_base;
517
518 if (fec_get_base_addr(0, &fec0_base))
519 return -1;
TsiChung Liew69b17572008-10-21 13:47:54 +0000520
521 if (setclear) {
522 /* Enable Ethernet pins */
Angelo Durgehello8ff47f72019-11-15 23:54:16 +0100523 if (info->iobase == fec0_base) {
Alison Wang95bed1f2012-03-26 21:49:04 +0000524 setbits_be16(&gpio->par_feci2c, 0x0f00);
525 setbits_8(&gpio->par_fec0hl, 0xc0);
TsiChung Liew69b17572008-10-21 13:47:54 +0000526 } else {
Alison Wang95bed1f2012-03-26 21:49:04 +0000527 setbits_be16(&gpio->par_feci2c, 0x00a0);
528 setbits_8(&gpio->par_fec1hl, 0xc0);
TsiChung Liew69b17572008-10-21 13:47:54 +0000529 }
530 } else {
Angelo Durgehello8ff47f72019-11-15 23:54:16 +0100531 if (info->iobase == fec0_base) {
Alison Wang95bed1f2012-03-26 21:49:04 +0000532 clrbits_be16(&gpio->par_feci2c, 0x0f00);
533 clrbits_8(&gpio->par_fec0hl, 0xc0);
TsiChung Liew69b17572008-10-21 13:47:54 +0000534 } else {
Alison Wang95bed1f2012-03-26 21:49:04 +0000535 clrbits_be16(&gpio->par_feci2c, 0x00a0);
536 clrbits_8(&gpio->par_fec1hl, 0xc0);
TsiChung Liew69b17572008-10-21 13:47:54 +0000537 }
538 }
539
540 return 0;
541}
542#endif /* CONFIG_CMD_NET */
Matthew Fettke761e2e92008-02-04 15:38:20 -0600543#endif /* #if defined(CONFIG_M5275) */
544
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500545#if defined(CONFIG_M5282)
wdenke65527f2004-02-12 00:47:09 +0000546/*
547 * Breath some life into the CPU...
548 *
549 * Set up the memory map,
550 * initialize a bunch of registers,
551 * initialize the UPM's
552 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500553void cpu_init_f(void)
wdenke65527f2004-02-12 00:47:09 +0000554{
Heiko Schocherac1956e2006-04-20 08:42:42 +0200555#ifndef CONFIG_WATCHDOG
556 /* disable watchdog if we aren't using it */
557 MCFWTM_WCR = 0;
558#endif
559
560#ifndef CONFIG_MONITOR_IS_IN_RAM
561 /* Set speed /PLL */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500562 MCFCLOCK_SYNCR =
Tom Rini6a5dccc2022-11-16 13:10:41 -0500563 MCFCLOCK_SYNCR_MFD(CFG_SYS_MFD) |
564 MCFCLOCK_SYNCR_RFD(CFG_SYS_RFD);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500565 while (!(MCFCLOCK_SYNSR & MCFCLOCK_SYNSR_LOCK)) ;
566
567 MCFGPIO_PBCDPAR = 0xc0;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200568
569 /* Set up the GPIO ports */
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200570#ifdef CONFIG_SYS_PEPAR
571 MCFGPIO_PEPAR = CONFIG_SYS_PEPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200572#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200573#ifdef CONFIG_SYS_PFPAR
574 MCFGPIO_PFPAR = CONFIG_SYS_PFPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200575#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500576#ifdef CFG_SYS_PJPAR
577 MCFGPIO_PJPAR = CFG_SYS_PJPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200578#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200579#ifdef CONFIG_SYS_PSDPAR
580 MCFGPIO_PSDPAR = CONFIG_SYS_PSDPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200581#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500582#ifdef CFG_SYS_PASPAR
583 MCFGPIO_PASPAR = CFG_SYS_PASPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200584#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500585#ifdef CFG_SYS_PEHLPAR
586 MCFGPIO_PEHLPAR = CFG_SYS_PEHLPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200587#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200588#ifdef CONFIG_SYS_PQSPAR
589 MCFGPIO_PQSPAR = CONFIG_SYS_PQSPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200590#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200591#ifdef CONFIG_SYS_PTCPAR
592 MCFGPIO_PTCPAR = CONFIG_SYS_PTCPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200593#endif
Michael Durranta4991f22010-01-20 19:33:02 -0600594#if defined(CONFIG_SYS_PORTTC)
595 MCFGPIO_PORTTC = CONFIG_SYS_PORTTC;
596#endif
597#if defined(CONFIG_SYS_DDRTC)
598 MCFGPIO_DDRTC = CONFIG_SYS_DDRTC;
599#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200600#ifdef CONFIG_SYS_PTDPAR
601 MCFGPIO_PTDPAR = CONFIG_SYS_PTDPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200602#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500603#ifdef CFG_SYS_PUAPAR
604 MCFGPIO_PUAPAR = CFG_SYS_PUAPAR;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200605#endif
606
Michael Durranta4991f22010-01-20 19:33:02 -0600607#if defined(CONFIG_SYS_DDRD)
608 MCFGPIO_DDRD = CONFIG_SYS_DDRD;
609#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500610#ifdef CFG_SYS_DDRUA
611 MCFGPIO_DDRUA = CFG_SYS_DDRUA;
Heiko Schocherac1956e2006-04-20 08:42:42 +0200612#endif
Heiko Schocherac1956e2006-04-20 08:42:42 +0200613
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000614 /* FlexBus Chipselect */
615 init_fbcs();
Heiko Schocherac1956e2006-04-20 08:42:42 +0200616
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500617#endif /* CONFIG_MONITOR_IS_IN_RAM */
wdenke65527f2004-02-12 00:47:09 +0000618
Heiko Schocherac1956e2006-04-20 08:42:42 +0200619 /* defer enabling cache until boot (see do_go) */
620 /* icache_enable(); */
wdenke65527f2004-02-12 00:47:09 +0000621}
622
623/*
624 * initialize higher level parts of CPU like timers
625 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500626int cpu_init_r(void)
wdenke65527f2004-02-12 00:47:09 +0000627{
628 return (0);
629}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500630
TsiChung Liewf9556a72010-03-09 19:17:52 -0600631void uart_port_conf(int port)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500632{
633 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600634 switch (port) {
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500635 case 0:
636 MCFGPIO_PUAPAR &= 0xFc;
637 MCFGPIO_PUAPAR |= 0x03;
638 break;
639 case 1:
640 MCFGPIO_PUAPAR &= 0xF3;
641 MCFGPIO_PUAPAR |= 0x0C;
642 break;
643 case 2:
644 MCFGPIO_PASPAR &= 0xFF0F;
645 MCFGPIO_PASPAR |= 0x00A0;
646 break;
647 }
TsiChung Liew69b17572008-10-21 13:47:54 +0000648}
649
650#if defined(CONFIG_CMD_NET)
Angelo Durgehello8ff47f72019-11-15 23:54:16 +0100651int fecpin_setclear(fec_info_t *info, int setclear)
TsiChung Liew69b17572008-10-21 13:47:54 +0000652{
653 if (setclear) {
654 MCFGPIO_PASPAR |= 0x0F00;
Tom Rini6a5dccc2022-11-16 13:10:41 -0500655 MCFGPIO_PEHLPAR = CFG_SYS_PEHLPAR;
TsiChung Liew69b17572008-10-21 13:47:54 +0000656 } else {
657 MCFGPIO_PASPAR &= 0xF0FF;
Tom Rini6a5dccc2022-11-16 13:10:41 -0500658 MCFGPIO_PEHLPAR &= ~CFG_SYS_PEHLPAR;
TsiChung Liew69b17572008-10-21 13:47:54 +0000659 }
660 return 0;
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500661}
TsiChung Liew69b17572008-10-21 13:47:54 +0000662#endif /* CONFIG_CMD_NET */
wdenke65527f2004-02-12 00:47:09 +0000663#endif
stroese53395a22004-12-16 18:09:49 +0000664
665#if defined(CONFIG_M5249)
666/*
667 * Breath some life into the CPU...
668 *
669 * Set up the memory map,
670 * initialize a bunch of registers,
671 * initialize the UPM's
672 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500673void cpu_init_f(void)
stroese53395a22004-12-16 18:09:49 +0000674{
stroese53395a22004-12-16 18:09:49 +0000675 /*
676 * NOTE: by setting the GPIO_FUNCTION registers, we ensure that the UART pins
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500677 * (UART0: gpio 30,27, UART1: gpio 31, 28) will be used as UART pins
678 * which is their primary function.
679 * ~Jeremy
stroese53395a22004-12-16 18:09:49 +0000680 */
Tom Rini6a5dccc2022-11-16 13:10:41 -0500681 mbar2_writeLong(MCFSIM_GPIO_FUNC, CFG_SYS_GPIO_FUNC);
682 mbar2_writeLong(MCFSIM_GPIO1_FUNC, CFG_SYS_GPIO1_FUNC);
683 mbar2_writeLong(MCFSIM_GPIO_EN, CFG_SYS_GPIO_EN);
684 mbar2_writeLong(MCFSIM_GPIO1_EN, CFG_SYS_GPIO1_EN);
685 mbar2_writeLong(MCFSIM_GPIO_OUT, CFG_SYS_GPIO_OUT);
686 mbar2_writeLong(MCFSIM_GPIO1_OUT, CFG_SYS_GPIO1_OUT);
stroese53395a22004-12-16 18:09:49 +0000687
688 /*
689 * dBug Compliance:
690 * You can verify these values by using dBug's 'ird'
691 * (Internal Register Display) command
692 * ~Jeremy
693 *
Wolfgang Denkc2c49442006-05-10 17:43:20 +0200694 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500695 mbar_writeByte(MCFSIM_MPARK, 0x30); /* 5249 Internal Core takes priority over DMA */
stroese53395a22004-12-16 18:09:49 +0000696 mbar_writeByte(MCFSIM_SYPCR, 0x00);
697 mbar_writeByte(MCFSIM_SWIVR, 0x0f);
698 mbar_writeByte(MCFSIM_SWSR, 0x00);
699 mbar_writeLong(MCFSIM_IMR, 0xfffffbff);
700 mbar_writeByte(MCFSIM_SWDICR, 0x00);
701 mbar_writeByte(MCFSIM_TIMER1ICR, 0x00);
702 mbar_writeByte(MCFSIM_TIMER2ICR, 0x88);
703 mbar_writeByte(MCFSIM_I2CICR, 0x00);
704 mbar_writeByte(MCFSIM_UART1ICR, 0x00);
705 mbar_writeByte(MCFSIM_UART2ICR, 0x00);
706 mbar_writeByte(MCFSIM_ICR6, 0x00);
707 mbar_writeByte(MCFSIM_ICR7, 0x00);
708 mbar_writeByte(MCFSIM_ICR8, 0x00);
709 mbar_writeByte(MCFSIM_ICR9, 0x00);
710 mbar_writeByte(MCFSIM_QSPIICR, 0x00);
711
712 mbar2_writeLong(MCFSIM_GPIO_INT_EN, 0x00000080);
Wolfgang Denkc2c49442006-05-10 17:43:20 +0200713 mbar2_writeByte(MCFSIM_INTBASE, 0x40); /* Base interrupts at 64 */
stroese53395a22004-12-16 18:09:49 +0000714 mbar2_writeByte(MCFSIM_SPURVEC, 0x00);
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500715 mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020); /* Enable a 1 cycle pre-drive cycle on CS1 */
stroese53395a22004-12-16 18:09:49 +0000716
717 /* Setup interrupt priorities for gpio7 */
718 /* mbar2_writeLong(MCFSIM_INTLEV5, 0x70000000); */
719
720 /* IDE Config registers */
721 mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020);
722 mbar2_writeLong(MCFSIM_IDECONFIG2, 0x00000000);
723
TsiChung Liew7f1a0462008-10-21 10:03:07 +0000724 /* FlexBus Chipselect */
725 init_fbcs();
stroese53395a22004-12-16 18:09:49 +0000726
727 /* enable instruction cache now */
728 icache_enable();
729}
730
731/*
732 * initialize higher level parts of CPU like timers
733 */
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500734int cpu_init_r(void)
stroese53395a22004-12-16 18:09:49 +0000735{
736 return (0);
737}
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500738
TsiChung Liewf9556a72010-03-09 19:17:52 -0600739void uart_port_conf(int port)
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500740{
TsiChungLiew8cd73be2007-08-15 19:21:21 -0500741}
742#endif /* #if defined(CONFIG_M5249) */