lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170616090436.GA5037@harukaze>
Date:   Fri, 16 Jun 2017 11:04:36 +0200
From:   Paolo Pisati <p.pisati@...il.com>
To:     Moritz Fischer <moritz.fischer@...us.com>
Cc:     Paolo Pisati <p.pisati@...il.com>, Alan Tull <atull@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Pawel Moll <pawel.moll@....com>,
        Mark Rutland <mark.rutland@....com>,
        Ian Campbell <ijc+devicetree@...lion.org.uk>,
        Kumar Gala <galak@...eaurora.org>, linux-fpga@...r.kernel.org,
        Devicetree List <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 2/2] fpga: lattice machxo2: Add Lattice MachXO2 support

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