Skip to contentSkip to conversation

doc: dt: add altera-ps-spi binding document

PATCH In review Anatolij Gustschin 1 participant 5 messages May 17, 2017 – May 18, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v10 1/3 doc: dt: add altera-ps-spi binding document

From: Joshua Clayton <[email protected]>

Describe an altera-ps-spi devicetree entry, required features

---
Changes in v10:
- fix compatible string in example
- add Arria 10 compatible
- s/spi/SPI/
- reword to remove entries mentioning cyclone, since it can be used with other FPGAs now (Arria 10, Stratix V)

 .../bindings/fpga/altera-passive-serial.txt        | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/fpga/altera-passive-serial.txt
Documentation/devicetree/bindings/fpga/altera-passive-serial.txt new file +29 -0
new file mode 100644
index 0000000..3e240b2
@@ -0,0 +1,29 @@
+Altera Passive Serial SPI FPGA Manager
+
+Altera FPGAs support a method of loading the bitstream over what is
+referred to as "passive serial".
+The passive serial link is not technically SPI, and might require extra
+circuits in order to play nicely with other SPI slaves on the same bus.
+
+See https://www.altera.com/literature/hb/cyc/cyc_c51013.pdf
+
+Required properties:
+- compatible: Must be one of the following:
+	"altr,fpga-passive-serial",
+	"altr,fpga-arria10-passive-serial"
+- reg: SPI chip select of the FPGA
+- nconfig-gpios: config pin (referred to as nCONFIG in the manual)
+- nstat-gpios: status pin (referred to as nSTATUS in the manual)
+
+Optional properties:
+- confd-gpios: confd pin (referred to as CONF_DONE in the manual)
+
+Example:
+	fpga_spi: evi-fpga-spi@0 {
+		compatible = "altr,fpga-passive-serial";
+		spi-max-frequency = <20000000>;
+		reg = <0>;
+		nconfig-gpios = <&gpio4 9 GPIO_ACTIVE_LOW>;
+		nstat-gpios = <&gpio4 11 GPIO_ACTIVE_LOW>;
+		confd-gpios = <&gpio4 12 GPIO_ACTIVE_LOW>;
+	};
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

PATCH v10 2/3 fpga manager: Add altera-ps-spi driver for Altera FPGAs

From: Joshua Clayton <[email protected]>

altera-ps-spi loads FPGA firmware over SPI, using the "passive serial" interface on Altera Arria 10, Cyclone V or Stratix V FPGAs.

This is one of the simpler ways to set up an FPGA at runtime. The signal interface is close to unidirectional SPI with lsb first.

---
Changes in v10:
- rename cyclone-ps-spi driver to altera-ps-spi since other FPGA series also supported
- use _cansleep gpio functions, since the underlying GPIO driver can be for an USB-to-GPIO or I2C-to-GPIO device (with can_sleep=true in the GPIO driver)
- add fpga image info flag for optional skipping of stream bitswapping
- merge Arria 10 support from Bastian
- add info about supported/tested FPGA series to the comment
- add GPL v2 license info to the header comment and MODULE_LICENSE
- register FPGA managers with unique device names (usefull in the logs to differentiate which device was configured, when multiple FPGAs used)
- drop not needed casts of mgr-priv pointers
- add COMPILE_TEST to depends in Kconfig
- mention the supported FPGA series in Kconfig help and driver comment
- rebase on fpga manager patches recently submitted to the list, applies on top of:

     https://patchwork.kernel.org/patch/9725677/
     https://patchwork.kernel.org/patch/9725721/

requires below patch for building:

     https://patchwork.kernel.org/patch/9691381/
 drivers/fpga/Kconfig         |   7 ++
 drivers/fpga/Makefile        |   2 +
 drivers/fpga/altera-ps-spi.c | 290 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 299 insertions(+)
 create mode 100644 drivers/fpga/altera-ps-spi.c
drivers/fpga/Kconfig +7 -0
index 895529e..a404fac 100644
@@ -33,6 +33,13 @@ config FPGA_MGR_ALTERA_CVP
 	  FPGA manager driver support for Arria-V, Cyclone-V, Stratix-V
 	  and Arria 10 Altera FPGAs using the CvP interface over PCIe.
 
