* [PATCH v4 1/2] board/km/cent2: add include common.h
@ 2023-07-19 13:45 christian.taedcke-oss
2023-07-19 13:45 ` [PATCH v4 2/2] event: Add fpga load event christian.taedcke-oss
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: christian.taedcke-oss @ 2023-07-19 13:45 UTC (permalink / raw)
To: u-boot; +Cc: Christian Taedcke, Niel Fourie
From: Christian Taedcke <christian.taedcke@weidmueller.com>
Including common.h before event.h is required, because the new fpga
load event in event.h uses the size_t type.
Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
---
Changes in v4:
- add include common.h to kmcent2 board file
board/keymile/kmcent2/kmcent2.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/board/keymile/kmcent2/kmcent2.c b/board/keymile/kmcent2/kmcent2.c
index ed552c57b5..6dbaaa5457 100644
--- a/board/keymile/kmcent2/kmcent2.c
+++ b/board/keymile/kmcent2/kmcent2.c
@@ -6,6 +6,7 @@
* Copyright 2013 Freescale Semiconductor, Inc.
*/
+#include <common.h>
#include <event.h>
#include <asm/cache.h>
#include <asm/fsl_fdt.h>
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v4 2/2] event: Add fpga load event
2023-07-19 13:45 [PATCH v4 1/2] board/km/cent2: add include common.h christian.taedcke-oss
@ 2023-07-19 13:45 ` christian.taedcke-oss
2023-07-19 20:30 ` Tom Rini
2023-07-19 19:11 ` [PATCH v4 1/2] board/km/cent2: add include common.h Simon Glass
2023-07-19 20:28 ` Tom Rini
2 siblings, 1 reply; 5+ messages in thread
From: christian.taedcke-oss @ 2023-07-19 13:45 UTC (permalink / raw)
To: u-boot; +Cc: Christian Taedcke, Simon Glass, Michal Simek
From: Christian Taedcke <christian.taedcke@weidmueller.com>
This enables implementing custom logic after a bitstream was loaded
into the fpga.
Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
(no changes since v3)
Changes in v3:
- replace #if with if
- remove previously added printf
- return notification error from fpga_load()
- fix static_assert checking event name list
Changes in v2:
- replace __weak function with a new event
common/event.c | 3 +++
drivers/fpga/fpga.c | 20 ++++++++++++++++++++
include/event.h | 16 ++++++++++++++++
3 files changed, 39 insertions(+)
diff --git a/common/event.c b/common/event.c
index 164c95f8f5..20720c5283 100644
--- a/common/event.c
+++ b/common/event.c
@@ -36,6 +36,9 @@ const char *const type_name[] = {
/* init hooks */
"misc_init_f",
+ /* Fpga load hook */
+ "fpga_load",
+
/* fdt hooks */
"ft_fixup",
diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c
index 7f6b6bc73a..81e6d8ffc0 100644
--- a/drivers/fpga/fpga.c
+++ b/drivers/fpga/fpga.c
@@ -244,6 +244,21 @@ int fpga_loads(int devnum, const void *buf, size_t size,
}
#endif
+static int fpga_load_event_notify(const void *buf, size_t bsize, int result)
+{
+ if (CONFIG_IS_ENABLED(EVENT)) {
+ struct event_fpga_load load = {
+ .buf = buf,
+ .bsize = bsize,
+ .result = result
+ };
+
+ return event_notify(EVT_FPGA_LOAD, &load, sizeof(load));
+ }
+
+ return 0;
+}
+
/*
* Generic multiplexing code
*/
@@ -251,6 +266,7 @@ int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype,
int flags)
{
int ret_val = FPGA_FAIL; /* assume failure */
+ int ret_notify;
const fpga_desc *desc = fpga_validate(devnum, buf, bsize,
(char *)__func__);
@@ -284,6 +300,10 @@ int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype,
}
}
+ ret_notify = fpga_load_event_notify(buf, bsize, ret_val);
+ if (ret_notify)
+ return ret_notify;
+
return ret_val;
}
diff --git a/include/event.h b/include/event.h
index fe41080fa6..77124c2e73 100644
--- a/include/event.h
+++ b/include/event.h
@@ -31,6 +31,9 @@ enum event_t {
/* Init hooks */
EVT_MISC_INIT_F,
+ /* Fpga load hook */
+ EVT_FPGA_LOAD,
+
/* Device tree fixups before booting */
EVT_FT_FIXUP,
@@ -59,6 +62,19 @@ union event_data {
struct udevice *dev;
} dm;
+ /**
+ * struct event_fpga_load - fpga load event
+ *
+ * @buf: The buffer that was loaded into the fpga
+ * @bsize: The size of the buffer that was loaded into the fpga
+ * @result: Result of the load operation
+ */
+ struct event_fpga_load {
+ const void *buf;
+ size_t bsize;
+ int result;
+ } fpga_load;
+
/**
* struct event_ft_fixup - FDT fixup before booting
*
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/2] board/km/cent2: add include common.h
2023-07-19 13:45 [PATCH v4 1/2] board/km/cent2: add include common.h christian.taedcke-oss
2023-07-19 13:45 ` [PATCH v4 2/2] event: Add fpga load event christian.taedcke-oss
@ 2023-07-19 19:11 ` Simon Glass
2023-07-19 20:28 ` Tom Rini
2 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2023-07-19 19:11 UTC (permalink / raw)
To: christian.taedcke-oss; +Cc: u-boot, Christian Taedcke, Niel Fourie
On Wed, 19 Jul 2023 at 07:46, <christian.taedcke-oss@weidmueller.com> wrote:
>
> From: Christian Taedcke <christian.taedcke@weidmueller.com>
>
> Including common.h before event.h is required, because the new fpga
> load event in event.h uses the size_t type.
>
> Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
> ---
>
> Changes in v4:
> - add include common.h to kmcent2 board file
>
> board/keymile/kmcent2/kmcent2.c | 1 +
> 1 file changed, 1 insertion(+)
>
This is fine, but really we should fix event.h
Reviewed-by: Simon Glass <sjg@chromium.org>
> diff --git a/board/keymile/kmcent2/kmcent2.c b/board/keymile/kmcent2/kmcent2.c
> index ed552c57b5..6dbaaa5457 100644
> --- a/board/keymile/kmcent2/kmcent2.c
> +++ b/board/keymile/kmcent2/kmcent2.c
> @@ -6,6 +6,7 @@
> * Copyright 2013 Freescale Semiconductor, Inc.
> */
>
> +#include <common.h>
> #include <event.h>
> #include <asm/cache.h>
> #include <asm/fsl_fdt.h>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/2] board/km/cent2: add include common.h
2023-07-19 13:45 [PATCH v4 1/2] board/km/cent2: add include common.h christian.taedcke-oss
2023-07-19 13:45 ` [PATCH v4 2/2] event: Add fpga load event christian.taedcke-oss
2023-07-19 19:11 ` [PATCH v4 1/2] board/km/cent2: add include common.h Simon Glass
@ 2023-07-19 20:28 ` Tom Rini
2 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2023-07-19 20:28 UTC (permalink / raw)
To: christian.taedcke-oss; +Cc: u-boot, Christian Taedcke, Niel Fourie
[-- Attachment #1: Type: text/plain, Size: 1099 bytes --]
On Wed, Jul 19, 2023 at 03:45:43PM +0200, christian.taedcke-oss@weidmueller.com wrote:
> From: Christian Taedcke <christian.taedcke@weidmueller.com>
>
> Including common.h before event.h is required, because the new fpga
> load event in event.h uses the size_t type.
>
> Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
> ---
>
> Changes in v4:
> - add include common.h to kmcent2 board file
>
> board/keymile/kmcent2/kmcent2.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/board/keymile/kmcent2/kmcent2.c b/board/keymile/kmcent2/kmcent2.c
> index ed552c57b5..6dbaaa5457 100644
> --- a/board/keymile/kmcent2/kmcent2.c
> +++ b/board/keymile/kmcent2/kmcent2.c
> @@ -6,6 +6,7 @@
> * Copyright 2013 Freescale Semiconductor, Inc.
> */
>
> +#include <common.h>
> #include <event.h>
> #include <asm/cache.h>
> #include <asm/fsl_fdt.h>
No, we aren't adding common.h to more files. What in event.h needs some
other part of common.h that it's not getting today? common.h has
nothing more in it than other includes.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 2/2] event: Add fpga load event
2023-07-19 13:45 ` [PATCH v4 2/2] event: Add fpga load event christian.taedcke-oss
@ 2023-07-19 20:30 ` Tom Rini
0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2023-07-19 20:30 UTC (permalink / raw)
To: christian.taedcke-oss
Cc: u-boot, Christian Taedcke, Simon Glass, Michal Simek
[-- Attachment #1: Type: text/plain, Size: 1374 bytes --]
On Wed, Jul 19, 2023 at 03:45:44PM +0200, christian.taedcke-oss@weidmueller.com wrote:
> From: Christian Taedcke <christian.taedcke@weidmueller.com>
>
> This enables implementing custom logic after a bitstream was loaded
> into the fpga.
>
> Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
[snip]
> diff --git a/include/event.h b/include/event.h
> index fe41080fa6..77124c2e73 100644
> --- a/include/event.h
> +++ b/include/event.h
> @@ -31,6 +31,9 @@ enum event_t {
> /* Init hooks */
> EVT_MISC_INIT_F,
>
> + /* Fpga load hook */
> + EVT_FPGA_LOAD,
> +
> /* Device tree fixups before booting */
> EVT_FT_FIXUP,
>
> @@ -59,6 +62,19 @@ union event_data {
> struct udevice *dev;
> } dm;
>
> + /**
> + * struct event_fpga_load - fpga load event
> + *
> + * @buf: The buffer that was loaded into the fpga
> + * @bsize: The size of the buffer that was loaded into the fpga
> + * @result: Result of the load operation
> + */
> + struct event_fpga_load {
> + const void *buf;
> + size_t bsize;
> + int result;
> + } fpga_load;
> +
> /**
> * struct event_ft_fixup - FDT fixup before booting
> *
Since here is where you're introducing a size_t to event.h, here is
where you also need to add <linux/types.h> to event.h
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-19 20:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-19 13:45 [PATCH v4 1/2] board/km/cent2: add include common.h christian.taedcke-oss
2023-07-19 13:45 ` [PATCH v4 2/2] event: Add fpga load event christian.taedcke-oss
2023-07-19 20:30 ` Tom Rini
2023-07-19 19:11 ` [PATCH v4 1/2] board/km/cent2: add include common.h Simon Glass
2023-07-19 20:28 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox