* Patch by Steven Scholz, 10 Oct 2003
[platform/kernel/u-boot.git] / board / dbau1x00 / dbau1x00.c
1 /*
2  * (C) Copyright 2003
3  * Thomas.Lange@corelatus.se
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 <command.h>
26 #include <asm/au1x00.h>
27 #include <asm/mipsregs.h>
28
29 long int initdram(int board_type)
30 {
31         /* Sdram is setup by assembler code */
32         /* If memory could be changed, we should return the true value here */
33         return 64*1024*1024;
34 }
35
36 #define BCSR_PCMCIA_PC0DRVEN            0x0010
37 #define BCSR_PCMCIA_PC0RST              0x0080
38
39 /* In cpu/mips/cpu.c */
40 void write_one_tlb( int index, u32 pagemask, u32 hi, u32 low0, u32 low1 );
41
42 int checkboard (void)
43 {
44         u16 status;
45         volatile u32 *pcmcia_bcsr = (u32*)(DB1000_BCSR_ADDR+0x10);
46         volatile u32 *phy = (u32*)(DB1000_BCSR_ADDR+0xC);
47         volatile u32 *sys_counter = (volatile u32*)SYS_COUNTER_CNTRL;
48         u32 proc_id;
49
50         *sys_counter = 0x100; /* Enable 32 kHz oscillator for RTC/TOY */
51
52         proc_id = read_32bit_cp0_register(CP0_PRID);
53
54         switch(proc_id>>24){
55         case 0:
56           puts("Board: Merlot (DbAu1000)\n");
57           printf("CPU: Au1000 396 MHz, id: 0x%02x, rev: 0x%02x\n",
58                  (proc_id>>8)&0xFF,proc_id&0xFF);
59           break;
60         default:
61           printf("Unsupported cpu %d, proc_id=0x%x\n",proc_id>>24,proc_id);
62         }
63 #ifdef CONFIG_IDE_PCMCIA
64         /* Enable 3.3 V on slot 0 ( VCC )
65            No 5V */
66         status = 4;
67         *pcmcia_bcsr = status;
68
69         status |= BCSR_PCMCIA_PC0DRVEN;
70         *pcmcia_bcsr = status;
71         au_sync();
72
73         udelay(300*1000);
74
75         status |= BCSR_PCMCIA_PC0RST;
76         *pcmcia_bcsr = status;
77         au_sync();
78
79         udelay(100*1000);
80
81         /* PCMCIA is on a 36 bit physical address.
82            We need to map it into a 32 bit addresses */
83
84 #if 0
85         /* We dont need theese unless we run whole pcmcia package */
86         write_one_tlb(20,                 /* index */
87                       0x01ffe000,         /* Pagemask, 16 MB pages */
88                       CFG_PCMCIA_IO_BASE, /* Hi */
89                       0x3C000017,         /* Lo0 */
90                       0x3C200017);        /* Lo1 */
91
92         write_one_tlb(21,                   /* index */
93                       0x01ffe000,           /* Pagemask, 16 MB pages */
94                       CFG_PCMCIA_ATTR_BASE, /* Hi */
95                       0x3D000017,           /* Lo0 */
96                       0x3D200017);          /* Lo1 */
97 #endif
98         write_one_tlb(22,                   /* index */
99                       0x01ffe000,           /* Pagemask, 16 MB pages */
100                       CFG_PCMCIA_MEM_ADDR,  /* Hi */
101                       0x3E000017,           /* Lo0 */
102                       0x3E200017);          /* Lo1 */
103
104         /* Release reset of ethernet PHY chips */
105         /* Always do this, because linux does not know about it */
106         *phy = 3;
107
108         return 0;
109 #endif
110 }