Save board_type retrieved from the BCM board firmware to the global data. This information can be accessed by using gd_board_type() call to determine the type of currently used board.
Signed-off-by: Oleksii Moisieiev <oleksii_moisie...@epam.com> Reviewed-by: Volodymyr Babchuk <volodymyr_babc...@epam.com> --- board/raspberrypi/rpi/rpi.c | 5 +++++ include/broadcom/bcm_board_types.h | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 include/broadcom/bcm_board_types.h diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 2851ebc985..32d67eb7f4 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -19,6 +19,8 @@ #include <asm/arch/sdhci.h> #include <asm/global_data.h> #include <dm/platform_data/serial_bcm283x_mu.h> +#include <broadcom/bcm_board_types.h> + #ifdef CONFIG_ARM64 #include <asm/armv8/mmu.h> #endif @@ -489,6 +491,9 @@ static void get_board_revision(void) model = &models[rev_type]; } + if (IS_ENABLED(CONFIG_BOARD_TYPES)) + gd->board_type = rev_type; + printf("RPI %s (0x%x)\n", model->name, revision); } diff --git a/include/broadcom/bcm_board_types.h b/include/broadcom/bcm_board_types.h new file mode 100644 index 0000000000..69db528874 --- /dev/null +++ b/include/broadcom/bcm_board_types.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * This header defines BCM board types. + * + * Copyright (c) 2024 EPAM Systems + * + */ +#ifndef _BCM_BOARD_TYPES_H_ +#define _BCM_BOARD_TYPES_H_ + +/* + * TODO: This enumerator defines the main BCM types. + * These types are defined by the BCM firmware and requested + * via mbox. Currently only one board type was added. + * This is needed to determine whether current board is bcm2712 + * or other to control the behaviour of the following drivers: + * macb and pcie_brcmstb. New board enumerators can be added here + * if needed. + * See https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-pi-revision-codes + */ +typedef enum { + BCM2712_RPI_5_B_NEW = 0x17, +} bcm_board_type_t; + +#endif /* _BCM_BOARD_TYPES_H_ */ -- 2.34.1