rewrite of memory detection code, should be fix #1909
[openwrt/openwrt.git] / target / linux / adm5120-2.6 / files / include / asm-mips / mach-adm5120 / adm5120_mpmc.h
1 /*
2 * $Id$
3 *
4 * ADM5120 MPMC (Multiport Memory Controller) register definitions
5 *
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 *
24 */
25
26 #ifndef _ADM5120_MPMC_H_
27 #define _ADM5120_MPMC_H_
28
29 #define MPMC_REG_CTRL 0x0000
30 #define MPMC_REG_STATUS 0x0004
31 #define MPMC_REG_CONF 0x0008
32 #define MPMC_REG_DC 0x0020
33 #define MPMC_REG_DR 0x0024
34 #define MPMC_REG_DRP 0x0030
35
36 #define MPMC_REG_DC0 0x0100
37 #define MPMC_REG_DRC0 0x0104
38 #define MPMC_REG_DC1 0x0120
39 #define MPMC_REG_DRC1 0x0124
40 #define MPMC_REG_DC2 0x0140
41 #define MPMC_REG_DRC2 0x0144
42 #define MPMC_REG_DC3 0x0160
43 #define MPMC_REG_DRC3 0x0164
44 #define MPMC_REG_SC0 0x0200 /* for F_CS1_N */
45 #define MPMC_REG_SC1 0x0220 /* for F_CS0_N */
46 #define MPMC_REG_SC2 0x0240
47 #define MPMC_REG_SC3 0x0260
48
49 #define MPMC_CTRL_AM ( 1 << 1 )
50
51 /* Dynamic Control register bits */
52 #define MPMC_DC_CE ( 1 << 0 )
53 #define MPMC_DC_DMC ( 1 << 1 )
54 #define MPMC_DC_SRR ( 1 << 2 )
55 #define MPMC_DC_SI_SHIFT 7
56 #define MPMC_DC_SI_MASK ( 3 << 7 )
57 #define MPMC_DC_SI_NORMAL ( 0 << 7 )
58 #define MPMC_DC_SI_MODE ( 1 << 7 )
59 #define MPMC_DC_SI_PALL ( 2 << 7 )
60 #define MPMC_DC_SI_NOP ( 3 << 7 )
61
62 #define SRAM_REG_CONF 0x00
63 #define SRAM_REG_WWE 0x04
64 #define SRAM_REG_WOE 0x08
65 #define SRAM_REG_WRD 0x0C
66 #define SRAM_REG_WPG 0x10
67 #define SRAM_REG_WWR 0x14
68 #define SRAM_REG_WTR 0x18
69
70 /* Dynamic Configuration register bits */
71 #define DC_BE (1 << 19) /* buffer enable */
72 #define DC_RW_SHIFT 28 /* shift for number of rows */
73 #define DC_RW_MASK 0x03
74 #define DC_NB_SHIFT 26 /* shift for number of banks */
75 #define DC_NB_MASK 0x01
76 #define DC_CW_SHIFT 22 /* shift for number of columns */
77 #define DC_CW_MASK 0x07
78 #define DC_DW_SHIFT 7 /* shift for device width */
79 #define DC_DW_MASK 0x03
80
81 /* Static Configuration register bits */
82 #define SC_MW_MASK 0x03 /* memory width mask */
83 #define SC_MW_8 0x00 /* 8 bit memory width */
84 #define SC_MW_16 0x01 /* 16 bit memory width */
85 #define SC_MW_32 0x02 /* 32 bit memory width */
86
87 #endif /* _ADM5120_MPMC_H_ */