From patchwork Fri Apr 2 06:28:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenguanqiao X-Patchwork-Id: 1461700 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=kuaishou.com header.i=@kuaishou.com header.a=rsa-sha256 header.s=dkim header.b=UWBhh/wQ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FBhPR0g19z9sSC for ; Sat, 3 Apr 2021 00:54:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0F08B81664; Fri, 2 Apr 2021 15:53:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kuaishou.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=kuaishou.com header.i=@kuaishou.com header.b="UWBhh/wQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5BEC080C76; Fri, 2 Apr 2021 08:30:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from bjfk-gateway01.kuaishou.com (smtpcn02.kuaishou.com [103.107.216.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BFCF480C71 for ; Fri, 2 Apr 2021 08:30:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kuaishou.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=chenguanqiao@kuaishou.com Received: from bjm7-pm-mail22.kuaishou.com ([172.28.1.42]) by bjfk-gateway01.kuaishou.com with ESMTPS id 1326SWBi023055 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Apr 2021 14:28:33 +0800 (GMT-8) (envelope-from chenguanqiao@kuaishou.com) DKIM-Signature: v=1; a=rsa-sha256; d=kuaishou.com; s=dkim; c=relaxed/relaxed; t=1617344912; h=from:subject:to:date:message-id; bh=mncwS4eW7lM60GXMaZSmqenDgQv/zGDObHJKCG3FKFE=; b=UWBhh/wQz6NasIy43rs0N78ZJK2CyN3Ptkr4QTGkQcwP0jAOGJDvZwHVy/SrHDmNIgVmn8TjMJK jXriohHwqS7zojks5cg4QLnCgsuZsBBqW4XRxTTd40fbFGE1p2rJxFCIIX9NUTfDwT8AEFDPYE2DY eCxJJs5VmufQBO6P+Lo= Received: from localhost.localdomain (172.28.1.32) by bjm7-pm-mail22.kuaishou.com (172.28.1.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 2 Apr 2021 14:28:32 +0800 From: chenguanqiao To: , CC: Chen Guanqiao Subject: [PATCH v2 1/2] dm: core: Add size operations on device tree references Date: Fri, 2 Apr 2021 14:28:20 +0800 Message-ID: <20210402062821.38162-2-chenguanqiao@kuaishou.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210402062821.38162-1-chenguanqiao@kuaishou.com> References: <20210402062821.38162-1-chenguanqiao@kuaishou.com> MIME-Version: 1.0 X-Originating-IP: [172.28.1.32] X-ClientProxiedBy: bjm7-pm-mail19.kuaishou.com (172.28.1.23) To bjm7-pm-mail22.kuaishou.com (172.28.1.42) X-DNSRBL: X-MAIL: bjfk-gateway01.kuaishou.com 1326SWBi023055 X-Mailman-Approved-At: Fri, 02 Apr 2021 15:53:35 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean Add functions to add size of addresses in the device tree using ofnode references. Signed-off-by: Chen Guanqiao Reviewed-by: Simon Glass --- drivers/core/ofnode.c | 9 +++++++++ include/dm/ofnode.h | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index fa0bd2a9c4..952c3cf9dd 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -347,6 +347,15 @@ fdt_addr_t ofnode_get_addr(ofnode node) return ofnode_get_addr_index(node, 0); } +fdt_size_t ofnode_get_size(ofnode node) +{ + fdt_size_t size; + + ofnode_get_addr_size_index(node, 0, &size); + + return size; +} + int ofnode_stringlist_search(ofnode node, const char *property, const char *string) { diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 2c0597c407..e91f81282b 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -510,6 +510,16 @@ phys_addr_t ofnode_get_addr_index(ofnode node, int index); */ phys_addr_t ofnode_get_addr(ofnode node); +/** + * ofnode_get_size() - get size from a node + * + * This reads the register size from a node + * + * @node: node to read from + * @return size of the address + */ +fdt_size_t ofnode_get_size(ofnode node); + /** * ofnode_stringlist_search() - find a string in a string list and return index *