From: Kumar Gala <galak@kernel.crashing.org>
To: Vitaly Wool <vitalywool@gmail.com>
Cc: David Brownell <david-b@pacbell.net>, Greg KH <greg@kroah.com>,
linux-kernel@vger.kernel.org,
spi-devel-general@lists.sourceforge.net
Subject: Re: [spi-devel-general] [PATCH][2.16.17-rc1-mm2] spi: Added spi master driver for Freescale MPC83xx SPI controller
Date: Mon, 10 Apr 2006 15:22:38 -0500 [thread overview]
Message-ID: <EB5A4A6A-BCD0-4DD0-A0F4-E155495EDCC6@kernel.crashing.org> (raw)
In-Reply-To: <443ABA1A.1060801@gmail.com>
On Apr 10, 2006, at 3:03 PM, Vitaly Wool wrote:
> Hi,
>
> Kumar Gala wrote:
>
>> +irqreturn_t mpc83xx_spi_irq(s32 irq, void *context_data,
>> + struct pt_regs * ptregs)
>> +{
>> + struct mpc83xx_spi *mpc83xx_spi = context_data;
>> + u32 event;
>> + irqreturn_t ret = IRQ_NONE;
>> +
>> + /* Get interrupt events(tx/rx) */
>> + event = mpc83xx_spi_read_reg(&mpc83xx_spi->base->event);
>> +
>> + /* We need handle RX first */
>> + if (event & SPIE_NE) {
>> + u32 rx_data = mpc83xx_spi_read_reg(&mpc83xx_spi->base->receive);
>> +
>> + if (mpc83xx_spi->rx)
>> + mpc83xx_spi->get_rx(rx_data, mpc83xx_spi);
>> +
>> + ret = IRQ_HANDLED;
>> + }
>> +
>> + if ((event & SPIE_NF) == 0)
>> + /* spin until TX is done */
>> + while (((event =
>> + mpc83xx_spi_read_reg(&mpc83xx_spi->base->event)) &
>> + SPIE_NF) == 0)
>> + ;
>>
> This is a potentially endless loop so two questions here.
> First, did you do any measurements on how long it can loop here?
> The, what if a bus error occurs and this bit is never set?
In my measurements the if is never true, so we never spin.
I wasn't particular happy about the spinning for ever, wasn't sure
what would be better. I need to ensure we've gotten both a TX & RX
event before transmitting the next character. I'm open to
suggestions on how to do this better.
>> +
>> + mpc83xx_spi->count -= 1;
>> + if (mpc83xx_spi->count) {
>> + if (mpc83xx_spi->tx) {
>> + u32 word = mpc83xx_spi->get_tx(mpc83xx_spi);
>> + mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit,
>> + word);
>> + }
>> + } else {
>> + complete(&mpc83xx_spi->done);
>> + }
>>
> So, if it's not SPIE_NF, it's not marked as HANDLED?
I wasn't sure what the best thing here was. In truth we will only
get an interrupt if SPIE_NF is set so it should always be handled.
next prev parent reply other threads:[~2006-04-10 20:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-06 18:30 [PATCH] " Kumar Gala
2006-04-07 5:22 ` David Brownell
2006-04-07 9:16 ` [spi-devel-general] " Vitaly Wool
2006-04-07 16:09 ` David Brownell
2006-04-07 17:04 ` Kumar Gala
2006-04-08 1:25 ` David Brownell
2006-04-07 14:04 ` Kumar Gala
2006-04-07 15:54 ` David Brownell
2006-04-07 16:44 ` Kumar Gala
2006-04-10 17:38 ` [PATCH][UPDATE] " Kumar Gala
2006-04-10 19:01 ` David Brownell
2006-04-10 19:05 ` Kumar Gala
2006-04-10 19:17 ` [PATCH][2.16.17-rc1-mm2] " Kumar Gala
2006-04-10 20:03 ` [spi-devel-general] " Vitaly Wool
2006-04-10 20:22 ` Kumar Gala [this message]
2006-04-10 21:06 ` David Brownell
2006-04-10 21:10 ` Kumar Gala
2006-04-11 14:39 ` [PATCH][2.16.17-rc1-mm2][UPDATE] " Kumar Gala
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=EB5A4A6A-BCD0-4DD0-A0F4-E155495EDCC6@kernel.crashing.org \
--to=galak@kernel.crashing.org \
--cc=david-b@pacbell.net \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=spi-devel-general@lists.sourceforge.net \
--cc=vitalywool@gmail.com \
/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
all inboxes | Powered by JetHome®