Lean Sheng Tan submitted this change.

View Change

Approvals: Arthur Heymans: Looks good to me, approved build bot (Jenkins): Verified Lean Sheng Tan: Looks good to me, but someone else must approve
util/autoport: Improve USB code

Currently autoport fills in USB current '0' if the detected setting
isn't one of the known settings. This works as 0 is a valid setting
from C point of view, but it's not supported on desktop PCs and on
mobile platform results in the lowest possible USB PHY gain. Thus
this might cause instabilities as the original firmware had stronger
USB drive currents and gain settings.

Add more known USB current fields to the map and generate a FIXME
as comment when the detected current isn't one of the known entries
instead of defaulting to 0.

Change-Id: I48f4d636ce3401ba188f5519b5ff45fccf13f080
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78828
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
---
M util/autoport/bd82x6x.go
1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/util/autoport/bd82x6x.go b/util/autoport/bd82x6x.go
index 6ce15a2..76411e7 100644
--- a/util/autoport/bd82x6x.go
+++ b/util/autoport/bd82x6x.go
@@ -309,6 +309,10 @@
0x2000055b: 2,
0x20000f51: 3,
0x2000094a: 4,
+ 0x2000035f: 5,
+ 0x20000f53: 6,
+ 0x20000357: 7,
+ 0x20000353: 8,
}

for port := uint(0); port < 14; port++ {
@@ -327,10 +331,16 @@
}
}
}
- fmt.Fprintf(sb, "\t{ %d, %d, %d },\n",
+ current, ok := currentMap[inteltool.RCBA[uint16(0x3500+4*port)]]
+ comment := ""
+ if !ok {
+ comment = fmt.Sprintf("// FIXME: Unknown current: RCBA(0x%x)=0x%x", 0x3500+4*port, uint16(0x3500+4*port))
+ }
+ fmt.Fprintf(sb, "\t{ %d, %d, %d }, %s\n",
((inteltool.RCBA[0x359c]>>port)&1)^1,
- currentMap[inteltool.RCBA[uint16(0x3500+4*port)]],
- OCPin)
+ current,
+ OCPin,
+ comment)
}
sb.WriteString("};\n")


To view, visit change 78828. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I48f4d636ce3401ba188f5519b5ff45fccf13f080
Gerrit-Change-Number: 78828
Gerrit-PatchSet: 11
Gerrit-Owner: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Lean Sheng Tan <sheng.tan@9elements.com>
Gerrit-Reviewer: Maximilian Brune <maximilian.brune@9elements.com>
Gerrit-Reviewer: Paul Menzel <paulepanter@mailbox.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus@gmail.com>
Gerrit-CC: Felix Held <felix-coreboot@felixheld.de>
Gerrit-MessageType: merged