Hi,
I am trying to use the OCRAM the way you suggested but I get kernel panic when I try to memcpy to/from it.
Could you please help me understand what am I doing wrong or missing?
dtsi:
resmem: reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
ocram: ocram@900000 {
no-map;
reg = <0 0x900000 0 0x70000>;
};
ocram_dma: ocram_dma@970000 {
no-map;
reg = <0 0x970000 0 0xC00>; // 3KB
};
...
module init:
// Find the OCRAM DMA node by name
np = of_find_node_by_name(NULL, "ocram_dma");
if (!np) {
pr_err("Failed to find OCRAM DMA node in device tree\n");
return -ENODEV;
}
// Lookup the reserved memory region
rmem = of_reserved_mem_lookup(np);
if (!rmem) {
pr_err("Failed to lookup reserved memory for OCRAM DMA\n");
return -ENODEV;
}
// Map the reserved memory region
ocram_dma_base = ioremap(rmem->base, rmem->size);
if (!ocram_dma_base) {
pr_err("Failed to map OCRAM DMA memory\n");
return -ENOMEM;
}
copy:
memcpy(current_address, mv->A, MATRIX_STRUCT_SIZE);