From 2bef056104ae842544f75ea14442572fa49e695b Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Tue, 7 Jan 2025 15:51:26 +0800 Subject: [PATCH] mb/google/rauru: Implement mainboard_get_storage_type Replace existing storage_type with mainboard_get_storage_type TEST=emerge-rauru coreboot Change-Id: I28e0e4294c9a44f1eb17147928ef2860227ff7d3 Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/85879 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/mainboard/google/rauru/boardid.c | 15 --------------- src/mainboard/google/rauru/mainboard.c | 21 +++++++++++++++++++++ src/mainboard/google/rauru/storage.h | 8 -------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/mainboard/google/rauru/boardid.c b/src/mainboard/google/rauru/boardid.c index fc0230d4ab..6f04c04901 100644 --- a/src/mainboard/google/rauru/boardid.c +++ b/src/mainboard/google/rauru/boardid.c @@ -66,21 +66,6 @@ uint32_t storage_id(void) return cached_storage_id; } -enum ufs_type storage_type(uint32_t index) -{ - switch (index) { - case 0: - return UFS_40; - case 1: - return UFS_31; - case 2: - return UFS_40_HS; - default: - printk(BIOS_DEBUG, "unsupported type %d\n", index); - } - return UFS_UNKNOWN; -} - uint32_t sku_id(void) { static uint32_t cached_sku_code = BOARD_ID_INIT; diff --git a/src/mainboard/google/rauru/mainboard.c b/src/mainboard/google/rauru/mainboard.c index 5664585f6f..db9d09993b 100644 --- a/src/mainboard/google/rauru/mainboard.c +++ b/src/mainboard/google/rauru/mainboard.c @@ -12,9 +12,11 @@ #include #include #include +#include #include #include "gpio.h" +#include "storage.h" #define AFE_SE_SECURE_CON1 (AUDIO_BASE + 0x5634) @@ -68,6 +70,25 @@ static void power_on_fpmcu(void) gpio_output(GPIO_FP_RST_1V8_S3_L, 1); } +enum mtk_storage_type mainboard_get_storage_type(void) +{ + uint32_t index = storage_id(); + + switch (index) { + case 0: + return STORAGE_UFS_40; + case 1: + return STORAGE_UFS_31; + case 2: + return STORAGE_UFS_40_HS; + case 3: + return STORAGE_NVME; + default: + printk(BIOS_WARNING, "unsupported storage id %u\n", index); + } + return STORAGE_UNKNOWN; +} + bool mainboard_needs_pcie_init(void) { return true; diff --git a/src/mainboard/google/rauru/storage.h b/src/mainboard/google/rauru/storage.h index a97bbcbb58..a1b4d63cce 100644 --- a/src/mainboard/google/rauru/storage.h +++ b/src/mainboard/google/rauru/storage.h @@ -3,14 +3,6 @@ #ifndef __MAINBOARD_GOOGLE_RAURU_STORAGE_H__ #define __MAINBOARD_GOOGLE_RAURU_STORAGE_H__ -enum ufs_type { - UFS_UNKNOWN = 0, - UFS_31 = 0x310, - UFS_40 = 0x400, - UFS_40_HS = 0x401, -}; - uint32_t storage_id(void); -enum ufs_type storage_type(uint32_t index); #endif