From patchwork Mon Jan 24 16:02:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 12722336 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4EC56C433F5 for ; Mon, 24 Jan 2022 16:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7R8XEzV4nZlImiVYTBrJR8NKL/t9EcHh/ISJ+2ThIMU=; b=lAu5Wjj8iZ6bJP ImfbBe0mkkN2lJwvTZSQsuZnODFMx522KnKrhnuRU1a2sgN6TTVZ+MkeLvXlNvNfl9pzhAJB2412B OxRjBD36TxI5+JWwe37fS/NIFPaZdfvMn+U01hjeRw4D7lUbs9oVpoNOBWk/+9ZqeqcNPTg5GDdL2 OQ5WeA3NmqpuQRkk1BMK1uATObCzQ+RclqZ2fwFlIS1N9b6fCWIl0w8CyJyog3Pnod7f6n3lJbX/l MGqdO69n9AQB/JKK5qVhcXcnJV1ThjbQUL0V/nWyIbr8yjYiugEiU4h5gXGqrvMlcEOXvJrHKiQKq 47CuTqF9hGYmi/zrqeZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC1qT-003uZX-Nm; Mon, 24 Jan 2022 16:05:30 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC1oM-003tn0-2v for linux-arm-kernel@lists.infradead.org; Mon, 24 Jan 2022 16:03:19 +0000 Received: by mail-lf1-x12b.google.com with SMTP id u6so19128776lfm.10 for ; Mon, 24 Jan 2022 08:03:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MVEI/04lRlpzFj8I8BWWmTX8RUNeV033mKjqJ7grZ2c=; b=ixdeo83yf4yjcQtce6LQghTMCa25tY67QjmF+wkz1jeDthrtlHOL3n4TKfmiZ7knvE m8w1+MuPumCMzVf+q81tGSkNKDPBJK3+BaSachNl7tYjv9Fjyo8XonkfytilmLIifDjt L9BFTLHoLCULUqGUUwfENWL/KIboJ3AjhHpZZ+8RLB3gb2e5xnKjtimm4/llK+bAW/lF elQ54dPPHNvqRTgqBBUYP+ZqTJ/uKjEZgitw1ZOrTKbyThL7caUvrn2wSWtVU163OuPW CQa+XSwWrcDY3ahqmNsZv20uxmTEsByBjtNbXjWMdH7cQMRNeKYwBPVJ2x35r6b02mW8 y6ag== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=MVEI/04lRlpzFj8I8BWWmTX8RUNeV033mKjqJ7grZ2c=; b=6rZAo0aVqrX+o2KUDjQP20DnMlrjs4PpOyvyE0aKEZButOnGg/D8T1tfj2GeE95fc3 Z8Ql461CyFzL4d1Tlh06L5+ASKz78hReth9y3aczIoM2o0+KfJOYuArNepj5z5CVhR+I zzReTWFjHVwc6dtN/Fw3NBIPkang2SUJwvcW7GE66aFzHqan76o/yB+BcFm7YUO7AJ6J GwQ5inSgIP7m4ZKX0qz1JG6xl5QBuUg4d7BmvpTHRcf/1a64jYFRztTcT25e673J5g6/ j4X4nN5lvBzulydHWp/fridVFkGj4zH7g0T7RoIOeDCfqMICSF+TiNsCg4JEnY+pLGP8 +4og== X-Gm-Message-State: AOAM531vughfr5vL8L0XPm+G/xX3isoQ/2I/ksBmpoWpfNjd5//xRDRp HZMxy5XMpcHn4i3L9bpJLTY= X-Google-Smtp-Source: ABdhPJzNfDuL+3ZKL/I7QuCGlh29SuKJzXglj8mwsrpOdEQPSmtdPzUFte8WylH0HHhB4j3XMayh/Q== X-Received: by 2002:a2e:a58b:: with SMTP id m11mr1671606ljp.383.1643040196104; Mon, 24 Jan 2022 08:03:16 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id n21sm674187lji.18.2022.01.24.08.03.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 08:03:15 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Srinivas Kandagatla , Rob Herring Cc: Florian Fainelli , Hauke Mehrtens , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 1/3] dt-bindings: nvmem: make "reg" property optional Date: Mon, 24 Jan 2022 17:02:58 +0100 Message-Id: <20220124160300.25131-2-zajec5@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220124160300.25131-1-zajec5@gmail.com> References: <20220124160300.25131-1-zajec5@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220124_080318_175971_B60BD52A X-CRM114-Status: GOOD ( 11.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Rafał Miłecki Most NVMEM providers have cells at hardcoded addresses however there are some exceptions. Some devices store cells layout in internal structs using custom formats. It's important to allow NVMEM consumers to still reference such NVMEM cells. Making "reg" optional allows defining NVMEM cells by their names only and using them with phandles. Signed-off-by: Rafał Miłecki Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/nvmem/nvmem.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Documentation/devicetree/bindings/nvmem/nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nvmem.yaml index 43ed7e32e5ac..3bb349c634cb 100644 --- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml +++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml @@ -60,9 +60,6 @@ patternProperties: description: Size in bit within the address range specified by reg. - required: - - reg - additionalProperties: true examples: From patchwork Mon Jan 24 16:02:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 12722337 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 817B4C433F5 for ; Mon, 24 Jan 2022 16:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LwXqMLncjJKXE5Xo2Uyedh3rzxyPzX3y4ZVaXx+BAdg=; b=rNdhuUhDeT4Jvd lbh+bYlXBHbWJxEdSY5HyhP3l8dLhRThliZb1arFwUK1uquU9IQSXNb3AnX1DE98K6pG8ZEQKvKr3 9o6sGqR9LI0MOzxOxcj0aMl3l5s/Jw1U77j/DYmk5/m8h1gg09MfgfzJgkWALfPjIfwL0BYPIZo5i wlBqbUnSMe6m6Mww4Lj/X+c8U6/e/7Dtwx5j3U5rS+KFtHQH8mHqM3DeAownSWAllzNg2CcfOifaG jXcbqn4DpkCpixrV8UIj6W6hwWu7RLPkTMmQXXPw3f6nIBxdr7+Rw0tyt54q4oe0EPcVwlbPqZXIR 6Hfrenk11ooY+jiqwMoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC1rJ-003uuw-9k; Mon, 24 Jan 2022 16:06:22 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC1oN-003tnS-Cz for linux-arm-kernel@lists.infradead.org; Mon, 24 Jan 2022 16:03:20 +0000 Received: by mail-lf1-x134.google.com with SMTP id b14so50899582lff.3 for ; Mon, 24 Jan 2022 08:03:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Mw/nT0vt0+cT+LkenUQbG2Z7gp/pXoAuAnG9olFE3MA=; b=pWO43tId6KoMhWrCNLMxVIO+NxW8YPGOOilVMNmJdZSwNeTQjtIGPEndNk5tWkxb8p KCQDhY2iq1MOFswrDvPLP09iYj7iWgkK9VRM4SIhF95oNunvro6QK5oxSOiYRI4cccCL JIUyTPVETcO7NftPRRD99KiTlQQqXMgb+WFM27vTpSQ435ZGVZSefRG5V0bURTmYmkUi /x9dk0YnzkLUQI0upBQNcQi1d6EEfVWvRNX36fdYcBM8L3qg8rM5TDodIuJ8iGx8uFM8 4zurLgccK8g1JWSgJI0CA8zJ7JhWO/nltB0Q8SiR/1HOmctQGXDh/NvifAh7CasIyR5Q eI4A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Mw/nT0vt0+cT+LkenUQbG2Z7gp/pXoAuAnG9olFE3MA=; b=tCdX/DTMPIC5XTFUo78HfKuGEiKkbJCH9JVIBaaS8tAmsgKOshEtcY2dSGOSKEI9VX 1+E+5JpgtF9sNEi2qo6bkw9ZIcBGemkVG9VNQ3Hy+0bjedJHEQQFHYeVG3IISngkRANL PVIiIbVbxzu//+Ay3DpagYLnx9/ezGOCQz8FEgSBtG5PKmJoF+Gkmuc6t0MrDETsrziz oj2MS5SFCyj0yGUc4NVgStwAAqPD/hrXvjnolDvnddObqs+zvu4XtDKJa8xtcbieVQUI pr57jdQ/CjJi1FZajx3gi3PAZtPrlnvgAG+mk8GSMyX+EMjMFILy+4L6env1KT7q41km 5TZg== X-Gm-Message-State: AOAM5323iktXCFmZox2j4R8mlPvkz0+YjRl7ypxILFNaZVIyZR5gf2rf 94Fo528d0YrHV+fCoko4C/0= X-Google-Smtp-Source: ABdhPJyjNJOSI6CBKKV6aC3EliDIlRqDSbiSoeVnzGZNFWML3IWOJXXdbxWG40DUby945j/ZAQ6vrA== X-Received: by 2002:a2e:a171:: with SMTP id u17mr5466485ljl.343.1643040197402; Mon, 24 Jan 2022 08:03:17 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id n21sm674187lji.18.2022.01.24.08.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 08:03:17 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Srinivas Kandagatla , Rob Herring Cc: Florian Fainelli , Hauke Mehrtens , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 2/3] dt-bindings: nvmem: brcm, nvram: add NVMEM cell to example Date: Mon, 24 Jan 2022 17:02:59 +0100 Message-Id: <20220124160300.25131-3-zajec5@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220124160300.25131-1-zajec5@gmail.com> References: <20220124160300.25131-1-zajec5@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220124_080319_496885_196BD71C X-CRM114-Status: GOOD ( 13.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Rafał Miłecki NVRAM doesn't have cells at hardcoded addresses. They are stored in internal struct (custom & dynamic format) . It's still important to define relevant cells in DT so NVMEM consumers can reference them. One of cells set in almost every device is "et0macaddr" containing MAC address. Add it to example to show how it can be referenced. Signed-off-by: Rafał Miłecki --- Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml index 8c3f0cd22821..ab14e3ae45c8 100644 --- a/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml +++ b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml @@ -32,6 +32,9 @@ unevaluatedProperties: false examples: - | nvram@1eff0000 { - compatible = "brcm,nvram"; - reg = <0x1eff0000 0x10000>; + compatible = "brcm,nvram"; + reg = <0x1eff0000 0x10000>; + + mac: et0macaddr { + }; }; From patchwork Mon Jan 24 16:03:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 12722350 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DCE98C433EF for ; Mon, 24 Jan 2022 16:08:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BgelLGpGQoyTA55/839erlUZgpd6M02HoHZURkwoyyY=; b=cnkdi+e3+3v0CH 3yRCZIbIdvmc5EcjrdIAEL+HLrw5ROvies2ruyUkhV3/ojj2XhA3GX5f7LxPnrCZBWgcyN1/lMVnk yEIKxDN7laWU24jfR/KVAloB+hbH4DuBGBAXgx92K7iQrpRWZFzX8ZdaIlpcK7XJDUVSJOx9pDkXH m4YedT+HjbYIJeX9rPE+KztBt0OawTJ9vdCO3WU0+4xyttRw36SUUFuYCP9Zrl3fnUe8s/kx2E74K 4dvjFyg55CVnlHcjDHvDYwO2CQD5hF3mPlYDkrCYdAyLEqWEjD24rzlOeMuNk3ALo46jz6/pAPfbp Jgxdjza/COpJmqm+QMUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC1s9-003vEl-5w; Mon, 24 Jan 2022 16:07:13 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC1oP-003tp8-1T for linux-arm-kernel@lists.infradead.org; Mon, 24 Jan 2022 16:03:22 +0000 Received: by mail-lf1-x134.google.com with SMTP id x23so3863392lfc.0 for ; Mon, 24 Jan 2022 08:03:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vfS/F/Wf9bu+NmDqBxpkt9bmTl6S69QHI1qpficbqZk=; b=BPJQ7SJ1V0lmwC4C01DIbifBg7ehy+WB5aIuFTp6EjdCDMMOsA6mfQfRV+4UTcrNdP Tdhc3iHt54ivoyVnXU1mWG1lf0abJKqqCwnPElabBBzQHWByy7GqLaXpvkooORBA0tJt xYnkY6QuTkwqjY1Bq0J75UrtLrn4urM2LojwoL00czhU7e+nAvLQmzUmfyTajF7xW+Jo LHFCXOsg5Ey6JaFG3qSVGmym+Uw2qL3l2Zfy+x7yQN3k4k6G0RocYgNZpUiGv71dfVh5 E4ok0tjNlDPOlkhARkh29k7oFo+teAVcWsyeFpgRqTItoVxCUcVbdab0wfAsWctUpEts LXEg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=vfS/F/Wf9bu+NmDqBxpkt9bmTl6S69QHI1qpficbqZk=; b=T02FqpvOVCXaXR6hNIYVu3wzivB5M35/bVS2v61dplNyKZMMJcO1+1B+p0FOzzgYTZ C8UT3z/5VNnf3SpClFxQBm9drEeB71rgsZ0CjcHtjy6V1tK/BkZWuTPqG5WtBoJZ+PLT RGBnnLNiR7TMjCrvHiAjZXbuidVGSK4UzOoyxXUF1unfPxh4vPCgtgEq80kBRMzfo7bh khFwfw5jdhxfqxSB59Cs3GsaIusK6Cjp6oG8s1g9/W1Hg7TL5KiXv8dk4SPThTAsKdVg LgQUXBrTJjQUFOjVtrlGjF6m0xcTKBopjQ7XOniR3Ol/ly61ChYP2uosRMJ5ENhVi8zf 4G6A== X-Gm-Message-State: AOAM530udLRNn3yMfXz/uWNMKcgt1mrBCbVV9cZ3WM6gPhgbQxImY3F8 ZAmb0+QgqkPFGXzUSvfD1OU= X-Google-Smtp-Source: ABdhPJxAfwvpekuz53Sh6fCrPpxNEfqZtyyPgqs42/pS7SEszF6KXyJ0UzyTB8S3DJyXgws5ehsBog== X-Received: by 2002:a05:6512:b84:: with SMTP id b4mr4711978lfv.652.1643040199237; Mon, 24 Jan 2022 08:03:19 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id n21sm674187lji.18.2022.01.24.08.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 08:03:18 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Srinivas Kandagatla , Rob Herring Cc: Florian Fainelli , Hauke Mehrtens , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 3/3] nvmem: core: add cell name based matching of DT cell nodes Date: Mon, 24 Jan 2022 17:03:00 +0100 Message-Id: <20220124160300.25131-4-zajec5@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220124160300.25131-1-zajec5@gmail.com> References: <20220124160300.25131-1-zajec5@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220124_080321_153680_70ED3281 X-CRM114-Status: GOOD ( 14.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Rafał Miłecki When adding NVMEM cells defined by driver it's important to match them with DT nodes that specify matching names. That way other bindings & drivers can reference such "dynamic" NVMEM cells. Signed-off-by: Rafał Miłecki --- drivers/nvmem/core.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 23a38dcf0fc4..9a1299a7f46a 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -499,6 +499,31 @@ static int nvmem_cell_info_to_nvmem_cell_entry(struct nvmem_device *nvmem, return 0; } +/** + * nvmem_find_cell_of_node() - Find DT node matching nvmem cell + * + * @nvmem: nvmem provider + * @name: nvmem cell name + * + * Runtime created nvmem cells (those not coming from DT) may still need to be + * referenced in DT. This function allows finding DT node referencing nvmem cell + * by its name. Such a DT node can be then used by nvmem consumers. + * + * Return: NULL or pointer to DT node + */ +static struct device_node *nvmem_find_cell_of_node(struct nvmem_device *nvmem, + const char *name) +{ + struct device_node *child; + + for_each_child_of_node(nvmem->dev.of_node, child) { + if (!strcmp(child->name, name)) + return child; + } + + return NULL; +} + /** * nvmem_add_cells() - Add cell information to an nvmem device * @@ -532,6 +557,8 @@ static int nvmem_add_cells(struct nvmem_device *nvmem, goto err; } + cells[i]->np = nvmem_find_cell_of_node(nvmem, cells[i]->name); + nvmem_cell_entry_add(cells[i]); }