public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* FPGA programming driver architecture
@ 2008-12-12 20:03 Hugo Villeneuve
  2008-12-13 12:58 ` Florian Fainelli
  0 siblings, 1 reply; 12+ messages in thread
From: Hugo Villeneuve @ 2008-12-12 20:03 UTC (permalink / raw)
  To: linux-kernel

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-01-09 23:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-12 20:03 FPGA programming driver architecture Hugo Villeneuve
2008-12-13 12:58 ` Florian Fainelli
2008-12-15 18:16   ` Hugo Villeneuve
2009-01-08 20:18   ` Hugo Villeneuve
2009-01-08 22:14     ` Thiago Galesi
2009-01-08 22:47       ` Leon Woestenberg
2009-01-08 22:57         ` Florian Fainelli
2009-01-08 23:07           ` Leon Woestenberg
2009-01-09  3:14             ` Duane Ellis
2009-01-09 12:24               ` Alexander Clouter
2009-01-09 15:07       ` Hugo Villeneuve
2009-01-09 23:40         ` Hans J. Koch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox