<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 12, 2014 at 8:13 PM, amit mehta <span dir="ltr"><<a href="mailto:gmate.amit@gmail.com" target="_blank">gmate.amit@gmail.com</a>></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 Thu, Jun 12, 2014 at 4:52 PM, priyaranjan <<a href="mailto:priyaranjan45678@gmail.com">priyaranjan45678@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> On Thu, Jun 12, 2014 at 7:09 PM, amit mehta <<a href="mailto:gmate.amit@gmail.com">gmate.amit@gmail.com</a>> wrote:<br>
>><br>
>> We are working on a school project in which we are trying to develop a<br>
>> audio mixer<br>
>> on Zedboard (Development board from Digilent). We have developed the IP<br>
>> and have<br>
>> integrated it with the overall hardware using Programmable logic. This<br>
>> board has ARM<br>
>> core. We have a Digilent pre-configured Linux source which we<br>
>> cross-compiled<br>
>> for ARM board, device tree blob and bootloader for Zync(BOOT.BIN). The<br>
>> system<br>
>> boots fine with Linux, but now to expose the recently added hardware<br>
>> implementation<br>
>> of audio mixer, we are trying to develop the driver using the platform<br>
>> driver API.<br>
>> Currently, In our reconfigurable hardware, we have 2 channels and a mixer<br>
>> and we<br>
>> want to access those individually as some file nodes under /proc FS. The<br>
>> sample<br>
>> code is shown below:<br>
>><br>
>> <snip from myiir.c><br>
>> /* device match table to match with device node in device tree<br>
>> * These are the list of devices that we want to expose as platform device<br>
>> */<br>
>> static const struct of_device_id myiir_of_match[] __devinitconst = {<br>
>> {.compatible = "dglnt,myiir-audio-ch0"},<br>
>> {.compatible = "dglnt,myiir-audio-ch1"},<br>
>> {.compatible = "dglnt,myiir-audio-mix0"},<br>
>> {},<br>
>> };<br>
>><br>
>> MODULE_DEVICE_TABLE(of, myiir_of_match);<br>
>><br>
>> /* platform driver structure for myiir driver */<br>
>> static struct platform_driver myiir_driver = {<br>
>> .driver = {<br>
>> .name = DRIVER_NAME,<br>
>> .owner = THIS_MODULE,<br>
>> .of_match_table = myiir_of_match},<br>
>> .probe = myiir_probe,<br>
>> .remove = __devexit_p(myiir_remove),<br>
>> .shutdown = __devexit_p(myiir_shutdown)<br>
>> };<br>
>><br>
>> /* Register myiir platform driver */<br>
>> module_platform_driver(myiir_driver);<br>
>> <myiir.c><br>
>><br>
>> Now, inside the probe routine (myiir_probe), can we create proc<br>
>> entries by calling<br>
>> create_proc for each of these nodes and setting the appropriate read and<br>
>> write<br>
>> methods(file_operations) ?<br>
><br>
><br>
><br>
> Yes, I feel this is fine, the proc entries to be created in probe,<br>
> Initialize all data structures as required in probe.<br>
><br>
</div></div>Thank you for this confirmation. I've one more query regarding the<br>
IO addresses. The CAD tool from Xilinx shows the base addresses<br>
of our custom IP, which we have put into the device tree blob(also<br>
shown in the attached screeshot) and in our driver, we are requesting<br>
the memory region and after calling the ioremap, we access those<br>
IO addresses, but is there are need to write the register addresses<br>
in the device tree file in a particular order(asceding/descending) ?<br></blockquote><div><br></div><div style>I am not sure about ascending or descending order but yes, the register addresses should be in the device tree. You can check more examples on the same and follow.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class=""><snip from device tree file><br>
myiir-aud-ch0 {<br>
compatible = "dglnt,myiir-audio-ch0";<br>
reg = <0x74200000 0x10000>;<br>
};<br>
myiir-aud-ch1 {<br>
compatible = "dglnt,myiir-audio-ch1";<br>
reg = <0x74220000 0x10000>;<br>
};<br>
myiir-aud-mix0 {<br>
compatible = "dglnt,myiir-audio-mix0";<br>
reg = <0x68600000 0x10000>;<br>
};<br>
<snip from device tree file><br>
</div>The sequence of operation in probe routine is:<br>
<br>
platform_get_resource(pdev, IORESOURCE_MEM, 0);<br>
remap_size = res->end - res->start + 1;<br>
request_mem_region(res->start, remap_size, pdev->name);<br>
base_addr = ioremap(res->start, remap_size);<br>
<br>
Thanks,<br>
Kumar<br>
</blockquote></div><br></div></div>