iowritexx() not always working for me

Jiri Slaby jirislaby at gmail.com
Wed May 18 11:57:35 UTC 2011


On 05/18/2011 08:04 AM, Dhoti Walla wrote:
> Hello,
> 
> I'm writing a driver for a PCI card and having some trouble accessing
> the memory mapped registers on the board.
> 
> I use:
> 
> pci_resource_start(..)  and pci_resource_len(..) to get the starting
> address and size of the memory mapped registers.
> pci_resource_flags(...) returns IORESOURCE_MEMORY and IORESOURCE_SHADOWABLE
> 
> request_mem_region() and ioremap_nocache() both succeed.
> 
> when I call iowrite32(...) to write a 4 byte value, it succeeds on the
> first attempt.
> when I call iowrite16(...) to write a 2 byte value, it succeeds on the
> 2nd  attempt (i.e  I have to call iowrite16(..) twice before the write
> happens)
> when I call iowrite8(...) to write a 1 byte value, it succeeds on the
> 4th  attempt.
> 
> I have no idea why 2 byte and 1 byte writes don't work on the first
> attempt.

It's probably the PCI posting. Try to read some register from the device
after the write.

BTW. you should not use iowrite*/ioread* on ioremap space. Either use
iomap with ioread*/iowrite* or ioremap with write*/read*.

regards,
-- 
js



More information about the devel mailing list