Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C413CC433F5 for ; Thu, 20 Jan 2022 23:16:57 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C4D0C8390E; Fri, 21 Jan 2022 00:16:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.b="AU4cT7Al"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 37AC18383B; Thu, 20 Jan 2022 09:42:20 +0100 (CET) Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4017383325 for ; Thu, 20 Jan 2022 09:42:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andy.chiu@sifive.com Received: by mail-pg1-x531.google.com with SMTP id t32so4994987pgm.7 for ; Thu, 20 Jan 2022 00:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nCrplZESY6aNy3x0DQxS1PHCj2PskbPvTewA/tC6Grw=; b=AU4cT7AlD25Qn/8YyoIIBBbgmtwPyr75bE0sv0tE1JnMz0hrfO2PB3aiYbYYwp4Q9J TO5nUZRMjpN1RC5cyaqCLYcfwHizg3YMJ3qWuLfrJ511thW3JJ0wTAbEJABYYavng8wU cgX3AwDrvKbdV/IVVBqzBjGODPeo6/OPvSRvIilYIR+InS3dqQDp378QacAJL1fkaiKz 4R57Ny4oGdAEX17cZBIrdjvl6U2NIHM8Ol8PtGL137ITQu7J6N2+oqEuVdw/pVqpWl+j 6xKKuEh4fCuuEeZXmfxnCUaXRISBM+2MM0thvSGLM3vBDnaeqS8yItldk+jwrvygQpWV kEBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nCrplZESY6aNy3x0DQxS1PHCj2PskbPvTewA/tC6Grw=; b=BLXFq3IvRXH89WUSl7IMLtkkdCzo7+OyjmpXPoZme9NjTrYTVH3UK9FGNB+ZKMEh8R MQvukdJCUDZ8I/RbRaKXqjzrn9zfewaNhDioZ/sZHLcR0x8LmlS49/hMboT3jNLMsGaV TemdOWx0k+P6RLw/LpF7p749+TV+i5JODs2/A6uYHwbKfdIPVqHIyZHOE7jfmBxhcotd FCZFNCXweXf3EaELXZ+Drgns0sXiI2LBSL32v5HKR6GN2oYFOvM0MMWrZzPlumQU6DLA 79DeI62FThyECpB+MaiEOci2kM7RcTZsJb6+VSWJZ6fnjvBUaRnRpkGLb+oBr33o1mGU o19A== X-Gm-Message-State: AOAM531QQj/agX6oj7FDTyaouvVerU+Nc3AK65vVZxxgFgFhcpkxiLqU 8u3uxAFY9favz1+0WpBtBO84Dg== X-Google-Smtp-Source: ABdhPJymKhJj8hRKJvm3pazQVpvRFLGW6Fxh68q/DwGAIBv9Ds8oiLy9BPG3vcGTZ2okabmC+e4HCg== X-Received: by 2002:a62:3142:0:b0:4c3:a26a:331b with SMTP id x63-20020a623142000000b004c3a26a331bmr22162947pfx.21.1642668135451; Thu, 20 Jan 2022 00:42:15 -0800 (PST) Received: from archlinux.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id n22sm2164693pfu.193.2022.01.20.00.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 00:42:15 -0800 (PST) From: Andy Chiu To: monstr@monstr.eu Cc: Greentime Hu , Andy Chiu , Joe Hershberger , Ramon Fried , u-boot@lists.denx.de Subject: [PATCH] net: xilinx: fix the wrong dma base address issue Date: Thu, 20 Jan 2022 16:41:28 +0800 Message-Id: <20220120084128.1892101-1-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Fri, 21 Jan 2022 00:16:27 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean From: Greentime Hu 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 Signed-off-by: Andy Chiu --- drivers/net/xilinx_axi_emac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c index 2ec76d0f52..f21addb4d0 100644 --- a/drivers/net/xilinx_axi_emac.c +++ b/drivers/net/xilinx_axi_emac.c @@ -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; -- 2.34.1