Repository navigation
Conversation
Add device trees for the NI VB-8012, VB-8034, and VB-8054 and the Digilent ADP5250, ADP5470, and ADP5490. ni-lci.dtsi describes the board they share: gem0 with the Marvell 88E1512 PHY, the uart0 console, usb0 in peripheral mode with its ULPI pinmux for the g_lci gadget, the PL fabric clocks FCLK0-3 for the FPGA design, and the raw-NAND fsbl/u-boot/boot-config/root partitions. The VB-8034, VB-8054, ADP5470, and ADP5490 enable Ethernet. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Add the National Instruments LCI (VirtualBench) USB gadget. f_hidbulk is a HID/bulk-switchable function registered as 'hid_bulk': alt0 is a HID interrupt interface, and the first instance's alt1 exposes 8 bulk endpoints for high throughput. g_lci composes 4 hid_bulk interfaces plus an optional mass-storage CD-ROM, configured by the g_lci.* module parameters. The composite source is lci.c so the g_lci module name does not collide with its only object. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Set OTGSC.OT (OTG Termination) from the Zynq controller reset notifier, as the Zynq-7000 TRM requires when the controller operates as a device. The OTGSC interrupt status bits are write-1-to-clear, so write them as zero. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Add a UIO driver for the LCI FPGA on NI VirtualBench devices. It exposes the FPGA registers and DMA memory as maps 0 and 1, and the FPGA interrupt, which the handler masks and irqcontrol unmasks. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Add the LCI FPGA node for uio_lci: FPGA registers at 0x40000000, the DMA buffer region at 0x0d600000, and PL interrupt 29, level high. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Set reset-on-timeout on the SWDT so the board resets when the LCI daemon stops petting /dev/watchdog. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
There was a problem hiding this comment.
🟡 Changes recommended
Open HID/bulk descriptors can access freed memory after unbind, and USB_G_LCI’s missing BLOCK dependency causes build failures with CONFIG_BLOCK=n.
8 open issues
Defer hidg release until open files and active I/O are gone · New Make USB_G_LCI depend on BLOCK · New Wake blocked reads on endpoint shutdown and return -ESHUTDOWN · New Set high-speed bulk endpoint max packet size to 512 bytes · New Reject unsupported alternate settings before changing endpoints · New Use a distinct device-node namespace to avoid stock HID collisions · New Clear descriptor pointers after freeing them · New Undo the refcount increment when descriptor allocation fails · New
What changed in this PR
Ports the VirtualBench support introduced for kernel 4.14 in #303 to kernel 6.18, integrating LCI devices with the existing NI Zynq platform support.
Changes:
- Adds shared LCI hardware definitions and device trees for six VirtualBench and Digilent boards.
- Introduces the FPGA UIO driver and a HID/bulk composite USB gadget with optional CD-ROM storage.
- Configures Zynq USB OTG termination and watchdog timeout resets.
| File | Description |
|---|---|
| drivers/usb/gadget/legacy/Makefile | Adds the g_lci build target. |
| drivers/usb/gadget/legacy/lci.c | Composes four HID/bulk interfaces and optional storage. |
| drivers/usb/gadget/legacy/Kconfig | Adds the LCI gadget option. |
| drivers/usb/gadget/Kconfig | Adds the HID/bulk function symbol. |
| drivers/usb/gadget/function/u_hidbulk.h | Defines shared HID/bulk instance options. |
| drivers/usb/gadget/function/Makefile | Builds the HID/bulk function. |
| drivers/usb/gadget/function/f_hidbulk.c | Implements switchable HID/bulk transport and character devices. |
| drivers/usb/chipidea/ci_hdrc_usb2.c | Sets OTG termination during Zynq controller reset. |
| drivers/usb/chipidea/bits.h | Defines the OTG termination register bit. |
| drivers/uio/uio_lci.c | Exposes FPGA registers, DMA memory, and interrupts. |
| drivers/uio/Makefile | Builds the LCI UIO driver. |
| drivers/uio/Kconfig | Adds the LCI FPGA driver option. |
| arch/arm/boot/dts/xilinx/ni-lci.dtsi | Defines shared peripherals, FPGA resources, and watchdog behavior. |
| arch/arm/boot/dts/xilinx/ni-7ABB.dts | Adds the Digilent ADP5490 board definition. |
| arch/arm/boot/dts/xilinx/ni-7ABA.dts | Adds the Digilent ADP5470 board definition. |
| arch/arm/boot/dts/xilinx/ni-7AB9.dts | Adds the Digilent ADP5250 board definition. |
| arch/arm/boot/dts/xilinx/ni-78B4.dts | Adds the NI VB-8054 board definition. |
| arch/arm/boot/dts/xilinx/ni-77DE.dts | Adds the NI VB-8034 board definition. |
| arch/arm/boot/dts/xilinx/ni-76F6.dts | Adds the NI VB-8012 board definition. |
| arch/arm/boot/dts/xilinx/Makefile | Registers all six new device-tree build targets. |
Review effort: Balanced
Comment on lines
+1631
to
+1633
| kfree(hidg->report_desc); | ||
| kfree(hidg->set_report_buff); | ||
| kfree(hidg); |
| dynamically linked module called "g_hid". | ||
|
|
||
| config USB_G_LCI | ||
| tristate "National Instruments LCI (VirtualBench) Gadget" |
Comment on lines
+318
to
+319
| if (wait_event_interruptible(hidg->read_queue, READ_COND)) | ||
| return -ERESTARTSYS; |
Comment on lines
+812
to
+813
| ep_desc->wMaxPacketSize = | ||
| min_t(short, hidg->report_length, 512); |
| unsigned long flags; | ||
| #endif | ||
|
|
||
| VDBG(cdev, "hidg_set_alt intf:%d alt:%d\n", intf, alt); |
| if (status) | ||
| goto fail; | ||
|
|
||
| device_create(hidg_class, NULL, dev, NULL, "%s%d", "hidg", hidg->minor); |
Comment on lines
+1319
to
+1320
| usb_free_descriptors(f->hs_descriptors); | ||
| usb_free_descriptors(f->fs_descriptors); |
| opts->report_desc_length, | ||
| GFP_KERNEL); | ||
| if (!hidg->report_desc) { | ||
| kfree(hidg); |
chaitu236
requested changes
Nov 24, 2026
chaitu236
left a comment
Contributor
There was a problem hiding this comment.
Took a quick pass - don't have any major concerns but we need to look into what copilot flagged.
There are also several checkpatch errors that we should also consider fixing (DT compatible string .. appears un-documented ones can be ignored`).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Port of the VirtualBench support merged for 4.14 in #303 to 6.18.
Tested on VB-8034 via NILE.
Build-tested: the NILE VB-8034 image (nati_zynq_defconfig plus the LCI options), and all six device trees.