Skip to content

Commit e7185c6

Browse files
gainspeedgregkh
authored andcommitted
staging: fpgaboot: Xilinx FPGA firmware download driver
This driver downloads Xilinx FPGA firmware using gpio pins. It loads Xilinx FPGA bitstream format firmware image and program the Xilinx FPGA using SelectMAP (parallel) mode. Signed-off-by: Insop Song <insop.song@gainspeed.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 86f78b8 commit e7185c6

10 files changed

Lines changed: 958 additions & 0 deletions

File tree

‎drivers/staging/Kconfig‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,6 @@ source "drivers/staging/dgnc/Kconfig"
146146

147147
source "drivers/staging/dgap/Kconfig"
148148

149+
source "drivers/staging/gs_fpgaboot/Kconfig"
150+
149151
endif # STAGING

‎drivers/staging/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ obj-$(CONFIG_XILLYBUS) += xillybus/
6565
obj-$(CONFIG_DGNC) += dgnc/
6666
obj-$(CONFIG_DGAP) += dgap/
6767
obj-$(CONFIG_MTD_SPINAND_MT29F) += mt29f_spinand/
68+
obj-$(CONFIG_GS_FPGABOOT) += gs_fpgaboot/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# "xilinx FPGA firmware download, fpgaboot"
3+
#
4+
config GS_FPGABOOT
5+
tristate "Xilinx FPGA firmware download module"
6+
default n
7+
help
8+
Xilinx FPGA firmware download module
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
gs_fpga-y += gs_fpgaboot.o io.o
2+
obj-$(CONFIG_GS_FPGABOOT) += gs_fpga.o
3+
4+
ccflags-$(CONFIG_GS_FPGA_DEBUG) := -DDEBUG

‎drivers/staging/gs_fpgaboot/README‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
==============================================================================
2+
Linux Driver Source for Xilinx FPGA firmware download
3+
==============================================================================
4+
5+
6+
TABLE OF CONTENTS.
7+
8+
1. SUMMARY
9+
2. BACKGROUND
10+
3. DESIGN
11+
4. HOW TO USE
12+
5. REFERENCE
13+
14+
1. SUMMARY
15+
16+
- Download Xilinx FPGA firmware
17+
- This module downloads Xilinx FPGA firmware using gpio pins.
18+
19+
2. BACKGROUND
20+
21+
An FPGA (Field Programmable Gate Array) is a programmable hardware that is
22+
used in various applications. Hardware design needs to programmed through
23+
a dedicated device or CPU assisted way (serial or parallel).
24+
This driver provides a way to download FPGA firmware.
25+
26+
3. DESIGN
27+
28+
- load Xilinx FPGA bitstream format[1] firmware image file using
29+
kernel firmware framework, request_firmware()
30+
- program the Xilinx FPGA using SelectMAP (parallel) mode [2]
31+
- FPGA prgram is done by gpio based bit-banging, as an example
32+
- platform independent file: gs_fpgaboot.c
33+
- platform dependent file: io.c
34+
35+
36+
4. HOW TO USE
37+
38+
$ insmod gs_fpga.ko file="xlinx_fpga_top_bitstream.bit"
39+
$ rmmod gs_fpga
40+
41+
5. USE CASE (from a mailing list discussion with Greg)
42+
43+
a. As a FPGA development support tool,
44+
During FPGA firmware development, you need to download a new FPGA
45+
image frequently.
46+
You would do that with a dedicated JTAG, which usually a limited
47+
resource in the lab.
48+
However, if you use my driver, you don't have to have a dedicated JTAG.
49+
This is a real gain :)
50+
51+
b. For the FPGA that runs without config after the download, which
52+
doesn't talk to any of Linux interfaces (such as PCIE).
53+
54+
We download FPGA firmware from user triggered or some other way, and that's it.
55+
Since that FPGA runs on its own, it doesn't require a linux driver
56+
after the download.
57+
58+
c. For the FPGA that requires config after the download, which talk to
59+
any of linux interfaces (such as PCIE)
60+
61+
Then, this type of FPGA config can be put into device tree and have a
62+
separate driver (pcie or others), then THAT driver calls my driver to
63+
download FPGA firmware during the Linux boot, the take over the device
64+
through the interface.
65+
66+
6. REFERENCE
67+
68+
1. Xilinx APP NOTE XAPP583:
69+
http://www.xilinx.com/support/documentation/application_notes/xapp583-fpga-configuration.pdf
70+
2. bitstream file info:
71+
http://home.earthlink.net/~davesullins/software/bitinfo.html

‎drivers/staging/gs_fpgaboot/TODO‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
TODO:
2+
- get bus width input instead of hardcoded bus width
3+
- get it reviewed
4+
5+
Please send any patches for this driver to Insop Song<insop.song@gainspeed.com>
6+
and Greg Kroah-Hartman <gregkh@linuxfoundation.org>.
7+
And please CC to "Staging subsystem" mail list <devel@driverdev.osuosl.org> too.

0 commit comments

Comments
 (0)