<div dir="ltr"><div>retval = pci_enable_device(dev);<br>    if (retval)<br>    {<br>        printk(KERN_ERR &quot;Unable to enable this PCI device\n&quot;);<br>        return retval;<br>    }<br>    else<br>    {<br>        printk(KERN_INFO &quot;PCI device enabled\n&quot;);<br>    }<br><br>    display_pci_config_space(dev);<br><br>    retval = pci_request_regions(dev, &quot;expt_pci&quot;);<br>    if (retval)<br>    {<br>        printk(KERN_ERR &quot;Unable to acquire regions of this PCI device\n&quot;);<br>        pci_disable_device(dev);<br>        return retval;<br>    }<br>    else<br>    {<br>        printk(KERN_INFO &quot;PCI device regions acquired\n&quot;);<br>    }<br><br>    if ((dpv-&gt;reg_base = ioremap(pci_resource_start(dev, 2), pci_resource_len(dev, 2))) == NULL)<br>    {<br>        printk(KERN_ERR &quot;Unable to map registers of this PCI device\n&quot;);<br>        pci_release_regions(dev);<br>        pci_disable_device(dev);<br>        return -ENODEV;<br>    }<br>    printk(KERN_INFO &quot;Register Base: %p\n&quot;, dpv-&gt;reg_base);<br><br>    printk(KERN_INFO &quot;IRQ: %u\n&quot;, dev-&gt;irq);<br>    <br>    printk(KERN_INFO &quot;dpv-&gt;reg_base value is: %x\n&quot;,dpv-&gt;reg_base);<br><br>    pci_set_drvdata(dev, dpv);<br><br>printk(KERN_INFO &quot;PCI device registered\n&quot;);<br><br>    printk(KERN_INFO &quot;Expt: In write\n&quot;);    <br>    //iowrite8(MY_BYTE,dev-&gt;resource[0].start);<br>    uint32_t a = 0x01;<br>    uint32_t addr;<br>    iowrite8(a, dpv-&gt;reg_base);<br>    printk(&quot;value written is %d\n&quot;,a);<br>    printk(KERN_INFO &quot;Expt: In read\n&quot;);<br>    //addr = ioread8(dev-&gt;resource[0].start );<br>    addr = ioread8(dpv-&gt;reg_base );<br>    printk(&quot;Value read is %d\n&quot;,addr);<br><br></div>THE OUTPUT i am getting is this:<br><div><br>[ 6482.783371] PCI device regions acquired<br>[ 6482.795801] Register Base: ffffc90015b00000<br>[ 6482.795803] IRQ: 16<br>[ 6482.795804] dpv-&gt;reg_base value is: 15b00000<br>[ 6482.795805] PCI device registered<br><b>[ 6482.795806] Expt: In write<br>[ 6482.795807] value written is 1<br>[ 6482.795808] Expt: In read<br>[ 6482.795810] Value read is 0</b><br>[ 6482.795836] Expt PCI driver registered<br><br><br></div><div>Can you tell me what am i doing wrong?<br><br></div><div>Regards<br><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 28, 2015 at 10:36 AM, Sudip Mukherjee <span dir="ltr">&lt;<a href="mailto:sudipm.mukherjee@gmail.com" target="_blank">sudipm.mukherjee@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Apr 28, 2015 at 10:25 AM, Robert Clove &lt;<a href="mailto:cloverobert@gmail.com">cloverobert@gmail.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I am trying to write and read PCI BAR address but not getting the expected<br>
&gt; output.<br>
&gt; I am using the ioremap api to get the address.<br>
&gt; Any leads will be fruit full.<br>
<br>
</div></div>can you please post what you have tried till now...<br>
<br>
regards<br>
<span class="HOEnZb"><font color="#888888">sudip<br>
</font></span></blockquote></div><br></div>