stroese | 46578cc | 2003-05-23 11:28:55 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2000 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 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 | long int spd_sdram (void); |
| 24 | |
| 25 | #include <common.h> |
| 26 | #include "bubinga405ep.h" |
| 27 | #include <asm/processor.h> |
| 28 | |
| 29 | |
| 30 | int board_pre_init (void) |
| 31 | { |
| 32 | mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */ |
| 33 | mtdcr (uicer, 0x00000000); /* disable all ints */ |
| 34 | mtdcr (uiccr, 0x00000010); |
| 35 | mtdcr (uicpr, 0xFFFF7FF0); /* set int polarities */ |
| 36 | mtdcr (uictr, 0x00000010); /* set int trigger levels */ |
| 37 | mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */ |
| 38 | |
| 39 | #if 0 |
| 40 | #define mtebc(reg, data) mtdcr(ebccfga,reg);mtdcr(ebccfgd,data) |
| 41 | /* CS1 */ |
| 42 | /* BAS=0xF00,BS=0x0(1MB),BU=0x3(R/W),BW=0x0( 8 bits) */ |
| 43 | mtebc (pb1ap, 0x02815480); |
| 44 | mtebc (pb1cr, 0xF0018000); |
| 45 | |
| 46 | p = (unsigned int*)0xEF600708; |
| 47 | t = *p; |
| 48 | t = t | 0x00000400; |
| 49 | *p = t; |
| 50 | |
| 51 | /* BAS=0xF01,BS=0x0(1MB),BU=0x3(R/W),BW=0x0(8 bits) */ |
| 52 | mtebc (pb2ap, 0x04815A80); |
| 53 | mtebc (pb2cr, 0xF0118000); |
| 54 | |
| 55 | /* BAS=0xF02,BS=0x0(1MB),BU=0x3(R/W),BW=0x0( 8 bits) */ |
| 56 | mtebc (pb3ap, 0x01815280); |
| 57 | mtebc (pb3cr, 0xF0218000); |
| 58 | |
| 59 | /* BAS=0xF03,BS=0x0(1MB),BU=0x3(R/W),BW=0x0(8 bits) */ |
| 60 | mtebc (pb7ap, 0x01815280); |
| 61 | mtebc (pb7cr, 0xF0318000); |
| 62 | |
| 63 | |
| 64 | /* set UART1 control to select CTS/RTS */ |
| 65 | #define FPGA_BRDC 0xF0300004 |
| 66 | *(volatile char *) (FPGA_BRDC) |= 0x1; |
| 67 | |
| 68 | #endif |
| 69 | |
| 70 | return 0; |
| 71 | } |
| 72 | |
| 73 | |
| 74 | /* ------------------------------------------------------------------------- */ |
| 75 | |
| 76 | /* |
| 77 | * Check Board Identity: |
| 78 | */ |
| 79 | |
| 80 | int checkboard (void) |
| 81 | { |
| 82 | unsigned char *s = getenv ("serial#"); |
| 83 | unsigned char *e; |
| 84 | |
| 85 | puts ("Board: "); |
| 86 | |
| 87 | if (!s || strncmp (s, "BUBINGA405EP", 9)) { |
| 88 | puts ("### No HW ID - assuming WALNUT405"); |
| 89 | } else { |
| 90 | for (e = s; *e; ++e) { |
| 91 | if (*e == ' ') |
| 92 | break; |
| 93 | } |
| 94 | for (; s < e; ++s) { |
| 95 | putc (*s); |
| 96 | } |
| 97 | } |
| 98 | putc ('\n'); |
| 99 | |
| 100 | return (0); |
| 101 | } |
| 102 | |
| 103 | |
| 104 | /* ------------------------------------------------------------------------- |
| 105 | initdram(int board_type) reads EEPROM via I2c. EEPROM contains all of |
| 106 | the necessary info for SDRAM controller configuration |
| 107 | ------------------------------------------------------------------------- */ |
| 108 | long int initdram (int board_type) |
| 109 | { |
| 110 | long int ret; |
| 111 | |
| 112 | ret = spd_sdram (); |
| 113 | return ret; |
| 114 | } |
| 115 | |
| 116 | /* ------------------------------------------------------------------------- */ |
| 117 | |
| 118 | int testdram (void) |
| 119 | { |
| 120 | /* TODO: XXX XXX XXX */ |
| 121 | printf ("test: xxx MB - ok\n"); |
| 122 | |
| 123 | return (0); |
| 124 | } |
| 125 | |
| 126 | /* ------------------------------------------------------------------------- */ |