summaryrefslogtreecommitdiff
path: root/src/northbridge/intel/i3100/raminit_ep80579.h
blob: b816512ae8330ccbbb0f5ccb73f4c71351ce06c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
 * This file is part of the coreboot project.
 *
 * Copyright (C) 2008 Arastra, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 */

#ifndef NORTHBRIDGE_INTEL_I3100_RAMINIT_EP80579_H
#define NORTHBRIDGE_INTEL_I3100_RAMINIT_EP80579_H

#include <stdint.h>

#define __stringify_1(x)        #x
#define __stringify(x)          __stringify_1(x)
#define mdelay(msecs) udelay(1000*(msecs))

#define DIMM_SOCKETS 2

#define BAR 0x90000000

/* DDR2 SDRAM mode register (MR) */
#define MR_BURST_LENGTH	0
#define  MR_BL_4	2
#define  MR_BL_8	3
#define MR_BURST_TYPE	3
#define MR_CAS_LAT	4
#define MR_TM		7
#define MR_DLL_RST	8
#define MR_WR		9
#define MR_PD		12

/* DDR2 SDRAM extended mode register 1 (EMR(1)) */
#define EMR1_Rtt0	2
#define EMR1_Rtt1	6

#define	 EMR1_Rtt1_disable	0
#define	 EMR1_Rtt0_disable	0

#define	 EMR1_Rtt1_75ohm	0
#define	 EMR1_Rtt0_75ohm	1

#define	 EMR1_Rtt1_150ohm	1
#define	 EMR1_Rtt0_150ohm	0

#define EMR1_OCD	7
#define  EMR1_OCD_cal_exit	0
#define  EMR1_OCD_cal_default	0

/* DCALADDR values */
#define DCALADDR_MR	0
#define DCALADDR_EMR1	1
#define DCALADDR_EMR2	2
#define DCALADDR_EMR3	3

/* Debugging macros. */
#if CONFIG_DEBUG_RAM_SETUP
#define PRINTK_DEBUG(x...) printk(BIOS_DEBUG, x)
#else
#define PRINTK_DEBUG(x...)
#endif

enum ddr_speed { DDR_400, DDR_533, DDR_667, DDR_800, DDR_1066 };
enum dev_size { DEV_2Gb, DEV_1Gb, DEV_512Mb, DEV_256Mb };
enum fsb_speed { FSB_133, FSB_100 };
struct ram_timing { enum ddr_speed speed; u8 CL, tRCD, tRP; };

enum speed_bin {
	DDR2_1066E,
	DDR2_1066F,
	DDR2_800C,
	DDR2_800D,
	DDR2_800E,
	DDR2_667C,
	DDR2_667D,
	DDR2_533B,
	DDR2_533C,
	DDR2_400B,
	DDR2_400C,
	NUM_SPEED_BINS
};

struct mem_controller {
	u8* spd;
	int dimm_num;
	enum ddr_speed max_speed;
	int CL[2][3];
	int tAC[2][3];
	int tCK[2][3];
	u8 tRP[2];
	u8 tRCD[2];
	/* Max timing confs supported = number of standard speed bins + 3 other
	 * speed bins explicitly supported in SPD */
	struct ram_timing support[2][NUM_SPEED_BINS+3];
	struct ram_timing common[NUM_SPEED_BINS+3];
	int n_support[2];
	int n_common;
	struct ram_timing timing;
	u8 mastcntl;
	u8 ecc;
};

/* Function prototypes. */
void sdram_initialize(struct mem_controller *mch);
int memory_initialized(void);

#endif			/* NORTHBRIDGE_INTEL_I3100_RAMINIT_EP80579_H */