xref: /linux/arch/mips/include/asm/mach-rc32434/ddr.h (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
1*384740dcSRalf Baechle /*
2*384740dcSRalf Baechle  *  Definitions for the DDR registers
3*384740dcSRalf Baechle  *
4*384740dcSRalf Baechle  *  Copyright 2002 Ryan Holm <ryan.holmQVist@idt.com>
5*384740dcSRalf Baechle  *  Copyright 2008 Florian Fainelli <florian@openwrt.org>
6*384740dcSRalf Baechle  *
7*384740dcSRalf Baechle  *  This program is free software; you can redistribute  it and/or modify it
8*384740dcSRalf Baechle  *  under  the terms of  the GNU General  Public License as published by the
9*384740dcSRalf Baechle  *  Free Software Foundation;  either version 2 of the  License, or (at your
10*384740dcSRalf Baechle  *  option) any later version.
11*384740dcSRalf Baechle  *
12*384740dcSRalf Baechle  *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
13*384740dcSRalf Baechle  *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
14*384740dcSRalf Baechle  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
15*384740dcSRalf Baechle  *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
16*384740dcSRalf Baechle  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17*384740dcSRalf Baechle  *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
18*384740dcSRalf Baechle  *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19*384740dcSRalf Baechle  *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
20*384740dcSRalf Baechle  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21*384740dcSRalf Baechle  *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22*384740dcSRalf Baechle  *
23*384740dcSRalf Baechle  *  You should have received a copy of the  GNU General Public License along
24*384740dcSRalf Baechle  *  with this program; if not, write  to the Free Software Foundation, Inc.,
25*384740dcSRalf Baechle  *  675 Mass Ave, Cambridge, MA 02139, USA.
26*384740dcSRalf Baechle  *
27*384740dcSRalf Baechle  */
28*384740dcSRalf Baechle 
29*384740dcSRalf Baechle #ifndef _ASM_RC32434_DDR_H_
30*384740dcSRalf Baechle #define _ASM_RC32434_DDR_H_
31*384740dcSRalf Baechle 
32*384740dcSRalf Baechle #include <asm/mach-rc32434/rb.h>
33*384740dcSRalf Baechle 
34*384740dcSRalf Baechle /* DDR register structure */
35*384740dcSRalf Baechle struct ddr_ram {
36*384740dcSRalf Baechle 	u32 ddrbase;
37*384740dcSRalf Baechle 	u32 ddrmask;
38*384740dcSRalf Baechle 	u32 res1;
39*384740dcSRalf Baechle 	u32 res2;
40*384740dcSRalf Baechle 	u32 ddrc;
41*384740dcSRalf Baechle 	u32 ddrabase;
42*384740dcSRalf Baechle 	u32 ddramask;
43*384740dcSRalf Baechle 	u32 ddramap;
44*384740dcSRalf Baechle 	u32 ddrcust;
45*384740dcSRalf Baechle 	u32 ddrrdc;
46*384740dcSRalf Baechle 	u32 ddrspare;
47*384740dcSRalf Baechle };
48*384740dcSRalf Baechle 
49*384740dcSRalf Baechle #define DDR0_PHYS_ADDR		0x18018000
50*384740dcSRalf Baechle 
51*384740dcSRalf Baechle /* DDR banks masks */
52*384740dcSRalf Baechle #define DDR_MASK		0xffff0000
53*384740dcSRalf Baechle #define DDR0_BASE_MSK		DDR_MASK
54*384740dcSRalf Baechle #define DDR1_BASE_MSK		DDR_MASK
55*384740dcSRalf Baechle 
56*384740dcSRalf Baechle /* DDR bank0 registers */
57*384740dcSRalf Baechle #define RC32434_DDR0_ATA_BIT		5
58*384740dcSRalf Baechle #define RC32434_DDR0_ATA_MSK		0x000000E0
59*384740dcSRalf Baechle #define RC32434_DDR0_DBW_BIT		8
60*384740dcSRalf Baechle #define RC32434_DDR0_DBW_MSK		0x00000100
61*384740dcSRalf Baechle #define RC32434_DDR0_WR_BIT		9
62*384740dcSRalf Baechle #define RC32434_DDR0_WR_MSK		0x00000600
63*384740dcSRalf Baechle #define RC32434_DDR0_PS_BIT		11
64*384740dcSRalf Baechle #define RC32434_DDR0_PS_MSK		0x00001800
65*384740dcSRalf Baechle #define RC32434_DDR0_DTYPE_BIT		13
66*384740dcSRalf Baechle #define RC32434_DDR0_DTYPE_MSK		0x0000e000
67*384740dcSRalf Baechle #define RC32434_DDR0_RFC_BIT		16
68*384740dcSRalf Baechle #define RC32434_DDR0_RFC_MSK		0x000f0000
69*384740dcSRalf Baechle #define RC32434_DDR0_RP_BIT		20
70*384740dcSRalf Baechle #define RC32434_DDR0_RP_MSK		0x00300000
71*384740dcSRalf Baechle #define RC32434_DDR0_AP_BIT		22
72*384740dcSRalf Baechle #define RC32434_DDR0_AP_MSK		0x00400000
73*384740dcSRalf Baechle #define RC32434_DDR0_RCD_BIT		23
74*384740dcSRalf Baechle #define RC32434_DDR0_RCD_MSK		0x01800000
75*384740dcSRalf Baechle #define RC32434_DDR0_CL_BIT		25
76*384740dcSRalf Baechle #define RC32434_DDR0_CL_MSK		0x06000000
77*384740dcSRalf Baechle #define RC32434_DDR0_DBM_BIT		27
78*384740dcSRalf Baechle #define RC32434_DDR0_DBM_MSK		0x08000000
79*384740dcSRalf Baechle #define RC32434_DDR0_SDS_BIT		28
80*384740dcSRalf Baechle #define RC32434_DDR0_SDS_MSK		0x10000000
81*384740dcSRalf Baechle #define RC32434_DDR0_ATP_BIT		29
82*384740dcSRalf Baechle #define RC32434_DDR0_ATP_MSK		0x60000000
83*384740dcSRalf Baechle #define RC32434_DDR0_RE_BIT		31
84*384740dcSRalf Baechle #define RC32434_DDR0_RE_MSK		0x80000000
85*384740dcSRalf Baechle 
86*384740dcSRalf Baechle /* DDR bank C registers */
87*384740dcSRalf Baechle #define RC32434_DDRC_MSK(x)		BIT_TO_MASK(x)
88*384740dcSRalf Baechle #define RC32434_DDRC_CES_BIT		0
89*384740dcSRalf Baechle #define RC32434_DDRC_ACE_BIT		1
90*384740dcSRalf Baechle 
91*384740dcSRalf Baechle /* Custom DDR bank registers */
92*384740dcSRalf Baechle #define RC32434_DCST_MSK(x)		BIT_TO_MASK(x)
93*384740dcSRalf Baechle #define RC32434_DCST_CS_BIT		0
94*384740dcSRalf Baechle #define RC32434_DCST_CS_MSK		0x00000003
95*384740dcSRalf Baechle #define RC32434_DCST_WE_BIT		2
96*384740dcSRalf Baechle #define RC32434_DCST_RAS_BIT		3
97*384740dcSRalf Baechle #define RC32434_DCST_CAS_BIT		4
98*384740dcSRalf Baechle #define RC32434_DSCT_CKE_BIT		5
99*384740dcSRalf Baechle #define RC32434_DSCT_BA_BIT		6
100*384740dcSRalf Baechle #define RC32434_DSCT_BA_MSK		0x000000c0
101*384740dcSRalf Baechle 
102*384740dcSRalf Baechle /* DDR QSC registers */
103*384740dcSRalf Baechle #define RC32434_QSC_DM_BIT		0
104*384740dcSRalf Baechle #define RC32434_QSC_DM_MSK		0x00000003
105*384740dcSRalf Baechle #define RC32434_QSC_DQSBS_BIT		2
106*384740dcSRalf Baechle #define RC32434_QSC_DQSBS_MSK		0x000000fc
107*384740dcSRalf Baechle #define RC32434_QSC_DB_BIT		8
108*384740dcSRalf Baechle #define RC32434_QSC_DB_MSK		0x00000100
109*384740dcSRalf Baechle #define RC32434_QSC_DBSP_BIT		9
110*384740dcSRalf Baechle #define RC32434_QSC_DBSP_MSK		0x01fffe00
111*384740dcSRalf Baechle #define RC32434_QSC_BDP_BIT		25
112*384740dcSRalf Baechle #define RC32434_QSC_BDP_MSK		0x7e000000
113*384740dcSRalf Baechle 
114*384740dcSRalf Baechle /* DDR LLC registers */
115*384740dcSRalf Baechle #define RC32434_LLC_EAO_BIT		0
116*384740dcSRalf Baechle #define RC32434_LLC_EAO_MSK		0x00000001
117*384740dcSRalf Baechle #define RC32434_LLC_EO_BIT		1
118*384740dcSRalf Baechle #define RC32434_LLC_EO_MSK		0x0000003e
119*384740dcSRalf Baechle #define RC32434_LLC_FS_BIT		6
120*384740dcSRalf Baechle #define RC32434_LLC_FS_MSK		0x000000c0
121*384740dcSRalf Baechle #define RC32434_LLC_AS_BIT		8
122*384740dcSRalf Baechle #define RC32434_LLC_AS_MSK		0x00000700
123*384740dcSRalf Baechle #define RC32434_LLC_SP_BIT		11
124*384740dcSRalf Baechle #define RC32434_LLC_SP_MSK		0x001ff800
125*384740dcSRalf Baechle 
126*384740dcSRalf Baechle /* DDR LLFC registers */
127*384740dcSRalf Baechle #define RC32434_LLFC_MSK(x)		BIT_TO_MASK(x)
128*384740dcSRalf Baechle #define RC32434_LLFC_MEN_BIT		0
129*384740dcSRalf Baechle #define RC32434_LLFC_EAN_BIT		1
130*384740dcSRalf Baechle #define RC32434_LLFC_FF_BIT		2
131*384740dcSRalf Baechle 
132*384740dcSRalf Baechle /* DDR DLLTA registers */
133*384740dcSRalf Baechle #define RC32434_DLLTA_ADDR_BIT		2
134*384740dcSRalf Baechle #define RC32434_DLLTA_ADDR_MSK		0xfffffffc
135*384740dcSRalf Baechle 
136*384740dcSRalf Baechle /* DDR DLLED registers */
137*384740dcSRalf Baechle #define RC32434_DLLED_MSK(x)		BIT_TO_MASK(x)
138*384740dcSRalf Baechle #define RC32434_DLLED_DBE_BIT		0
139*384740dcSRalf Baechle #define RC32434_DLLED_DTE_BIT		1
140*384740dcSRalf Baechle 
141*384740dcSRalf Baechle #endif	/* _ASM_RC32434_DDR_H_ */
142