From patchwork Mon Nov 5 05:47:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keerthy X-Patchwork-Id: 992867 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42pMDB4Jq5z9rxp for ; Mon, 5 Nov 2018 16:48:24 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 4B6F3C221BA; Mon, 5 Nov 2018 05:48:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id DB06EC221A5; Mon, 5 Nov 2018 05:48:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3FF6CC221B1; Mon, 5 Nov 2018 05:48:11 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id C4DC7C2219B for ; Mon, 5 Nov 2018 05:48:09 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id wA55m5dT010864; Sun, 4 Nov 2018 23:48:05 -0600 Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wA55m5Sc067326 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 4 Nov 2018 23:48:05 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Sun, 4 Nov 2018 23:48:05 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Sun, 4 Nov 2018 23:48:05 -0600 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id wA55m3M9019901; Sun, 4 Nov 2018 23:48:03 -0600 From: Keerthy To: , Date: Mon, 5 Nov 2018 11:17:45 +0530 Message-ID: <1541396866-4425-1-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: u-boot@lists.denx.de, t-kristo@ti.com Subject: [U-Boot] [PATCH 1/2] core: ofnode: Fix ofnode_get_addr_size_index function X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Currently the else part of ofnode_get_addr_size_index function does not fetch addresses based on the index but rather just returns the base address. Fix that. Signed-off-by: Keerthy Reviewed-by: Simon Glass Reviewed-by: Simon Glass --- drivers/core/ofnode.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index b7b7ad3..c80e1cb 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -253,12 +253,12 @@ int ofnode_read_size(ofnode node, const char *propname) fdt_addr_t ofnode_get_addr_index(ofnode node, int index) { + int na, ns; + u64 size; + if (ofnode_is_np(node)) { const __be32 *prop_val; uint flags; - u64 size; - int na; - int ns; prop_val = of_get_address(ofnode_to_np(node), index, &size, &flags); @@ -274,8 +274,11 @@ fdt_addr_t ofnode_get_addr_index(ofnode node, int index) return of_read_number(prop_val, na); } } else { - return fdt_get_base_address(gd->fdt_blob, - ofnode_to_offset(node)); + na = ofnode_read_simple_addr_cells(ofnode_get_parent(node)); + ns = ofnode_read_simple_size_cells(ofnode_get_parent(node)); + return fdtdec_get_addr_size_fixed(gd->fdt_blob, + ofnode_to_offset(node), "reg", + index, na, ns, &size, true); } return FDT_ADDR_T_NONE;