Add support for ARRI FPGA configuration
Subsystems (3)
cover Add support for ARRI FPGA configuration
This series adds drivers and FPGA manager support required for FT232H based ARRI FPGA configuration adapters.
Patch 1/3 adds FT232H interface driver (for ARRI USB PIDs) implementing commonly used FTDI USB transfer operations and ACBUS/MPSSE GPIO controllers. Depending on USB PIDs it creates platform devices for MPSSE SPI bus with attached SPI slaves or platform devices for ARRI FPP FPGA manager.
Patch 2/3 adds MPSSE SPI controller driver which registers an FTDI USB-SPI bus with attached SPI slaves from description in platform data, so existing SPI protocol drivers can be used for these slave devices (in our case altera-ps-spi). Via interface driver in patch 1/3 it is easily possible to add support for other slave devices using custom USB PIDs (e.g. spi-nor flash W25Q32 with m25p80 driver has beed used for testing MPSSE SPI controller driver).
Patch 3/3 adds FPGA manager driver for ARRI FPP adapters for FPGA configuration via Altera fast passive parallel interface.
Anatolij Gustschin (3):
usb: misc: add driver for FT232H based FPGA configuration devices
spi: add FTDI MPSSE SPI controller driver
fpga: Add fpga manager driver for ARRI Altera FPP
drivers/fpga/Kconfig | 7 + drivers/fpga/Makefile | 1 + drivers/fpga/ftdi-fifo-fpp.c | 594 +++++++++++++ drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/spi-ftdi-mpsse.c | 671 ++++++++++++++ drivers/usb/misc/Kconfig | 9 + drivers/usb/misc/Makefile | 1 + drivers/usb/misc/ft232h-intf.c | 1468 +++++++++++++++++++++++++++++++ include/linux/usb/ft232h-intf.h | 198 +++++ 10 files changed, 2957 insertions(+) create mode 100644 drivers/fpga/ftdi-fifo-fpp.c create mode 100644 drivers/spi/spi-ftdi-mpsse.c create mode 100644 drivers/usb/misc/ft232h-intf.c create mode 100644 include/linux/usb/ft232h-intf.h
Signature · 1 line
2.17.1
PATCH 1/3 usb: misc: add driver for FT232H based FPGA configuration devices
Add USB interface driver for ARRI FPGA configuration devices based on FTDI FT232H chip. Depending on USB PID the driver registers different platform devices describing an FPGA configuration interface.
One FPGA configuration interface type is the usual SPI bus with additional control and status GPIOs. For this interface type the FTDI MPSSE mode is utilized to support SPI bus and GPIO-L/H pins for SPI bus chipselect and SPI slave device I/O. Subsequent patch adds an MPSSE SPI controller driver for USB-SPI bus support. The actual FPGA configuration driver for SPI bus is already available in the FPGA manager framework (altera-ps-spi module).
Another FPGA configuration interface type is the FT245 FIFO (connected via CPLD) with additional control and status GPIOs on FT232H ACBUS. This interface is used to configure FPGAs using Altera fast passive parallel (FPP) interface. Subsequent patch will add an FPP FPGA manager driver for it.
The FTDI protocol code and prototypes was borrowed from libftdi.
--- drivers/usb/misc/Kconfig | 9 + drivers/usb/misc/Makefile | 1 + drivers/usb/misc/ft232h-intf.c | 1468 +++++++++++++++++++++++++++++++ include/linux/usb/ft232h-intf.h | 198 +++++ 4 files changed, 1676 insertions(+) create mode 100644 drivers/usb/misc/ft232h-intf.c create mode 100644 include/linux/usb/ft232h-intf.h
drivers/usb/misc/Kconfig +9 -0
@@ -275,3 +275,12 @@ config USB_CHAOSKEY To compile this driver as a module, choose M here: the module will be called chaoskey. + +config USB_FT232H_INTF + tristate "FTDI FT232H FPGA configuration interface driver" + help + Enable driver support for the FT232H based USB-GPIO/SPI/FIFO + interface adapter for FPGA configuration. Additional drivers + such as spi-ftdi-mpsse, altera-ps-spi, ftdi-fifo-fpp and + fpga-mgr must be enabled in order to use the functionality of + the device.
drivers/usb/misc/Makefile +1 -0
@@ -31,3 +31,4 @@ obj-$(CONFIG_USB_CHAOSKEY) += chaoskey.o obj-$(CONFIG_USB_SISUSBVGA) += sisusbvga/ obj-$(CONFIG_USB_LINK_LAYER_TEST) += lvstest.o +obj-$(CONFIG_USB_FT232H_INTF) += ft232h-intf.o
drivers/usb/misc/ft232h-intf.c new file +1468 -0
1,468 lines not on this page · raw message
include/linux/usb/ft232h-intf.h new file +198 -0
198 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 2/3 spi: add FTDI MPSSE SPI controller driver
In reply to Anatolij GustschinAdd SPI bus controller driver for FTDI MPSSE mode. This driver is supposed to be used together with the FT232H interface driver for FPGA configuration in drivers/usb/misc/ft232h-intf.c which adds an mpsse spi platform device describing USB SPI bus with attached SPI slave devices.
--- drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/spi-ftdi-mpsse.c | 671 +++++++++++++++++++++++++++++++++++ 3 files changed, 679 insertions(+) create mode 100644 drivers/spi/spi-ftdi-mpsse.c
drivers/spi/Kconfig +7 -0
@@ -259,6 +259,13 @@ config SPI_FSL_LPSPI help This enables Freescale i.MX LPSPI controllers in master mode. +config SPI_FTDI_MPSSE + tristate "FTDI MPSSE SPI controller" + depends on USB_FT232H_INTF || COMPILE_TEST + help + FT232H supports SPI in MPSSE mode. This driver provides MPSSE + SPI controller in master mode. + config SPI_GPIO tristate "GPIO-based bitbanging SPI Master" depends on GPIOLIB || COMPILE_TEST
drivers/spi/Makefile +1 -0
@@ -113,6 +113,7 @@ obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o obj-$(CONFIG_SPI_XLP) += spi-xlp.o obj-$(CONFIG_SPI_XTENSA_XTFPGA) += spi-xtensa-xtfpga.o obj-$(CONFIG_SPI_ZYNQMP_GQSPI) += spi-zynqmp-gqspi.o +obj-$(CONFIG_SPI_FTDI_MPSSE) += spi-ftdi-mpsse.o # SPI slave protocol handlers obj-$(CONFIG_SPI_SLAVE_TIME) += spi-slave-time.o
drivers/spi/spi-ftdi-mpsse.c new file +671 -0
671 lines not on this page · raw message
Signature · 1 line
2.17.1
kbuild test robot
build botRe: [PATCH 2/3] spi: add FTDI MPSSE SPI controller driver
I love your patch! Yet something to improve:
Hi Anatolij,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.20-rc1 next-20181105]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Anatolij-Gustschin/Add-support-for-ARRI-FPGA-configuration/20181106-090458 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing config: i386-allmodconfig (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386
All error/warnings (new ones prefixed by >>):
In file included from arch/x86/include/uapi/asm/ptrace.h:6:0,
from arch/x86/include/asm/ptrace.h:7,
from arch/x86/include/asm/math_emu.h:5,
from arch/x86/include/asm/processor.h:12,
from arch/x86/include/asm/cpufeature.h:8,
from arch/x86/include/asm/thread_info.h:53,
from include/linux/thread_info.h:38,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:81,
from include/linux/spinlock.h:51,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/stat.h:19,
from include/linux/module.h:10,
from drivers/spi/spi-ftdi-mpsse.c:11:
>> arch/x86/include/uapi/asm/ptrace-abi.h:20:13: error: expected identifier before numeric constant
#define CS 13
^
>> drivers/spi/spi-ftdi-mpsse.c:27:2: note: in expansion of macro 'CS'
CS = BIT(3),
^~vim +/CS +27 drivers/spi/spi-ftdi-mpsse.c
> 11 #include <linux/module.h>
12 #include <linux/gpio/consumer.h>
13 #include <linux/gpio/machine.h>
14 #include <linux/platform_device.h>
15 #include <linux/printk.h>
16 #include <linux/slab.h>
17 #include <linux/spi/spi.h>
18 #include <linux/types.h>
19 #include <linux/sizes.h>
20 #include <linux/usb.h>
21 #include <linux/usb/ft232h-intf.h>
22
23 enum gpiol {
24 SK = BIT(0),
25 DO = BIT(1),
26 DI = BIT(2),
> 27 CS = BIT(3),
28 };
29 ---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH 2/3] spi: add FTDI MPSSE SPI controller driver
On Tue, 6 Nov 2018 13:07:13 +0800
kbuild test robot [email protected] wrote:
...
Quoted 7 lines
from
drivers/spi/spi-ftdi-mpsse.c:11:Quoted 1 line
Quoted 1 line
arch/x86/include/uapi/asm/ptrace-abi.h:20:13: error: expected identifier before numeric constant#define CS 13 ^Quoted 1 line
Quoted 1 line
drivers/spi/spi-ftdi-mpsse.c:27:2: note: in expansion of macro 'CS'CS = BIT(3), ^~
I didn't see this while my build-testing, sorry. Will fix it in next patch version.
Thanks,
Anatolij
kbuild test robot
build botRe: [PATCH 2/3] spi: add FTDI MPSSE SPI controller driver
In reply to Anatolij GustschinI love your patch! Yet something to improve:
Hi Anatolij,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.20-rc1 next-20181105]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Anatolij-Gustschin/Add-support-for-ARRI-FPGA-configuration/20181106-090458 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing config: i386-allyesconfig (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
>> drivers//spi/spi-ftdi-mpsse.c:27:2: error: expected identifier before numeric constant
CS = BIT(3),
^~vim +27 drivers//spi/spi-ftdi-mpsse.c
22
23 enum gpiol {
24 SK = BIT(0),
25 DO = BIT(1),
26 DI = BIT(2),
> 27 CS = BIT(3),
28 };
29 ---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH v2 2/3 spi: add FTDI MPSSE SPI controller driver
In reply to Anatolij GustschinAdd SPI bus controller driver for FTDI MPSSE mode. This driver is supposed to be used together with the FT232H interface driver for FPGA configuration in drivers/usb/misc/ft232h-intf.c which adds an mpsse spi platform device describing USB SPI bus with attached SPI slave devices.
---
Changes in v2:
- fix build breakage when building with ARCH=i386 allmodconfig
- add checks for ops->lock/ops->unlock presence in pdata
drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/spi-ftdi-mpsse.c | 673 +++++++++++++++++++++++++++++++++++ 3 files changed, 681 insertions(+) create mode 100644 drivers/spi/spi-ftdi-mpsse.c
drivers/spi/Kconfig +7 -0
@@ -259,6 +259,13 @@ config SPI_FSL_LPSPI help This enables Freescale i.MX LPSPI controllers in master mode. +config SPI_FTDI_MPSSE + tristate "FTDI MPSSE SPI controller" + depends on USB_FT232H_INTF || COMPILE_TEST + help + FT232H supports SPI in MPSSE mode. This driver provides MPSSE + SPI controller in master mode. + config SPI_GPIO tristate "GPIO-based bitbanging SPI Master" depends on GPIOLIB || COMPILE_TEST
drivers/spi/Makefile +1 -0
@@ -113,6 +113,7 @@ obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o obj-$(CONFIG_SPI_XLP) += spi-xlp.o obj-$(CONFIG_SPI_XTENSA_XTFPGA) += spi-xtensa-xtfpga.o obj-$(CONFIG_SPI_ZYNQMP_GQSPI) += spi-zynqmp-gqspi.o +obj-$(CONFIG_SPI_FTDI_MPSSE) += spi-ftdi-mpsse.o # SPI slave protocol handlers obj-$(CONFIG_SPI_SLAVE_TIME) += spi-slave-time.o
drivers/spi/spi-ftdi-mpsse.c new file +673 -0
673 lines not on this page · raw message
Signature · 1 line
2.17.1
Mark Brown
maintainerRe: [PATCH v2 2/3] spi: add FTDI MPSSE SPI controller driver
Quoted 5 lines · Anatolij Gustschin
Add SPI bus controller driver for FTDI MPSSE mode. This driver is supposed to be used together with the FT232H interface driver for FPGA configuration in
drivers/usb/misc/ft232h-intf.cwhich adds an mpsse spi platform device describing USB SPI bus with attached SPI slave devices.
I don't have the rest of this series or a cover letter - what's the story with dependencies?
Re: [PATCH v2 2/3] spi: add FTDI MPSSE SPI controller driver
Quoted 9 lines · On Fri, 9 Nov 2018 15:30:26 +0000 Mark Brown [email protected] wrote:
Quoted 5 lines · Anatolij Gustschin
Add SPI bus controller driver for FTDI MPSSE mode. This driver is supposed to be used together with the FT232H interface driver for FPGA configuration in
drivers/usb/misc/ft232h-intf.cwhich adds an mpsse spi platform device describing USB SPI bus with attached SPI slave devices.I don't have the rest of this series or a cover letter - what's the story with dependencies?
This v2 patch is the only patch of the original series that was changed, I didn't resend whole series to avoid spamming the lists.
The original cover letter is here [1], this v2 patch depends on patch [2].
[1] https://marc.info/?l=linux-spi&m=154143476109363&w=2
[2] https://marc.info/?l=linux-spi&m=154143479113473&w=2
Thanks,
Anatolij
Mark Brown
maintainerRe: [PATCH v2 2/3] spi: add FTDI MPSSE SPI controller driver
Quoted 2 lines · Anatolij Gustschin
This v2 patch is the only patch of the original series that was changed, I didn't resend whole series to avoid spamming the lists.
Please don't do this, the numbering for a patch series only makes sense for ordering the patches within a series. If you're just sending a single patch then there's no need to number anything, or the patch series hasn't been applied then resend the whole thing so people don't have to work out which versions of which patches are the current ones.
Re: [PATCH v2 2/3] spi: add FTDI MPSSE SPI controller driver
Quoted 5 lines · On Tue, 13 Nov 2018 10:11:32 -0800 Mark Brown [email protected] wrote:
Please don't do this, the numbering for a patch series only makes sense for ordering the patches within a series. If you're just sending a single patch then there's no need to number anything, or the patch series hasn't been applied then resend the whole thing so people don't have to work out which versions of which patches are the current ones.
got it, thanks.
Anatolij
PATCH 3/3 fpga: Add fpga manager driver for ARRI Altera FPP
In reply to Anatolij GustschinAdd FPGA manager driver for loading ARRI Altera FPGAs via fast passive parallel (FPP) interface using FTDI FT232H chip.
--- drivers/fpga/Kconfig | 7 + drivers/fpga/Makefile | 1 + drivers/fpga/ftdi-fifo-fpp.c | 594 +++++++++++++++++++++++++++++++++++ 3 files changed, 602 insertions(+) create mode 100644 drivers/fpga/ftdi-fifo-fpp.c
drivers/fpga/Kconfig +7 -0
@@ -59,6 +59,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_FTDI_FIFO_FPP + tristate "Altera FPP over FT232H FIFO" + depends on USB_FT232H_INTF + help + FPGA manager driver support for Altera fast passive parallel + interface (FPP) over FT232H FT245 FIFO. + config FPGA_MGR_ZYNQ_FPGA tristate "Xilinx Zynq FPGA" depends on ARCH_ZYNQ || COMPILE_TEST
drivers/fpga/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_FPGA) += fpga-mgr.o # FPGA Manager Drivers obj-$(CONFIG_FPGA_MGR_ALTERA_CVP) += altera-cvp.o obj-$(CONFIG_FPGA_MGR_ALTERA_PS_SPI) += altera-ps-spi.o +obj-$(CONFIG_FPGA_MGR_FTDI_FIFO_FPP) += ftdi-fifo-fpp.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
drivers/fpga/ftdi-fifo-fpp.c new file +594 -0
594 lines not on this page · raw message
Signature · 1 line
2.17.1
On Mon, Nov 5, 2018 at 10:19 AM Anatolij Gustschin <[email protected]> wrote:
Hi Anatolij,
Quoted 3 lines
This series adds drivers and FPGA manager support required for FT232H based ARRI FPGA configuration adapters.
Is this a repost or a new version of this patchset? If it's a repost, you could note that. If there are changes since the previous posting, version info helps reviewers know what's new.
Thanks,
Alan
Quoted 43 lines
Patch 1/3 adds FT232H interface driver (for ARRI USB PIDs) implementing commonly used FTDI USB transfer operations and ACBUS/MPSSE GPIO controllers. Depending on USB PIDs it creates platform devices for MPSSE SPI bus with attached SPI slaves or platform devices for ARRI FPP FPGA manager.
Patch 2/3 adds MPSSE SPI controller driver which registers an FTDI USB-SPI bus with attached SPI slaves from description in platform data, so existing SPI protocol drivers can be used for these slave devices (in our case altera-ps-spi). Via interface driver in patch 1/3 it is easily possible to add support for other slave devices using custom USB PIDs (e.g. spi-nor flash W25Q32 with m25p80 driver has beed used for testing MPSSE SPI controller driver).
Patch 3/3 adds FPGA manager driver for ARRI FPP adapters for FPGA configuration via Altera fast passive parallel interface.
Anatolij Gustschin (3):
usb: misc: add driver for FT232H based FPGA configuration devices
spi: add FTDI MPSSE SPI controller driver
fpga: Add fpga manager driver for ARRI Altera FPPdrivers/fpga/Kconfig | 7 + drivers/fpga/Makefile | 1 + drivers/fpga/ftdi-fifo-fpp.c | 594 +++++++++++++ drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/spi-ftdi-mpsse.c | 671 ++++++++++++++ drivers/usb/misc/Kconfig | 9 + drivers/usb/misc/Makefile | 1 + drivers/usb/misc/ft232h-intf.c | 1468 +++++++++++++++++++++++++++++++ include/linux/usb/ft232h-intf.h | 198 +++++ 10 files changed, 2957 insertions(+) create mode 100644 drivers/fpga/ftdi-fifo-fpp.c create mode 100644 drivers/spi/spi-ftdi-mpsse.c create mode 100644 drivers/usb/misc/ft232h-intf.c create mode 100644 include/linux/usb/ft232h-intf.h--
2.17.1
Hi Alan,
Quoted 11 lines · On Mon, 5 Nov 2018 12:52:03 -0600 Alan Tull [email protected] wrote:
On Mon, Nov 5, 2018 at 10:19 AM Anatolij Gustschin <[email protected]> wrote:
Hi Anatolij,
Quoted 3 lines
This series adds drivers and FPGA manager support required for FT232H based ARRI FPGA configuration adapters.
Is this a repost or a new version of this patchset? If it's a repost, you could note that. If there are changes since the previous posting, version info helps reviewers know what's new.
This is a new version. Or it is very different compared to my first attempt to add driver support for this adapter hardware. The initial series ([1],[2],[3]) didn't include MPSSE SPI driver, it didn't use vendor specific USB PIDs for FTDI device and had fundamental design issues. This new version implements the new driver design as summarized here [4].
Changes in this new version:
- don't use MFD framework
- don't use original FT232H USB PID (it is too generic and collides with existing ftdi_sio driver)
- don't add separate CBUS GPIO driver based on FT232H MFD device
- redesign/rework the drivers as described under [4]
- add basic FT232H interface driver under drivers/usb/misc/
- use custom reserved USB PIDs in the USB driver for adapter devices
- add notes about borrowed protocol code from libftdi to commit log and header file
- add MPSSE SPI controller driver supporting USB-SPI bus with dynamically added SPI slaves from description in platform data (the initial attempt didn't include USB SPI bus support for PS- SPI FPGA configuration via USB)
- rework FPP fpga manager driver based on new FT232H interface driver and extend it according to CPLD changes for additional support of new hardware revision B.
[1] https://patchwork.kernel.org/patch/9828985/
[2] https://patchwork.kernel.org/patch/9828981/
[3] https://patchwork.kernel.org/patch/9828983/
[4] https://www.spinics.net/lists/linux-usb/msg163441.html
Thanks,
Anatolij