diff options
author | Elyes HAOUAS <ehaouas@noos.fr> | 2019-10-08 21:44:02 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2019-10-10 13:52:45 +0000 |
commit | edfe125bf9441fdfcfe37855ddcdc594d5e652aa (patch) | |
tree | 7c22d83d49db18f769a325457f3eb39d54267801 /src/mainboard/kontron/986lcd-m | |
parent | 7f9b90f0a68849dc6bf60da7b6074361e701cae1 (diff) |
mb/{ibase/mb899,kontron/986lcd-m}: Use pnp_write_hwm5_index function
Change-Id: If30a17d053da8f0758085fc36469b564d46049cd
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35901
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/mainboard/kontron/986lcd-m')
-rw-r--r-- | src/mainboard/kontron/986lcd-m/mainboard.c | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/src/mainboard/kontron/986lcd-m/mainboard.c b/src/mainboard/kontron/986lcd-m/mainboard.c index 85b704e3dd..509e894507 100644 --- a/src/mainboard/kontron/986lcd-m/mainboard.c +++ b/src/mainboard/kontron/986lcd-m/mainboard.c @@ -21,22 +21,12 @@ #include <drivers/intel/gma/int15.h> #include <pc80/mc146818rtc.h> #include <arch/io.h> +#include <superio/hwm5_conf.h> /* Hardware Monitor */ static u16 hwm_base = 0xa00; -static void hwm_write(u8 reg, u8 value) -{ - outb(reg, hwm_base + 0x05); - outb(value, hwm_base + 0x06); -} - -static void hwm_bank(u8 bank) -{ - hwm_write(0x4e, bank); -} - #define FAN_CRUISE_CONTROL_DISABLED 0 #define FAN_CRUISE_CONTROL_SPEED 1 #define FAN_CRUISE_CONTROL_THERMAL 2 @@ -86,16 +76,16 @@ static void hwm_setup(void) sysfan_speed = FAN_SPEED_5625; get_option(&sysfan_speed, "sysfan_speed"); - hwm_bank(0); - hwm_write(0x59, 0x20); /* Diode Selection */ - hwm_write(0x5d, 0x0f); /* All Sensors Diode, not Thermistor */ + pnp_write_hwm5_index(hwm_base, 0x4e, 0); + pnp_write_hwm5_index(hwm_base, 0x59, 0x20); /* Diode Selection */ + pnp_write_hwm5_index(hwm_base, 0x5d, 0x0f); /* All Sensors Diode, not Thermistor */ - hwm_bank(4); - hwm_write(0x54, 0xf1); /* SYSTIN temperature offset */ - hwm_write(0x55, 0x19); /* CPUTIN temperature offset */ - hwm_write(0x56, 0xfc); /* AUXTIN temperature offset */ + pnp_write_hwm5_index(hwm_base, 0x4e, 4); + pnp_write_hwm5_index(hwm_base, 0x54, 0xf1); /* SYSTIN temperature offset */ + pnp_write_hwm5_index(hwm_base, 0x55, 0x19); /* CPUTIN temperature offset */ + pnp_write_hwm5_index(hwm_base, 0x56, 0xfc); /* AUXTIN temperature offset */ - hwm_bank(0x80); /* Default */ + pnp_write_hwm5_index(hwm_base, 0x4e, 0x80); /* Default */ u8 fan_config = 0; /* 00 FANOUT is Manual Mode */ @@ -110,43 +100,45 @@ static void hwm_setup(void) case FAN_CRUISE_CONTROL_THERMAL: fan_config |= (1 << 2); break; } /* This register must be written first */ - hwm_write(0x04, fan_config); + pnp_write_hwm5_index(hwm_base, 0x04, fan_config); switch (cpufan_control) { - case FAN_CRUISE_CONTROL_SPEED: + case FAN_CRUISE_CONTROL_SPEED: /* CPUFANIN target speed */ printk(BIOS_DEBUG, "Fan Cruise Control setting CPU fan to %d RPM\n", fan_speeds[cpufan_speed].fan_speed); - hwm_write(0x06, fan_speeds[cpufan_speed].fan_in); /* CPUFANIN target speed */ + pnp_write_hwm5_index(hwm_base, 0x06, fan_speeds[cpufan_speed].fan_in); break; - case FAN_CRUISE_CONTROL_THERMAL: + case FAN_CRUISE_CONTROL_THERMAL: /* CPUFANIN target temperature */ printk(BIOS_DEBUG, "Fan Cruise Control setting CPU fan to activation at %d deg C/%d deg F\n", temperatures[cpufan_temperature].deg_celsius, temperatures[cpufan_temperature].deg_fahrenheit); - hwm_write(0x06, temperatures[cpufan_temperature].deg_celsius); /* CPUFANIN target temperature */ + pnp_write_hwm5_index(hwm_base, 0x06, + temperatures[cpufan_temperature].deg_celsius); break; } switch (sysfan_control) { - case FAN_CRUISE_CONTROL_SPEED: + case FAN_CRUISE_CONTROL_SPEED: /* SYSFANIN target speed */ printk(BIOS_DEBUG, "Fan Cruise Control setting system fan to %d RPM\n", fan_speeds[sysfan_speed].fan_speed); - hwm_write(0x05, fan_speeds[sysfan_speed].fan_in); /* SYSFANIN target speed */ + pnp_write_hwm5_index(hwm_base, 0x05, fan_speeds[sysfan_speed].fan_in); break; - case FAN_CRUISE_CONTROL_THERMAL: + case FAN_CRUISE_CONTROL_THERMAL: /* SYSFANIN target temperature */ printk(BIOS_DEBUG, "Fan Cruise Control setting system fan to activation at %d deg C/%d deg F\n", temperatures[sysfan_temperature].deg_celsius, temperatures[sysfan_temperature].deg_fahrenheit); - hwm_write(0x05, temperatures[sysfan_temperature].deg_celsius); /* SYSFANIN target temperature */ + pnp_write_hwm5_index(hwm_base, 0x05, + temperatures[sysfan_temperature].deg_celsius); break; } - hwm_write(0x0e, 0x02); /* Fan Output Step Down Time */ - hwm_write(0x0f, 0x02); /* Fan Output Step Up Time */ + pnp_write_hwm5_index(hwm_base, 0x0e, 0x02); /* Fan Output Step Down Time */ + pnp_write_hwm5_index(hwm_base, 0x0f, 0x02); /* Fan Output Step Up Time */ - hwm_write(0x47, 0xaf); /* FAN divisor register */ - hwm_write(0x4b, 0x84); /* AUXFANIN speed divisor */ + pnp_write_hwm5_index(hwm_base, 0x47, 0xaf); /* FAN divisor register */ + pnp_write_hwm5_index(hwm_base, 0x4b, 0x84); /* AUXFANIN speed divisor */ - hwm_write(0x40, 0x01); /* Init, but no SMI# */ + pnp_write_hwm5_index(hwm_base, 0x40, 0x01); /* Init, but no SMI# */ } /* mainboard_enable is executed as first thing after */ |