blob: 4039145e438db45be7c6951c4155f990fdd80de2 [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>
Jean-Christophe PLAGNIOL-VILLARD52cb4d42009-05-16 12:14:54 +020029#include <stdio_dev.h>
wdenkf8cac652002-08-26 22:36:39 +000030#include <net.h>
Peter Tyser561858e2008-11-03 09:30:59 -060031#include <timestamp.h>
wdenkf8cac652002-08-26 22:36:39 +000032#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");
Peter Tyser561858e2008-11-03 09:30:59 -060048 printf("Built: %s at %s\n", U_BOOT_DATE, U_BOOT_TIME);
wdenkf8cac652002-08-26 22:36:39 +000049 /* printf("MPLD: Revision %d\n", SYS_REVID_GET()); */
50 printf("Local Bus at %s MHz\n", strmhz(buf, busfreq));
51 return 0;
52}
53
Becky Bruce9973e3c2008-06-09 16:03:40 -050054phys_size_t initdram(int board_type)
wdenkf8cac652002-08-26 22:36:39 +000055{
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
stroesead10dd92003-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
Wolfgang Denk7640f412009-07-19 19:37:24 +0200120#ifdef CONFIG_CMD_DOC
wdenkf8cac652002-08-26 22:36:39 +0000121/*
122 * Map onboard TSOP-16MB DOC FLASH chip.
123 */
124void doc_init (void)
125{
126 doc_probe(DOC_BASE_ADDR);
127}
Wolfgang Denk7640f412009-07-19 19:37:24 +0200128#endif
wdenkf8cac652002-08-26 22:36:39 +0000129
Jean-Christophe PLAGNIOL-VILLARD0e8d1582008-09-10 22:48:06 +0200130#define NV_ADDR ((volatile unsigned char *) CONFIG_ENV_ADDR)
wdenkf8cac652002-08-26 22:36:39 +0000131
132/* Read from NVRAM */
133void*
134nvram_read(void *dest, const long src, size_t count)
135{
136 int i;
137 volatile unsigned char* d = (unsigned char*)dest;
138 volatile unsigned char* s = (unsigned char*)src;
139
140 for( i = 0; i < count;i++)
141 d[i] = s[i];
142
143 return dest;
144}
145
146/* Write to NVRAM */
147void
148nvram_write(long dest, const void *src, size_t count)
149{
150 int i;
151 volatile unsigned char* d = (unsigned char*)dest;
152 volatile unsigned char* s = (unsigned char*)src;
153
154 SYS_TOD_UNPROTECT();
155
156 for( i = 0; i < count;i++)
157 d[i] = s[i];
158
159 SYS_TOD_PROTECT();
160}