← Back to Pull requests

hal: microchip: pic32cz_ca90: fix PHY24 and EPINFO in usbhs.h #85

Open
TheArkadiuszGrzelka opened this pull request with 7 lines diff across 1 files
View on GitHub
TheArkadiuszGrzelka TheArkadiuszGrzelka commented on Sep 22, 2026 14:54 UTC
Author

Two bitfields in the PIC32CZ CA90 USBHS component header do not match the PIC32CZ CA80/CA90 Family Data Sheet (DS60001749).

1. USBHS_PHY24 (offset 0x1524) has no field for bit 1. The field list jumps from HSSLEW2 at bit 0 to RSVD0 at bit 2, and USBHS_PHY24_Msk is 0x000000FD, which excludes bit 1 from the register mask. Data sheet section 37.15.10 documents bit 1 as OTGPDN, "ODT Power Down". A write built by ORing this header's masked field values can never set that bit.

2. USBHS_EPINFO_RESETVALUE (offset 0x1078, read-only) is 0xFF, which the header's own TXENDPOINTS/RXENDPOINTS split would read as 15 TX and 15 RX endpoints. Data sheet section 37.7.31 gives the per-bit reset value as 0111_0111, that is 0x77: 7 TX and 7 RX endpoints, matching the part's documented endpoint count.

Both are already present in the PIC32CZ8110CA90208 ATDF bundled alongside this header in the same pack directory, so the header is a correct transcription of pack data that itself disagrees with the printed data sheet.

Full write-up, including the datasheet and ATDF checks: zephyrproject-rtos/zephyr#119959

Fix

Add the missing OTGPDN field at bit 1, widen USBHS_PHY24_Msk to 0x000000FF to include it, and correct USBHS_EPINFO_RESETVALUE to 0x77. Scoped to the CA90 pack only, the part this was checked against; CA80 and CA91 carry the identical bug in their own copy of this header and likely want the same fix, noted in the linked issue.

Testing

Checked the changed macros expand as expected with a standalone preprocessor/_Static_assert check (USBHS_PHY24_OTGPDN_Msk == 0x2, USBHS_PHY24_Msk == 0xFF, USBHS_EPINFO_RESETVALUE == 0x77). No PIC32CZ CA90 USBHS driver exists in-tree yet to exercise this header through a build.

Diff: 7 lines (+5 / -2) across 1 files Reviewer: Madhan-Kurukondar Review duration: 49867m
All Vouch review confidence checks passed
Residual risk 0.12 = Change Risk (0.22) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.22 · 7 lines diff across 1 files
0.22
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.00 · 1 substantive comment(s)
0.00
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth shallow_review_depth
0.350
Diff Size diff_size
0.124
Real PR Conversation Timeline
2 items
Madhan-Kurukondar Madhan-Kurukondar approved these changes on Oct 05, 2026 13:37 UTC
Approved Reviewer

Approved these changes.

Assignees
TheArkadiuszGrzelka TheArkadiuszGrzelka
Labels
risk: low confidence: 46.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 22.4% (LOW) · Higher = larger blast radius
22.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 46.5% · Lower = rushed or shallow review
46.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 12% · Safe to merge
12%