From: Paolo Pisati <p.pisati@gmail.com>
To: Moritz Fischer <moritz.fischer@ettus.com>
Cc: Paolo Pisati <p.pisati@gmail.com>, Alan Tull <atull@kernel.org>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
linux-fpga@vger.kernel.org,
Devicetree List <devicetree@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] fpga: lattice machxo2: Add Lattice MachXO2 support
Date: Fri, 16 Jun 2017 11:04:36 +0200 [thread overview]
Message-ID: <20170616090436.GA5037@harukaze> (raw)
In-Reply-To: <CAAtXAHfv75VC=J+J5Xd7xeAoPtu1k97XRp2FSOS0ttwnrvWurg@mail.gmail.com>
On Thu, Jun 15, 2017 at 01:03:41PM -0700, Moritz Fischer wrote:
> > +static int machxo2_write(struct fpga_manager *mgr, const char *buf,
> > + size_t count)
> > +{
> > + struct spi_device *spi = mgr->priv;
> > + struct spi_message msg;
> > + struct spi_transfer tx;
> > + u32 progincr = LSC_PROGINCRNV;
> > + u8 payload[MACHXO2_BUF_SIZE];
> > + int i, ret;
> > +
> > + if (count % MACHXO2_PAGE_SIZE != 0) {
> > + dev_err(&mgr->dev, "Malformed payload.\n");
> > + return -EINVAL;
> > + }
> > +
> > + memcpy(payload, &progincr, MACHXO2_OP_SIZE);
> > + for (i = 0; i < count; i += MACHXO2_PAGE_SIZE) {
> > + memcpy(&payload[MACHXO2_OP_SIZE], &buf[i], MACHXO2_PAGE_SIZE);
> > + memset(&tx, 0, sizeof(tx));
> > + spi_message_init(&msg);
> > + tx.tx_buf = payload;
> > + tx.len = MACHXO2_BUF_SIZE;
> > + tx.delay_usecs = MACHXO2_HIGH_DELAY;
> > + spi_message_add_tail(&tx, &msg);
> > + ret = spi_sync(spi, &msg);
> > + if (ret) {
> > + dev_err(&mgr->dev, "Error loading the bitstream.\n");
> > + return ret;
> > + }
> > + }
>
> Can't you chain them together and submit it as one? Instead of calling
> spi_sync in a loop?
> You don't seem to wait for _wait_until_not_busy, so wouldn't that work?
I could unroll the loop, or i could move from a static delay
(MACHXO2_HIGH_DELAY) to checking the busy flag if we want to make it faster, not
sure which one i prefer, or if it's worth though.
--
bye,
p.
next prev parent reply other threads:[~2017-06-16 9:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-15 11:13 [PATCH v3 0/2] [RESEND] Lattice MachXO2 Slave SPI FPGA Manager support Paolo Pisati
[not found] ` <1497525185-30232-1-git-send-email-p.pisati-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-06-15 11:13 ` [PATCH v3 1/2] dt: bindings: fpga: add lattice machxo2 slave spi binding description Paolo Pisati
2017-06-15 11:13 ` [PATCH v3 2/2] fpga: lattice machxo2: Add Lattice MachXO2 support Paolo Pisati
2017-06-15 20:03 ` Moritz Fischer
2017-06-16 9:04 ` Paolo Pisati [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-06-15 11:15 [PATCH v3 0/2] [RESEND] Lattice MachXO2 Slave SPI FPGA Manager support Paolo Pisati
[not found] ` <1497525359-30519-1-git-send-email-p.pisati-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-06-15 11:15 ` [PATCH v3 2/2] fpga: lattice machxo2: Add Lattice MachXO2 support Paolo Pisati
2017-06-02 10:27 [PATCH v3 0/2] [PATCH v3 0/2] Lattice MachXO2 Slave SPI FPGA Manager support Paolo Pisati
2017-06-02 10:27 ` [PATCH v3 2/2] fpga: lattice machxo2: Add Lattice MachXO2 support Paolo Pisati
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=20170616090436.GA5037@harukaze \
--to=p.pisati@gmail.com \
--cc=atull@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=moritz.fischer@ettus.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.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).