From: mrnuke <mr.nuke.me-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 1/2] v1 ARM: sun4i: spi: Allow Rx transfers larger than FIFO size
Date: Wed, 19 Mar 2014 13:03:45 -0500 [thread overview]
Message-ID: <29069269.5VPQtL8a7I@nukelap.gtech> (raw)
In-Reply-To: <20140319165507.GJ27873@lukather>
On Wednesday, March 19, 2014 05:55:07 PM Maxime Ripard wrote:
> Hi,
>
> Thanks for working on this.
>
> I have a few general comments first:
> - Use a decent mailer for your patches. [...]
> - The vX should be between the brackets, [...]
OOPS
> - Those two patches should be merged together. [...]
Sure.
> > - /* We don't support transfer larger than the FIFO */
> > - if (tfr->len > SUN4I_FIFO_DEPTH)
> > + if (tfr->len > SUN4I_MAX_XFER_SIZE)
> > + return -EINVAL;
>
> Why do you still need this test?
>
SUN4I_MAX_XFER_SIZE is not the FIFO size. It is the max number we can write in
SUN4I_BURST_CNT_REG. That's the maximum SPI burst size (16 MiB - 1) that the
hardware supports. Anything larger, and we'd need to break up the transfer in
several bursts. That's a different problem than the one I'm addressing.
> > - sun4i_spi_drain_fifo(sspi, SUN4I_FIFO_DEPTH);
> > + /* FIFO is drained during the interrupt handler */
>
> Then don't mention it.
>
Got it, boss.
> > + /* Receive FIFO 3/4 full */
> > + if (status & SUN4I_INT_CTL_RF_F34) {
> > + sun4i_spi_drain_fifo(sspi, SUN4I_FIFO_DEPTH);
> > + /* Only clear the interrupt _after_ draining the FIFO */
> > + sun4i_spi_write(sspi, SUN4I_INT_STA_REG,
> > SUN4I_INT_CTL_RF_F34);
>
> Not that it's important, but it really doesn't matter to do it before
> or after, the interrupts are disabled in the handler.
>
I think this was one of those bits that keeps being set by hardware until the
Rx FIFO is under 48 bytes (less than 3/4 full). I'll have to look into this
again.
Alex
WARNING: multiple messages have this Message-ID (diff)
From: mr.nuke.me@gmail.com (mrnuke)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] v1 ARM: sun4i: spi: Allow Rx transfers larger than FIFO size
Date: Wed, 19 Mar 2014 13:03:45 -0500 [thread overview]
Message-ID: <29069269.5VPQtL8a7I@nukelap.gtech> (raw)
In-Reply-To: <20140319165507.GJ27873@lukather>
On Wednesday, March 19, 2014 05:55:07 PM Maxime Ripard wrote:
> Hi,
>
> Thanks for working on this.
>
> I have a few general comments first:
> - Use a decent mailer for your patches. [...]
> - The vX should be between the brackets, [...]
OOPS
> - Those two patches should be merged together. [...]
Sure.
> > - /* We don't support transfer larger than the FIFO */
> > - if (tfr->len > SUN4I_FIFO_DEPTH)
> > + if (tfr->len > SUN4I_MAX_XFER_SIZE)
> > + return -EINVAL;
>
> Why do you still need this test?
>
SUN4I_MAX_XFER_SIZE is not the FIFO size. It is the max number we can write in
SUN4I_BURST_CNT_REG. That's the maximum SPI burst size (16 MiB - 1) that the
hardware supports. Anything larger, and we'd need to break up the transfer in
several bursts. That's a different problem than the one I'm addressing.
> > - sun4i_spi_drain_fifo(sspi, SUN4I_FIFO_DEPTH);
> > + /* FIFO is drained during the interrupt handler */
>
> Then don't mention it.
>
Got it, boss.
> > + /* Receive FIFO 3/4 full */
> > + if (status & SUN4I_INT_CTL_RF_F34) {
> > + sun4i_spi_drain_fifo(sspi, SUN4I_FIFO_DEPTH);
> > + /* Only clear the interrupt _after_ draining the FIFO */
> > + sun4i_spi_write(sspi, SUN4I_INT_STA_REG,
> > SUN4I_INT_CTL_RF_F34);
>
> Not that it's important, but it really doesn't matter to do it before
> or after, the interrupts are disabled in the handler.
>
I think this was one of those bits that keeps being set by hardware until the
Rx FIFO is under 48 bytes (less than 3/4 full). I'll have to look into this
again.
Alex
next prev parent reply other threads:[~2014-03-19 18:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-18 22:04 [PATCH 1/2] v1 ARM: sun4i: spi: Allow Rx transfers larger than FIFO size Alexandru Gagniuc
2014-03-18 22:04 ` Alexandru Gagniuc
[not found] ` <2167943.Zs1zPAMITN-joXr/IIKmbNbKQuZ0yLBSw@public.gmane.org>
2014-03-19 16:55 ` Maxime Ripard
2014-03-19 16:55 ` Maxime Ripard
2014-03-19 18:03 ` mrnuke [this message]
2014-03-19 18:03 ` mrnuke
[not found] ` <29069269.5VPQtL8a7I-joXr/IIKmbNbKQuZ0yLBSw@public.gmane.org>
2014-03-20 15:08 ` Maxime Ripard
2014-03-20 15:08 ` Maxime Ripard
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=29069269.5VPQtL8a7I@nukelap.gtech \
--to=mr.nuke.me-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
--cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.