Thread (12 messages) 12 messages, 5 authors, 2007-10-04

Re: Is it safe to use these Linux function (test_bit(), set_bit(), clear_bit()) in character device driver for 2.6.10 ppc kernel.

From: Olof Johansson <hidden>
Date: 2007-10-01 04:22:12

First, PLEASE stop quoting your own text. Do not append > in front of
the lines you write yourself in the reply. It makes it impossible to
tell what parts are new and what are old.

On Sun, Sep 30, 2007 at 07:54:28AM -0700, Misbah khan wrote:
quoted
quoted
FPGA is Indeed mapped non cashed here is the part of the code 

/* Physical bus memory is mapped */
	mmap_reg_ptr=(UINT32 *)ioremap_nocache(PHY_MEM_ADDR,PHY_MEM_SIZE);

And is it ok if I caste FPGA pointer volatile like this will reduce the
probability of failure 
You cannot ever use set_bit/clear_bit to uncacheable memory. Ever. It
uses load-reserve/store-conditional, and they are not legal to use to
uncacheable memory.

Also, regular ioremap() is by default uncacheable, so it's quite adequate
to use in this case, no need to use the _nocache version.
quoted
quoted
do you think   in_be32()  could be the best approach than direct
dereferencing. And about test_bit() function does it looks fine to you 
You need to use in_be32() + manipulating the value + out_be32(),
yes. Depending on the rest of your driver you might need to protect it
with a spinlock, but that's beyond the scope of this question.


-Olof
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help