Am 10.07.2023 um 13:41 schrieb Michal Simek:
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.
What do you want to do there?
I have 2 use-cases for this:
1. Clear the RAM which contained the bitstream (memset to zero). This
should happen independed of the result of the upload operation.
2. Control a LED based on the upload result. So in case the upload
failed, i want to enable some error LED.
One issue is that the return values of spl_fit_load_fpga() or
spl_fit_upload_fpga() are not evaluated in common/spl
/spl_fit.c. So this error is not propagated to higher layers.
I my use-case uploading the bitstream is mandatory before starting u-boot.
I expect Simon won't like that it is another weak function.
I did not find another way to implement the above use-cases. Maybe i
missed something.
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)
Would be good to have kernel-doc and curious about ret parameter.
Also function like this could fail and you should propagate error.
I can add some code documentation for this function. These are the
parametes from spl_fit_upload_fpga() plus the return value of fpga_load().
My intend is that this function should not affect the result of
spl_fit_upload_fpga(). It should be just used trigger something based on
the upload result (parameter ret) or every time (e.g. clear the data
buffer in ram).
M
Regards,
Christian