devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Max Filippov <jcmvbkbc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "linux-xtensa-PjhNF2WwrV/0Sa2dR60CXw@public.gmane.org"
	<linux-xtensa-PjhNF2WwrV/0Sa2dR60CXw@public.gmane.org>,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Chris Zankel <chris-YvXeqwSYzG2sTnJN9+BGXg@public.gmane.org>,
	Marc Gauthier <marc-vna1KIf7WgpBDgjK7y7TUQ@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Grant Likely
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Subject: Re: [PATCH 1/3] spi: add xtfpga SPI controller driver
Date: Wed, 12 Mar 2014 00:34:01 +0000	[thread overview]
Message-ID: <20140312003401.GE28112@sirena.org.uk> (raw)
In-Reply-To: <CAMo8BfLTn+pneF6_7XkP66+LzpZgcefnAo_FkwxpvtYdt9yduA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2697 bytes --]

On Wed, Mar 12, 2014 at 12:20:49AM +0400, Max Filippov wrote:
> On Tue, Mar 11, 2014 at 11:49 PM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> > On Tue, Mar 11, 2014 at 04:44:49PM +0400, Max Filippov wrote:

> >> +     unsigned long timeout = jiffies + msecs_to_jiffies(100);
> >> +     while (xtfpga_spi_read32(xspi, XTFPGA_SPI_BUSY)) {
> >> +             if (!time_before(jiffies, timeout))
> >> +                     return -EBUSY;
> >> +             else
> >> +                     cpu_relax();
> >> +     }

> > So we'll busy wait for up to 100ms - that seems like an awfully long
> > time.  Perhaps fall back to msleep() if the delay is non-trivial (or
> > just reduce the timeout)?

> The timeout is here for the unlikely case everything went wrong. Normally
> transfers get completed in about 10 useconds on 50 MHz hardware, it
> doesn't seem worth msleeping here. I put the timeout here just because
> otherwise infinite loop polling the device register looks scary.

I appreciate that but even with 5MHz that's three orders of magnitude
longer busy waiting in the error case than the operation is expected to
take.  If you must wait for that long busy wait for a bit then start
sleeping.

> 
> >> +/* Unused: this device controls its only CS automatically,
> >> + * deactivating it after every 16 bit transfer completion.
> >> + */

> > This is too limited to use with most SPI clients, they'll want to be
> > able to transmit more than one word (and the fact that only 16 bit words
> > are supported is also an issue, though that's easy enough to handle for
> > a bitbanging driver - I'd really strongly suggest supporting 8 bits per
> > word as well).  Clients are pretty much going to need to use GPIO based
> > chip select, you should make sure that's supported and covered in the
> > binding.

> There's no hardware for that. This device is really dumb, it is specifically
> suited to control TLV320AIC23 which expects exactly 16 bit words, SPI
> mode 0.

This driver is not actually compatible with the tlv320aic23 driver since
it needs 8 bit words, you need to at least support that.  You don't need
hardware in the controller to support a GPIO chip select, the whole
point is that the controller chip select isn't wired up and a GPIO is
used instead.

> >> +static void xtfpga_spi_chipselect(struct spi_device *spi, int is_on)
> >> +{
> >> +}

> > Omit this since it's empty.

> The bitbang side doesn't like when this callback is NULL and returns
> -EINVAL from spi_bitbang_start.

So fix that, but really it's trying to tell you that the hardware is far
too limited to work with many things.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2014-03-12  0:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11 12:44 [PATCH 0/3] xtensa xtfpga SPI controller driver Max Filippov
2014-03-11 12:44 ` [PATCH 2/3] spi/xtensa-xtfpga: add DT binding documentation Max Filippov
     [not found] ` <1394541891-26469-1-git-send-email-jcmvbkbc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-03-11 12:44   ` [PATCH 1/3] spi: add xtfpga SPI controller driver Max Filippov
     [not found]     ` <1394541891-26469-2-git-send-email-jcmvbkbc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-03-11 19:49       ` Mark Brown
2014-03-11 20:20         ` Max Filippov
     [not found]           ` <CAMo8BfLTn+pneF6_7XkP66+LzpZgcefnAo_FkwxpvtYdt9yduA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-12  0:34             ` Mark Brown [this message]
     [not found]               ` <20140312003401.GE28112-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-03-12  0:59                 ` Max Filippov
     [not found]                   ` <CAMo8Bf+dePYf0jW6zaH-4Qiy5oF-bBzHjkfzL1u6pyTS1OE46w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-12  1:08                     ` Mark Brown
     [not found]                       ` <20140312010858.GI28112-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-03-12  1:43                         ` Max Filippov
     [not found]                           ` <CAMo8BfL6dwgZitRBZQEU6HCRVMRoYhPkiJWW5QTpS-cu-njR5A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-12  1:53                             ` Mark Brown
2014-03-12  1:11                     ` Mark Brown
2014-03-12  1:48                       ` Max Filippov
     [not found]                         ` <CAMo8BfKFp1kz8S_4JbSh5=f+hMygJL1670fkFfzdArgDqtW72A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-12 13:24                           ` Mark Brown
2014-03-11 12:44   ` [PATCH 3/3] MAINTAINERS: add xtfpga platform section Max Filippov

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=20140312003401.GE28112@sirena.org.uk \
    --to=broonie-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=chris-YvXeqwSYzG2sTnJN9+BGXg@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=jcmvbkbc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-xtensa-PjhNF2WwrV/0Sa2dR60CXw@public.gmane.org \
    --cc=marc-vna1KIf7WgpBDgjK7y7TUQ@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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).