diff options
author | Sebastian Reichel <sebastian.reichel@collabora.com> | 2020-11-04 17:18:41 +0100 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2020-12-06 15:31:36 +0100 |
commit | 2d86fb31bdee7d428a3e423d54b51e5e02221682 (patch) | |
tree | 1103f0b535de283f67134886a8b0e38cf05ff4d8 | |
parent | 822e1b31bdf6abec87375a8e4fd1fe2b830bdce0 (diff) | |
download | u-boot-2d86fb31bdee7d428a3e423d54b51e5e02221682.zip u-boot-2d86fb31bdee7d428a3e423d54b51e5e02221682.tar.gz u-boot-2d86fb31bdee7d428a3e423d54b51e5e02221682.tar.bz2 |
board: ge: bx50v3: reduce magic numbers
Use VPD product ID instead of confidx, so that we can easily reuse the
product ID defines and avoid some magic numbers.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-rw-r--r-- | board/ge/bx50v3/bx50v3.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c index 5ad265a..8e7b90a 100644 --- a/board/ge/bx50v3/bx50v3.c +++ b/board/ge/bx50v3/bx50v3.c @@ -43,7 +43,11 @@ DECLARE_GLOBAL_DATA_PTR; -static int confidx; /* Default to generic. */ +#define VPD_PRODUCT_B850 1 +#define VPD_PRODUCT_B650 2 +#define VPD_PRODUCT_B450 3 + +static int productid; /* Default to generic. */ static struct vpd_cache vpd; #define NC_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ @@ -112,7 +116,7 @@ static void do_enable_hdmi(struct display_info_t const *dev) static int is_b850v3(void) { - return confidx == 3; + return productid == VPD_PRODUCT_B850; } static int detect_lcd(struct display_info_t const *dev) @@ -299,9 +303,6 @@ int overwrite_console(void) #define VPD_TYPE_INVALID 0x00 #define VPD_BLOCK_NETWORK 0x20 #define VPD_BLOCK_HWID 0x44 -#define VPD_PRODUCT_B850 1 -#define VPD_PRODUCT_B650 2 -#define VPD_PRODUCT_B450 3 #define VPD_HAS_MAC1 0x1 #define VPD_HAS_MAC2 0x2 #define VPD_MAC_ADDRESS_LENGTH 6 @@ -397,28 +398,13 @@ int board_early_init_f(void) return 0; } -static void set_confidx(const struct vpd_cache* vpd) -{ - switch (vpd->product_id) { - case VPD_PRODUCT_B450: - confidx = 1; - break; - case VPD_PRODUCT_B650: - confidx = 2; - break; - case VPD_PRODUCT_B850: - confidx = 3; - break; - } -} - int board_init(void) { if (!read_i2c_vpd(&vpd, vpd_callback)) { int ret, rescan; vpd.is_read = true; - set_confidx(&vpd); + productid = vpd.product_id; ret = fdtdec_resetup(&rescan); if (!ret && rescan) { |