From patchwork Fri Nov 18 21:40:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 13048811 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 1AC25C4332F for ; Fri, 18 Nov 2022 21:41:52 +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=n5nFk2KjvJzchqjh+hAFGe4Syfkfoux5auqYYb5Uh2g=; b=X3JwxMILYZ786+ Yk2mThj44K+w/88H1lNLfiAfg5xMA2C7Um39qSv6atu9RLIDVMqDzY5iYHp136fj5zWRYrYQOiHDL 4L++yetYA1oqTsfE9nQ7JG7F14sp4ZexhEmE1ItPAQd41V7YQKtMRZWM8sWiQ5/kpjTgqx+thTeWA QRMWclRGYig9atV5u+7YE3ifOv1Blb311v0ggylyQTQ/06l8HzDwYNU1Lzhzlg8TmB03BvUXZYOSr HZ4OkZXkfhTLOhHSYGoq17UMCrRFDayrBS11dD4debXoLACdnpYOclrgR9sjwFFTHlKax0GEmGJDr 4PoVNmKSNSV1I/UpA1/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow96Z-008GxW-Ul; Fri, 18 Nov 2022 21:41:00 +0000 Received: from 0001.3ffe.de ([2a01:4f8:c0c:9d57::1] helo=mail.3ffe.de) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow96V-008GrW-Ah for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2022 21:40:57 +0000 Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id 7DB7D1CF7; Fri, 18 Nov 2022 22:40:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1668807651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PCD/6dmFnGBLqWK1cint2zY12NZJUc/wLW+bw2dtkU8=; b=vUKLS4bqpaikYXvkQtVYN3r7XeWvcQJkx7QF1r/3prG0WQ2dzbJJx3wreaTe2wVNgT1BQC 3oH7C6JxPRJKTDHo4yWCGQvtFJr5Fu5iPBAFUkQaPcxzsB3TTNshCHkAjoBZ3ubMO07wZE c+t3045n0vUKTTxoUVO6CBSJQUapB81ujl/LjWAucAJaPd7PN11pJQco4HYxw3Rik7eX+9 xNdn0NKfB3HuvtCDgwONTzGhjkpYPoCtoH0Wl496fz1x8FBJ7SAcvforeLYa+2+H3QxDms OFsOaA1sVr3YTZbve7sq5kyKZq5wqh3aarK3M+VXZVhmg8nE12rtmAX1ZMGxtA== From: Michael Walle To: Srinivas Kandagatla , Miquel Raynal , Rob Herring , Frank Rowand Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Michael Walle Subject: [PATCH] of: property: special #nvmem-cell-cells handling Date: Fri, 18 Nov 2022 22:40:36 +0100 Message-Id: <20221118214036.1269005-1-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <8b976cf546bad3aa159a6f05cd3c15d1@walle.cc> References: <8b976cf546bad3aa159a6f05cd3c15d1@walle.cc> MIME-Version: 1.0 X-Spam: Yes X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221118_134055_584578_B5B99A38 X-CRM114-Status: GOOD ( 13.14 ) 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 Since recently, there is a new #nvmem-cell-cells. To be backwards compatible this is optional. Therefore, we need special handling and cannot use DEFINE_SIMPLE_PROP() anymore. Signed-off-by: Michael Walle Tested-by: Miquel Raynal --- This patch will be part of the following series: https://lore.kernel.org/linux-arm-kernel/20221118185118.1190044-1-michael@walle.cc/ drivers/of/property.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index 967f79b59016..93c0ea662336 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1305,7 +1305,6 @@ DEFINE_SIMPLE_PROP(dmas, "dmas", "#dma-cells") DEFINE_SIMPLE_PROP(power_domains, "power-domains", "#power-domain-cells") DEFINE_SIMPLE_PROP(hwlocks, "hwlocks", "#hwlock-cells") DEFINE_SIMPLE_PROP(extcon, "extcon", NULL) -DEFINE_SIMPLE_PROP(nvmem_cells, "nvmem-cells", NULL) DEFINE_SIMPLE_PROP(phys, "phys", "#phy-cells") DEFINE_SIMPLE_PROP(wakeup_parent, "wakeup-parent", NULL) DEFINE_SIMPLE_PROP(pinctrl0, "pinctrl-0", NULL) @@ -1381,6 +1380,22 @@ static struct device_node *parse_interrupts(struct device_node *np, return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np; } +static struct device_node *parse_nvmem_cells(struct device_node *np, + const char *prop_name, int index) +{ + struct of_phandle_args sup_args; + + if (strcmp(prop_name, "nvmem-cells")) + return NULL; + + if (of_parse_phandle_with_optional_args(np, prop_name, + "#nvmem-cell-cells", index, + &sup_args)) + return NULL; + + return sup_args.np; +} + static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, },