Skip to content

Commit

Permalink
Adding in RPI 5 support
Browse files Browse the repository at this point in the history
Signed-off-by: Chuckduey <[email protected]>
  • Loading branch information
Chuckduey authored and tingleby committed Jan 23, 2024
1 parent 3c288a0 commit 3022803
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/arm/raspberry_pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern "C" {
#define MRAA_RASPBERRY_PI3_A_PLUS_PINCOUNT 41
#define MRAA_RASPBERRY_PI4_B_PINCOUNT 41
#define MRAA_RASPBERRY_PI_400_PINCOUNT 41

#define MRAA_RASPBERRY_PI5_B_PINCOUNT 41
mraa_board_t *
mraa_raspberry_pi();

Expand Down
15 changes: 14 additions & 1 deletion src/arm/raspberry_pi.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#define PLATFORM_NAME_RASPBERRY_PI3_A_PLUS "Raspberry Pi 3 Model A+"
#define PLATFORM_NAME_RASPBERRY_PI4_B "Raspberry Pi 4 Model B"
#define PLATFORM_NAME_RASPBERRY_PI_400 "Raspberry Pi 400"
#define PLATFORM_NAME_RASPBERRY_PI5_B "Raspberry Pi 5 Model B"
#define PLATFORM_RASPBERRY_PI_B_REV_1 1
#define PLATFORM_RASPBERRY_PI_A_REV_2 2
#define PLATFORM_RASPBERRY_PI_B_REV_2 3
Expand All @@ -44,6 +45,7 @@
#define PLATFORM_RASPBERRY_PI3_A_PLUS 12
#define PLATFORM_RASPBERRY_PI4_B 13
#define PLATFORM_RASPBERRY_PI_400 14
#define PLATFORM_RASPBERRY_PI5_B 15
#define MMAP_PATH "/dev/mem"
#define BCM2835_PERI_BASE 0x20000000
#define BCM2836_PERI_BASE 0x3f000000
Expand Down Expand Up @@ -523,6 +525,12 @@ mraa_raspberry_pi()
platform_detected = PLATFORM_RASPBERRY_PI_400;
b->phy_pin_count = MRAA_RASPBERRY_PI_400_PINCOUNT;
peripheral_base = BCM2837_PERI_BASE;
block_size = BCM2837_BLOCK_SIZE;
} else if (strstr(line, "c04170") || strstr(line,"d04170")) {
b->platform_name = PLATFORM_NAME_RASPBERRY_PI5_B;
platform_detected = PLATFORM_RASPBERRY_PI5_B;
b->phy_pin_count = MRAA_RASPBERRY_PI5_B_PINCOUNT;
peripheral_base = BCM2837_PERI_BASE;
block_size = BCM2837_BLOCK_SIZE;
} else {
b->platform_name = PLATFORM_NAME_RASPBERRY_PI_B_REV_1;
Expand Down Expand Up @@ -602,6 +610,10 @@ mraa_raspberry_pi()
b->platform_name = PLATFORM_NAME_RASPBERRY_PI_400;
platform_detected = PLATFORM_RASPBERRY_PI_400;
b->phy_pin_count = MRAA_RASPBERRY_PI_400_PINCOUNT;
} else if (mraa_file_contains(compatible_path, "raspberrypi,5-model-b")) {
b->platform_name = PLATFORM_NAME_RASPBERRY_PI5_B;
platform_detected = PLATFORM_RASPBERRY_PI5_B;
b->phy_pin_count = MRAA_RASPBERRY_PI5_B_PINCOUNT;
}
}

Expand Down Expand Up @@ -872,7 +884,8 @@ mraa_raspberry_pi()
(platform_detected == PLATFORM_RASPBERRY_PI3_B_PLUS) ||
(platform_detected == PLATFORM_RASPBERRY_PI3_A_PLUS) ||
(platform_detected == PLATFORM_RASPBERRY_PI4_B) ||
(platform_detected == PLATFORM_RASPBERRY_PI_400)) {
(platform_detected == PLATFORM_RASPBERRY_PI_400) ||
(platform_detected == PLATFORM_RASPBERRY_PI5_B) ) {

strncpy(b->pins[27].name, "ID_SD", MRAA_PIN_NAME_SIZE);
b->pins[27].capabilities = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
Expand Down

0 comments on commit 3022803

Please sign in to comment.