From a841bd0ac8b7591f20155257c8be171f3188d8d0 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Tue, 11 Jun 2019 14:43:19 +0800 Subject: tx amp from commit b1c25e7 --- src/northbridge/intel/haswell/do_raminit_frag.c | 38 ++++++++++++++----------- src/northbridge/intel/haswell/pei_usb.c | 2 +- src/northbridge/intel/haswell/pei_usb.h | 2 +- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/northbridge/intel/haswell/do_raminit_frag.c b/src/northbridge/intel/haswell/do_raminit_frag.c index 9727d50f36..891a79995e 100644 --- a/src/northbridge/intel/haswell/do_raminit_frag.c +++ b/src/northbridge/intel/haswell/do_raminit_frag.c @@ -353,25 +353,25 @@ static void frag_fffa3ba4(PEI_USB *pusb) uint8_t loc = setting->location; if (loc == 5) { setting->f4 = 5; - setting->f5 = 2; + setting->txamp = 2; } else if (loc == 2) { setting->f4 = 4; - setting->f5 = 2 - (setting->length < 0x50); + setting->txamp = 2 - (setting->length < 0x50); } else if (setting->length <= 0x6f) { setting->f4 = 5; - setting->f5 = 2; + setting->txamp = 2; } else { setting->f4 = 6; if (setting->length <= 0xff) { - setting->f5 = 2; + setting->txamp = 2; } else { - setting->f5 = 3; + setting->txamp = 3; } } } } -static void frag_fffa3aa7(PEI_USB *pusb) +static void conf_ehci_desktop(PEI_USB *pusb) { int nb_ehci = nb_usb2_ports(); @@ -380,13 +380,19 @@ static void frag_fffa3aa7(PEI_USB *pusb) uint8_t loc = setting->location; if (loc == 0) { setting->f4 = 4; - if (setting->length <= 0x7f) { - setting->f5 = 2; + if (setting->length < 0x80) { + /* setting 1, front/back panel <8in, lowest tx amp */ + setting->txamp = 2; + } else if (setting->length < 0x130) { + /* setting 2, back panel 8~13in, higher tx amp */ + setting->txamp = 3; + } else { + /* setting 3, back panel 13~15in, highest tx amp */ + setting->txamp = 4; } - setting->f5 = 4 - (setting->length < 0x130); } else { setting->f4 = 3; - setting->f5 = 2; + setting->txamp = 2; } } } @@ -402,19 +408,19 @@ static void frag_fffa3c1b(PEI_USB *pusb) if (setting->length > 0x6f) { setting->f4 = 6; if (setting->length > 0xff) - setting->f5 = 3; + setting->txamp = 3; else - setting->f5 = 2; + setting->txamp = 2; } else { setting->f4 = 5; - setting->f5 = 2; + setting->txamp = 2; } } else if (loc == 2) { setting->f4 = 0x50; - setting->f5 = 2 - (setting->length < 0x50); + setting->txamp = 2 - (setting->length < 0x50); } else { setting->f4 = 5; - setting->f5 = 2; + setting->txamp = 2; } } } @@ -432,7 +438,7 @@ void frag_fffa3a17(PEI_USB *pusb) uint16_t did = pci_read_config16(PCH_LPC_DEV, 2); if (is_desktop_pch(did)) { - frag_fffa3aa7(pusb); + conf_ehci_desktop(pusb); return; } if (is_mobile_pch(did)) { diff --git a/src/northbridge/intel/haswell/pei_usb.c b/src/northbridge/intel/haswell/pei_usb.c index e88e42afd2..6287d676dc 100644 --- a/src/northbridge/intel/haswell/pei_usb.c +++ b/src/northbridge/intel/haswell/pei_usb.c @@ -405,7 +405,7 @@ static void frag_usb_fffaf75b(PEI_USB *upd) { for (int i = 0; i < nb_usb2_ports(); i++) { u32 a1 = (u32)(upd->ehci_settings[i].f4 & 7) << 8; - u32 a2 = (u32)(upd->ehci_settings[i].f5 & 7) << 11; + u32 a2 = (u32)(upd->ehci_settings[i].txamp & 7) << 11; pch_iobp_update((0xe50041 + i) << 8, 0xffff80ff, a1 | a2); } } diff --git a/src/northbridge/intel/haswell/pei_usb.h b/src/northbridge/intel/haswell/pei_usb.h index 8666f92459..2da2226deb 100644 --- a/src/northbridge/intel/haswell/pei_usb.h +++ b/src/northbridge/intel/haswell/pei_usb.h @@ -3,7 +3,7 @@ struct _PEI_EHCI { uint8_t location; uint16_t length; uint8_t f4; - uint8_t f5; + uint8_t txamp; } __packed; typedef struct _PEI_EHCI PEI_EHCI; -- cgit v1.2.3