mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 07:34:31 +00:00
common: fdt_support: Add missing cpu_to_fdt32() to fdt_pci_dma_ranges()
The fdt_pci_dma_ranges() cannot work on e.g. ARM, since the DT entries endianness is not adjusted at all. Fix this. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
15d61d04b4
commit
867aaf6806
1 changed files with 14 additions and 11 deletions
|
@ -671,30 +671,33 @@ int fdt_pci_dma_ranges(void *blob, int phb_off, struct pci_controller *hose) {
|
||||||
|
|
||||||
dma_range[0] = 0;
|
dma_range[0] = 0;
|
||||||
if (size >= 0x100000000ull)
|
if (size >= 0x100000000ull)
|
||||||
dma_range[0] |= FDT_PCI_MEM64;
|
dma_range[0] |= cpu_to_fdt32(FDT_PCI_MEM64);
|
||||||
else
|
else
|
||||||
dma_range[0] |= FDT_PCI_MEM32;
|
dma_range[0] |= cpu_to_fdt32(FDT_PCI_MEM32);
|
||||||
if (hose->regions[r].flags & PCI_REGION_PREFETCH)
|
if (hose->regions[r].flags & PCI_REGION_PREFETCH)
|
||||||
dma_range[0] |= FDT_PCI_PREFETCH;
|
dma_range[0] |= cpu_to_fdt32(FDT_PCI_PREFETCH);
|
||||||
#ifdef CONFIG_SYS_PCI_64BIT
|
#ifdef CONFIG_SYS_PCI_64BIT
|
||||||
dma_range[1] = bus_start >> 32;
|
dma_range[1] = cpu_to_fdt32(bus_start >> 32);
|
||||||
#else
|
#else
|
||||||
dma_range[1] = 0;
|
dma_range[1] = 0;
|
||||||
#endif
|
#endif
|
||||||
dma_range[2] = bus_start & 0xffffffff;
|
dma_range[2] = cpu_to_fdt32(bus_start & 0xffffffff);
|
||||||
|
|
||||||
if (addrcell == 2) {
|
if (addrcell == 2) {
|
||||||
dma_range[3] = phys_start >> 32;
|
dma_range[3] = cpu_to_fdt32(phys_start >> 32);
|
||||||
dma_range[4] = phys_start & 0xffffffff;
|
dma_range[4] = cpu_to_fdt32(phys_start & 0xffffffff);
|
||||||
} else {
|
} else {
|
||||||
dma_range[3] = phys_start & 0xffffffff;
|
dma_range[3] = cpu_to_fdt32(phys_start & 0xffffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sizecell == 2) {
|
if (sizecell == 2) {
|
||||||
dma_range[3 + addrcell + 0] = size >> 32;
|
dma_range[3 + addrcell + 0] =
|
||||||
dma_range[3 + addrcell + 1] = size & 0xffffffff;
|
cpu_to_fdt32(size >> 32);
|
||||||
|
dma_range[3 + addrcell + 1] =
|
||||||
|
cpu_to_fdt32(size & 0xffffffff);
|
||||||
} else {
|
} else {
|
||||||
dma_range[3 + addrcell + 0] = size & 0xffffffff;
|
dma_range[3 + addrcell + 0] =
|
||||||
|
cpu_to_fdt32(size & 0xffffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
dma_range += (3 + addrcell + sizecell);
|
dma_range += (3 + addrcell + sizecell);
|
||||||
|
|
Loading…
Reference in a new issue