wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003 |
| 3 | * Thomas.Lange@corelatus.se |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <command.h> |
Daniel Schwierzeck | 536ce92 | 2015-12-21 16:35:14 +0100 | [diff] [blame] | 10 | #include <mach/au1x00.h> |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 11 | #include <asm/mipsregs.h> |
Jean-Christophe PLAGNIOL-VILLARD | 089dbb7 | 2007-11-13 09:11:05 +0100 | [diff] [blame] | 12 | #include <asm/io.h> |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 13 | |
Becky Bruce | bd99ae7 | 2008-06-09 16:03:40 -0500 | [diff] [blame] | 14 | phys_size_t initdram(int board_type) |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 15 | { |
| 16 | /* Sdram is setup by assembler code */ |
| 17 | /* If memory could be changed, we should return the true value here */ |
wdenk | 96c7a8c | 2005-01-09 22:28:56 +0000 | [diff] [blame] | 18 | return MEM_SIZE*1024*1024; |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | #define BCSR_PCMCIA_PC0DRVEN 0x0010 |
| 22 | #define BCSR_PCMCIA_PC0RST 0x0080 |
| 23 | |
Peter Tyser | 1d85dee | 2010-04-12 22:28:14 -0500 | [diff] [blame] | 24 | /* In arch/mips/cpu/cpu.c */ |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 25 | void write_one_tlb( int index, u32 pagemask, u32 hi, u32 low0, u32 low1 ); |
| 26 | |
| 27 | int checkboard (void) |
| 28 | { |
wdenk | 525d7b6 | 2005-01-22 18:13:04 +0000 | [diff] [blame] | 29 | #ifdef CONFIG_IDE_PCMCIA |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 30 | u16 status; |
wdenk | 96c7a8c | 2005-01-09 22:28:56 +0000 | [diff] [blame] | 31 | volatile u32 *pcmcia_bcsr = (u32*)(DB1XX0_BCSR_ADDR+0x10); |
wdenk | 525d7b6 | 2005-01-22 18:13:04 +0000 | [diff] [blame] | 32 | #endif /* CONFIG_IDE_PCMCIA */ |
wdenk | 96c7a8c | 2005-01-09 22:28:56 +0000 | [diff] [blame] | 33 | volatile u32 *phy = (u32*)(DB1XX0_BCSR_ADDR+0xC); |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 34 | volatile u32 *sys_counter = (volatile u32*)SYS_COUNTER_CNTRL; |
| 35 | u32 proc_id; |
| 36 | |
| 37 | *sys_counter = 0x100; /* Enable 32 kHz oscillator for RTC/TOY */ |
| 38 | |
Shinya Kuribayashi | 0fdd27e | 2008-05-30 00:53:38 +0900 | [diff] [blame] | 39 | proc_id = read_c0_prid(); |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 40 | |
wdenk | 4ea537d | 2003-12-07 18:32:37 +0000 | [diff] [blame] | 41 | switch (proc_id >> 24) { |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 42 | case 0: |
wdenk | 4ea537d | 2003-12-07 18:32:37 +0000 | [diff] [blame] | 43 | puts ("Board: Merlot (DbAu1000)\n"); |
| 44 | printf ("CPU: Au1000 396 MHz, id: 0x%02x, rev: 0x%02x\n", |
| 45 | (proc_id >> 8) & 0xFF, proc_id & 0xFF); |
| 46 | break; |
| 47 | case 1: |
| 48 | puts ("Board: DbAu1500\n"); |
| 49 | printf ("CPU: Au1500, id: 0x%02x, rev: 0x%02x\n", |
| 50 | (proc_id >> 8) & 0xFF, proc_id & 0xFF); |
| 51 | break; |
| 52 | case 2: |
| 53 | puts ("Board: DbAu1100\n"); |
| 54 | printf ("CPU: Au1100, id: 0x%02x, rev: 0x%02x\n", |
| 55 | (proc_id >> 8) & 0xFF, proc_id & 0xFF); |
| 56 | break; |
wdenk | 96c7a8c | 2005-01-09 22:28:56 +0000 | [diff] [blame] | 57 | case 3: |
| 58 | puts ("Board: DbAu1550\n"); |
| 59 | printf ("CPU: Au1550, id: 0x%02x, rev: 0x%02x\n", |
| 60 | (proc_id >> 8) & 0xFF, proc_id & 0xFF); |
| 61 | break; |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 62 | default: |
wdenk | 4ea537d | 2003-12-07 18:32:37 +0000 | [diff] [blame] | 63 | printf ("Unsupported cpu %d, proc_id=0x%x\n", proc_id >> 24, proc_id); |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 64 | } |
Jean-Christophe PLAGNIOL-VILLARD | 089dbb7 | 2007-11-13 09:11:05 +0100 | [diff] [blame] | 65 | |
| 66 | set_io_port_base(0); |
| 67 | |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 68 | #ifdef CONFIG_IDE_PCMCIA |
| 69 | /* Enable 3.3 V on slot 0 ( VCC ) |
| 70 | No 5V */ |
| 71 | status = 4; |
| 72 | *pcmcia_bcsr = status; |
| 73 | |
| 74 | status |= BCSR_PCMCIA_PC0DRVEN; |
| 75 | *pcmcia_bcsr = status; |
| 76 | au_sync(); |
| 77 | |
| 78 | udelay(300*1000); |
| 79 | |
| 80 | status |= BCSR_PCMCIA_PC0RST; |
| 81 | *pcmcia_bcsr = status; |
| 82 | au_sync(); |
| 83 | |
| 84 | udelay(100*1000); |
| 85 | |
| 86 | /* PCMCIA is on a 36 bit physical address. |
| 87 | We need to map it into a 32 bit addresses */ |
| 88 | |
| 89 | #if 0 |
| 90 | /* We dont need theese unless we run whole pcmcia package */ |
| 91 | write_one_tlb(20, /* index */ |
| 92 | 0x01ffe000, /* Pagemask, 16 MB pages */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 93 | CONFIG_SYS_PCMCIA_IO_BASE, /* Hi */ |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 94 | 0x3C000017, /* Lo0 */ |
| 95 | 0x3C200017); /* Lo1 */ |
| 96 | |
| 97 | write_one_tlb(21, /* index */ |
| 98 | 0x01ffe000, /* Pagemask, 16 MB pages */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 99 | CONFIG_SYS_PCMCIA_ATTR_BASE, /* Hi */ |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 100 | 0x3D000017, /* Lo0 */ |
| 101 | 0x3D200017); /* Lo1 */ |
wdenk | 604b7a1 | 2004-06-09 15:29:49 +0000 | [diff] [blame] | 102 | #endif /* 0 */ |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 103 | write_one_tlb(22, /* index */ |
| 104 | 0x01ffe000, /* Pagemask, 16 MB pages */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 105 | CONFIG_SYS_PCMCIA_MEM_ADDR, /* Hi */ |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 106 | 0x3E000017, /* Lo0 */ |
| 107 | 0x3E200017); /* Lo1 */ |
wdenk | 604b7a1 | 2004-06-09 15:29:49 +0000 | [diff] [blame] | 108 | #endif /* CONFIG_IDE_PCMCIA */ |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 109 | |
| 110 | /* Release reset of ethernet PHY chips */ |
| 111 | /* Always do this, because linux does not know about it */ |
| 112 | *phy = 3; |
| 113 | |
| 114 | return 0; |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 115 | } |