public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* SPI read problem
@ 2011-04-19 11:41 Murali K. Vemuri
       [not found] ` <BANLkTimFd0ZuP2OQ4A_w7VFbDDN+rsvBtg@mail.gmail.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Murali K. Vemuri @ 2011-04-19 11:41 UTC (permalink / raw)
  To: linux-kernel

Hello there,
I have a device which is Written_to/Read_from using SPI Bus.

I initialize the device like this:

static int __init myDEV_init(void)
{
    return spi_register_driver(&myDEV_driver);
}
module_init(myDEV_init);

My myDEV_probe() function looks like this:

static int __devinit myDEV_probe(struct spi_device *spi)
{
.....
.....
/*when my CPU receives a particular IRQ, I have to do a spi_read() and
do couple of spi_write(), I am using like this:*/
err = request_threaded_irq (MY_DEV_IRQ, NULL, myDEV_irq_thread,
            IRQF_TRIGGER_RISING, "MYDEV", NULL);

return 0;
}

When the Interrupt is received by the CPU, myDEV_irq_thread is being called.
However, in the ISR I have to do  spi_read(). This is always returning
"Timed out".

To verify if the device is not at all working, along with registering
for the IRQ, I also created a char device through I did a IOCTL.
The IOCTL command in turn does spi_read(). In this case spi_read() is
successful.

Since it is necessary to do spi_read() in my ISR, I searched around
and found some information that
spi_read() is callable only from contexts that can sleep.

How can I make my ISR sleep? or is there any other way of doing this?

Any help is highly appreciated.
Thanks & regards
Murali

^ permalink raw reply	[flat|nested] 10+ messages in thread
* SPI read problem
@ 2011-04-19 21:46 Murali K. Vemuri
  0 siblings, 0 replies; 10+ messages in thread
From: Murali K. Vemuri @ 2011-04-19 21:46 UTC (permalink / raw)
  To: linux-kernel

Hello there,
I have a device which is Written_to/Read_from using SPI Bus.

I initialize the device like this:

static int __init myDEV_init(void)
{
   return spi_register_driver(&myDEV_driver);
}
module_init(myDEV_init);

My myDEV_probe() function looks like this:

static int __devinit myDEV_probe(struct spi_device *spi)
{
.....
.....
/*when my CPU receives a particular IRQ, I have to do a spi_read() and
do couple of spi_write(), I am using like this:*/
err = request_threaded_irq (MY_DEV_IRQ, NULL, myDEV_irq_thread,
           IRQF_TRIGGER_RISING, "MYDEV", NULL);

return 0;
}

When the Interrupt is received by the CPU, myDEV_irq_thread is being called.
However, in the ISR I have to do  spi_read(). This is always returning
"Timed out".

To verify if the device is not at all working, along with registering
for the IRQ, I also created a char device through I did a IOCTL.
The IOCTL command in turn does spi_read(). In this case spi_read() is
successful.

Since it is necessary to do spi_read() in my ISR, I searched around
and found some information that
spi_read() is callable only from contexts that can sleep.

How can I make my ISR sleep? or is there any other way of doing this?

Any help is highly appreciated.
Thanks & regards
Murali

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-04-22 12:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-19 11:41 SPI read problem Murali K. Vemuri
     [not found] ` <BANLkTimFd0ZuP2OQ4A_w7VFbDDN+rsvBtg@mail.gmail.com>
2011-04-20  4:40   ` Murali K. Vemuri
2011-04-20 13:48     ` Jonathan Cameron
2011-04-21  1:15       ` Murali K. Vemuri
2011-04-21  2:05         ` Pei Lin
2011-04-21  2:33           ` Murali K. Vemuri
2011-04-21 11:30             ` Murali K. Vemuri
2011-04-21 11:35               ` Jonathan Cameron
2011-04-22 12:22                 ` Murali K. Vemuri
  -- strict thread matches above, loose matches on Subject: below --
2011-04-19 21:46 Murali K. Vemuri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox