blob: 485e050b19a65319a5b272326b32ff64193a4ec5 [file] [log] [blame]
wdenkf8cac652002-08-26 22:36:39 +00001/*
2 * (C) Copyright 2002
3 * James F. Dougherty, Broadcom Corporation, jfd@broadcom.com
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24#include <common.h>
25#include <common.h>
26#include <watchdog.h>
27#include <command.h>
28#include <malloc.h>
29#include <devices.h>
wdenkf8cac652002-08-26 22:36:39 +000030#include <net.h>
31#include <version.h>
32#include <dtt.h>
33#include <mpc824x.h>
34#include <asm/processor.h>
35#include <linux/mtd/doc2000.h>
36
37#include "bmw.h"
38#include "m48t59y.h"
39#include <pci.h>
40
41
42int checkboard(void)
43{
44 ulong busfreq = get_bus_freq(0);
45 char buf[32];
46
47 puts ("Board: BMW MPC8245/KAHLUA2 - CHRP (MAP B)\n");
48 printf("Built: %s at %s\n", __DATE__ , __TIME__ );
49 /* printf("MPLD: Revision %d\n", SYS_REVID_GET()); */
50 printf("Local Bus at %s MHz\n", strmhz(buf, busfreq));
51 return 0;
52}
53
54long int initdram(int board_type)
55{
56 return 64*1024*1024;
57}
58
59
60void
61get_tod(void)
62{
63 int year, month, day, hour, minute, second;
64
65 m48_tod_get(&year,
66 &month,
67 &day,
68 &hour,
69 &minute,
70 &second);
71
72 printf(" Current date/time: %d/%d/%d %d:%d:%d \n",
73 month, day, year, hour, minute, second);
74
75}
76
77/*
78 * EPIC, PCI, and I/O devices.
79 * Initialize Mousse Platform, probe for PCI devices,
80 * Query configuration parameters if not set.
81 */
82int misc_init_f (void)
83{
84#if 0
85 m48_tod_init(); /* Init SGS M48T59Y TOD/NVRAM */
86 printf("RTC: M48T589 TOD/NVRAM (%d) bytes\n",
87 TOD_NVRAM_SIZE);
88 get_tod();
89#endif
90
91 sys_led_msg("BOOT");
92 return 0;
93}
94
95
wdenkf8cac652002-08-26 22:36:39 +000096/*
97 * Initialize PCI Devices, report devices found.
98 */
99struct pci_controller hose;
100
stroesef5dd4102003-02-14 11:21:23 +0000101void pci_init_board (void)
wdenkf8cac652002-08-26 22:36:39 +0000102{
103 pci_mpc824x_init(&hose);
104 /* pci_dev_init(0); */
105}
106
107/*
108 * Write characters to LCD display.
109 * Note that the bytes for the first character is the last address.
110 */
111void
112sys_led_msg(char* msg)
113{
114 LED_REG(0) = msg[3];
115 LED_REG(1) = msg[2];
116 LED_REG(2) = msg[1];
117 LED_REG(3) = msg[0];
118}
119
120/*
121 * Map onboard TSOP-16MB DOC FLASH chip.
122 */
123void doc_init (void)
124{
125 doc_probe(DOC_BASE_ADDR);
126}
127
128#define NV_ADDR ((volatile unsigned char *) CFG_ENV_ADDR)
129
130/* Read from NVRAM */
131void*
132nvram_read(void *dest, const long src, size_t count)
133{
134 int i;
135 volatile unsigned char* d = (unsigned char*)dest;
136 volatile unsigned char* s = (unsigned char*)src;
137
138 for( i = 0; i < count;i++)
139 d[i] = s[i];
140
141 return dest;
142}
143
144/* Write to NVRAM */
145void
146nvram_write(long dest, const void *src, size_t count)
147{
148 int i;
149 volatile unsigned char* d = (unsigned char*)dest;
150 volatile unsigned char* s = (unsigned char*)src;
151
152 SYS_TOD_UNPROTECT();
153
154 for( i = 0; i < count;i++)
155 d[i] = s[i];
156
157 SYS_TOD_PROTECT();
158}