From b825d9435d1c1a57db080e3a28f4e92dcca29332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBygowski?= Date: Sun, 20 Feb 2022 23:22:36 +0100 Subject: mb/dell/optiplex_9010/sch5545_ec.c: Fix HWM initialization bugs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the HWM sequence matching to the chassis. HWM sequence for SFF was incorrectly passed to MT chassis HWM initialization. Vendor code also applies a fix-up for MT/DT chassis. This fixup was missing one register read compared to the vendor code. Add the missing read and guard the fixup depening on the returned value to match the vendor code behavior. Not doing so resulted in increased fan speeds on Dell Precision T1650 compared to Dell's firmware. TEST=Boot Dell Precision T1650 and hear the fans are as silent as on Dell's firmware Signed-off-by: Michał Żygowski Change-Id: I5c0e1c00e69d66848a602ad91a3e83375a095f44 Reviewed-on: https://review.coreboot.org/c/coreboot/+/62210 Tested-by: build bot (Jenkins) Reviewed-by: Krystian Hebel --- src/mainboard/dell/optiplex_9010/sch5545_ec.c | 44 +++++++++++++++------------ 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/mainboard/dell/optiplex_9010/sch5545_ec.c b/src/mainboard/dell/optiplex_9010/sch5545_ec.c index fa78a98b73..9aa0038cc3 100644 --- a/src/mainboard/dell/optiplex_9010/sch5545_ec.c +++ b/src/mainboard/dell/optiplex_9010/sch5545_ec.c @@ -548,17 +548,17 @@ static uint8_t get_chassis_type(void) switch (chassis_id) { case 0x0: case 0x4: - return 5; + return 5; /* MT */ case 0x8: - return 4; + return 4; /* DT */ case 0x3: case 0xb: - return 3; + return 3; /* USFF */ case 0x1: case 0x9: case 0x5: case 0xd: - return 6; + return 6; /* SFF */ default: printk(BIOS_DEBUG, "Unknown chassis ID %x\n", chassis_id); break; @@ -640,7 +640,7 @@ void sch5545_ec_hwm_init(void *unused) ec_hwm_init_late(ec_hwm_chassis4, ARRAY_SIZE(ec_hwm_chassis4)); break; case 5: - ec_hwm_init_late(ec_hwm_chassis6, ARRAY_SIZE(ec_hwm_chassis5)); + ec_hwm_init_late(ec_hwm_chassis5, ARRAY_SIZE(ec_hwm_chassis5)); break; case 6: ec_hwm_init_late(ec_hwm_chassis6, ARRAY_SIZE(ec_hwm_chassis6)); @@ -673,21 +673,25 @@ void sch5545_ec_hwm_init(void *unused) ec_read_write_reg(EC_HWM_LDN, 0x00b8, &val, READ_OP); if (chassis_type == 4 || chassis_type == 5) { - ec_read_write_reg(EC_HWM_LDN, 0x00a0, &val, READ_OP); - val &= 0xfb; - ec_read_write_reg(EC_HWM_LDN, 0x00a0, &val, WRITE_OP); - ec_read_write_reg(EC_HWM_LDN, 0x00a1, &val, READ_OP); - val &= 0xfb; - ec_read_write_reg(EC_HWM_LDN, 0x00a1, &val, WRITE_OP); - ec_read_write_reg(EC_HWM_LDN, 0x00a2, &val, READ_OP); - val &= 0xfb; - ec_read_write_reg(EC_HWM_LDN, 0x00a2, &val, WRITE_OP); - val = 0x99; - ec_read_write_reg(EC_HWM_LDN, 0x008a, &val, WRITE_OP); - val = 0x47; - ec_read_write_reg(EC_HWM_LDN, 0x008b, &val, WRITE_OP); - val = 0x91; - ec_read_write_reg(EC_HWM_LDN, 0x008c, &val, WRITE_OP); + ec_read_write_reg(EC_HWM_LDN, 0x0027, &val, READ_OP); + if (val == 0) { + printk(BIOS_INFO, "Applying HWM fix-up for MT/DT chassis\n"); + ec_read_write_reg(EC_HWM_LDN, 0x00a0, &val, READ_OP); + val &= 0xfb; + ec_read_write_reg(EC_HWM_LDN, 0x00a0, &val, WRITE_OP); + ec_read_write_reg(EC_HWM_LDN, 0x00a1, &val, READ_OP); + val &= 0xfb; + ec_read_write_reg(EC_HWM_LDN, 0x00a1, &val, WRITE_OP); + ec_read_write_reg(EC_HWM_LDN, 0x00a2, &val, READ_OP); + val &= 0xfb; + ec_read_write_reg(EC_HWM_LDN, 0x00a2, &val, WRITE_OP); + val = 0x99; + ec_read_write_reg(EC_HWM_LDN, 0x008a, &val, WRITE_OP); + val = 0x47; + ec_read_write_reg(EC_HWM_LDN, 0x008b, &val, WRITE_OP); + val = 0x91; + ec_read_write_reg(EC_HWM_LDN, 0x008c, &val, WRITE_OP); + } } ec_read_write_reg(EC_HWM_LDN, 0x0049, &val, READ_OP); -- cgit v1.2.3