2 * This file is part of the coreboot project.
4 * Copyright (C) 2005 Tyan
5 * (Written by Yinghai Lu <yhlu@tyan.com> for Tyan)
6 * Copyright (C) 2007 Ward Vandewege <ward@gnu.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <device/device.h>
24 #include <console/console.h>
25 #include <device/smbus.h>
29 * Do some S2881-specific HWM initialization for the ADT7463 chip.
31 * Should be factored out so that it can be more general.
33 * See Analog Devices ADT7463 datasheet, Rev C (2004):
34 * http://www.analog.com/en/prod/0,,766_825_ADT7463,00.html
36 static void adt7463_init(device_t adt7463)
40 printk(BIOS_DEBUG, "ADT7463 is %s\n", dev_path(adt7463));
42 /* Set all fans to 'Fastest Speed Calculated by All 3 Temperature
43 * Channels Controls PWMx'.
45 result = smbus_write_byte(adt7463, 0x5c, 0xc2);
46 result = smbus_write_byte(adt7463, 0x5d, 0xc2);
47 result = smbus_write_byte(adt7463, 0x5e, 0xc2);
49 /* Make sure that our fans never stop when temp. falls below Tmin,
50 * but rather keep going at minimum duty cycle (applies to automatic
51 * fan control mode only).
53 result = smbus_write_byte(adt7463, 0x62, 0xc0);
55 /* Set minimum PWM duty cycle to 25%, rather than the default 50%. */
56 result = smbus_write_byte(adt7463, 0x64, 0x40);
57 result = smbus_write_byte(adt7463, 0x65, 0x40);
58 result = smbus_write_byte(adt7463, 0x66, 0x40);
60 /* Set Tmin to 55C, rather than the default 90C. Above this temperature
61 * the fans will start blowing harder as temperature increases
62 * (automatic mode only).
64 result = smbus_write_byte(adt7463, 0x67, 0x37);
65 result = smbus_write_byte(adt7463, 0x68, 0x37);
66 result = smbus_write_byte(adt7463, 0x69, 0x37);
68 /* Set THERM limit to 70C, rather than the default 100C.
69 * The fans will kick in at 100% if the sensors reach this temperature,
70 * (only in automatic mode, but supposedly even when hardware is
71 * locked up). This is a failsafe measure.
73 result = smbus_write_byte(adt7463, 0x6a, 0x46);
74 result = smbus_write_byte(adt7463, 0x6b, 0x46);
75 result = smbus_write_byte(adt7463, 0x6c, 0x46);
77 /* Remote temperature 1 offset (LSB == 0.25C). */
78 result = smbus_write_byte(adt7463, 0x70, 0x02);
80 /* Remote temperature 2 offset (LSB == 0.25C). */
81 result = smbus_write_byte(adt7463, 0x72, 0x01);
83 /* Set TACH measurements to normal (1/second). */
84 result = smbus_write_byte(adt7463, 0x78, 0xf0);
86 printk(BIOS_DEBUG, "ADT7463 properly initialized\n");
89 static void adt7463_noop(device_t dummy)
93 static struct device_operations adt7463_operations = {
94 .read_resources = adt7463_noop,
95 .set_resources = adt7463_noop,
96 .enable_resources = adt7463_noop,
100 static void enable_dev(struct device *dev)
102 dev->ops = &adt7463_operations;
105 struct chip_operations drivers_i2c_adt7463_ops = {
107 .enable_dev = enable_dev,