From patchwork Mon Feb 28 09:33:50 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: 12762610 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 766DEC433F5 for ; Mon, 28 Feb 2022 09:35:18 +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: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:In-Reply-To:References: List-Owner; bh=Llm8bdJ0/3+M0b4AAof4q805ric+Y1oqGvYyYfIoLcg=; b=fhkeJ1M93c6+bf F+wSRv9KJfplySpNM202JCTXC/noh4mUfNRV/ktgedwI4XqnZUBukrz06MThmDgonLHrKi+Uk0Dn0 9Duv19E1YpCddl8C/BGg7E5GVtkkaXCgC3dsRyfIbvGglslQ7CHXkjSj2uXR3SKHkI9aNL3nCMJs+ 9oqMeEQJvakJNwdC73qgSd0eqD85w79tWhC4yyqaDnpPwAnQ6w13GZMxR012nFTitoh/bWapzeWsu A9JiDxBV5H+B8iakfVd/MoQcLojF8FS1ZEM4wOJvjcPtzuvlw9L5dHp5JmYpl/f2uJckqxIhHLThD bj+wFrOEQN1P2Uo2X+Sg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOcPy-00BGxz-RB; Mon, 28 Feb 2022 09:34:11 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOcPv-00BGwW-LY for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 09:34:09 +0000 Received: by mail-lf1-x12f.google.com with SMTP id m14so20274438lfu.4 for ; Mon, 28 Feb 2022 01:34:06 -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:mime-version :content-transfer-encoding; bh=fyLAwYBTvyuqO87oNdeuHQ7QKOeWMlrnczfuq8lDfy0=; b=MAlC1PXvtBS4kESMFqvatJNemhkHIuJ8yqRgVhJGf32Vign6qvkBQuS3Kt5YPi4CwD Y67GrQ7yIdxljqpHi8DzBVgQf0TFQP3Pt8BVKv9d2rCEhK5m7lCvz8GhZbDuNz174bqO lYwBwdEioZYMRF9Ob6o4oBZifqogVhCu2WwtonGxFvdGCyH01FdXhz3vU3O9Lk2x7Iqz XIakM6YZK3ibXdACUqOi6J2Ajlqv7n9WvtZRgmtRGAtaOKEL3Fj8vKLOqbaWAqlB1oRJ cQNb5cGsoYsqQVNF9lUeq7ZX8jb8EXXO462z31eC9ZcrYbGCPURE17/w4Ss2fvtW5oHk L4jg== 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=fyLAwYBTvyuqO87oNdeuHQ7QKOeWMlrnczfuq8lDfy0=; b=KEcwPjKbvZgIPJNojlQYR2RHcItYy+rLCOR1k7BAzJaNdXQGzxSSNWd7Q2j/3EENVM R4ZSfAyTQke2zpQPE7hHMhdl6dAtvLcfLDQ1HdY8cdlmznvDzn4p/2lyr/pfkk0lOGx+ yVPUInpxTwS64FD0KWeMJN8E/NuFU8OiZF/YtZaTYlOfXqklZ8ai4w9swjIOgV4EDc5e OkxBQP+JuOUgmsZcUJyJv2JkWWe0ZB5KKpTEUWaXpUFiiM1VXVeVoXztkWIndNmAlbMR eE0lmlqApJiuB+bNNzgfxQCYnCIgchqCGIiL/TDMO7uHvA8iIfK9x/2Wxso7l9cEvQ3c OBnQ== X-Gm-Message-State: AOAM530oKBaxexV8s9m4cWPkhL8hC5RTsLQvFMEuybu+vSjOrwDIM05M M3WYjpNsETmOhrds1LTXNFM= X-Google-Smtp-Source: ABdhPJxB4BVjo7DczKxRbvgCnl/C/wzdu7aovyg1ZYnL7+qqSH8ER4BnqbnPUYMofKizf2NvG1B4Sw== X-Received: by 2002:ac2:5dfb:0:b0:443:7baa:aee6 with SMTP id z27-20020ac25dfb000000b004437baaaee6mr12229114lfq.324.1646040844785; Mon, 28 Feb 2022 01:34:04 -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 k7-20020a0565123d8700b00443cec880e5sm876184lfv.4.2022.02.28.01.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 01:34:04 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Srinivas Kandagatla Cc: Rob Herring , Krzysztof Kozlowski , 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/2] nvmem: core: support passing DT node in cell info Date: Mon, 28 Feb 2022 10:33:50 +0100 Message-Id: <20220228093351.28162-1-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220228_013407_734398_5B1C2D57 X-CRM114-Status: GOOD ( 12.86 ) 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 Some hardware may have NVMEM cells described in Device Tree using individual nodes. Let drivers pass such nodes to the NVMEM subsystem so they can be later used by NVMEM consumers. Signed-off-by: Rafał Miłecki --- drivers/nvmem/core.c | 1 + include/linux/nvmem-consumer.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 6d5702e715d6..5fcf2793b599 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -467,6 +467,7 @@ static int nvmem_cell_info_to_nvmem_cell_entry_nodup(struct nvmem_device *nvmem, cell->bit_offset = info->bit_offset; cell->nbits = info->nbits; + cell->np = info->np; if (cell->nbits) cell->bytes = DIV_ROUND_UP(cell->nbits + cell->bit_offset, diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index c0c0cefc3b92..980f9c9ac0bc 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -25,6 +25,7 @@ struct nvmem_cell_info { unsigned int bytes; unsigned int bit_offset; unsigned int nbits; + struct device_node *np; }; /** From patchwork Mon Feb 28 09:33:51 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: 12762611 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 18E8BC433EF for ; Mon, 28 Feb 2022 09:35:26 +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=KnEWSc62NuCem7sZGj4310nqs+Cm1kh3YUiAjeOmBog=; b=hlodAzYNCtUT7i lCP09oHmo7etndlFPqMw1bd/wHGK5V9rvVhd57A3vapcVQnn56IsQ0gfykRJQe99bSgkMv0bfe1jq dwpJjm4dpt4DWvQZtd0T8jnrdkcbsg2XwGng/HkGfVwdf+SeOV8PUerEKUD7XFVkb+LgGp3D6sXlt TeR/l4UIrN7pH1Pof1SVwByt3/S4UYx0nKDFlc5APmK3mlzG8GZb3DU6yJzRiZJOjcq+VFUj268N8 iOxpymVRaplZZK+PnCiwl2wMzbEafMdrcxgMg5QdybXbS0XC9j2Top1dO2M8402e8x3qfqvw7wRJu lEf0KTQCPniZ6NdkZjIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOcQA-00BH1K-Cy; Mon, 28 Feb 2022 09:34:22 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOcPw-00BGwl-ME for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 09:34:12 +0000 Received: by mail-lf1-x12c.google.com with SMTP id m14so20274624lfu.4 for ; Mon, 28 Feb 2022 01:34:08 -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=vNW8B911OQBRBUW/DpOFF8iaYDouAHt80BzfGLFj4rk=; b=ifm8un2LzrGCL6C6xB27XvYINTfvoIQNf9qJWpyHsuwa0w8B+Oe0N2oxflFKS+yTG0 qafUp62HAXtgkMulaEsdBqcm38zCscXbiyu+B1+/4X2mbGTa60UVQ2RvmhAluJnsIwUh lngnfNQwh9FEBuFNVXGaVkhxGwFm7cvntg9sDJYSoZp+ng77lN8P2UClkD914TtRfBXk 2af65uJ3BiAUOwqsepNJvrS3jjLOho3BJ+uLn0b13DPFN21EmHweT4CxSlUQ8Ms18FwS xxEXk9I7xZjzd81uWcXDG452YQk0ouE5L4F8TgYtW7Z6a2AIEweNNmpPPnh8aiaXdDKr reKg== 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=vNW8B911OQBRBUW/DpOFF8iaYDouAHt80BzfGLFj4rk=; b=KhW1jqsoTT9EOqET4a4SH1HDvL2esQMOsT88mcIHl5yd2kkXU1Q7pqW+BNcj755COj TqBWfGH2U4nkg6FAulf6vjdVPEmqD3E5eQDNiV/OZI6+XJFDlZA6PBcaO9yIDy8ua5un RE8+A2G0wYE6QOw7pwNpFbATeM/c7GuVLde0TnSoODwcA4ZlEpPz8pXh7jL6zQ3CxwVZ AOIRlunbzCzK/V2NlFjOGGdQkD9C+08s+VrzMD4Bh/om0QWIYRCQMoLGKxc8SsOsor93 vrZWABvlRR8P9cR9kiB/SHWiHO3EFQ4lMflpnbwCWoIT5f9Zvo7t0UAoyNN4MqthCFJI iUaQ== X-Gm-Message-State: AOAM533ywMkdE9A0+UW4VrmF5Eec7feHKkVcdXPRetM68iNHHEoZh5do wEo80nufsL0/We723KKGf8U= X-Google-Smtp-Source: ABdhPJwq15AXczlwtQ3CyPeeEL2d3+ucD7NWWmlTWuUOcnhvnGMcdNyfI2le/5F18R1XrR8MDBKqxQ== X-Received: by 2002:a05:6512:783:b0:443:ae8d:6eda with SMTP id x3-20020a056512078300b00443ae8d6edamr12574542lfr.153.1646040846889; Mon, 28 Feb 2022 01:34:06 -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 k7-20020a0565123d8700b00443cec880e5sm876184lfv.4.2022.02.28.01.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 01:34:06 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Srinivas Kandagatla Cc: Rob Herring , Krzysztof Kozlowski , 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/2] nvmem: brcm_nvram: find Device Tree nodes for NVMEM cells Date: Mon, 28 Feb 2022 10:33:51 +0100 Message-Id: <20220228093351.28162-2-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220228093351.28162-1-zajec5@gmail.com> References: <20220228093351.28162-1-zajec5@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220228_013408_749506_46316247 X-CRM114-Status: GOOD ( 12.81 ) 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 DT binding for Broadcom's NVRAM supports specifying NVMEM cells as NVMEM device (provider) subnodes. Look for such subnodes when collecing NVMEM cells. This allows NVMEM consumers to use NVRAM variables. Signed-off-by: Rafał Miłecki --- drivers/nvmem/brcm_nvram.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvmem/brcm_nvram.c b/drivers/nvmem/brcm_nvram.c index 439f00b9eef6..450b927691c3 100644 --- a/drivers/nvmem/brcm_nvram.c +++ b/drivers/nvmem/brcm_nvram.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -72,6 +73,7 @@ static int brcm_nvram_add_cells(struct brcm_nvram *priv, uint8_t *data, return -ENOMEM; priv->cells[idx].offset = value - (char *)data; priv->cells[idx].bytes = strlen(value); + priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name); } return 0;