summaryrefslogtreecommitdiff
path: root/board/gdsys
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-08-21 21:17:01 -0600
committerTom Rini <trini@konsulko.com>2023-08-31 13:16:55 -0400
commit91caa3bb89b112a1421ee2ee3661baf67c64bab9 (patch)
treef70b4d2452f8ca45025916cd85f0d1af684902bb /board/gdsys
parent6a32bfae61652f9dae621410ca6e094f374a1f11 (diff)
downloadu-boot-91caa3bb89b112a1421ee2ee3661baf67c64bab9.tar.gz
u-boot-91caa3bb89b112a1421ee2ee3661baf67c64bab9.tar.bz2
u-boot-91caa3bb89b112a1421ee2ee3661baf67c64bab9.zip
event: Use an event to replace last_stage_init()
Add a new event which handles this function. Convert existing use of the function to use the new event instead. Make sure that EVENT is enabled by affected boards, by selecting it from the LAST_STAGE_INIT option. For x86, enable it by default since all boards need it. For controlcenterdc, inline the get_tpm() function and make sure the event is not built in SPL. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'board/gdsys')
-rw-r--r--board/gdsys/a38x/controlcenterdc.c31
-rw-r--r--board/gdsys/mpc8308/gazerbeam.c4
2 files changed, 17 insertions, 18 deletions
diff --git a/board/gdsys/a38x/controlcenterdc.c b/board/gdsys/a38x/controlcenterdc.c
index ccebba7272..0f620c2d91 100644
--- a/board/gdsys/a38x/controlcenterdc.c
+++ b/board/gdsys/a38x/controlcenterdc.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <command.h>
#include <dm.h>
+#include <event.h>
#include <init.h>
#include <miiphy.h>
#include <net.h>
@@ -35,19 +36,6 @@ DECLARE_GLOBAL_DATA_PTR;
#define DB_GP_88F68XX_GPP_POL_LOW 0x0
#define DB_GP_88F68XX_GPP_POL_MID 0x0
-static int get_tpm(struct udevice **devp)
-{
- int rc;
-
- rc = uclass_first_device_err(UCLASS_TPM, devp);
- if (rc) {
- printf("Could not find TPM (ret=%d)\n", rc);
- return CMD_RET_FAILURE;
- }
-
- return 0;
-}
-
/*
* Define the DDR layout / topology here in the board file. This will
* be used by the DDR3 init code in the SPL U-Boot version to configure
@@ -284,15 +272,22 @@ int board_fix_fdt(void *rw_fdt_blob)
return 0;
}
-int last_stage_init(void)
+#ifndef CONFIG_SPL_BUILD
+static int last_stage_init(void)
{
struct udevice *tpm;
int ret;
-#ifndef CONFIG_SPL_BUILD
+ if (IS_ENABLED(CONFIG_SPL_BUILD))
+ return 0;
ccdc_eth_init();
-#endif
- ret = get_tpm(&tpm);
+
+ ret = uclass_first_device_err(UCLASS_TPM, &tpm);
+ if (ret) {
+ printf("Could not find TPM (ret=%d)\n", ret);
+ return ret;
+ }
+
if (ret || tpm_init(tpm) || tpm1_startup(tpm, TPM_ST_CLEAR) ||
tpm1_continue_self_test(tpm)) {
return 1;
@@ -305,3 +300,5 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
+#endif
diff --git a/board/gdsys/mpc8308/gazerbeam.c b/board/gdsys/mpc8308/gazerbeam.c
index ba88401f13..cc608c4ac4 100644
--- a/board/gdsys/mpc8308/gazerbeam.c
+++ b/board/gdsys/mpc8308/gazerbeam.c
@@ -9,6 +9,7 @@
#include <command.h>
#include <dm.h>
#include <env.h>
+#include <event.h>
#include <fdt_support.h>
#include <fsl_esdhc.h>
#include <init.h>
@@ -124,7 +125,7 @@ static void display_osd_info(struct udevice *osd,
osd_info->width, osd_info->height);
}
-int last_stage_init(void)
+static int last_stage_init(void)
{
int fpga_hw_rev = 0;
int i;
@@ -179,6 +180,7 @@ int last_stage_init(void)
return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
#if defined(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, struct bd_info *bd)