From: Anatolij Gustschin <agust-ynQEQJNshbs@public.gmane.org>
To: linux-fpga-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: RFC: FT232H based FPGA configuration adapter drivers
Date: Thu, 7 Dec 2017 15:31:50 +0100 [thread overview]
Message-ID: <20171207153150.6f33f2e7@crub> (raw)
Hi,
I have to rework drivers for custom FT232H based FPGA configuration
adapters to make them suitable for including in mainline kernel. These
adapters should be usable via low-level drivers for FPGA Manager
framework. Two required low-level FPGA Manager drivers (for PS-SPI and
CvP configurations) are already in mainline. The missing parts are the
MPSSE SPI master driver (for attaching altera-ps-spi SPI devices) and
the FTDI FIFO FPP interface driver for FPGA Manager. I'm CCing the
relevant subsystem mailing lists and would like to get feedback to the
draft below before rewriting the missing driver parts.
A few words about our FPGA and FPGA configuration adapter hardware. We
have FPGA PCIe boards with two different FT232H based configuration
adapters. The first adapter type utilizes FT232H chip in MPSSE mode to
connect ADBUS SPI/GPIO pins to Stratix-V PS-SPI interface. Another
adapter type connects FT232H ADBUS (in FT245 FIFO mode) and two ACBUS
GPIOs to a CPLD, the CPLD is connected to the Arria-10 FPP interface.
Both FPGA boards are connected to the host via PCIe and USB (FT232H).
Below simplified diagram shows the drivers relationship used in the
first patch series [1] submitted to the FPGA and USB lists before
(this series didn't yet include the MPSSE SPI master driver).
+-------------+
| |
| STRATIX V |PS-SPI FT245 FIFO & GPIO
| +-----+ +-------------------+
| on Board 1 | | | |
| | +----+---+
| PCIe | ADBUS&ACBUS | CPLD |
+---+---------+ Connection Options +----+---+
^ (MPSSE or FIFO&GPIO) |
| | +------+-------+
altera-cvp +-----------+----------+ | FPP |
| | | |
| FT232H 0x0403:0x6014 | | ARRIA 10 |
| | | |
+----------+-----------+ | on Board 2 |
| | |
MFD drv +----------+-----------+ | PCIe |
creates | ftdi-ft232h MFD drv | +----------+---+
platform | USB bulk/ctrl xfer | ^
devices +---+------+-------+---+ |
below | | | |
+-----+ | +-------------+ +--------+
| | | |
+------+-------+ +--+-----------+ +-------+---------+ |
|ftdi-mpsse-spi| |ftdi-cbus-gpio| |ftdi-fifo-fpp-mgr| |
| platform dev | | platform dev | | platform dev | |
+-------+------+ +------+-------+ +---------+-------+ |
platform ^ ^ ^ |
drivers: + + | |
MPSSE SPI master ACBUS GPIO Ctrl +-----+ +--+
^ ^ | |
| | + +
altera-ps-spi \uses ftdi-fifo-fpp altera-cvp
FPGA Manager ------+ FPGA Manager FPGA Manager
^ ^ ^
| | |
+-------------------------+ + +------------+
fpga-mgr
The first FTDI FPP adapter driver patch series has some fundamental
issues as discussed on the lists and I plan to rework the FT232H
specific parts to prepare a new patch series. We have already
reserved custom PIDs for both adapter types and can use them in
adapter EEPROMs to ensure binding to the vendor specific drivers
for SPI and FIFO FPP types.
Instead of MFD part as in previous version I intend to add an USB misc
driver for our FPGA configuration adapters under drivers/usb/misc.
When probing for VID/PID assigned to FIFO-FPP adapter type, this
driver will register CBUS GPIO controller, GPIO lookup tables for
FIFO FPP device and will create a platform device for attaching the
low-level FPGA manager driver for FIFO FPP interface. The attached
FPGA manager driver will be similar to the ftdi-fifo-fpp driver and
will reside in drivers/fpga. When probing for VID/PID assigned to
MPSSE SPI adapter type, the USB misc driver will register MPSSE GPIO
controller, GPIO lookup tables for altera-ps-spi control/status GPIOs
and will create platform device for attaching MPSSE SPI master
controller driver. The SPI master controller platform driver will
register MPSSE SPI bus with SPI slave device from spi_board_info
struct in its platform data (in our case altera-ps-spi SPI slave
device for attaching altera-ps-spi driver). The intended location
of this custom SPI master controller driver is drivers/spi.
Below simplified diagram shows the intended device and drivers
relationship for reworking the adapter drivers.
+-------------+
| |
| STRATIX V |PS-SPI FT245 FIFO & GPIO
| +-----+ +-------------------+
| on Board 1 | + + |
| | +----+---+
| PCIe | ADBUS&ACBUS | CPLD |
+---+---------+ Connection Options +----+---+
^ (MPSSE or FIFO&GPIO) |
+ + +------+-------+
altera-cvp +-----------+----------+ | FPP |
| FT232H | | |
| 0x0403:0x7148 | | ARRIA 10 |
| 0x0403:0x7149 | | |
+----------+-----------+ | on Board 2 |
| | |
+-----------+------------+ | PCIe |
USB misc | fpga-cfg-intf USB misc | +----------+---+
drv creates| bulk/ctrl xfer | ^
platform |ACBUS GPIO Ctrl (0x7148)| |
devices |MPSSE GPIO Ctrl (0x7149)| |
below +-------+-------+--------+ |
| | |
for +----+ +------+ for |
PID 0x7149 | | PID 0x7148 |
+---------+--------+ +-------+---------+ |
| ftdi-mpsse-spi + | | | |
| altera-ps-spi in | |ftdi-fifo-fpp-mgr| |
| spi_board_info | | platform device | |
+---------+--------+ +--------+--------+ |
^ ^ |
drivers: | | |
+ | |
MPSSE SPI master | |
^ | |
| + +
altera-ps-spi ftdi-fifo-fpp altera-cvp
FPGA Manager FPGA Manager FPGA Manager
^ ^ ^
| | |
+---------------+ + +---------+
fpga-mgr
It would be worthwhile to concentrate the common USB transfer related
functions (bulk, control and FTDI mode setting code used in previous
ftdi-ft232h driver part) in a single file and reuse them in MPSSE SPI
master and FIFO FPP drivers to avoid code duplication. I plan to add
these functions in USB misc adapter driver and it could pass them to
platform drivers as callbacks in an ops struct via platform data.
Before reworking the adapter drivers I'd like to get comments to this
draft, especially when there are design issues that will cause driver
rejection in the appropriate subsystem.
Thanks!
Anatolij
[1] https://lkml.org/lkml/2017/7/6/710
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2017-12-07 14:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-07 14:31 Anatolij Gustschin [this message]
2017-12-07 20:24 ` RFC: FT232H based FPGA configuration adapter drivers Alan Tull
[not found] ` <CANk1AXQtqWBN4Y40vQun6V9Oq+TB5xbXCCT8MDUXCufHtn9ZgQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-07 23:12 ` Anatolij Gustschin
2017-12-08 9:27 ` Geert Uytterhoeven
[not found] ` <CAMuHMdUAXv_s8Lw1qwORew8RydKRKhFq7tMccU7jCa63_Otp0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-08 13:57 ` Anatolij Gustschin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171207153150.6f33f2e7@crub \
--to=agust-ynqeqjnshbs@public.gmane.org \
--cc=linux-fpga-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).