-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
drivers: Add GPIO driver for BCM2711 (Raspberry Pi 4B) #63323
Conversation
* defconfig is located under `boards/arm64/` instead of `boards/arm/` * 64-bit mode (`arm_64bit=1`) is required to boot Signed-off-by: Chen Xingyu <[email protected]>
1021588
to
5007722
Compare
5b394c9
to
b383829
Compare
drivers/gpio/gpio_bcm2711.c
Outdated
static int uart_bcm2711_controller_init(void) | ||
{ | ||
IRQ_CONNECT(DT_IRQN(GPIO_BCM2711_CONTROLLER), DT_IRQ(GPIO_BCM2711_CONTROLLER, priority), | ||
uart_bcm2711_controller_isr, NULL, 0); | ||
irq_enable(DT_IRQN(GPIO_BCM2711_CONTROLLER)); | ||
|
||
return 0; | ||
} | ||
|
||
SYS_INIT(uart_bcm2711_controller_init, PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I read this correctly, SYS_INIT is not required, just define this function as part of the device definition macro and call it during driver init, there are quite a few examples in tree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I explained in the commit message, the two instances of GPIO devices share the same IRQ. To the best of my knowledge, only one ISR function can be connected to a specific IRQ.
So the idea here is to register a 'shared' ISR function in case either one or both GPIO instances are enabled. This separate SYS_INIT function is responsible for handling the registration job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zephyr recently gained support for shared IRQ, please see commit 017cf89.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's strange that shared IRQ causes the applicaton hangs at *** Booti
. I'm investigating the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, nice to see native drivers. Far easier to read and of higher quality compared to bloated/crappy hal based ones.
Just found some issues on tests. I'll update later. |
9424d40
to
5fa27b2
Compare
Updated. It's ready now. |
Keep aligned with `rpi_pico` board. Signed-off-by: Chen Xingyu <[email protected]>
No reason to declare it per node, as it is almostly shared by all peripherals. Also introduced `DT_FREQ_M` macro for better readability. Signed-off-by: Chen Xingyu <[email protected]>
The BCM2711 SoC exposes 58 GPIOs. The first 28 (bank 0) are accessible to users via the 40-pin header, while the others (bank 1) are used for controlling on-board peripherals. This also update doc of `rpi_4b` board. Signed-off-by: Chen Xingyu <[email protected]>
LED_ACT is the green LED at the top left corner of the RPi 4B board. Signed-off-by: Chen Xingyu <[email protected]>
Rewrote with a more detailed procedure. Signed-off-by: Chen Xingyu <[email protected]>
LGTM, And Thanks for updateing doc. |
This PR implements a GPIO driver for the BCM2711 SoC recently introduced in #62320. It also adds an LED node for the
rpi_4b
board, enabling the blinky sample to work on this board.Minor adjustments have also been made to the doc and DTS for this SoC/board to facilitate future contributions.