+config FPGA_MGR_ALTERA_PS_SPI
+	tristate "Altera FPGA Passive Serial over SPI"
+	depends on SPI || COMPILE_TEST
+	help
+	  FPGA manager driver support for Altera Arria/Cyclone/Stratix
+	  using the passive serial interface over SPI.
+
 config FPGA_MGR_SOCFPGA
 	tristate "Altera SOCFPGA FPGA Manager"
 	depends on ARCH_SOCFPGA || COMPILE_TEST
drivers/fpga/Makefile +2 -0
index 2e5c8b6..7a19091 100644
@@ -7,6 +7,8 @@ obj-$(CONFIG_FPGA)			+= fpga-mgr.o
 
 # FPGA Manager Drivers
 obj-$(CONFIG_FPGA_MGR_ALTERA_CVP)	+= altera-cvp.o
+obj-$(CONFIG_FPGA_MGR_CYCLONE_PS_SPI)	+= cyclone-ps-spi.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_SOCFPGA)		+= socfpga.o
 obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10)	+= socfpga-a10.o
drivers/fpga/altera-ps-spi.c new file +290 -0

290 lines not on this page · raw message

Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

PATCH v10 3/3 ARM: dts: imx6q-evi: support cyclone-ps-spi

In reply to Anatolij Gustschin

From: Joshua Clayton <[email protected]>

Add support for Altera cyclone V FPGA connected to an spi port to the evi devicetree file

---
Changes in v10:
- none

 arch/arm/boot/dts/imx6q-evi.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/boot/dts/imx6q-evi.dts +16 -0
index fd2220a..746ab07 100644
@@ -94,6 +94,15 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_ecspi1 &pinctrl_ecspi1cs>;
 	status = "okay";
+
+	fpga_spi: cyclonespi@0 {
+		compatible = "altr,fpga-passive-serial";
+		spi-max-frequency = <20000000>;
+		reg = <0>;
+		pinctrl-0 = <&pinctrl_fpgaspi>;
+		nconfig-gpios = <&gpio4 9 GPIO_ACTIVE_LOW>;
+		nstat-gpios = <&gpio4 11 GPIO_ACTIVE_LOW>;
+	};
 };
 
 &ecspi3 {
@@ -319,6 +328,13 @@
 		>;
 	};
 
+	pinctrl_fpgaspi: fpgaspigrp {
+		fsl,pins = <
+			MX6QDL_PAD_KEY_ROW1__GPIO4_IO09 0x1b0b0
+			MX6QDL_PAD_KEY_ROW2__GPIO4_IO11 0x1b0b0
+		>;
+	};
+
 	pinctrl_gpminand: gpminandgrp {
 		fsl,pins = <
 			MX6QDL_PAD_NANDF_CLE__NAND_CLE 0xb0b1
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

Re: [PATCH v10 2/3] fpga manager: Add altera-ps-spi driver for Altera FPGAs

In reply to Anatolij Gustschin

Hi,

On Wed, 17 May 2017 20:23:41 +0200
Anatolij Gustschin [email protected] wrote:
...

drivers/fpga/altera-ps-spi.c line 241

Quoted 2 lines
drivers/fpga/altera-ps-spi.c new file +2 -0
+	conf->spi = spi;
+	conf->config = devm_gpiod_get(&spi->dev, "nconfig", GPIOD_OUT_HIGH);

we should use GPIOD_OUT_LOW flags here. nCONFIG is low active, so setting logical high will enable the signal (drive the pin low), resulting in configuration reset for already initialised FPGAs when loading/reloading the module.

Thanks,

Anatolij

#3 lore raw

Re: [PATCH v10 2/3] fpga manager: Add altera-ps-spi driver for Altera FPGAs

In reply to Anatolij Gustschin

On Wed, 17 May 2017 20:23:41 +0200
Anatolij Gustschin [email protected] wrote:
...

drivers/fpga/altera-ps-spi.c line 201

Quoted 3 lines
drivers/fpga/altera-ps-spi.c new file +3 -0
+	if (!IS_ERR(conf->confd)) {
+		if (!gpiod_get_raw_value_cansleep(conf->confd)) {
+			dev_err(&mgr->dev, "CONF_DONE is low!\n");

as we agreed in the another thread, gpiod_get_value_cansleep() should be used here. Another change: s/low/inactive/

--
Anatolij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html