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: 534644 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C949C433FE for ; Mon, 24 Jan 2022 16:03:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240966AbiAXQDS (ORCPT ); Mon, 24 Jan 2022 11:03:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240900AbiAXQDS (ORCPT ); Mon, 24 Jan 2022 11:03:18 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD31DC06173B; Mon, 24 Jan 2022 08:03:17 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id b14so50899297lff.3; 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=lEeJWudxTu6N4phjfDjd8W5fhwuLbTayTxHYNsIkNWCsgE7f9BmMsMVaINM/tMwUzJ tIqRTNDLd3eve/sblm/LDCP3L9OpmIE4ay+xJC4uzwlS3kPopkBTiurtLWmv7XOEd6+D UuE1ZwdbhqTGpuKH4DKvSMkaIsF78h9YgGeF04eLGxsKIHuGe5LO+eDNTjcUf8X2pj3Z erv/xuEr1tzOIx+h2z95ZzDdB00YKjmqOHQIUc5M+XeOu0siYNj3CzKzwAZctTDWp8kC hzuORFz07gW/uf40Mr5KcGFRlBqWnIYG+ve72LfQ/3j2Ni+CrQsxySJO076jNiMh/eJe W3iQ== X-Gm-Message-State: AOAM531FOwXaCjR44QUoGIuiIChqVyze9ywNPYRME/TogM22A1oLZvi9 FbtYILG31FfstM0FeymlSQ8= 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 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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 --- 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 Fri Feb 18 07:07:28 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: 543898 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0C18C433F5 for ; Fri, 18 Feb 2022 07:07:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231797AbiBRHIJ (ORCPT ); Fri, 18 Feb 2022 02:08:09 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231778AbiBRHII (ORCPT ); Fri, 18 Feb 2022 02:08:08 -0500 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCED31BB715; Thu, 17 Feb 2022 23:07:50 -0800 (PST) Received: by mail-lj1-x232.google.com with SMTP id c15so2915556ljf.11; Thu, 17 Feb 2022 23:07:50 -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=IWDJ487yLqJMH2R9nX25geZJE4tvSDIiR8xa0l3wTz0=; b=IlUrs1RVK2LtAIx0K8FKunjdCr8qaBX4BhLfEYD1cCBATkF5gNTEO5aV7XLepcZngT 5xvmeytA/gzHC7V3X2nPXsV4pFX77uEGlVZbJSOnIN9ERh24nUyI6U1w20I77lwNLk3T YlewxLcYhoMWB0zHtnKLq1JaTd893WrE9ZFOjCRjeJBpPeRNDtgkZ3o+nKqQbX8NYVGG UQ040lm1calR6iOJOW+PHnP+cISn94xgQVBK27t6rACckUPZFd9mAokgv79qLo8YqwSL jcHfZcNH6DafyXoUSt3kpr5PBDWbz0aMI3lFx3XP2x11SkHkyg0IPgd7GUGj+y7hriwX PhaQ== 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=IWDJ487yLqJMH2R9nX25geZJE4tvSDIiR8xa0l3wTz0=; b=uZfL+hVb3bJTBYuZiaHoGKB+QrEuQB63Wy7W5Z+/TZSpO0DYlQD++9ZodROFOxh50C 7rCl9X1xYWTaLjWmkiu1d/1QHgfG/2ZtYNCzG3T6Xo5vniW8fT8JdzeQhxy3l0xLnJkG Ii+YD4mfPmgzhTMm2M5x2T3DejeXOQ3Dlhn//azt7NqNTTKWbhSfT1u6yyWLPp6lG0DM hG0gLdZgr2PHaAysIIqvZuG5TZimtH0/fkzT754hG33M4R/+UtlIpr9/ByTudSv9Pzug sohTvrMH2b1S9ELfCBPPNS6jQP+ELa+JtUSLl5jSs/WVD9G2BXL/yDfDdFhuT10dGIm5 QnBw== X-Gm-Message-State: AOAM530D5YKpqjCE/gaAMpCuySTALXKIaDb/rVapDGUom6SLnyXeibku LciZ8UWeYUPqLn5F48wuPjI= X-Google-Smtp-Source: ABdhPJyG4PhqQCB3tkP0I48RQhI08avuz/CEw5sI25p72beCNJ/SSg79592K5goUTi3gS47psMDsHA== X-Received: by 2002:a2e:9043:0:b0:246:1afb:1436 with SMTP id n3-20020a2e9043000000b002461afb1436mr3638607ljg.215.1645168069084; Thu, 17 Feb 2022 23:07:49 -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 f2sm216321ljn.11.2022.02.17.23.07.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 23:07:48 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Srinivas Kandagatla , Rob Herring Cc: 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 V3 2/3] dt-bindings: nvmem: brcm,nvram: add basic NVMEM cells Date: Fri, 18 Feb 2022 08:07:28 +0100 Message-Id: <20220218070729.3256-3-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220218070729.3256-1-zajec5@gmail.com> References: <20220124160300.25131-1-zajec5@gmail.com> <20220218070729.3256-1-zajec5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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. Update binding to allow including basic cells as NVMEM device subnodes. Signed-off-by: Rafał Miłecki --- V2: Add children nodes description per Rob's request V3: Document NVMEM cells as properties --- .../devicetree/bindings/nvmem/brcm,nvram.yaml | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml index 8c3f0cd22821..25033de3ef6b 100644 --- a/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml +++ b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml @@ -14,6 +14,8 @@ description: | NVRAM can be accessed on Broadcom BCM47xx MIPS and Northstar ARM Cortex-A9 devices usiong I/O mapped memory. + NVRAM variables can be defined as NVMEM device subnodes. + maintainers: - Rafał Miłecki @@ -27,11 +29,30 @@ properties: reg: maxItems: 1 + board_id: + type: object + description: Board identification name + + et0macaddr: + type: object + description: First Ethernet interface's MAC address + + et1macaddr: + type: object + description: Second Ethernet interface's MAC address + + et2macaddr: + type: object + description: Third Ethernet interface's MAC address + 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: 534643 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 970C2C433F5 for ; Mon, 24 Jan 2022 16:03:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243298AbiAXQDW (ORCPT ); Mon, 24 Jan 2022 11:03:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240993AbiAXQDV (ORCPT ); Mon, 24 Jan 2022 11:03:21 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02A55C06173B; Mon, 24 Jan 2022 08:03:21 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id x11so50884812lfa.2; 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=f8gYXlwAuzLYA8wMmhHan2LIT1f2q9ziy2DUCvWfQdOMmnZ8NsFr0rxW6HQcXjD9PC y9tIMP67i1btKsXwFSTedGF6fbGm+Bn5PSKTlwlfxMlyxmKTTnH/MuyNCkGkX5z3salK gfQTh/T4AU2eh2rJ2omafZtY5jaApvKePRhT+wKQibKTwI39zueA2LDRZkGEo5Gl5KV8 ptcRj6I5FnAbrb5vds9whxbXuHjMt7i5KoNeOC9a1x/ewhl36MdJ07BH/locVBHo1cyJ JSl1hWIXPgmbcIecu8YnTqTmvtyDT2E4uHrkBDUUfxnfuYa/+maO647pNtPL8zvjzQ09 xsCQ== X-Gm-Message-State: AOAM532M24WxxUoTqpu8DNIQ7zxUT3pRC8G8fvK6vUVndRcrISmGxXfJ uIq/1T/39pif7ExKk4K9Aks= 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 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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]); }