Re: [U-Boot] [PATCH] common: fdt_support: Add missing cpu_to_fdt32() to fdt_pci_dma_ranges()

2019-07-20 Thread sjg
On 7/9/19 2:49 AM, Marek Vasut wrote:
> 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 
> Cc: Tom Rini 

+CC Simon

> ---
>  common/fdt_support.c | 25 ++---
>  1 file changed, 14 insertions(+), 11 deletions(-)
>
Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] common: fdt_support: Add missing cpu_to_fdt32() to fdt_pci_dma_ranges()

2019-07-08 Thread Marek Vasut
On 7/9/19 2:49 AM, Marek Vasut wrote:
> 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 
> Cc: Tom Rini 

+CC Simon

> ---
>  common/fdt_support.c | 25 ++---
>  1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index f31e9b0cc5..e0043e8da6 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -671,30 +671,33 @@ int fdt_pci_dma_ranges(void *blob, int phb_off, struct 
> pci_controller *hose) {
>  
>   dma_range[0] = 0;
>   if (size >= 0x1ull)
> - dma_range[0] |= FDT_PCI_MEM64;
> + dma_range[0] |= cpu_to_fdt32(FDT_PCI_MEM64);
>   else
> - dma_range[0] |= FDT_PCI_MEM32;
> + dma_range[0] |= cpu_to_fdt32(FDT_PCI_MEM32);
>   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
> - dma_range[1] = bus_start >> 32;
> + dma_range[1] = cpu_to_fdt32(bus_start >> 32);
>  #else
>   dma_range[1] = 0;
>  #endif
> - dma_range[2] = bus_start & 0x;
> + dma_range[2] = cpu_to_fdt32(bus_start & 0x);
>  
>   if (addrcell == 2) {
> - dma_range[3] = phys_start >> 32;
> - dma_range[4] = phys_start & 0x;
> + dma_range[3] = cpu_to_fdt32(phys_start >> 32);
> + dma_range[4] = cpu_to_fdt32(phys_start & 0x);
>   } else {
> - dma_range[3] = phys_start & 0x;
> + dma_range[3] = cpu_to_fdt32(phys_start & 0x);
>   }
>  
>   if (sizecell == 2) {
> - dma_range[3 + addrcell + 0] = size >> 32;
> - dma_range[3 + addrcell + 1] = size & 0x;
> + dma_range[3 + addrcell + 0] =
> + cpu_to_fdt32(size >> 32);
> + dma_range[3 + addrcell + 1] =
> + cpu_to_fdt32(size & 0x);
>   } else {
> - dma_range[3 + addrcell + 0] = size & 0x;
> + dma_range[3 + addrcell + 0] =
> + cpu_to_fdt32(size & 0x);
>   }
>  
>   dma_range += (3 + addrcell + sizecell);
> 


-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] common: fdt_support: Add missing cpu_to_fdt32() to fdt_pci_dma_ranges()

2019-07-08 Thread Marek Vasut
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 
Cc: Tom Rini 
---
 common/fdt_support.c | 25 ++---
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index f31e9b0cc5..e0043e8da6 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -671,30 +671,33 @@ int fdt_pci_dma_ranges(void *blob, int phb_off, struct 
pci_controller *hose) {
 
dma_range[0] = 0;
if (size >= 0x1ull)
-   dma_range[0] |= FDT_PCI_MEM64;
+   dma_range[0] |= cpu_to_fdt32(FDT_PCI_MEM64);
else
-   dma_range[0] |= FDT_PCI_MEM32;
+   dma_range[0] |= cpu_to_fdt32(FDT_PCI_MEM32);
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
-   dma_range[1] = bus_start >> 32;
+   dma_range[1] = cpu_to_fdt32(bus_start >> 32);
 #else
dma_range[1] = 0;
 #endif
-   dma_range[2] = bus_start & 0x;
+   dma_range[2] = cpu_to_fdt32(bus_start & 0x);
 
if (addrcell == 2) {
-   dma_range[3] = phys_start >> 32;
-   dma_range[4] = phys_start & 0x;
+   dma_range[3] = cpu_to_fdt32(phys_start >> 32);
+   dma_range[4] = cpu_to_fdt32(phys_start & 0x);
} else {
-   dma_range[3] = phys_start & 0x;
+   dma_range[3] = cpu_to_fdt32(phys_start & 0x);
}
 
if (sizecell == 2) {
-   dma_range[3 + addrcell + 0] = size >> 32;
-   dma_range[3 + addrcell + 1] = size & 0x;
+   dma_range[3 + addrcell + 0] =
+   cpu_to_fdt32(size >> 32);
+   dma_range[3 + addrcell + 1] =
+   cpu_to_fdt32(size & 0x);
} else {
-   dma_range[3 + addrcell + 0] = size & 0x;
+   dma_range[3 + addrcell + 0] =
+   cpu_to_fdt32(size & 0x);
}
 
dma_range += (3 + addrcell + sizecell);
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot