Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable CM5's RTC to make Yellow's on-board RTC the primary one #3706

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

sairon
Copy link
Member

@sairon sairon commented Dec 2, 2024

With both RTCs enabled, the rpi_rtc is probed as the first one, making the on-board RTC unused by default. Since the CM5's RTC peripheral can't be used on Yellow, as the VBAT pin is not connected, disable it completely to fix RTC.

Summary by CodeRabbit

  • New Features

    • Disabled the Real-Time Clock (RTC) for the Raspberry Pi Compute Module 5 on the Yellow board, allowing the use of an external I2C RTC.
  • Bug Fixes

    • Resolved potential conflicts with RTC functionality by ensuring the onboard RTC is disabled due to power limitations.

With both RTCs enabled, the rpi_rtc is probed as the first one, making the
on-board RTC unused by default. Since the CM5's RTC peripheral can't be used on
Yellow, as the VBAT pin is not connected, disable it completely to fix RTC.
@sairon sairon added the board/yellow Home Assistant Yellow label Dec 2, 2024
@sairon sairon requested a review from agners December 2, 2024 16:27
Copy link

coderabbitai bot commented Dec 2, 2024

📝 Walkthrough

Walkthrough

The changes involve a patch to the device tree source file for the Raspberry Pi Compute Module 5 (CM5) specific to the Yellow board. The modification disables the Real-Time Clock (RTC) associated with the Raspberry Pi by adding a status property set to "disabled" in the device tree. This adjustment is necessary because the Yellow board uses its own I2C RTC and lacks the capability to power the RTC peripheral on the CM5.

Changes

File Path Change Summary
arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5-ha-yellow.dts Added status = "disabled" to the &rpi_rtc node to disable the RTC.

Sequence Diagram(s)

sequenceDiagram
    participant YellowBoard
    participant CM5
    participant RTC

    YellowBoard->>CM5: Request RTC status
    CM5->>RTC: Check power capability
    RTC-->>CM5: No power available
    CM5-->>YellowBoard: RTC disabled
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e0ccf39 and 52510b2.

📒 Files selected for processing (1)
  • buildroot-external/board/raspberrypi/yellow/patches/linux/0020-ARM-dts-bcm2712-yellow-Disable-rpi_rtc.patch (1 hunks)
🔇 Additional comments (2)
buildroot-external/board/raspberrypi/yellow/patches/linux/0020-ARM-dts-bcm2712-yellow-Disable-rpi_rtc.patch (2)

1-16: LGTM! Well-structured commit message.

The commit message clearly explains the rationale for disabling the RTC - Yellow has its own I2C RTC and CM5's RTC cannot be powered. The patch is properly signed-off.


25-29: LGTM! Clean and correct implementation.

The changes correctly disable the CM5's RTC:

  1. The comment clearly documents the hardware limitation (VBAT pin not powered)
  2. The status = "disabled" property is the proper way to disable a device tree node
  3. This will ensure the Yellow's on-board I2C RTC becomes the primary RTC

Let's verify there are no other RTC-related configurations that might need adjustment:

✅ Verification successful

LGTM - RTC configuration is correct and consistent

The changes are verified to be correct:

  1. The Yellow board has a working PCF85063A I2C RTC at address 0x51 (confirmed in patches 0008 and 0016)
  2. The CM5's built-in RTC is correctly disabled since its VBAT pin cannot be powered
  3. The changes ensure no RTC conflicts by disabling the non-functional hardware
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any other RTC-related configurations in DTS files
rg -t dts "rpi_rtc|rtc@|compatible.*rtc" arch/arm64/boot/dts/

Length of output: 91


Script:

#!/bin/bash
# Search for RTC configurations in all files (not limiting to .dts extension)
rg "rpi_rtc|rtc@|compatible.*rtc" buildroot-external/board/raspberrypi/

Length of output: 641


Script:

#!/bin/bash
# Let's examine the content of these RTC-related patches to understand the full context
for file in buildroot-external/board/raspberrypi/yellow/patches/linux/0{008,016,020}-*.patch; do
    echo "=== $file ==="
    cat "$file"
    echo -e "\n\n"
done

Length of output: 27497


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sairon sairon merged commit 9d643ed into dev Dec 2, 2024
3 checks passed
@sairon sairon deleted the disable-yellow-rpi-rtc branch December 2, 2024 16:47
sairon added a commit that referenced this pull request Dec 2, 2024
With both RTCs enabled, the rpi_rtc is probed as the first one, making the
on-board RTC unused by default. Since the CM5's RTC peripheral can't be used on
Yellow, as the VBAT pin is not connected, disable it completely to fix RTC.
sairon added a commit that referenced this pull request Dec 2, 2024
With both RTCs enabled, the rpi_rtc is probed as the first one, making the
on-board RTC unused by default. Since the CM5's RTC peripheral can't be used on
Yellow, as the VBAT pin is not connected, disable it completely to fix RTC.

(cherry picked from commit 9d643ed)
This was referenced Dec 2, 2024
This was referenced Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
board/yellow Home Assistant Yellow cla-signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants