Paul Menzel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/50710 )
Change subject: mb/asrock/e350m1: Configure HWM ......................................................................
mb/asrock/e350m1: Configure HWM
Change-Id: I799b23366f79a2f986627b0368fb337179f7f92f Signed-off-by: Paul Menzel pmenzel@molgen.mpg.de --- M src/mainboard/asrock/e350m1/Kconfig M src/mainboard/asrock/e350m1/bootblock.c 2 files changed, 49 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/50710/1
diff --git a/src/mainboard/asrock/e350m1/Kconfig b/src/mainboard/asrock/e350m1/Kconfig index 091d57a..24837d2 100644 --- a/src/mainboard/asrock/e350m1/Kconfig +++ b/src/mainboard/asrock/e350m1/Kconfig @@ -8,6 +8,7 @@ select NORTHBRIDGE_AMD_AGESA_FAMILY14 select SOUTHBRIDGE_AMD_CIMX_SB800 select SUPERIO_NUVOTON_NCT5572D + select SUPERIO_NUVOTON_NCT5572D_HWM select SB_SUPERIO_HWM select HAVE_OPTION_TABLE select HAVE_PIRQ_TABLE diff --git a/src/mainboard/asrock/e350m1/bootblock.c b/src/mainboard/asrock/e350m1/bootblock.c index 210a014..f7202c2 100644 --- a/src/mainboard/asrock/e350m1/bootblock.c +++ b/src/mainboard/asrock/e350m1/bootblock.c @@ -3,10 +3,58 @@ #include <bootblock_common.h> #include <superio/nuvoton/common/nuvoton.h> #include <superio/nuvoton/nct5572d/nct5572d.h> +#include <superio/nuvoton/nct5572d/nct5572d_hwm.h>
#define SERIAL_DEV PNP_DEV(0x2e, NCT5572D_SP1) +#define HWM_DEV PNP_DEV(0x2e, NCT5572D_HWM_TSI_FPLED) + +#define HWM_BASE 0x290 + +#define CHA_FAN1 SYS_FAN +#define CHA_FAN2 AUX_FAN0
void bootblock_mainboard_early_init(void) { + /* Set up the HWM */ + nct5572d_hwm_init(HWM_DEV, HWM_BASE); + + /* The NCT3941S on CHA_FAN1 takes a PWM signal, not a voltage signal */ + nct5572d_hwm_set_sysfan_out_voltage_mode(HWM_BASE, false); + + /* Force all fan outputs to full speed */ + nct5572d_hwm_force_fan_full_on(HWM_BASE, CPU_FAN); + nct5572d_hwm_force_fan_full_on(HWM_BASE, CHA_FAN1); + nct5572d_hwm_force_fan_full_on(HWM_BASE, CHA_FAN2); + + nct5572d_hwm_enable_peci(HWM_BASE, 0x5c); + + /* Example of speed cruise, which I don't use because the chassis fans are 2-pin */ + struct nct5572d_hwm_speed_cruise_params scp = { + .target_speed = 4095, + .tolerance = 0, + .step_up_time = 1, + .step_down_time = 1, + }; + + nct5572d_hwm_program_speed_cruise(HWM_BASE, CPU_FAN, &scp); + + /* Example of temperature-controlled fans with thermal cruise mode */ + struct nct5572d_hwm_thermal_cruise_params tcp = { + .target_temp = 55, + .tolerance = 0, + .start_up_val = 1, + .stop_val = 0, + .stopduty_en = false, + .stop_time = 1, + .step_up_time = 1, + .step_down_time = 1, + .critical_temp = 60, + .temp_src = PECI_0, + }; + + nct5572d_hwm_program_thermal_cruise(HWM_BASE, CPU_FAN, &tcp); + nct5572d_hwm_program_thermal_cruise(HWM_BASE, CHA_FAN1, &tcp); + nct5572d_hwm_program_thermal_cruise(HWM_BASE, CHA_FAN2, &tcp); + nuvoton_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE); }