I've tried to use the CMA (Contiguous Memory Allocator) configured with DT. But how can I access the allocated memory region form the module?
This is the DT part:
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
dsp_reserved: dsp@83400000 {
reg = <0x83400000 0x400000>;
no-map;
};
};
c64_dsp {
compatible = "c64-dsp";
interrupt-parent = <&intc>;
interrupts = <26>;
memory-region = <&dsp_reserved>;
};
How can I get the reserved memory region "dsp_reserved" in my own driver? Is this region already requested by "dma_alloc_coherent"? Is there a function similar to "platform_get_irq"?
Thanks for help, Sven
I've found a solution (called in probe() function):
memory = of_parse_phandle(dev->of_node, "memory-region", 0);
if (!memory) {
return -ENODEV;
}
addr = of_translate_address(memory,
of_get_address(memory, 0, &memory_size, NULL));
virt_addr = phys_to_virt(addr);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.