dm: fpga: Introduce new uclass
v2 cover dm: fpga: Introduce new uclass
Hei hei,
tried to address all the feedback I got from Simon, thanks for that.
Build tested on Debian GNU/Linux 11 (bullseye) on arch amd64, tried on i386 first, but got some nasty errors there (see IRC backlog).
Tried in sandbox console, and everythings looks fine to me, as far as I can judge. dm tree and dm uclass and dm drivers list the right things, and ut dm fpga returns with success.
I refused to add Simon's Reviewed-by, because I did some changes compared to RFC (see notes on patch).
One technical question: should I add SANDBOX_FPGA to sandbox_defconfig?
And Michal, is it okay to add you as maintainer for the unit test as I did in v2 of the patch now?
Greets
Alex
Alexander Dahl (1):
dm: fpga: Introduce new uclass
MAINTAINERS | 1 + arch/sandbox/dts/test.dts | 4 ++++ drivers/fpga/Kconfig | 19 +++++++++++++++++++ drivers/fpga/Makefile | 3 +++ drivers/fpga/fpga-uclass.c | 11 +++++++++++ drivers/fpga/sandbox.c | 17 +++++++++++++++++ include/dm/uclass-id.h | 1 + test/dm/Makefile | 1 + test/dm/fpga.c | 20 ++++++++++++++++++++ 9 files changed, 77 insertions(+) create mode 100644 drivers/fpga/fpga-uclass.c create mode 100644 drivers/fpga/sandbox.c create mode 100644 test/dm/fpga.c
base-commit: 97c0a9c5708dc60d82cad721a8b882f0ce37e83d
Signature · 1 line
2.30.2
PATCH v2 1/1 dm: fpga: Introduce new uclass
For future DM based FPGA drivers and for now to have a meaningful logging class for old FPGA drivers.
---
Notes:
RFC -> v2:
- Added/Improved Kconfig help texts
- Use uclass_first_device_err() in test
- Add compatibles match list to sandbox driver
- Add 'test/dm/fpga.c' to MAINTAINERS
MAINTAINERS | 1 + arch/sandbox/dts/test.dts | 4 ++++ drivers/fpga/Kconfig | 19 +++++++++++++++++++ drivers/fpga/Makefile | 3 +++ drivers/fpga/fpga-uclass.c | 11 +++++++++++ drivers/fpga/sandbox.c | 17 +++++++++++++++++ include/dm/uclass-id.h | 1 + test/dm/Makefile | 1 + test/dm/fpga.c | 20 ++++++++++++++++++++ 9 files changed, 77 insertions(+) create mode 100644 drivers/fpga/fpga-uclass.c create mode 100644 drivers/fpga/sandbox.c create mode 100644 test/dm/fpga.c
MAINTAINERS +1 -0
@@ -918,6 +918,7 @@ T: git https://source.denx.de/u-boot/custodians/u-boot-microblaze.git F: drivers/fpga/ F: cmd/fpga.c F: include/fpga.h +F: test/dm/fpga.c FLATTENED DEVICE TREE M: Simon Glass <[email protected]>
arch/sandbox/dts/test.dts +4 -0
@@ -650,6 +650,10 @@ }; }; + fpga { + compatible = "sandbox,fpga"; + }; + pinctrl-gpio { compatible = "sandbox,pinctrl-gpio";
drivers/fpga/Kconfig +19 -0
@@ -118,4 +118,23 @@ config SPL_FPGA_LOAD_SECURE Enables the fpga loads() functions that are used to load secure (authenticated or encrypted or both) bitstreams on to FPGA. +config DM_FPGA + bool "Enable Driver Model for FPGA drivers" + depends on DM + select FPGA + help + Enable driver model for Field-Programmable Gate Array (FPGA) devices. + The devices cover a wide range of applications and are configured at + runtime by loading a bitstream into the FPGA device. + Loading a bitstream from any kind of storage is the main task of the + FPGA drivers. + For now this uclass has no methods yet. + +config SANDBOX_FPGA + bool "Enable sandbox FPGA driver" + depends on SANDBOX && DM_FPGA + help + This is a driver model based FPGA driver for sandbox. + Currently it is a stub only, as there are no usable uclass methods yet. + endmenu
drivers/fpga/Makefile +3 -0
@@ -4,6 +4,9 @@ # Wolfgang Denk, DENX Software Engineering, [email protected]. obj-y += fpga.o +obj-$(CONFIG_DM_FPGA) += fpga-uclass.o +obj-$(CONFIG_SANDBOX_FPGA) += sandbox.o + obj-$(CONFIG_FPGA_SPARTAN2) += spartan2.o obj-$(CONFIG_FPGA_SPARTAN3) += spartan3.o obj-$(CONFIG_FPGA_VERSALPL) += versalpl.o
drivers/fpga/fpga-uclass.c new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright 2022 Alexander Dahl <[email protected]> +*/ + +#include <dm.h> + +UCLASS_DRIVER (fpga) = { + .name ="fpga" , + .id =UCLASS_FPGA , +};
drivers/fpga/sandbox.c new file +17 -0
@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright 2022 Alexander Dahl <[email protected]> +*/ + +#include <dm.h> + +static const struct udevice_id sandbox_fpga_match[] = { + { .compatible ="sandbox,fpga" }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (sandbox_fpga) = { + .name ="sandbox_fpga" , + .id =UCLASS_FPGA , + .of_match = sandbox_fpga_match, +};
include/dm/uclass-id.h +1 -0
@@ -56,6 +56,7 @@ enum uclass_id {UCLASS_ETH ,/* Ethernet device */ UCLASS_ETH_PHY ,/* Ethernet PHY device */ UCLASS_FIRMWARE ,/* Firmware */ +UCLASS_FPGA ,/* FPGA device */ UCLASS_FUZZING_ENGINE ,/* Fuzzing engine */ UCLASS_FS_FIRMWARE_LOADER ,/* Generic loader */ UCLASS_GPIO, /* Bank of general-purpose I/O pins */
test/dm/Makefile +1 -0
@@ -47,6 +47,7 @@ ifneq ($(CONFIG_EFI_PARTITION),) obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o endif obj-$(CONFIG_FIRMWARE) += firmware.o +obj-$(CONFIG_DM_FPGA) += fpga.o obj-$(CONFIG_DM_HWSPINLOCK) += hwspinlock.o obj-$(CONFIG_DM_I2C) += i2c.o obj-$(CONFIG_SOUND) += i2s.o
test/dm/fpga.c new file +20 -0
@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright 2022 Alexander Dahl <[email protected]> +*/ + +#include <dm.h> +#include <dm/test.h> +#include <test/test.h> +#include <test/ut.h> + +static int dm_test_fpga (struct unit_test_state *uts) +{ +struct udevice *dev; + +ut_assertok (uclass_first_device_err (UCLASS_FPGA , &dev)); + +return 0 ; +} + +DM_TEST (dm_test_fpga,UT_TESTF_SCAN_FDT );
Signature · 1 line
2.30.2
Quoted 16 lines · Alexander Dahl
For future DM based FPGA drivers and for now to have a meaningful logging class for old FPGA drivers.
Suggested-by Michal Simek <[email protected]>Suggested-by Simon Glass <[email protected]>Signed-off-by Alexander Dahl <[email protected]>---
Notes:
RFC -> v2:
- Added/ImprovedKconfighelp texts
- Useuclass_first_device_err()in test
- Add compatibles match list to sandbox driver
- Add 'test/dm/fpga.c' toMAINTAINERS
Quoted 13 lines
MAINTAINERS | 1 + arch/sandbox/dts/test.dts | 4 ++++ drivers/fpga/Kconfig | 19 +++++++++++++++++++ drivers/fpga/Makefile | 3 +++ drivers/fpga/fpga-uclass.c | 11 +++++++++++ drivers/fpga/sandbox.c | 17 +++++++++++++++++ include/dm/uclass-id.h | 1 + test/dm/Makefile | 1 + test/dm/fpga.c | 20 ++++++++++++++++++++ 9 files changed, 77 insertions(+) create mode 100644 drivers/fpga/fpga-uclass.c create mode 100644 drivers/fpga/sandbox.c create mode 100644 test/dm/fpga.c
The only thing needed now is a header file, but we can add that once we have some operations.
Hi Simon,
Quoted 31 lines · Simon Glass
Quoted 26 lines · Alexander Dahl
For future DM based FPGA drivers and for now to have a meaningful logging class for old FPGA drivers.
Suggested-by Michal Simek <[email protected]>Suggested-by Simon Glass <[email protected]>Signed-off-by Alexander Dahl <[email protected]>---
Notes:
RFC -> v2:
- Added/ImprovedKconfighelp texts
- Useuclass_first_device_err()in test
- Add compatibles match list to sandbox driver
- Add 'test/dm/fpga.c' toMAINTAINERSMAINTAINERS | 1 + arch/sandbox/dts/test.dts | 4 ++++ drivers/fpga/Kconfig | 19 +++++++++++++++++++ drivers/fpga/Makefile | 3 +++ drivers/fpga/fpga-uclass.c | 11 +++++++++++ drivers/fpga/sandbox.c | 17 +++++++++++++++++ include/dm/uclass-id.h | 1 + test/dm/Makefile | 1 + test/dm/fpga.c | 20 ++++++++++++++++++++ 9 files changed, 77 insertions(+)Quoted 3 lines
create mode 100644
drivers/fpga/fpga-uclass.c
create mode 100644drivers/fpga/sandbox.c
create mode 100644test/dm/fpga.c
Quoted 4 lines
Reviewed-by Simon Glass <[email protected]>The only thing needed now is a header file, but we can add that once we have some operations.
Do you want me to take it via my tree or you want to take it via your DM tree? Both ways works for me.
Thanks,
Michal
Hi Michal,
Quoted 35 lines · Michal Simek
Hi Simon,
Quoted 31 lines · Simon Glass
Quoted 29 lines · Alexander Dahl
For future DM based FPGA drivers and for now to have a meaningful logging class for old FPGA drivers.
Suggested-by Michal Simek <[email protected]>Suggested-by Simon Glass <[email protected]>Signed-off-by Alexander Dahl <[email protected]>---
Notes:
RFC -> v2:
- Added/ImprovedKconfighelp texts
- Useuclass_first_device_err()in test
- Add compatibles match list to sandbox driver
- Add 'test/dm/fpga.c' toMAINTAINERSMAINTAINERS | 1 + arch/sandbox/dts/test.dts | 4 ++++ drivers/fpga/Kconfig | 19 +++++++++++++++++++ drivers/fpga/Makefile | 3 +++ drivers/fpga/fpga-uclass.c | 11 +++++++++++ drivers/fpga/sandbox.c | 17 +++++++++++++++++ include/dm/uclass-id.h | 1 + test/dm/Makefile | 1 + test/dm/fpga.c | 20 ++++++++++++++++++++ 9 files changed, 77 insertions(+)create mode 100644
drivers/fpga/fpga-uclass.c
create mode 100644drivers/fpga/sandbox.c
create mode 100644test/dm/fpga.c
Quoted 7 lines
Quoted 4 lines
Reviewed-by Simon Glass <[email protected]>The only thing needed now is a header file, but we can add that once we have some operations.
Do you want me to take it via my tree or you want to take it via your DM tree? Both ways works for me.
If you are doing it soon, go ahead!
Regards,
Simon
Michal Simek
AppliedQuoted 35 lines · Alexander Dahl
Hei hei,
tried to address all the feedback I got from Simon, thanks for that.
Build tested on Debian GNU/Linux 11 (bullseye) on arch amd64, tried on i386 first, but got some nasty errors there (see IRC backlog).
Tried in sandbox console, and everythings looks fine to me, as far as I can judge.
dm treeanddm uclassanddm driverslist the right things, andut dm fpgareturns with success.I refused to add Simon's Reviewed-by, because I did some changes compared to RFC (see notes on patch).
One technical question: should I add
SANDBOX_FPGAtosandbox_defconfig?And Michal, is it okay to add you as maintainer for the unit test as I did in v2 of the patch now?
Greets
AlexAlexander Dahl (1):
dm: fpga: Introduce new uclassMAINTAINERS | 1 + arch/sandbox/dts/test.dts | 4 ++++ drivers/fpga/Kconfig | 19 +++++++++++++++++++ drivers/fpga/Makefile | 3 +++ drivers/fpga/fpga-uclass.c | 11 +++++++++++ drivers/fpga/sandbox.c | 17 +++++++++++++++++ include/dm/uclass-id.h | 1 + test/dm/Makefile | 1 + test/dm/fpga.c | 20 ++++++++++++++++++++ 9 files changed, 77 insertions(+)
Quoted 6 lines
create mode 100644
drivers/fpga/fpga-uclass.c
create mode 100644drivers/fpga/sandbox.c
create mode 100644test/dm/fpga.cbase-commit:
97c0a9c5708dc60d82cad721a8b882f0ce37e83d
Applied.
M