blob: 5a26ae0317aa32256aec969c5addd8711bc31053 [file] [log] [blame]
TsiChung Liew8e585f02007-06-18 13:50:13 -05001/*
2 *
3 * (C) Copyright 2000-2003
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 *
TsiChungLiew84a015b2007-07-05 23:03:28 -05006 * (C) Copyright 2007 Freescale Semiconductor, Inc.
TsiChung Liew8e585f02007-06-18 13:50:13 -05007 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
8 *
9 * See file CREDITS for list of people who contributed to this
10 * project.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 * MA 02111-1307 USA
26 */
27
28#include <common.h>
29#include <watchdog.h>
30
TsiChungLiew84a015b2007-07-05 23:03:28 -050031#include <asm/immap.h>
TsiChung Liew8e585f02007-06-18 13:50:13 -050032
33/*
34 * Breath some life into the CPU...
35 *
36 * Set up the memory map,
37 * initialize a bunch of registers,
38 * initialize the UPM's
39 */
40void cpu_init_f(void)
41{
42 volatile scm1_t *scm1 = (scm1_t *) MMAP_SCM1;
43 volatile scm2_t *scm2 = (scm2_t *) MMAP_SCM2;
44 volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
45 volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS;
46 volatile wdog_t *wdog = (wdog_t *) MMAP_WDOG;
47
48 /* watchdog is enabled by default - disable the watchdog */
49#ifndef CONFIG_WATCHDOG
50 wdog->cr = 0;
51#endif
52
53 scm1->mpr0 = 0x77777777;
54 scm2->pacra = 0;
55 scm2->pacrb = 0;
56 scm2->pacrc = 0;
57 scm2->pacrd = 0;
58 scm2->pacre = 0;
59 scm2->pacrf = 0;
60 scm2->pacrg = 0;
61 scm1->pacrh = 0;
62
TsiChung Liew8e585f02007-06-18 13:50:13 -050063 /* Port configuration */
64 gpio->par_cs = 0x3E;
65
66#if (defined(CFG_CS0_BASE) && defined(CFG_CS0_MASK) && defined(CFG_CS0_CTRL))
67 fbcs->csar0 = CFG_CS0_BASE;
68 fbcs->cscr0 = CFG_CS0_CTRL;
69 fbcs->csmr0 = CFG_CS0_MASK;
70#endif
71
72#if (defined(CFG_CS1_BASE) && defined(CFG_CS1_MASK) && defined(CFG_CS1_CTRL))
73 /* Latch chipselect */
74 fbcs->csar1 = CFG_CS1_BASE;
75 fbcs->cscr1 = CFG_CS1_CTRL;
76 fbcs->csmr1 = CFG_CS1_MASK;
77#endif
78
79#if (defined(CFG_CS2_BASE) && defined(CFG_CS2_MASK) && defined(CFG_CS2_CTRL))
80 fbcs->csar2 = CFG_CS2_BASE;
81 fbcs->cscr2 = CFG_CS2_CTRL;
82 fbcs->csmr2 = CFG_CS2_MASK;
83#endif
84
85#if (defined(CFG_CS3_BASE) && defined(CFG_CS3_MASK) && defined(CFG_CS3_CTRL))
86 fbcs->csar3 = CFG_CS3_BASE;
87 fbcs->cscr3 = CFG_CS3_CTRL;
88 fbcs->csmr3 = CFG_CS3_MASK;
89#endif
90
91#if (defined(CFG_CS4_BASE) && defined(CFG_CS4_MASK) && defined(CFG_CS4_CTRL))
92 fbcs->csar4 = CFG_CS4_BASE;
93 fbcs->cscr4 = CFG_CS4_CTRL;
94 fbcs->csmr4 = CFG_CS4_MASK;
95#endif
96
97#if (defined(CFG_CS5_BASE) && defined(CFG_CS5_MASK) && defined(CFG_CS5_CTRL))
98 fbcs->csar5 = CFG_CS5_BASE;
99 fbcs->cscr5 = CFG_CS5_CTRL;
100 fbcs->csmr5 = CFG_CS5_MASK;
101#endif
TsiChung0dca8742007-07-10 15:45:43 -0500102
103 icache_enable();
TsiChung Liew8e585f02007-06-18 13:50:13 -0500104}
105
106/*
107 * initialize higher level parts of CPU like timers
108 */
109int cpu_init_r(void)
110{
TsiChung Liew8e585f02007-06-18 13:50:13 -0500111 return (0);
112}
TsiChungLiew8d1d66a2007-08-05 03:55:21 -0500113
114void uart_port_conf(void)
115{
116 volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
117
118 /* Setup Ports: */
119 switch (CFG_UART_PORT) {
120 case 0:
121 gpio->par_uart = (GPIO_PAR_UART_TXD0 | GPIO_PAR_UART_RXD0);
122 break;
123 case 1:
124 gpio->par_uart =
125 (GPIO_PAR_UART_TXD1(3) | GPIO_PAR_UART_RXD1(3));
126 break;
127 case 2:
128 gpio->par_timer &= 0x0F;
129 gpio->par_timer |= (GPIO_PAR_TIN3_URXD2 | GPIO_PAR_TIN2_UTXD2);
130 break;
131 }
132}
133