I am developing a PowerPC 405 built into the Virtex4 FPGA with the Linux 2.6.33 kernel.
So far, I have written drivers for platform devices implemented in FPGAs as loadable kernel modules. Devices are registered using the Open Open Firmware Device Tree file. To create a device file, I use the OF functions to get the node device and then register a new miscdevice , which then automatically registers the minor device number and creates a device file for it. This also creates a device built into miscdevice (i.e. miscdevice.this_device )
Now the problem is DMA operations. I tried to call the dma_alloc_coherent() function using miscdevice.this_device , but this device is not connected to any bus and always returns an error. I did something, and it turned out that the struct of_device also has a struct device built into it (i.e. of_device.dev ). When I tried using this with dma_alloc_coherent() , it worked fine.
So now I have two different struct device structures, one for managing a personal device file, and the other for managing basic Open Firmware system calls, bus transactions, and DMA. These devices are not connected to each other in sysfs, of course.
My question is: can I somehow request to create a device file for the device structure that I get from the OF level and not create a new device with the Misc API? Thus, everything will be connected with one device structure.
source share