diff options
author | Michal Simek <michal.simek@xilinx.com> | 2020-04-08 11:04:41 +0200 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2020-04-27 13:57:18 +0200 |
commit | 51f6c52e6b12d7bc7a82db566057efe731f5aae9 (patch) | |
tree | d78ce4ad2e25a06497caf02b98b02d6644403224 /board/xilinx/versal/board.c | |
parent | a29511eeca5f00e31653af28b9f758cf39e001fc (diff) |
xilinx: Move bootmode detection to separate function
Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'board/xilinx/versal/board.c')
-rw-r--r-- | board/xilinx/versal/board.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index 2900dfb44e..483e3ce2f7 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -82,9 +82,23 @@ int board_early_init_r(void) return 0; } -int board_late_init(void) +static u8 versal_get_bootmode(void) { + u8 bootmode; u32 reg = 0; + + reg = readl(&crp_base->boot_mode_usr); + + if (reg >> BOOT_MODE_ALT_SHIFT) + reg >>= BOOT_MODE_ALT_SHIFT; + + bootmode = reg & BOOT_MODES_MASK; + + return bootmode; +} + +int board_late_init(void) +{ u8 bootmode; struct udevice *dev; int bootseq = -1; @@ -99,12 +113,7 @@ int board_late_init(void) return 0; } - reg = readl(&crp_base->boot_mode_usr); - - if (reg >> BOOT_MODE_ALT_SHIFT) - reg >>= BOOT_MODE_ALT_SHIFT; - - bootmode = reg & BOOT_MODES_MASK; + bootmode = versal_get_bootmode(); puts("Bootmode: "); switch (bootmode) { |