Am 10.07.2023 um 13:45 schrieb Marek Vasut:
On 6/27/23 11:04, [email protected] wrote:
From: Christian Taedcke <[email protected]>
This way custom logic can be implemented per board after the fpga
image is uploaded.
Signed-off-by: Christian Taedcke <[email protected]>
---
common/spl/spl_fit.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 730639f756..3a1e3382ba 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -560,6 +560,16 @@ __weak void *spl_load_simple_fit_fix_load(const
void *fit)
return (void *)fit;
}
+/*
+ * Weak default function to allow implementing logic after fpga image is
+ * uploaded.
+ */
+__weak void board_spl_fit_post_upload_fpga(const void *fit, int node,
+ struct spl_image_info *fpga_image,
+ int ret)
+{
Is there an example use case for this, which cannot be implemented
elsewhere ?
See my previous email to Michal, i did not find another way to implemnt
my use-cases.
+}
+
static void warn_deprecated(const char *msg)
{
printf("DEPRECATED: %s\n", msg);
@@ -590,6 +600,9 @@ static int spl_fit_upload_fpga(struct spl_fit_info
*ctx, int node,
ret = fpga_load(devnum, (void *)fpga_image->load_addr,
fpga_image->size, BIT_FULL, flags);
+
+ board_spl_fit_post_upload_fpga(ctx->fit, node, fpga_image, ret);
+
if (ret) {
Please implement error handling this way:
ret = fpga_load(...)
if (ret)
handle_error();
ret = board_spl_...(...)
if (ret)
handle_error();
I need to call board_spl_fit_post_upload_fpga() independent of the
return value of fpga_load(). This is not a handle_error() function, more
like a notify_result() (with can be ok or an error).
Regards,
Christian