Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1667542
| From | Paolo Pisati <p.pisati@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 2/2] fpga: lattice machxo2: Add Lattice MachXO2 support |
| Date | 2017-06-16 11:10 +0200 |
| Message-ID | <tSVqq-6tS-9@gated-at.bofh.it> (permalink) |
| References | <tSAYF-1Mg-3@gated-at.bofh.it> <tSAYF-1Mg-1@gated-at.bofh.it> <tSJfz-726-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v3 2/2] fpga: lattice machxo2: Add Lattice MachXO2 support Paolo Pisati <p.pisati@gmail.com> - 2017-06-15 13:20 +0200
Re: [PATCH v3 2/2] fpga: lattice machxo2: Add Lattice MachXO2 support Moritz Fischer <moritz.fischer@ettus.com> - 2017-06-15 22:10 +0200
Re: [PATCH v3 2/2] fpga: lattice machxo2: Add Lattice MachXO2 support Paolo Pisati <p.pisati@gmail.com> - 2017-06-16 11:10 +0200
csiph-web