Skip to contentSkip to conversation

misc: Add Lattice ECP3 FPGA configuration via SPI

PATCH New Stefan Roese 1 participant 1 message Dec 7, 2012 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 misc: Add Lattice ECP3 FPGA configuration via SPI

This patch adds support for bitstream configuration (programming / loading) of the Lattice ECP3 FPGA's via the SPI bus.

Here an example on my custom MPC5200 based board:

$ echo 1 > /sys/class/firmware/spi0.0/loading
$ cat fpga_a4m2k.bit > /sys/class/firmware/spi0.0/data
$ echo 0 > /sys/class/firmware/spi0.0/loading

leads to these messages:

lattice-ecp3 spi0.0: FPGA Lattice ECP3-35 detected lattice-ecp3 spi0.0: Configuring the FPGA... lattice-ecp3 spi0.0: FPGA succesfully configured!

---
v5:
- Moved to drivers/misc as suggested by Grant
- Removed DRIVER_* macros
- Added Acked-by from Ming Lei
- Added Reviewed-by from Grant Likely

v4:
- Allocate per-device struct to store the completion variable unique per device

v3:
- Removed unnecessary goto (return instead)
- Added waiting for completion in remove

v2:
- Moved from drivers/firmware to drivers/spi as suggested by Ming Lei
- Removed pseudo device
- Removed static buffer pointer usage

 drivers/misc/Kconfig               |  11 ++
 drivers/misc/Makefile              |   1 +
 drivers/misc/lattice-ecp3-config.c | 243 +++++++++++++++++++++++++++++++++++++
 3 files changed, 255 insertions(+)
 create mode 100644 drivers/misc/lattice-ecp3-config.c
drivers/misc/Kconfig +11 -0
index b151b7c..50a0840 100644
@@ -499,6 +499,17 @@ config USB_SWITCH_FSA9480
 	  stereo and mono audio, video, microphone and UART data to use
 	  a common connector port.
 
+config LATTICE_ECP3_CONFIG
+	tristate "Lattice ECP3 FPGA bitstream configuration via SPI"
+	depends on SPI && SYSFS
+	select FW_LOADER
+	default	n
+	help
+	  This option enables support for bitstream configuration (programming
+	  or loading) of the Lattice ECP3 FPGA family via SPI.
+
+	  If unsure, say N.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
index 2129377..d19d364 100644
@@ -49,3 +49,4 @@ obj-y				+= carma/
 obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o
 obj-$(CONFIG_ALTERA_STAPL)	+=altera-stapl/
 obj-$(CONFIG_INTEL_MEI)		+= mei/
+obj-$(CONFIG_LATTICE_ECP3_CONFIG)	+= lattice-ecp3-config.o
drivers/misc/lattice-ecp3-config.c new file +243 -0

243 lines not on this page · raw message

Signature · 1 line
1.8.0.1