Skip to contentSkip to conversation

FPGA Manager Patches for 4.18

PATCH New Moritz Fischer 1 participant 4 messages Apr 17, 2018

Subsystems (2)
lore
Share & tools
lore

Moritz Fischer

author maintainer
#0 lore raw

cover FPGA Manager Patches for 4.18

Hi Greg,

Please queue the following patches for v4.18.

Alan's Patch clarifies the locking in the fpga-region code.

Paolo's patches add a new driver with corresponding bindings for a Lattice FPGA part.

Thanks,

Moritz

Alan Tull (1):
fpga: fpga-region: comment on fpga_region_program_fpga locking

Paolo Pisati (2):
dt: bindings: fpga: add lattice machxo2 slave spi binding description
fpga: lattice machxo2: Add Lattice MachXO2 support

 .../bindings/fpga/lattice-machxo2-spi.txt     |  29 ++
 drivers/fpga/Kconfig                          |   7 +
 drivers/fpga/Makefile                         |   1 +
 drivers/fpga/fpga-region.c                    |   5 +
 drivers/fpga/machxo2-spi.c                    | 403 ++++++++++++++++++
 5 files changed, 445 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/fpga/lattice-machxo2-spi.txt
 create mode 100644 drivers/fpga/machxo2-spi.c
Signature · 1 line
2.17.0
author maintainer
#1 lore raw

PATCH 1/3 dt: bindings: fpga: add lattice machxo2 slave spi binding description

From: Paolo Pisati <[email protected]>

Add dt binding documentation details for Lattice MachXO2 FPGA configuration over Slave SPI interface.

---
 .../bindings/fpga/lattice-machxo2-spi.txt     | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/fpga/lattice-machxo2-spi.txt
Documentation/devicetree/bindings/fpga/lattice-machxo2-spi.txt new file +29 -0
new file mode 100644
index 000000000000..a8c362eb160c
@@ -0,0 +1,29 @@
+Lattice MachXO2 Slave SPI FPGA Manager
+
+Lattice MachXO2 FPGAs support a method of loading the bitstream over
+'slave SPI' interface.
+
+See 'MachXO2ProgrammingandConfigurationUsageGuide.pdf' on www.latticesemi.com
+
+Required properties:
+- compatible: should contain "lattice,machxo2-slave-spi"
+- reg: spi chip select of the FPGA
+
+Example for full FPGA configuration:
+
+	fpga-region0 {
+		compatible = "fpga-region";
+		fpga-mgr = <&fpga_mgr_spi>;
+		#address-cells = <0x1>;
+		#size-cells = <0x1>;
+	};
+
+	spi1: spi@2000 {
+        ...
+
+		fpga_mgr_spi: fpga-mgr@0 {
+			compatible = "lattice,machxo2-slave-spi";
+			spi-max-frequency = <8000000>;
+			reg = <0>;
+		};
+	};
Signature · 1 line
2.17.0
author maintainer
#2 lore raw

PATCH 2/3 fpga: lattice machxo2: Add Lattice MachXO2 support

In reply to Moritz Fischer

From: Paolo Pisati <[email protected]>

This patch adds support to the FPGA manager for programming MachXO2 device’s internal flash memory, via slave SPI.

---
 drivers/fpga/Kconfig       |   7 +
 drivers/fpga/Makefile      |   1 +
 drivers/fpga/machxo2-spi.c | 403 +++++++++++++++++++++++++++++++++++++
 3 files changed, 411 insertions(+)
 create mode 100644 drivers/fpga/machxo2-spi.c
drivers/fpga/Kconfig +7 -0
index f47ef848bcd0..53d3f5514775 100644
@@ -70,6 +70,13 @@ config FPGA_MGR_ICE40_SPI
 	help
 	  FPGA manager driver support for Lattice iCE40 FPGAs over SPI.
 
+config FPGA_MGR_MACHXO2_SPI
+	tristate "Lattice MachXO2 SPI"
+	depends on SPI
+	help
+	  FPGA manager driver support for Lattice MachXO2 configuration
+	  over slave SPI interface.
+
 config FPGA_MGR_TS73XX
 	tristate "Technologic Systems TS-73xx SBC FPGA Manager"
 	depends on ARCH_EP93XX && MACH_TS72XX
drivers/fpga/Makefile +1 -0
index 3cb276a0f88d..f9803dad6919 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_FPGA)			+= fpga-mgr.o
 obj-$(CONFIG_FPGA_MGR_ALTERA_CVP)	+= altera-cvp.o
 obj-$(CONFIG_FPGA_MGR_ALTERA_PS_SPI)	+= altera-ps-spi.o
 obj-$(CONFIG_FPGA_MGR_ICE40_SPI)	+= ice40-spi.o
+obj-$(CONFIG_FPGA_MGR_MACHXO2_SPI)	+= machxo2-spi.o
 obj-$(CONFIG_FPGA_MGR_SOCFPGA)		+= socfpga.o
 obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10)	+= socfpga-a10.o
 obj-$(CONFIG_FPGA_MGR_TS73XX)		+= ts73xx-fpga.o
drivers/fpga/machxo2-spi.c new file +403 -0

403 lines not on this page · raw message

Signature · 1 line
2.17.0
author maintainer
#3 lore raw

PATCH 3/3 fpga: fpga-region: comment on fpga_region_program_fpga locking

In reply to Moritz Fischer

From: Alan Tull <[email protected]>

Add a comment to the header of fpga_region_program_fpga() regarding locking of the bridges.

---
 drivers/fpga/fpga-region.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/fpga/fpga-region.c +5 -0
index edab2a2e03ef..cb0603e07ff8 100644
@@ -95,6 +95,11 @@ static void fpga_region_put(struct fpga_region *region)
  * fpga_region_program_fpga - program FPGA
  * @region: FPGA region
  * Program an FPGA using fpga image info (region->info).
+ * If the region has a get_bridges function, the exclusive reference for the
+ * bridges will be held if programming succeeds.  This is intended to prevent
+ * reprogramming the region until the caller considers it safe to do so.
+ * The caller will need to call fpga_bridges_put() before attempting to
+ * reprogram the region.
  * Return 0 for success or negative error code.
  */
 int fpga_region_program_fpga(struct fpga_region *region)
Signature · 1 line
2.17.0