blob: f3e6110077522b0fcb10b7a597047031261cb686 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Wolfgang Denk265817c2005-09-25 00:53:22 +02002/*
3 * (C) Copyright 2003
4 * Thomas.Lange@corelatus.se
Wolfgang Denk265817c2005-09-25 00:53:22 +02005 */
6
7#include <common.h>
8#include <command.h>
Daniel Schwierzeck76ada5f2015-12-21 16:35:14 +01009#include <mach/au1x00.h>
Wolfgang Denk265817c2005-09-25 00:53:22 +020010#include <asm/mipsregs.h>
Jean-Christophe PLAGNIOL-VILLARD5c150102007-11-13 09:11:05 +010011#include <asm/io.h>
Wolfgang Denk265817c2005-09-25 00:53:22 +020012
Simon Glass088454c2017-03-31 08:40:25 -060013DECLARE_GLOBAL_DATA_PTR;
14
Simon Glassf1683aa2017-04-06 12:47:05 -060015int dram_init(void)
Wolfgang Denk265817c2005-09-25 00:53:22 +020016{
17 /* Sdram is setup by assembler code */
18 /* If memory could be changed, we should return the true value here */
Simon Glass088454c2017-03-31 08:40:25 -060019 gd->ram_size = 64 * 1024 * 1024;
20
21 return 0;
Wolfgang Denk265817c2005-09-25 00:53:22 +020022}
23
24#define BCSR_PCMCIA_PC0DRVEN 0x0010
25#define BCSR_PCMCIA_PC0RST 0x0080
26
Peter Tyser1e3827d2010-04-12 22:28:14 -050027/* In arch/mips/cpu/cpu.c */
Wolfgang Denk265817c2005-09-25 00:53:22 +020028void write_one_tlb( int index, u32 pagemask, u32 hi, u32 low0, u32 low1 );
29
30int checkboard (void)
31{
Jean-Christophe PLAGNIOL-VILLARD6073f612007-11-18 12:55:02 +010032#if defined(CONFIG_IDE_PCMCIA) && 0
Wolfgang Denk265817c2005-09-25 00:53:22 +020033 u16 status;
Jean-Christophe PLAGNIOL-VILLARD6073f612007-11-18 12:55:02 +010034#endif
Wolfgang Denk265817c2005-09-25 00:53:22 +020035 /* volatile u32 *pcmcia_bcsr = (u32*)(DB1000_BCSR_ADDR+0x10); */
36 volatile u32 *sys_counter = (volatile u32*)SYS_COUNTER_CNTRL;
37 u32 proc_id;
38
39 *sys_counter = 0x100; /* Enable 32 kHz oscillator for RTC/TOY */
40
Shinya Kuribayashie2ad8422008-05-30 00:53:38 +090041 proc_id = read_c0_prid();
Wolfgang Denk265817c2005-09-25 00:53:22 +020042
43 switch (proc_id >> 24) {
44 case 0:
45 puts ("Board: Pb1000\n");
46 printf ("CPU: Au1000 396 MHz, id: 0x%02x, rev: 0x%02x\n",
47 (proc_id >> 8) & 0xFF, proc_id & 0xFF);
48 break;
49 case 1:
50 puts ("Board: Pb1500\n");
51 printf ("CPU: Au1500, id: 0x%02x, rev: 0x%02x\n",
52 (proc_id >> 8) & 0xFF, proc_id & 0xFF);
53 break;
54 case 2:
55 puts ("Board: Pb1100\n");
56 printf ("CPU: Au1100, id: 0x%02x, rev: 0x%02x\n",
57 (proc_id >> 8) & 0xFF, proc_id & 0xFF);
58 break;
59 default:
60 printf ("Unsupported cpu %d, proc_id=0x%x\n", proc_id >> 24, proc_id);
61 }
Jean-Christophe PLAGNIOL-VILLARD5c150102007-11-13 09:11:05 +010062
63 set_io_port_base(0);
64
Wolfgang Denk265817c2005-09-25 00:53:22 +020065#if defined(CONFIG_IDE_PCMCIA) && 0
66 /* Enable 3.3 V on slot 0 ( VCC )
67 No 5V */
68 status = 4;
69 *pcmcia_bcsr = status;
70
71 status |= BCSR_PCMCIA_PC0DRVEN;
72 *pcmcia_bcsr = status;
73 au_sync();
74
75 udelay(300*1000);
76
77 status |= BCSR_PCMCIA_PC0RST;
78 *pcmcia_bcsr = status;
79 au_sync();
80
81 udelay(100*1000);
82
83 /* PCMCIA is on a 36 bit physical address.
84 We need to map it into a 32 bit addresses */
85
86#if 0
87 /* We dont need theese unless we run whole pcmcia package */
88 write_one_tlb(20, /* index */
89 0x01ffe000, /* Pagemask, 16 MB pages */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020090 CONFIG_SYS_PCMCIA_IO_BASE, /* Hi */
Wolfgang Denk265817c2005-09-25 00:53:22 +020091 0x3C000017, /* Lo0 */
92 0x3C200017); /* Lo1 */
93
94 write_one_tlb(21, /* index */
95 0x01ffe000, /* Pagemask, 16 MB pages */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020096 CONFIG_SYS_PCMCIA_ATTR_BASE, /* Hi */
Wolfgang Denk265817c2005-09-25 00:53:22 +020097 0x3D000017, /* Lo0 */
98 0x3D200017); /* Lo1 */
99#endif /* 0 */
100 write_one_tlb(22, /* index */
101 0x01ffe000, /* Pagemask, 16 MB pages */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200102 CONFIG_SYS_PCMCIA_MEM_ADDR, /* Hi */
Wolfgang Denk265817c2005-09-25 00:53:22 +0200103 0x3E000017, /* Lo0 */
104 0x3E200017); /* Lo1 */
105#endif /* CONFIG_IDE_PCMCIA */
106
107 return 0;
108}