Skip to content

Conversation

@hathach
Copy link
Owner

@hathach hathach commented Oct 10, 2025

No description provided.

Copilot AI review requested due to automatic review settings October 10, 2025 06:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR attempts to enable OHCI (Open Host Controller Interface) support for the LPC55 microcontroller family but notes it's not working properly, likely due to clock configuration issues. The implementation refactors the OHCI code to be more modular and adds LPC55 support alongside existing LPC17/40 support.

Key changes include:

  • Refactoring OHCI hardware abstraction with a new ohci_nxp.h header
  • Adding LPC55 OHCI configuration and USB0 host mode support
  • Restructuring port/speed selection logic in the LPC55 BSP

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/portable/ohci/ohci_nxp.h New hardware abstraction layer separating LPC17/40 and LPC55 OHCI implementations
src/portable/ohci/ohci.h Added register offset comments for documentation
src/portable/ohci/ohci.c Replaced direct hardware includes with abstracted header
src/common/tusb_mcu.h Added OHCI support flags for LPC55
hw/bsp/lpc55/family.cmake Restructured port/speed selection and added OHCI source
hw/bsp/lpc55/family.c Added USB0 host mode initialization with pin configuration
Board configuration files Removed hardcoded PORT settings in favor of new RHPORT system
BSP makefiles Removed old LPC17/40 HCD driver references
README.rst Updated documentation to reflect OHCI/EHCI controller types

*/
#ifndef TUSB_OHCI_NXP_H
#define TUSB_OHCI_NXP_H

Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing include for tusb_option.h which is required for the TU_CHECK_MCU macro. This will cause compilation errors.

Suggested change
#include "tusb_option.h"

Copilot uses AI. Check for mistakes.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines +265 to 268
#if (CFG_TUD_ENABLED && BOARD_TUD_RHPORT == 1) || (CFG_TUH_ENABLED && BOARD_TUH_RHPORT == 1)
// Port1 is High Speed

/* Turn on USB1 Phy */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid forcing USB1 into device mode when host uses port 1

The initialization for USB1 now runs when either the device or host selects port 1, but the body still configures the PHY and clocks for device mode (USBHSH->PORTMODE |= USBHSH_PORTMODE_DEV_ENABLE_MASK, device clock enables). For host builds that set BOARD_TUH_RHPORT == 1, this code flips the controller into device mode and never enables host clocks, which will prevent the OHCI host from ever running. Previously the block only executed for device builds.

Useful? React with 👍 / 👎.

# Conflicts:
- hw/bsp/lpc17/family.cmake
- hw/bsp/lpc40/family.cmake
- hw/bsp/lpc55/family.cmake
codescene-delta-analysis[bot]

This comment was marked as outdated.

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gates Failed
Enforce advisory code health rules (1 file with Complex Method)

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Reason for failure
Enforce advisory code health rules Violations Code Health Impact
family.c 1 advisory rule 9.58 → 9.46 Suppress

Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.

#endif

// USB VBUS
#if (CFG_TUD_ENABLED && BOARD_TUD_RHPORT == 0) || (CFG_TUH_ENABLED && BOARD_TUH_RHPORT == 0)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ New issue: Complex Method
board_init has a cyclomatic complexity of 9, threshold = 9

Suppress

@sonarqubecloud
Copy link

@hathach hathach merged commit fc3857e into master Oct 30, 2025
166 of 167 checks passed
@hathach hathach deleted the add-ohci-lpc55 branch October 30, 2025 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants