]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: xilinx: fix the wrong dma base address issue
authorGreentime Hu <greentime.hu@sifive.com>
Thu, 20 Jan 2022 08:41:28 +0000 (16:41 +0800)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 1 Feb 2022 16:11:33 +0000 (17:11 +0100)
If we just use fdtdec_get_addr_size_fixed to get "reg" it will use
64bit address cell to get the base address.

soc {
   #address-cells = <1>;
   #size-cells = <1>;
   compatible ="SiFive,FU500-soc", "fu500-soc", "sifive-soc", "simple-bus";
   ranges;
   L28: axidma@30010000 {
           #dma-cells = <1>;
           compatible = "xlnx,axi-dma-1.00.a";
           axistream-connected = <&L27>;
           axistream-control-connected = <&L27>;
           clocks = <&L1>;
           interrupt-parent = <&L6>;
           interrupts = <32 33>;
           reg = <0x30010000 0x4000>;

fdtdec_get_addr_size_fixed: reg: addr=3001000000004000

We should get the base address through its parent's address-cells and
size-cells settings. So we should use fdtdec_get_addr_size_auto_parent()
to get correct base address.

After applying this patch, we can get the correct base address of dma by
replacing fdtdec_get_addr_size_fixed() with
fdtdec_get_addr_size_auto_parent().

fdtdec_get_addr_size_auto_parent:
     na=1, ns=1, fdtdec_get_addr_size_fixed: reg: addr=30010000

Signed-off-by: Greentime Hu <greentime.hu@sifive.com>
Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Link: https://lore.kernel.org/r/20220120084128.1892101-1-andy.chiu@sifive.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/net/xilinx_axi_emac.c

index 2ec76d0f52d52af63350f9bc2373c1b6bc1433d3..f21addb4d08898154c49bbbf3d40f57e74b5bb35 100644 (file)
@@ -832,8 +832,8 @@ static int axi_emac_of_to_plat(struct udevice *dev)
                printf("%s: axistream is not found\n", __func__);
                return -EINVAL;
        }
-       plat->dmatx = (struct axidma_reg *)fdtdec_get_addr(gd->fdt_blob,
-                                                         offset, "reg");
+       plat->dmatx = (struct axidma_reg *)fdtdec_get_addr_size_auto_parent
+                     (gd->fdt_blob, 0, offset, "reg", 0, NULL, false);
        if (!plat->dmatx) {
                printf("%s: axi_dma register space not found\n", __func__);
                return -EINVAL;