From: Chris Packham <judge.packham@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH 7/7] fpga/spartan3: add reverse bitstream mode
Date: Tue, 22 Nov 2016 21:49:02 +1300 [thread overview]
Message-ID: <20161122084902.20890-8-judge.packham@gmail.com> (raw)
In-Reply-To: <20161122084902.20890-1-judge.packham@gmail.com>
The Xilinx tools we use appear to give us a bitstream with the bits
reversed (compared to what the existing code expects) add a new
CONFIG_FPGA_REVERSE_BITSTREAM option which tells the spartan3 driver
to output the serial stream with the leftmost bit first.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
drivers/fpga/Kconfig | 7 +++++++
drivers/fpga/spartan3.c | 8 ++++++++
2 files changed, 15 insertions(+)
diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index 1b3b03c8f938..26b7c864d275 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -29,6 +29,13 @@ config FPGA_SPARTAN2
help
Enable FPGA driver for Xilinx Spartan-II devices.
+config FPGA_REVERSE_BITSTREAM
+ bool "Reverse bitstream when programming"
+ depends on FPGA_SPARTAN3
+ help
+ Some Xilinx tools generate programs that need to be uploaded LSb
+ first. Set this option if your fpga binary requires this.
+
config FPGA_PROG_FEEDBACK
bool "FPGA programming feedback"
help
diff --git a/drivers/fpga/spartan3.c b/drivers/fpga/spartan3.c
index 34aa097ab6c2..2a57c8ab77b5 100644
--- a/drivers/fpga/spartan3.c
+++ b/drivers/fpga/spartan3.c
@@ -392,12 +392,20 @@ static int spartan3_ss_load(xilinx_desc *desc, const void *buf, size_t bsize)
(*fn->clk) (false, true, cookie);
CONFIG_FPGA_DELAY ();
/* Write data */
+#ifdef CONFIG_FPGA_REVERSE_BITSTREAM
+ (*fn->wr) ((val & 0x01), true, cookie);
+#else
(*fn->wr) ((val & 0x80), true, cookie);
+#endif
CONFIG_FPGA_DELAY ();
/* Assert the clock */
(*fn->clk) (true, true, cookie);
CONFIG_FPGA_DELAY ();
+#ifdef CONFIG_FPGA_REVERSE_BITSTREAM
+ val >>= 1;
+#else
val <<= 1;
+#endif
i --;
} while (i > 0);
--
2.10.2
next prev parent reply other threads:[~2016-11-22 8:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-22 8:48 [U-Boot] [RFC PATCH 0/7] FPGA changes Chris Packham
2016-11-22 8:48 ` [U-Boot] [RFC PATCH 1/7] fpga: CONFIG_SYS_FPGA_PROG_FEEDBACK -> CONFIG_FPGA_PROG_FEEDBACK Chris Packham
2016-11-23 12:09 ` Michal Simek
2016-11-24 23:57 ` Chris Packham
2016-11-25 6:57 ` Michal Simek
2016-11-22 8:48 ` [U-Boot] [RFC PATCH 2/7] fpga: add Kconfig support for Xilinx Spartan devices Chris Packham
2016-11-23 12:10 ` Michal Simek
2016-11-22 8:48 ` [U-Boot] [RFC PATCH 3/7] Move CONFIG_FPGA_SPARTAN options to defconfig Chris Packham
2016-11-23 12:14 ` Michal Simek
2016-11-25 0:53 ` Chris Packham
2016-11-25 8:39 ` Chris Packham
2016-11-22 8:48 ` [U-Boot] [RFC PATCH 4/7] fpga/spartan3: make output quieter Chris Packham
2016-11-23 12:14 ` Michal Simek
2016-11-22 8:49 ` [U-Boot] [RFC PATCH 5/7] fpga: add Kconfig for CONFIG_FPGA_PROG_FEEDBACK Chris Packham
2016-11-23 12:13 ` Michal Simek
2016-11-25 0:10 ` Chris Packham
2016-11-25 6:58 ` Michal Simek
2016-11-22 8:49 ` [U-Boot] [RFC PATCH 6/7] Move FPGA_PROG_FEEDBACK to defconfig Chris Packham
2016-11-23 12:16 ` Michal Simek
2016-11-22 8:49 ` Chris Packham [this message]
2016-11-23 12:16 ` [U-Boot] [RFC PATCH 7/7] fpga/spartan3: add reverse bitstream mode Michal Simek
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=20161122084902.20890-8-judge.packham@gmail.com \
--to=judge.packham@gmail.com \
--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