wdenk | f8cac65 | 2002-08-26 22:36:39 +0000 | [diff] [blame] | 1 | /* |
| 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> |
| 30 | #include <syscall.h> |
| 31 | #include <net.h> |
| 32 | #include <version.h> |
| 33 | #include <dtt.h> |
| 34 | #include <mpc824x.h> |
| 35 | #include <asm/processor.h> |
| 36 | #include <linux/mtd/doc2000.h> |
| 37 | |
| 38 | #include "bmw.h" |
| 39 | #include "m48t59y.h" |
| 40 | #include <pci.h> |
| 41 | |
| 42 | |
| 43 | int checkboard(void) |
| 44 | { |
| 45 | ulong busfreq = get_bus_freq(0); |
| 46 | char buf[32]; |
| 47 | |
| 48 | puts ("Board: BMW MPC8245/KAHLUA2 - CHRP (MAP B)\n"); |
| 49 | printf("Built: %s at %s\n", __DATE__ , __TIME__ ); |
| 50 | /* printf("MPLD: Revision %d\n", SYS_REVID_GET()); */ |
| 51 | printf("Local Bus at %s MHz\n", strmhz(buf, busfreq)); |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | long int initdram(int board_type) |
| 56 | { |
| 57 | return 64*1024*1024; |
| 58 | } |
| 59 | |
| 60 | |
| 61 | void |
| 62 | get_tod(void) |
| 63 | { |
| 64 | int year, month, day, hour, minute, second; |
| 65 | |
| 66 | m48_tod_get(&year, |
| 67 | &month, |
| 68 | &day, |
| 69 | &hour, |
| 70 | &minute, |
| 71 | &second); |
| 72 | |
| 73 | printf(" Current date/time: %d/%d/%d %d:%d:%d \n", |
| 74 | month, day, year, hour, minute, second); |
| 75 | |
| 76 | } |
| 77 | |
| 78 | /* |
| 79 | * EPIC, PCI, and I/O devices. |
| 80 | * Initialize Mousse Platform, probe for PCI devices, |
| 81 | * Query configuration parameters if not set. |
| 82 | */ |
| 83 | int misc_init_f (void) |
| 84 | { |
| 85 | #if 0 |
| 86 | m48_tod_init(); /* Init SGS M48T59Y TOD/NVRAM */ |
| 87 | printf("RTC: M48T589 TOD/NVRAM (%d) bytes\n", |
| 88 | TOD_NVRAM_SIZE); |
| 89 | get_tod(); |
| 90 | #endif |
| 91 | |
| 92 | sys_led_msg("BOOT"); |
| 93 | return 0; |
| 94 | } |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | /* |
| 101 | * Initialize PCI Devices, report devices found. |
| 102 | */ |
| 103 | struct pci_controller hose; |
| 104 | |
stroese | ad10dd9 | 2003-02-14 11:21:23 +0000 | [diff] [blame^] | 105 | void pci_init_board (void) |
wdenk | f8cac65 | 2002-08-26 22:36:39 +0000 | [diff] [blame] | 106 | { |
| 107 | pci_mpc824x_init(&hose); |
| 108 | /* pci_dev_init(0); */ |
| 109 | } |
| 110 | |
| 111 | /* |
| 112 | * Write characters to LCD display. |
| 113 | * Note that the bytes for the first character is the last address. |
| 114 | */ |
| 115 | void |
| 116 | sys_led_msg(char* msg) |
| 117 | { |
| 118 | LED_REG(0) = msg[3]; |
| 119 | LED_REG(1) = msg[2]; |
| 120 | LED_REG(2) = msg[1]; |
| 121 | LED_REG(3) = msg[0]; |
| 122 | } |
| 123 | |
| 124 | /* |
| 125 | * Map onboard TSOP-16MB DOC FLASH chip. |
| 126 | */ |
| 127 | void doc_init (void) |
| 128 | { |
| 129 | doc_probe(DOC_BASE_ADDR); |
| 130 | } |
| 131 | |
| 132 | #define NV_ADDR ((volatile unsigned char *) CFG_ENV_ADDR) |
| 133 | |
| 134 | /* Read from NVRAM */ |
| 135 | void* |
| 136 | nvram_read(void *dest, const long src, size_t count) |
| 137 | { |
| 138 | int i; |
| 139 | volatile unsigned char* d = (unsigned char*)dest; |
| 140 | volatile unsigned char* s = (unsigned char*)src; |
| 141 | |
| 142 | for( i = 0; i < count;i++) |
| 143 | d[i] = s[i]; |
| 144 | |
| 145 | return dest; |
| 146 | } |
| 147 | |
| 148 | /* Write to NVRAM */ |
| 149 | void |
| 150 | nvram_write(long dest, const void *src, size_t count) |
| 151 | { |
| 152 | int i; |
| 153 | volatile unsigned char* d = (unsigned char*)dest; |
| 154 | volatile unsigned char* s = (unsigned char*)src; |
| 155 | |
| 156 | SYS_TOD_UNPROTECT(); |
| 157 | |
| 158 | for( i = 0; i < count;i++) |
| 159 | d[i] = s[i]; |
| 160 | |
| 161 | SYS_TOD_PROTECT(); |
| 162 | } |