blob: 1c0540a9899e80ba21530d178a9a054ef0c16810 [file] [log] [blame]
Wolfgang Denk265817c2005-09-25 00:53:22 +02001/*
2 * (C) Copyright 2003
3 * Thomas.Lange@corelatus.se
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Wolfgang Denk265817c2005-09-25 00:53:22 +02006 */
7
8#include <common.h>
9#include <command.h>
Daniel Schwierzeck76ada5f2015-12-21 16:35:14 +010010#include <mach/au1x00.h>
Wolfgang Denk265817c2005-09-25 00:53:22 +020011#include <asm/mipsregs.h>
Jean-Christophe PLAGNIOL-VILLARD5c150102007-11-13 09:11:05 +010012#include <asm/io.h>
Wolfgang Denk265817c2005-09-25 00:53:22 +020013
Simon Glass088454c2017-03-31 08:40:25 -060014DECLARE_GLOBAL_DATA_PTR;
15
Simon Glassf1683aa2017-04-06 12:47:05 -060016int dram_init(void)
Wolfgang Denk265817c2005-09-25 00:53:22 +020017{
18 /* Sdram is setup by assembler code */
19 /* If memory could be changed, we should return the true value here */
Simon Glass088454c2017-03-31 08:40:25 -060020 gd->ram_size = 64 * 1024 * 1024;
21
22 return 0;
Wolfgang Denk265817c2005-09-25 00:53:22 +020023}
24
25#define BCSR_PCMCIA_PC0DRVEN 0x0010
26#define BCSR_PCMCIA_PC0RST 0x0080
27
Peter Tyser1e3827d2010-04-12 22:28:14 -050028/* In arch/mips/cpu/cpu.c */
Wolfgang Denk265817c2005-09-25 00:53:22 +020029void write_one_tlb( int index, u32 pagemask, u32 hi, u32 low0, u32 low1 );
30
31int checkboard (void)
32{
Jean-Christophe PLAGNIOL-VILLARD6073f612007-11-18 12:55:02 +010033#if defined(CONFIG_IDE_PCMCIA) && 0
Wolfgang Denk265817c2005-09-25 00:53:22 +020034 u16 status;
Jean-Christophe PLAGNIOL-VILLARD6073f612007-11-18 12:55:02 +010035#endif
Wolfgang Denk265817c2005-09-25 00:53:22 +020036 /* volatile u32 *pcmcia_bcsr = (u32*)(DB1000_BCSR_ADDR+0x10); */
37 volatile u32 *sys_counter = (volatile u32*)SYS_COUNTER_CNTRL;
38 u32 proc_id;
39
40 *sys_counter = 0x100; /* Enable 32 kHz oscillator for RTC/TOY */
41
Shinya Kuribayashie2ad8422008-05-30 00:53:38 +090042 proc_id = read_c0_prid();
Wolfgang Denk265817c2005-09-25 00:53:22 +020043
44 switch (proc_id >> 24) {
45 case 0:
46 puts ("Board: Pb1000\n");
47 printf ("CPU: Au1000 396 MHz, id: 0x%02x, rev: 0x%02x\n",
48 (proc_id >> 8) & 0xFF, proc_id & 0xFF);
49 break;
50 case 1:
51 puts ("Board: Pb1500\n");
52 printf ("CPU: Au1500, id: 0x%02x, rev: 0x%02x\n",
53 (proc_id >> 8) & 0xFF, proc_id & 0xFF);
54 break;
55 case 2:
56 puts ("Board: Pb1100\n");
57 printf ("CPU: Au1100, 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 }
Jean-Christophe PLAGNIOL-VILLARD5c150102007-11-13 09:11:05 +010063
64 set_io_port_base(0);
65
Wolfgang Denk265817c2005-09-25 00:53:22 +020066#if defined(CONFIG_IDE_PCMCIA) && 0
67 /* Enable 3.3 V on slot 0 ( VCC )
68 No 5V */
69 status = 4;
70 *pcmcia_bcsr = status;
71
72 status |= BCSR_PCMCIA_PC0DRVEN;
73 *pcmcia_bcsr = status;
74 au_sync();
75
76 udelay(300*1000);
77
78 status |= BCSR_PCMCIA_PC0RST;
79 *pcmcia_bcsr = status;
80 au_sync();
81
82 udelay(100*1000);
83
84 /* PCMCIA is on a 36 bit physical address.
85 We need to map it into a 32 bit addresses */
86
87#if 0
88 /* We dont need theese unless we run whole pcmcia package */
89 write_one_tlb(20, /* index */
90 0x01ffe000, /* Pagemask, 16 MB pages */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020091 CONFIG_SYS_PCMCIA_IO_BASE, /* Hi */
Wolfgang Denk265817c2005-09-25 00:53:22 +020092 0x3C000017, /* Lo0 */
93 0x3C200017); /* Lo1 */
94
95 write_one_tlb(21, /* index */
96 0x01ffe000, /* Pagemask, 16 MB pages */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020097 CONFIG_SYS_PCMCIA_ATTR_BASE, /* Hi */
Wolfgang Denk265817c2005-09-25 00:53:22 +020098 0x3D000017, /* Lo0 */
99 0x3D200017); /* Lo1 */
100#endif /* 0 */
101 write_one_tlb(22, /* index */
102 0x01ffe000, /* Pagemask, 16 MB pages */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200103 CONFIG_SYS_PCMCIA_MEM_ADDR, /* Hi */
Wolfgang Denk265817c2005-09-25 00:53:22 +0200104 0x3E000017, /* Lo0 */
105 0x3E200017); /* Lo1 */
106#endif /* CONFIG_IDE_PCMCIA */
107
108 return 0;
109}