From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78D8FC433EF for ; Sun, 12 Sep 2021 03:16:54 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id EFB1D611F0 for ; Sun, 12 Sep 2021 03:16:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EFB1D611F0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ED5F3838FF; Sun, 12 Sep 2021 05:16:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="N9ABUgTe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9C99A838E6; Sun, 12 Sep 2021 05:15:46 +0200 (CEST) Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) (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 A08F8838E4 for ; Sun, 12 Sep 2021 05:15:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pj1-x102b.google.com with SMTP id m21-20020a17090a859500b00197688449c4so4140040pjn.0 for ; Sat, 11 Sep 2021 20:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=4L3bsZII0hnbM/VH1B/MsJcuCO0tok1TQs880PhQQAU=; b=N9ABUgTeOl37Ud/ZT7swuT2IpdwJQcx0w1hem3vknQp1TKcO+KuOgEF8e+T4UYqErq nNrSK6TrmOLDDHQaC8uZxLySgub9CZZAgWOy1lYQZfRtsp2MQnnGXZOCqbuddl3RfZ1Q 7VqrInjmuEeyfpAuUyWb7Gg2UO2ao/GVBfOZpVyZxB7oVc7sx+om2S+MzgtqFUTzImZt 9ujhp4WsS29STvjIjVaMaSRH1VDYI38/EnjXhvPXXw1TCLQ/YLGcLfzTVvR577yaL4uF 5VRHjyd+Mnj9ig9ySqTPO1G3QZ1HEC9lzBZbpD0JyIxTcCsV5T7u/XLw3OO0D/PIq7tN x9tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4L3bsZII0hnbM/VH1B/MsJcuCO0tok1TQs880PhQQAU=; b=vg4YKMgoJD4zfQJD2ekAVzHyz5BM3WJSLUN2UD454kT2o9s0sLpHqlJWWES/m4FK8M 4IFiEGpm2OyKmafWt00ucPmUvtlXT32tvIFcKHt/ZdHgZQ2Mazx/68FWF1P1pJS0f6Yl hhtXl4drml1WKAP3rI6tL8p2s/YOqjDwl3DOomfg2cKCvV+zxN/Sb1GipTK3/LU6IbW8 8LedMg/UkM6cQAkSuaMf7eZlVPTdICguYXQ741sY6gPhHqpRosESGXJhixN+TY/yTIfi TDetsmVmro389XVwmURBMRuiNmRwSbFytHd6iaEcDa5x4pv/TZ8KO3PlqSa7QIAPHboj mCFg== X-Gm-Message-State: AOAM530XxKUGj6W00OtEylLWJVydRs0GGteM8lTSHWzXpzNDBgTct8Im sxicKtz3DYt/k7MTznUlDmPE+Wzx2ls= X-Google-Smtp-Source: ABdhPJxj2PHiRvVJbdlyGXyjN4Op9CcKpZgGsE5XzIcy0O/Jey5waGyfXrIresbXoO4a2TfFM5nmWA== X-Received: by 2002:a17:902:9a91:b0:138:efd5:7302 with SMTP id w17-20020a1709029a9100b00138efd57302mr4643041plp.35.1631416536055; Sat, 11 Sep 2021 20:15:36 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id z9sm2924300pfa.2.2021.09.11.20.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Sep 2021 20:15:35 -0700 (PDT) From: Bin Meng To: Simon Glass , Rick Chen , Leo Yu-Chi Liang , u-boot@lists.denx.de Subject: [PATCH 6/9] dm: Provide dev_read_addr_index_ptr() wrapper Date: Sun, 12 Sep 2021 11:15:13 +0800 Message-Id: <20210912031516.24885-6-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210912031516.24885-1-bmeng.cn@gmail.com> References: <20210912031516.24885-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.103.2 at phobos.denx.de X-Virus-Status: Clean Like dev_read_addr_ptr(), provide a wrapper for the indexed version. Signed-off-by: Bin Meng --- include/dm/read.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/dm/read.h b/include/dm/read.h index 5bf3405614..890bf3d847 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -180,6 +180,18 @@ int dev_read_size(const struct udevice *dev, const char *propname); */ fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index); +/** + * dev_read_addr_index_ptr() - Get the indexed reg property of a device + * as a pointer + * + * @dev: Device to read from + * @index: the 'reg' property can hold a list of pairs + * and @index is used to select which one is required + * + * @return pointer or NULL if not found + */ +void *dev_read_addr_index_ptr(const struct udevice *dev, int index); + /** * dev_read_addr_size_index() - Get the indexed reg property of a device * @@ -805,6 +817,12 @@ static inline fdt_addr_t dev_read_addr_index(const struct udevice *dev, return devfdt_get_addr_index(dev, index); } +static inline void *dev_read_addr_index_ptr(const struct udevice *dev, + int index) +{ + return devfdt_get_addr_index_ptr(dev, index); +} + static inline fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index, fdt_size_t *size) -- 2.25.1