linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Moritz Fischer <moritz.fischer@ettus.com>
To: Joel Holdsworth <joel@airwebreathe.org.uk>
Cc: "Alan Tull" <atull@opensource.altera.com>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Rob Herring" <robh@kernel.org>,
	"Devicetree List" <devicetree@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	linux-spi@vger.kernel.org, "Marek Vašut" <marex@denx.de>,
	clifford@clifford.at
Subject: Re: [PATCH v8 3/3] fpga: Add support for Lattice iCE40 FPGAs
Date: Mon, 7 Nov 2016 13:41:28 -0800	[thread overview]
Message-ID: <CAAtXAHeO+qF=X-7L8uOCuFjCcVnUhEFkucYd3xfsFgVUp8JdcQ@mail.gmail.com> (raw)
In-Reply-To: <da65c3e6-c0cf-df38-7f1b-c05d674f002c@airwebreathe.org.uk>

Hi Joel,

On Mon, Nov 7, 2016 at 11:02 AM, Joel Holdsworth
<joel@airwebreathe.org.uk> wrote:
> Hi Moritz - thanks for your comments.
>
>
>>> An example of such a device is the icoBoard; a RaspberryPI HAT which
>>> features an iCE40HX8K with a 1 or 8 MBit SRAM and ports for
>>> Digilent-compatible PMOD modules. A PMOD module may contain a device
>>> with which the kernel communicates, via the FPGA.
>>
>>
>> Personally I find this a bit verbose, but that's just me.
>
>
> I could cut it down a bit if you want. I was just trying to make the case
> for why this *has* to be in the kernel rather than just being done from
> user-space.
>
>
>>> +       struct spi_transfer assert_cs_then_reset_delay = {.cs_change = 1,
>>> +               .delay_usecs = ICE40_SPI_FPGAMGR_RESET_DELAY};
>>
>>
>> Formatting looks odd, can you move the .cs_change to the next line?
>
>
> Marek made the same comment. I'll make the change.
>
>
>>> +static int ice40_fpga_ops_write_complete(struct fpga_manager *mgr, u32
>>> flags)
>>> +{
>>> +       struct ice40_fpga_priv *priv = mgr->priv;
>>> +       struct spi_device *dev = priv->dev;
>>> +       const u8 padding[ICE40_SPI_FPGAMGR_NUM_ACTIVATION_BYTES] = {0,};
>>> +
>>> +       /* Check CDONE is asserted */
>>> +       if (!gpiod_get_value(priv->cdone)) {
>>> +               dev_err(&dev->dev,
>>> +                       "CDONE was not asserted after firmware
>>> transfer\n");
>>> +               return -EIO;
>>> +       }
>>> +
>>> +       /* Send of zero-padding to activate the firmware */
>>> +       return spi_write(dev, padding, sizeof(padding));
>>
>>
>> I'd move all of these into the write() callback.
>
>
> Is that correct? I was under the impression that write might be called
> multiple times to load firmware in multiple chunks.

Nah, you're right. Don't listen to me :)
>
>
>>> +       /* Enter reset */
>>> +       gpiod_set_value(priv->reset, 1);
>>
>>
>> I know Marek had suggested this, none of the other drivers behave like
>> that.
>> I'm not sure this is expected behavior for most people.
>
>
> For me it's not a big deal either way, but I think it's quite good for the
> driver to reset the device.
>
> When you remove most other drivers, you expect the driver to shut the device
> down, so isn't this just the same?
>
> ...but then the FPGA manager is a unique best with its own conventions, so
> perhaps it should behave differently.
>
> How can we get a consensus about this?

Fair enough. I don't mind either way all that much, just thought I'd
bring it up.

Thanks,

Moritz

      reply	other threads:[~2016-11-07 21:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07  2:49 [PATCH v8 1/3] of: Add vendor prefix for Lattice Semiconductor Joel Holdsworth
2016-11-07  2:49 ` [PATCH v8 2/3] Documentation: Add binding document for Lattice iCE40 FPGA manager Joel Holdsworth
2016-11-07 17:53   ` Marek Vasut
2016-11-07 18:57     ` Joel Holdsworth
2016-11-14 16:11   ` Rob Herring
2016-11-18 18:56     ` atull
2016-11-18 19:17       ` Moritz Fischer
2016-11-18 19:28         ` Marek Vasut
2016-11-07  2:49 ` [PATCH v8 3/3] fpga: Add support for Lattice iCE40 FPGAs Joel Holdsworth
2016-11-07 18:01   ` Marek Vasut
2016-11-07 18:49     ` Joel Holdsworth
2016-11-07 18:53       ` Marek Vasut
2016-11-08 17:06         ` Moritz Fischer
2016-11-08 17:30           ` Joel Holdsworth
2016-11-09 12:01             ` Marek Vasut
2016-11-09 18:37               ` Joel Holdsworth
2016-11-09 18:39                 ` Marek Vasut
2016-11-09 18:54                   ` Joel Holdsworth
2016-11-10 12:11                     ` Marek Vasut
2016-11-08 17:13         ` Joel Holdsworth
2016-11-07 18:26   ` Moritz Fischer
2016-11-07 19:02     ` Joel Holdsworth
2016-11-07 21:41       ` Moritz Fischer [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='CAAtXAHeO+qF=X-7L8uOCuFjCcVnUhEFkucYd3xfsFgVUp8JdcQ@mail.gmail.com' \
    --to=moritz.fischer@ettus.com \
    --cc=atull@opensource.altera.com \
    --cc=clifford@clifford.at \
    --cc=devicetree@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=joel@airwebreathe.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=robh@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).