From: Philippe De Muyter <phdm@macqel.be>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: linux-fpga@vger.kernel.org
Subject: Re: [PATCH] fpga: add simple userspace interface to trigger FPGA programming
Date: Sat, 11 Aug 2018 17:01:43 +0200 [thread overview]
Message-ID: <20180811150143.GA1940@frolo.macqel> (raw)
In-Reply-To: <20171204154315.30128-1-thomas.petazzoni@free-electrons.com>
[-- Attachment #1: Type: text/plain, Size: 1619 bytes --]
Hi Thomas,
On Mon, Dec 04, 2017 at 01:43:15PM +0000, Thomas Petazzoni wrote:
> The current FPGA subsystem only allows programming the FPGA bitstream
> through Device Tree overlays. This assumes that the devices inside the
> FPGA are described through a Device Tree.
>
> However, some platforms have their FPGA connected to the main CPU over
> PCIe and the devices in the FPGA are therefore dynamically
> discoverable using the normal PCIe enumeration mechanisms. There is
> therefore no Device Tree overlay describing the devices in the
> FPGA. Furthermore, on my platform (an old SH7786), there is no Device
> Tree at all, as there is no support for Device Tree for this SoC.
>
> Adding a userspace interface to trigger the programming of the FPGA
> has already been requested in the past (see [1]) showing that there is
> a need for such a feature.
>
> This commit therefore introduces a very simple interface, in the form
> of a "load" sysfs file. Writing the name of the firmware file to
> program into the FPGA to this "load" file triggers the programming
> process.
Thank you for your patch. I have used it succesfully to program and
reprogram with different bit files an 'invisible' FPGA which is actually
a piece of hardware bridging a Sub LVDS CMOS sensor output to a CSI
MIPI-2 input.
If this patch is not suitable in the general case it could at least be
made available for development context.
Attached is a small patch on top of yours that fixes a minor annoyance
when using 'echo' without the '-n' option.
Philippe
--
Philippe De Muyter +32 2 6101532 Macq SA rue de l'Aeronef 2 B-1140 Bruxelles
[-- Attachment #2: 0001-FIX-fpga-add-simple-userspace-interface-to-trigger-F.patch --]
[-- Type: text/x-patch, Size: 1124 bytes --]
From 284a904c4f8bf3978735d234c7ee2bacfd10edaf Mon Sep 17 00:00:00 2001
From: Philippe De Muyter <phdm@macqel.be>
Date: Fri, 10 Aug 2018 09:35:41 +0200
Subject: [PATCH] FIX "fpga: add simple userspace interface to trigger FPGA
programming"
When fpga-mgr load_store strips the received string to remove the
terminating '\n', it should still return the whole count, not the
stripped one.
Signed-off-by: Philippe De Muyter <phdm@macqel.be>
---
drivers/fpga/fpga-mgr.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
index 751a447..61492787 100644
--- a/drivers/fpga/fpga-mgr.c
+++ b/drivers/fpga/fpga-mgr.c
@@ -404,11 +404,15 @@ static ssize_t load_store(struct device *dev,
struct fpga_manager *mgr = to_fpga_manager(dev);
char *name;
int ret;
+ size_t stripped_count = count;
if (count > 0 && buf[count - 1] == '\n')
- count--;
+ stripped_count--;
- name = kstrndup(buf, count, GFP_KERNEL);
+ if (!stripped_count)
+ return count;
+
+ name = kstrndup(buf, stripped_count, GFP_KERNEL);
if (!name)
return -ENOSPC;
--
2.7.4
prev parent reply other threads:[~2018-08-11 17:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-04 15:43 [PATCH] fpga: add simple userspace interface to trigger FPGA programming Thomas Petazzoni
2017-12-04 15:50 ` Alan Tull
2017-12-04 15:58 ` Thomas Petazzoni
2017-12-04 16:25 ` Alan Tull
2017-12-04 16:49 ` Moritz Fischer
2017-12-04 17:30 ` Alan Tull
2017-12-09 18:05 ` Florian Fainelli
2017-12-10 4:03 ` Alan Tull
2017-12-10 22:44 ` Thomas Petazzoni
2017-12-10 22:59 ` Florian Fainelli
2017-12-11 22:05 ` Moritz Fischer
2017-12-11 23:32 ` Alan Tull
2017-12-13 6:30 ` yves.vandervennet
2017-12-13 5:23 ` Thomas Petazzoni
2017-12-13 15:59 ` Alan Tull
2017-12-14 5:27 ` Thomas Petazzoni
2017-12-14 20:10 ` Alan Tull
2017-12-10 22:42 ` Thomas Petazzoni
2018-08-11 15:01 ` Philippe De Muyter [this message]
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=20180811150143.GA1940@frolo.macqel \
--to=phdm@macqel.be \
--cc=linux-fpga@vger.kernel.org \
--cc=thomas.petazzoni@free-electrons.com \
/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