From: u-boot@emagii.com
To: u-boot@lists.denx.de
Cc: marex@denx.de, monstr@monstr.eu, sjg@chromium.org
Subject: [PATCH 0/4] FPGAs as Memory Technology Devices in U-Boot
Date: Sat, 11 Feb 2023 11:07:39 +0100 [thread overview]
Message-ID: <20230211100743.12087-1-u-boot@emagii.com> (raw)
As shown at a presentation in the recent OpenEmbedded Workshop,
it is possible to configure an FPGA in Passive Serial mode
using a standard SPI controller, each FPGA getting its own chipselect.
https://pretalx.com/openembedded-workshop-2023/talk/D3AQ3R/
This allows you to add the FPGA to the devicetree and to use standard MTD commands, instead of the FPGA commands.
I.E: The SPI portion is
&spi1 {
u-boot,dm-spl;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins>;
num-cs = <4>; /* Needed for GPIO cs */
cs-gpios =
<&gpio0 12 GPIO_ACTIVE_LOW>, /* D18,0:12 uart1_ctsn.spi1_cs0 */
<&gpio0 13 GPIO_ACTIVE_LOW>, /* D17,0:13 uart1_rtsn.spi1_cs1 */
<&gpio0 17 GPIO_ACTIVE_LOW>, /* K15,0:17 mii_txd2.spi1_cs2 */
<&gpio0 16 GPIO_ACTIVE_LOW>; /* J18,0:16 mii_txd3.spi1_cs3 */
spi-max-frequency = <10000000>; ;
gpio_spi0: gpio_spi@0 {...}
gpio_spi1: gpio_spi@1 {...}
spi-fpga-cfg@2 {...} /* FPGA #1 */
spy-fpga-cfg@3 {...} /* FPGA #2 */
};
The FPGA part is.
spi-fpga-cfg@2 { /* Intel Cyclone 10, 10CL010 */
#address-cells = <1>;
#size-cells = <1>;
compatible = "intel,cyclone10";
reg = <2>; /* Chip select 2 */
spi-max-frequency = <10000000>;
fpga = "spif"; /* Installed as /dev/spif */
config-size = <368011>;
nconfig-gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>; /* ,3:15 */
nstat-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>; /* ,3:19 */
confd-gpios = <&gpio3 18 GPIO_ACTIVE_HIGH>; /* ,3:18 */
crc-error-gpios= <&gpio2 1 GPIO_ACTIVE_HIGH>; /* ,2:01 */
partition@0 {
label = "spi-fpga";
reg = <0x0000000 0x8000>;
};
};
To configure the FPGA, you load the config info into RAM and write it to the FPGA.
U-BOOT> mtd read spi1 ${loadaddr} 0 ${filesize} # read from SPI
U-BOOT> mtd write fpga0 ${loadaddr} 0 ${filesize} # configure FPGA
A driver will pulse the nCONFIG pin of the FPGA, do an SPI transfer
and then check the FPGA status outputs.
Since the MTD command set can be used (and is needed anyway)
the FPGA command set can be removed from the U-Boot both simplifying
the user interface and reducing code size of the u-boot image.
It relies on the (hopefully) existing SPI driver for the chip in u-boot
so it should be easy to use in most systems (as long as the H/W is designed for it)
A linux driver, using the same principle would allow the FPGA to be
configured using a simple statement.
$ cat <bitfile> > /dev/fpga
The approach has been tested on a development board using an AM335x and 2 x Cyclone 10.
The changes needed are
* adding the FPGA class in mtd-abi.h
* The "mtd" command hardwires the transfer to be RAW and no OOB.
* A driver wrapping the control signals around an SPI transfer
1.Claim SPI bus
2.Pulse nCONFIG low for 40 us,
3.Wait for nSTATUS high
4.Transfer bitstream using U-Boot SPI transfer
5.Release SPI bus
6.Wait until CONFIG_DONE (or error on nSTATUS)
[PATCH 1/4] include/mtd/mtd-abi.h: Add FPGA as MTD device
[PATCH 2/4] cmd/mtd.c: Support FPGAs in mtd command
[PATCH 3/4] mtd/fpga: add fpga directory to mtd (with Cyclone 10)
[PATCH 4/4] mtd/Kconfig,Makefile support FPGA
next reply other threads:[~2023-02-11 10:08 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-11 10:07 u-boot [this message]
2023-02-11 10:07 ` [PATCH 1/4] include/mtd/mtd-abi.h: Add FPGA as MTD device u-boot
2023-02-11 10:07 ` [PATCH 2/4] cmd/mtd.c: Support FPGAs in mtd command u-boot
2023-02-11 10:07 ` [PATCH 3/4] mtd/fpga: add fpga directory to mtd (with Cyclone 10) u-boot
2023-02-12 19:31 ` Marek Vasut
2023-02-12 19:52 ` Ulf Samuelsson
2023-02-12 20:01 ` Marek Vasut
2023-02-12 22:07 ` Ulf Samuelsson
2023-02-12 22:40 ` Marek Vasut
2023-02-13 9:30 ` Ulf Samuelsson
2023-02-20 16:17 ` Marek Vasut
2023-02-20 21:29 ` Ulf Samuelsson
2023-02-20 22:34 ` Marek Vasut
2023-02-20 23:47 ` Ulf Samuelsson
2023-02-21 1:13 ` Marek Vasut
2023-02-21 9:08 ` Michael Walle
2023-02-21 10:42 ` Ulf Samuelsson
2023-02-21 11:19 ` Michael Walle
2023-02-21 11:20 ` Michael Walle
2023-02-21 15:37 ` Ulf Samuelsson
2023-02-21 16:01 ` Michael Walle
2023-02-21 10:58 ` Ulf Samuelsson
2023-02-22 19:51 ` Steffen Dirkwinkel
2023-02-23 8:28 ` Ulf Samuelsson
2023-02-23 8:51 ` Steffen Dirkwinkel
2023-02-23 8:51 ` Steffen Dirkwinkel
2023-02-21 11:54 ` Ulf Samuelsson
2023-02-11 10:07 ` [PATCH 4/4] mtd/Kconfig,Makefile support FPGA u-boot
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=20230211100743.12087-1-u-boot@emagii.com \
--to=u-boot@emagii.com \
--cc=marex@denx.de \
--cc=monstr@monstr.eu \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/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