1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <common.h>
25#include <watchdog.h>
26#include <command.h>
27#include <malloc.h>
28#include <stdio_dev.h>
29#include <net.h>
30#include <timestamp.h>
31#include <dtt.h>
32#include <mpc824x.h>
33#include <asm/processor.h>
34#include <linux/mtd/doc2000.h>
35
36#include "bmw.h"
37#include "m48t59y.h"
38#include <pci.h>
39
40
41int checkboard(void)
42{
43 ulong busfreq = get_bus_freq(0);
44 char buf[32];
45
46 puts ("Board: BMW MPC8245/KAHLUA2 - CHRP (MAP B)\n");
47 printf("Built: %s at %s\n", U_BOOT_DATE, U_BOOT_TIME);
48
49 printf("Local Bus at %s MHz\n", strmhz(buf, busfreq));
50 return 0;
51}
52
53phys_size_t initdram(int board_type)
54{
55 return 64*1024*1024;
56}
57
58
59void
60get_tod(void)
61{
62 int year, month, day, hour, minute, second;
63
64 m48_tod_get(&year,
65 &month,
66 &day,
67 &hour,
68 &minute,
69 &second);
70
71 printf(" Current date/time: %d/%d/%d %d:%d:%d \n",
72 month, day, year, hour, minute, second);
73
74}
75
76
77
78
79
80
81int misc_init_f (void)
82{
83#if 0
84 m48_tod_init();
85 printf("RTC: M48T589 TOD/NVRAM (%d) bytes\n",
86 TOD_NVRAM_SIZE);
87 get_tod();
88#endif
89
90 sys_led_msg("BOOT");
91 return 0;
92}
93
94
95
96
97
98struct pci_controller hose;
99
100void pci_init_board (void)
101{
102 pci_mpc824x_init(&hose);
103
104}
105
106
107
108
109
110void
111sys_led_msg(char* msg)
112{
113 LED_REG(0) = msg[3];
114 LED_REG(1) = msg[2];
115 LED_REG(2) = msg[1];
116 LED_REG(3) = msg[0];
117}
118
119#ifdef CONFIG_CMD_DOC
120
121
122
123void doc_init (void)
124{
125 doc_probe(DOC_BASE_ADDR);
126}
127#endif
128
129#define NV_ADDR ((volatile unsigned char *) CONFIG_ENV_ADDR)
130
131
132void*
133nvram_read(void *dest, const long src, size_t count)
134{
135 int i;
136 volatile unsigned char* d = (unsigned char*)dest;
137 volatile unsigned char* s = (unsigned char*)src;
138
139 for( i = 0; i < count;i++)
140 d[i] = s[i];
141
142 return dest;
143}
144
145
146void
147nvram_write(long dest, const void *src, size_t count)
148{
149 int i;
150 volatile unsigned char* d = (unsigned char*)dest;
151 volatile unsigned char* s = (unsigned char*)src;
152
153 SYS_TOD_UNPROTECT();
154
155 for( i = 0; i < count;i++)
156 d[i] = s[i];
157
158 SYS_TOD_PROTECT();
159}
160