summaryrefslogtreecommitdiff
path: root/src/southbridge/amd/cimx/sb800/fan.h
blob: 16e33e6f997c113e0121f299cc15dd271a105bd3 (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
 * This file is part of the coreboot project.
 *
 * Copyright (C) 2012 Sage Electronic Engineering, LLC
 *
 * 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 _SB800_FAN_H_
#define _SB800_FAN_H_

#ifndef __PRE_RAM__
void init_sb800_IMC_fans(device_t dev);
void init_sb800_MANUAL_fans(device_t dev);
#endif

/* Fan Register Definitions */
#define FAN_0_OFFSET				0x00
#define FAN_1_OFFSET				0x10
#define FAN_2_OFFSET				0x20
#define FAN_3_OFFSET				0x30
#define FAN_4_OFFSET				0x40

#define FAN_INPUT_CONTROL_REG		0x00
#define FAN_CONTROL_REG				0x01
#define FAN_FREQUENCY_REG			0x02
#define FAN_LOW_DUTY_REG			0x03
#define FAN_MED_DUTY_REG			0x04
#define FAN_MULTIPLIER_REG			0x05
#define FAN_LOW_TEMP_LO_REG			0x06
#define FAN_LOW_TEMP_HI_REG			0x07
#define FAN_MED_TEMP_LO_REG			0x08
#define FAN_MED_TEMP_HI_REG			0x09
#define FAN_HIGH_TEMP_LO_REG		0x0A
#define FAN_HIGH_TEMP_HI_REG		0x0B
#define FAN_LINEAR_RANGE_REG		0x0C
#define FAN_LINEAR_HOLD_REG			0x0D

/* FanXInputControl Definitions */
#define FAN_INPUT_INTERNAL_DIODE	0
#define FAN_INPUT_TEMP0				1
#define FAN_INPUT_TEMP1				2
#define FAN_INPUT_TEMP2				3
#define FAN_INPUT_TEMP3				4
#define FAN_INPUT_TEMP0_FILTER		5
#define FAN_INPUT_ZERO				6
#define FAN_INPUT_DISABLED			7

/* FanXControl Definitions */
#define FAN_AUTOMODE				(1 << 0)
#define FAN_LINEARMODE				(1 << 1)
#define FAN_STEPMODE				0 /* ~(1 << 1) */
#define FAN_POLARITY_HIGH			(1 << 2)
#define FAN_POLARITY_LOW			0 /*~(1 << 2) */

/* FanXLowDuty Definitions */
#define FAN_POLARITY_HIGH_MAX_SPEED	0xff
#define FAN_POLARITY_LOW_MAX_SPEED	0x00

/* FanXFreq Definitions */
/* Typically, fans run at 25KHz */
#define FREQ_28KHZ			0x0
#define FREQ_25KHZ			0x1
#define FREQ_23KHZ			0x2
#define FREQ_21KHZ			0x3
#define FREQ_29KHZ			0x4
#define FREQ_18KHZ			0x5
/* Any value > 05h and < F7: Freq = 1/(FreqDiv * 2048 * 15ns) */
#define FREQ_100HZ			0xF7
#define FREQ_87HZ			0xF8
#define FREQ_58HZ			0xF9
#define FREQ_44HZ			0xFA
#define FREQ_35HZ			0xFB
#define FREQ_29HZ			0xFC
#define FREQ_22HZ			0xFD
#define FREQ_14HZ			0xFE
#define FREQ_11HZ			0xFF


/* IMC Fan Control Definitions */
#define IMC_MODE1_FAN_ENABLED					( 1 << 0 )
#define IMC_MODE1_FAN_IMC_CONTROLLED			( 1 << 2 )
#define IMC_MODE1_FAN_LINEAR_MODE				( 1 << 4 )
#define IMC_MODE1_FAN_STEP_MODE					0 /* ~( 1 << 4 ) */
#define IMC_MODE1_NO_FANOUT						0 /* ~( 7 << 5 ) */
#define IMC_MODE1_FANOUT0						( 1 << 5 )
#define IMC_MODE1_FANOUT1						( 2 << 5 )
#define IMC_MODE1_FANOUT2						( 3 << 5 )
#define IMC_MODE1_FANOUT3						( 4 << 5 )
#define IMC_MODE1_FANOUT4						( 5 << 5 )

#define IMC_MODE2_TEMPIN_NONE					0 /* ~( 7 << 0) */
#define IMC_MODE2_TEMPIN_0						1
#define IMC_MODE2_TEMPIN_1						2
#define IMC_MODE2_TEMPIN_2						3
#define IMC_MODE2_TEMPIN_3						4
#define IMC_MODE2_INT_TEMPIN					5
#define IMC_MODE2_TEMPIN_SB_TSI					6
#define IMC_MODE2_TEMPIN_OTHER					7
#define IMC_MODE2_FANIN_NONE					0 /* ~ (7 << 3) */
#define IMC_MODE2_FANIN0						( 1 << 3 )
#define IMC_MODE2_FANIN1						( 2 << 3 )
#define IMC_MODE2_FANIN2						( 3 << 3 )
#define IMC_MODE2_FANIN3						( 4 << 3 )
#define IMC_MODE2_FANIN4						( 5 << 3 )
#define IMC_MODE2_TEMP_AVERAGING_ENABLED		( 1 << 6 )
#define IMC_MODE2_TEMP_AVERAGING_DISABLED		0 /* ~( 1 << 6 ) */

#define IMC_TEMP_SENSOR_ON_SMBUS_0				0
#define IMC_TEMP_SENSOR_ON_SMBUS_2				1
#define IMC_TEMP_SENSOR_ON_SMBUS_3				2
#define IMC_TEMP_SENSOR_ON_SMBUS_4				3

#define IMC_ZONE0								0
#define IMC_ZONE1								1
#define IMC_ZONE2								2
#define IMC_ZONE3								3
#define IMC_ZONE4								4

#define IMC_TEMPIN_TUNING_DEFAULT_MODE			0
#define IMC_TEMPIN_TUNING_HIGH_CURRENT_RATIO	1
#define IMC_TEMPIN_TUNING_HIGH_CURRENT			2
#define IMC_TEMPIN_TUNING_DISABLE_FILTERING		( 1 << 2 )

/* IMCFUNSupportBitMap - Zone enable values */
#define IMC_ENABLE_ZONE0						0x111
#define IMC_ENABLE_ZONE1						0x222
#define IMC_ENABLE_ZONE2						0x333
#define IMC_ENABLE_ZONE3						0x444
#define IMC_ENABLE_TEMPIN0						( 1 << 12 )
#define IMC_ENABLE_TEMPIN1						( 1 << 13 )
#define IMC_ENABLE_TEMPIN2						( 1 << 14 )
#define IMC_ENABLE_TEMPIN3						( 1 << 15 )

/* Array size settings */
#define IMC_FAN_THRESHOLD_COUNT					9
#define IMC_FAN_SPEED_COUNT						8
#define IMC_FAN_CONFIG_COUNT					8
#define FAN_REGISTER_COUNT						15

#endif