[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <BANLkTi=9dROLwWH2J=Y_FmP+t=rkjMLBJg@mail.gmail.com>
Date: Wed, 20 Apr 2011 13:40:06 +0900
From: "Murali K. Vemuri" <vemuri.muralikrishna@...il.com>
To: 徐建辉 <xujianhui168@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: SPI read problem
On Wed, Apr 20, 2011 at 12:19 PM, 徐建辉 <xujianhui168@...il.com> wrote:
> you can use tasklet.
>
> 2011/4/19 Murali K. Vemuri <vemuri.muralikrishna@...il.com>
>>
>> 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
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@...r.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
>
>
Hi there,
I tried using "tasklet", "workqueue" and semaphore ... all my attempts failed.
if there is any other method I should try, please let me know.
Thanks & regards
Murali
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists