FPGA programming driver architecture
Hi,
I have written some code to program a FPGA in Linux, for two different types of boards: one uses a serial interface (SPI) and the second a parallel interface. I have been able to sucessfully program both boards. I'm now trying to clean my code and make it more generic, as well as better in line with the Linux driver model. I would also like to include it in the mainline kernel if there is interest.
Here is a description of the current architecture (refer to diagrams below): The fpgaload module controls one output GPIOs (PROG), and two input GPIOs (INIT and DONE). These GPIOs are specified in board setup code. Both fpgaload_ser and fpgaload_par modules export a single function to write a byte. The fpgaload driver is a char device to which we can write (/dev/fpgaload) to program a bitstream (FPGA firmware) inside the FPGA. The fpgaload driver will toggle the GPIOs to initiate programming and the then call the corresponding write_byte function based on the interface type specified in board setup code (serial or parallel, or any future interface desired).
FPGA serial bitstream loading architecture
+----------------------+
| FPGA load driver |
| (fpgaload) |
+----------------------+
| |
| +----------------+
| | FPGA serial |
| | load driver |
| | (fpgaload_ser) |
| +----------------+
| |
| +-------------------+
| | SPI master |
| | controller driver |
| +-------------------+
| |
| | Linux
------------------------------------
| | HARDWARE
| |spi
| |
| +--------------+
| | SPI |
+----->| Programming |
GPIOs | interface |
+--------------+FPGA
FPGA parallel bitstream loading architecture
+----------------------+
| FPGA load driver |
| (fpgaload) |
+----------------------+
| |
| +----------------+
| | FPGA parallel |
| | load driver |
| | (fpgaload_par) |
| +----------------+
| |
| | Linux
------------------------------------
| | HARDWARE
| |parallel
| |
| +--------------+
| | Parallel |
+----->| Programming |
GPIOs | interface |
+--------------+FPGA
The problem with that approach is that when loading the fpgaload module with modprobe, it will automatically try to load the fpgaload_ser and fpgaload_par modules, even if only serial interface was specified in board setup code for example. This is not good when building a kernel for similar but different boards.
Probably a better approach would be for the fpgaload_Ser and fpgaload_par modules to register themselves with the fpgaload module. Then, should the fpgaload module be built using a BUS driver structure? Or anyone having any suggestions on how it should be implemented?
Hugo Villeneuve
Quoted 2 lines · On Fri, 12 Dec 2008 15:00:47 -0500 Hugo Villeneuve <[email protected]> wrote:
Hi,
I have written some code to program a FPGA in Linux...
Sorry, wrong mailing list :)
Hugo V.
Dear Hugo Villeneuve,
Quoted 3 lines · In message <[email protected]> you wrote:
I have written some code to program a FPGA in Linux, for two different types of boards: one uses a serial interface (SPI) and the second a parallel interface. I have been able to sucessfully program both boards. I'm now trying to clean my code and make it more generic, as well as better in line with the Linux driver model. I would also like to include it in the mainline kernel if there is interest.
Your lines are way too long, and discussing Linux kernel code is off topic here.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de When all else fails, read the instructions.
Quoted 12 lines · On Sat, 13 Dec 2008 00:10:26 +0100 Wolfgang Denk <[email protected]> wrote:
Dear Hugo Villeneuve,
Quoted 8 lines · In message <[email protected]> you wrote:
I have written some code to program a FPGA in Linux, for two different types of boards: one uses a serial interface (SPI) and the second a parallel interface. I have been able to sucessfully program both boards. I'm now trying to clean my code and make it more generic, as well as better in line with the Linux driver model. I would also like to include it in the mainline kernel if there is interest.
Quoted 2 lines
Your lines are way too long, and discussing Linux kernel code is off topic here.
You probably have missed the email I sent 30 seconds after having sent the first one stating it was the wrong list. Please read your emails carefully next time.
Hugo V.
Dear Hugo Villeneuve,
Quoted 4 lines · In message <[email protected]> you wrote:
You probably have missed the email I sent 30 seconds after having sent the first one stating it was the wrong list. Please read your emails carefully next time.
I can read them only as fast as they get delivered.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Only a fool fights in a burning house. -- Kank the Klingon, "Day of the Dove", stardate unknown