blob: 07a2666cdfb6a1465cfa7360b6f117170fc6560f [file] [log] [blame]
Ronald Hoogenboom56cf01f2008-02-25 19:36:20 +00001#include <arch/io.h>
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +00002#include <stdlib.h>
Stefan Reinauerd55e26f2010-04-25 13:54:30 +00003#include <superio/ite/it8716f/it8716f.h>
Ronald Hoogenboom56cf01f2008-02-25 19:36:20 +00004
5static void write_index(uint16_t port_base, uint8_t reg, uint8_t value)
6{
7 outb(reg, port_base);
8 outb(value, port_base + 1);
9}
10
11static const struct {
12 uint8_t index, value;
13} sequence[]= {
Ronald Hoogenboomfb73fa12008-06-22 14:33:17 +000014 /* Make sure we can monitor, and enable SMI# interrupt output */
15 { 0x00, 0x13},
16 /* Disable fan interrupt status bits for SMI# */
17 { 0x04, 0x37},
18 /* Disable VIN interrupt status bits for SMI# */
19 { 0x05, 0xff},
20 /* Disable fan interrupt status bits for IRQ */
21 { 0x07, 0x37},
22 /* Disable VIN interrupt status bits for IRQ */
23 { 0x08, 0xff},
24 /* Disable external sensor interrupt */
25 { 0x09, 0x87},
26 /* Enable 16 bit counter divisors */
27 { 0x0c, 0x07},
Ronald Hoogenboom56cf01f2008-02-25 19:36:20 +000028 /* Set FAN_CTL control register (0x14) polarity to high, and
29 activate fans 1, 2 and 3. */
Ronald Hoogenboomfb73fa12008-06-22 14:33:17 +000030 { 0x14, 0xd7},
Ronald Hoogenboom56cf01f2008-02-25 19:36:20 +000031 /* set the correct sensor types 1,2 thermistor; 3 diode */
32 { 0x51, 0x1c},
Ronald Hoogenboomfb73fa12008-06-22 14:33:17 +000033 /* set the 'zero' voltage for diode type sensor 3 */
Ronald Hoogenboom56cf01f2008-02-25 19:36:20 +000034 { 0x5c, 0x80},
35// { 0x56, 0xe5},
36// { 0x57, 0xe5},
Ronald Hoogenboomfb73fa12008-06-22 14:33:17 +000037 { 0x59, 0xec},
Ronald Hoogenboom56cf01f2008-02-25 19:36:20 +000038 { 0x5c, 0x00},
39 /* fan1 (controlled by temp3) control parameters */
40 /* fan off limit */
41 { 0x60, 0xff},
42 /* fan start limit */
43 { 0x61, 0x14},
44 /* ???? */
45// { 0x62, 0x00},
46 /* start PWM */
47 { 0x63, 0x27},
48 /* smooth and slope PWM */
49 { 0x64, 0x90},
50 /* direct-down and interval */
51 { 0x65, 0x03},
Ronald Hoogenboomfb73fa12008-06-22 14:33:17 +000052 /* temperature limit of fan stop for fan3 (automatic) */
53 { 0x70, 0xff},
54 /* temperature limit of fan start for fan3 (automatic) */
55 { 0x71, 0x14},
56 /* Set PWM start & slope for fan3 */
57 { 0x73, 0x20},
58 /* Initialize PWM automatic mode slope values for fan3 */
59 { 0x74, 0x90},
60 /* set smartguardian temperature interval for fan3 */
61 { 0x75, 0x03},
Ronald Hoogenboom56cf01f2008-02-25 19:36:20 +000062 /* fan1 auto controlled by temp3 */
63 { 0x15, 0x82},
Ronald Hoogenboomfb73fa12008-06-22 14:33:17 +000064 /* fan2 auto controlled by temp3 */
65 { 0x16, 0x82},
66 /* fan3 auto controlled by temp3 */
67 { 0x17, 0x82},
Ronald Hoogenboom56cf01f2008-02-25 19:36:20 +000068 /* all fans enable, fan1 ctl smart */
Ronald Hoogenboomfb73fa12008-06-22 14:33:17 +000069 { 0x13, 0x77}
Ronald Hoogenboom56cf01f2008-02-25 19:36:20 +000070};
71
Ronald Hoogenboom56cf01f2008-02-25 19:36:20 +000072/*
73 * Called from superio.c
74 */
75void init_ec(uint16_t base)
76{
77 int i;
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000078 for (i=0; i<ARRAY_SIZE(sequence); i++) {
Ronald Hoogenboom56cf01f2008-02-25 19:36:20 +000079 write_index(base, sequence[i].index, sequence[i].value);
80 }
81}