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

Add pinctrl_bcm2835_rust.rs #1

Open
wants to merge 2 commits into
base: rust
Choose a base branch
from

Conversation

shtiy2023
Copy link

@shtiy2023 shtiy2023 commented Apr 22, 2024

Rewrite GPIO registration part in pinctrl-bcm2835.c using Rust.
pinctrl_bcm2835_rust.rs has been tested on the virt machine in QEMU, and libgpiod can successfully call the GPIO controller through the `pinctrl_bcm2835_rust'.

Issue:

bcm2835_rust fails to register on Raspberry Pi 4B, and the error displayed in syslog is:
pinctrl_bcm2835_rust: probe of fe200000.gpio failed with error -22
And KGDB and jlink cannot be used to debug this driver since both kgdb and jlink are based on the gpio driver on the board.

Changes needed:

  • Investigate the reason behind the failure to register bcm2835_rust on Raspberry Pi 4B.

Copy link

@Richardhongyu Richardhongyu left a comment

Choose a reason for hiding this comment

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

Great work! You can add more details about how to evaluate this driver and what you can do with this. Besides, you can add some links of the prior mails when we had touch out with the community.

Comment on lines +17 to +39
macro_rules! FSEL_REG {
($p:expr) => {
GPFSEL0 + (($p / 10) * 4)
};
}

macro_rules! FSEL_SHIFT {
($p:expr) => {
(($p % 10) * 3)
};
}

macro_rules! GPIO_REG_OFFSET {
($p:expr) => {
$p / 32
};
}

macro_rules! GPIO_REG_SHIFT {
($p:expr) => {
$p % 32
};
}

Choose a reason for hiding this comment

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

Why not move these to macro.rs of RFL of gpio related files?

drivers/pinctrl/bcm/pinctrl_bcm2835_rust.rs Outdated Show resolved Hide resolved
drivers/pinctrl/bcm/pinctrl_bcm2835_rust.rs Outdated Show resolved Hide resolved
drivers/pinctrl/bcm/pinctrl_bcm2835_rust.rs Outdated Show resolved Hide resolved
drivers/pinctrl/bcm/pinctrl_bcm2835_rust.rs Outdated Show resolved Hide resolved
drivers/pinctrl/bcm/pinctrl_bcm2835_rust.rs Outdated Show resolved Hide resolved
drivers/pinctrl/bcm/pinctrl_bcm2835_rust.rs Outdated Show resolved Hide resolved
@shtiy2023 shtiy2023 closed this Apr 22, 2024
@shtiy2023 shtiy2023 reopened this Apr 22, 2024
Copy link

@ruiqurm ruiqurm left a comment

Choose a reason for hiding this comment

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

LGFM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants