From patchwork Wed Sep 25 10:13:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1989280 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=vLNzWBK6; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=YrXgTvIi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XDCKR62vVz1xt4 for ; Wed, 25 Sep 2024 20:15:23 +1000 (AEST) 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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MKsE4l4p6VQoG0JPrAtn5q8lyHe+y0zpgO26jqpXZ7M=; b=vLNzWBK6sRbZ3W CYCXEOFHxFSPS9G1ZIGhVsdDHkiUyKtvHtpIrHWjJkQUOzz8EhBDuIUt1B61XE6cpB+/U3tXYGnUx 908a52egmT9lORzb7O9loUF4iL/5jAIxcPHsM+RW7Qfqask+3osEPPVuiWT3gkr5GDZQhWKkuibED S7e1FFYXFQQZVkDvbjZCm+dIJ7hrlGspoLI/din2A/UQ3ER3bGA1/H+cuVZcOLzwfidC/iBaxefm+ XaZu5m1AGE1MP8qQRqlj136qmQKBMUK5qxcKS406iAF+c8SpDJ8Lo/IStYvpBSm9R+RszgW2o86JH g9i9JSOuCdG/MjR3bj3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stP3C-00000004is0-0B7u; Wed, 25 Sep 2024 10:15:14 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stP39-00000004ir1-2eqs for linux-mtd@lists.infradead.org; Wed, 25 Sep 2024 10:15:13 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-42cde6b5094so61130655e9.3 for ; Wed, 25 Sep 2024 03:15:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727259310; x=1727864110; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=mH3iAq1TAeBK36lg95WliQsOcKLSEbditM8M8e4wTwE=; b=YrXgTvIi0MZWTQllnf7o/aP+iDfZ35hbGtglL34esLMroCmSRLZN8UWstbKzzDOksF e+ee1g2MF8PSfMpyfCWEPNCjHsXrw9PIxOIrqwOfuAFjMlgIBAUaeOIqM7AUaJ7z1GYl qlL02470t7DsjISBKWRTDeK2wxOIPNQjgTld/Q70Sxn+ClFiFvOdQ+69rey1bTxuKt2W vsRDRWOR+z0N7haE9Ff77jT2kSX21ZTblVoKSne6Rzsk+cHfdNaFn/zH0OtlCDt/7lwC zuEepnC6UGgnTDXoU2iDH7rqsezCBQgl10+raA0l6XNhtb8oVKud7SvLOmMGJ/8ROS+4 bpWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727259310; x=1727864110; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mH3iAq1TAeBK36lg95WliQsOcKLSEbditM8M8e4wTwE=; b=ae1aGr4jCZQo/pvVzO8jFESHtVBsmu6ziafvCz7VF266yNjzH8DqvxkJC2+brQ1EhH CM1xXr/LMxd+crSyx3YuJSMm2BPbhcVNLVgB0jcYy7Tws1EkQQKnFBztA3UzRavWNOm+ wVnwaV3noOLK/OGAslxzYgRyNONS5FAP/TvngwousGEeoumb8PVKFZoqiYOMRxWfmGjX QJY5JyuXKeyvzqWrG0p097ggnYsuftMWe2nWRThVdjFVoksRYYI35msyF+Tl37b//yUe ylRWSZ/zSF9Z2oYCBMBpo4V909ZLaJDi8baxGch2W2JylO8xGwZCp7SrM9z7Jek9FUUL XQug== X-Forwarded-Encrypted: i=1; AJvYcCV03uXJpz5g+2Qz1cnSWOaB85/X88Rn+cY+65TP+gixg6BEDmGt58oMdNObpqJJOWGQpePs2gFh+PY=@lists.infradead.org X-Gm-Message-State: AOJu0Yx0KeQWcuBWKnEybCXRDCUDAvweB/cRxTIVQefSW5u1ugxjw4f7 lZgJUxSoG6AkNGDIMvkdJCgdZC3m2V82LdAHgh21ciZvneWY5TgJ X-Google-Smtp-Source: AGHT+IEDuMF7AmbE72EiRIWfTyj8UDV6s6Ac8BVbi1Q8y0Keq8ajGW2UzIm9myAL8AG1LUQcAtjFmA== X-Received: by 2002:adf:f1ca:0:b0:374:c8cc:1bb1 with SMTP id ffacd0b85a97d-37cc24b575bmr1521519f8f.39.1727259309987; Wed, 25 Sep 2024 03:15:09 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-37cbc1560a7sm3628194f8f.0.2024.09.25.03.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 03:15:09 -0700 (PDT) From: Christian Marangi To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Saravana Kannan , Christian Marangi , Florian Fainelli , Thomas Bogendoerfer , Wolfram Sang , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Bianconi , upstream@airoha.com Subject: [PATCH 1/3] of: also export of_update_property Date: Wed, 25 Sep 2024 12:13:57 +0200 Message-ID: <20240925101422.8373-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240925101422.8373-1-ansuelsmth@gmail.com> References: <20240925101422.8373-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240925_031511_712182_DF2E9FBE X-CRM114-Status: UNSURE ( 9.92 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Similar to how is done for of_add_property and of_remove_property, also export of_update_property to permit kmod to use this additional function and correctly update entry in DT. Signed-off-by: Christian Marangi --- drivers/of/base.c | 1 + 1 file changed, 1 insertion(+) Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ansuelsmth(at)gmail.com] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Similar to how is done for of_add_property and of_remove_property, also export of_update_property to permit kmod to use this additional function and correctly update entry in DT. Signed-off-by: Christian Marangi --- drivers/of/base.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 20603d3c9931..b2d523cf4925 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1746,6 +1746,7 @@ int of_update_property(struct device_node *np, struct property *newprop) return rc; } +EXPORT_SYMBOL_GPL(of_update_property); static void of_alias_add(struct alias_prop *ap, struct device_node *np, int id, const char *stem, int stem_len) From patchwork Wed Sep 25 10:13:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1989282 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=HuVnp/Oh; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=J7yHKGUh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XDCKW4f6kz1xt4 for ; Wed, 25 Sep 2024 20:15:27 +1000 (AEST) 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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4MlXrFLTRkDEyv03L/cq0X/82li9MPEbxUeBeJMFumY=; b=HuVnp/OhEN+Wcy 9cCYmu5gCy5z748fSXHCp0Fs6DPXhurJRbgEX5gVnpr4NRB3GJtusgxMDyIzsiNX0+7JHA3jkaWMW fni876qyk0jWA02oZKc3DNeYP757+/1CSDcdU718VUbc02lf1zvQYv8SOK7yAwBf2MVRwpuPTGTj6 n+w392RTyu8pJa+bmSLvn8nFM9w5HEcIGKIJLYIDfQ6kxrNSjVyPhGf/A1aE87c36WmlHEeSs3+r6 bDabQ22wKnBZUmSKMPboe8JXIX9boFT5jsPFPZItQTOJIBNHZ1Gknf7t+QrbV5IcVka/G2WU2RwA3 gckkAkv10TZCfrLH21rQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stP3E-00000004iso-1OZG; Wed, 25 Sep 2024 10:15:16 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stP3B-00000004irS-08ae for linux-mtd@lists.infradead.org; Wed, 25 Sep 2024 10:15:14 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42cde6b5094so61130935e9.3 for ; Wed, 25 Sep 2024 03:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727259311; x=1727864111; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=q0yqjz/vLAoslnLJDGa7eN7K2Pvc9Kf7CmkO2W3efDk=; b=J7yHKGUhNdfE/hLDx9wcfQ6B3aM37X/Y5DBq9HeW2NQo75PQrxcUEidlTQmyGpSPOE Ww2tZKbKPyueLGh+MKpoF5P0mb0k3Gr78BYNBdqKgPlZ4qxKXIhbPBqseiY/pRMX6v+n GmCrQzmdb5wIa9uKMiAMwqyrk4barj8wYddwyqjoTAx0iuPHcXLlBRcui0Ds6fkIKyOD lrKJqGo88z9FrBTbrA+KjQY48o912b+49NLUrVO1qNDG2TSXrhsOLC2NsmEEjNlNofaH mvdsHWJxYcWceCc2UhagogObghCVSzq0nw2J5ghAkZX9jwKdOx9xqHZcDc3+Hgvhyaqa EO+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727259311; x=1727864111; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q0yqjz/vLAoslnLJDGa7eN7K2Pvc9Kf7CmkO2W3efDk=; b=Az2i52qKAJo0sCCwqlEb68WBvFvtUd2pWKhkuQ9bAnKVZibNrUp258n85gOIsedmWE fnwb8fW7+nxt9mxq+vx9Ry3Ab0lzVHka+Js+lF6qrILukU6zAiWOzOioPUn+nDLg21Wh OnYoCK5zJeLprraCwkyF+I9ildZi9CfCUPEL6dpxSINE7V/9OyRqkR0nfqYOwin8bEg7 ny9SMHtDeZ9SHrIyOqBoAJofOeBfhwca8VZjsdB0lm6oH9gztUXeq6agH2nNYcTxE09B Y6iNq13HA5nrzIODRScqesTRB8DjYjN4CkdsOzLC2Csy7Mhdl9RN/Ek56USCZHyGCtfW P63w== X-Forwarded-Encrypted: i=1; AJvYcCVLoHUprN/0sQjiqzsTD/8dIAUt4mxIMZptNHbBGxHZZnBLaP4/E6WurVEUP7TeFXUw5+uEb3wPwEA=@lists.infradead.org X-Gm-Message-State: AOJu0YwsCn66aeMsikdYGcK/eWkIcuzx0P3ZB/cxt08kxOWHt2qYDpP3 5QlWIPb/kRWyA6wLYTmLobvjVqz4BuDAqUzaVbsWCxtDKhoCECX8 X-Google-Smtp-Source: AGHT+IGGrksQqujrE8tWrONIU2RpDc8dp9sRezir+8ahhKdtMo+RszPM/Z6hhXo38BC01/GaWh/h6Q== X-Received: by 2002:a05:600c:4689:b0:42c:b16e:7a22 with SMTP id 5b1f17b1804b1-42e9610d52fmr15491985e9.12.1727259311130; Wed, 25 Sep 2024 03:15:11 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-37cbc1560a7sm3628194f8f.0.2024.09.25.03.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 03:15:10 -0700 (PDT) From: Christian Marangi To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Saravana Kannan , Christian Marangi , Florian Fainelli , Thomas Bogendoerfer , Wolfram Sang , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Bianconi , upstream@airoha.com Subject: [PATCH 2/3] dt-bindings: mtd: Add Documentation for Airoha fixed-partitions Date: Wed, 25 Sep 2024 12:13:58 +0200 Message-ID: <20240925101422.8373-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240925101422.8373-1-ansuelsmth@gmail.com> References: <20240925101422.8373-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240925_031513_097455_C1740F2C X-CRM114-Status: GOOD ( 18.47 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Add Documentation for Airoha fixed-partitions compatibles. Airoha based SoC declare a dedicated partition at the end of the flash to store calibration and device specific data, in addition to fixed partitions. Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ansuelsmth(at)gmail.com] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add Documentation for Airoha fixed-partitions compatibles. Airoha based SoC declare a dedicated partition at the end of the flash to store calibration and device specific data, in addition to fixed partitions. The offset of this special partition is not well defined as a custom bad block management driver is used that reserve space at the end of the flash. This binding allows defining all fixed partitions and marking the last one to detect the correct offset. Signed-off-by: Christian Marangi --- .../partitions/airoha,fixed-partitions.yaml | 80 +++++++++++++++++++ .../bindings/mtd/partitions/partitions.yaml | 1 + 2 files changed, 81 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-partitions.yaml diff --git a/Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-partitions.yaml new file mode 100644 index 000000000000..a45df51065af --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-partitions.yaml @@ -0,0 +1,80 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/partitions/airoha,fixed-partitions.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha SoC partitioning + +description: | + Airoha based SoC declare a dedicated partition at the end of the flash to + store calibration and device specific data, in addition to fixed partitions. + + The offset of this special partition is not well defined as a custom bad block + management driver is used that reserve space at the end of the flash. + + This binding allows defining all fixed partitions and marking the last one to + detect the correct offset from the new end of the flash. + +maintainers: + - Christian Marangi + +select: false + +properties: + compatible: + const: airoha,fixed-partitions + + "#address-cells": + enum: [ 1, 2 ] + + "#size-cells": + enum: [ 1, 2 ] + +patternProperties: + "^partition@[0-9a-f]+$": + $ref: partition.yaml# + properties: + compatible: + const: airoha,dynamic-art + unevaluatedProperties: false + +required: + - "#address-cells" + - "#size-cells" + +additionalProperties: false + +examples: + - | + partitions { + compatible = "airoha,fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x00000000 0x00080000>; + }; + + partition@80000 { + label = "tclinux"; + reg = <0x00080000 0x02800000>; + }; + + partition@2880000 { + label = "tclinux_slave"; + reg = <0x02880000 0x02800000>; + }; + + partition@5080000 { + label = "rootfs_data"; + reg = <0x5080000 0x00800000>; + }; + + partition@ffffffff { + compatible = "airoha,dynamic-art"; + label = "art"; + reg = <0xffffffff 0x00300000>; + }; + }; diff --git a/Documentation/devicetree/bindings/mtd/partitions/partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/partitions.yaml index 1dda2c80747b..ec254e03adf0 100644 --- a/Documentation/devicetree/bindings/mtd/partitions/partitions.yaml +++ b/Documentation/devicetree/bindings/mtd/partitions/partitions.yaml @@ -14,6 +14,7 @@ maintainers: - Miquel Raynal oneOf: + - $ref: airoha,fixed-partitions.yaml - $ref: arm,arm-firmware-suite.yaml - $ref: brcm,bcm4908-partitions.yaml - $ref: brcm,bcm947xx-cfe-partitions.yaml From patchwork Wed Sep 25 10:13:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1989283 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=r50zq2nB; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=j+vS5c1r; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XDCKW65dkz1xt6 for ; Wed, 25 Sep 2024 20:15:27 +1000 (AEST) 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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=q90W9ILbwqEWMBVds18BIbLtyT3FAFnO023HaTVBOa0=; b=r50zq2nBN3oMT5 J5b1daKekolOdh3mQoTy0z4g2bk1E3akjTJ+TxxPfyls5BsXyr8E92WezbCSUloouCciga241upso 1Qy1LryVrM/ntIR4kAbVNlhAVcSA4O2vH5ci1D/OwcSScZH7OpRkaNMOh3qt5ba8bea63UDUEFA4L jt0CZ0S2+QzlrcmhvMBk3MmQdZgnntzuyk/UI6Qm6TwFhtrQW4Kc4hPnzdIUDuaZPixB7vJlp1NNn xaQfEa7lZUniNpIewuPMYUmAxJER3VuItbWxstHDgKTDsO+BBgITD55deai7tScePUwQP0tSrXlFG jZjH5XJCIHKvCUiOzLmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stP3F-00000004itE-3pw9; Wed, 25 Sep 2024 10:15:17 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stP3C-00000004irf-1AFE for linux-mtd@lists.infradead.org; Wed, 25 Sep 2024 10:15:15 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42cacabd2e0so56864565e9.3 for ; Wed, 25 Sep 2024 03:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727259312; x=1727864112; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xm9CdzNjdFxXiQLDIbBOl19NIoTai2DZ2tEF/6IV/ts=; b=j+vS5c1rkossDW0MCqh4U/WZd1GNgvhR7NftNn74gPKQ1dQ8l1oaKrk1nE1Mxuoh5D IHIZC0rfSx/34cCZG+2oovqEBNLyAaPXYMbrFVJbi2OdxYHZbi4nmfwa61xOReLo8g3N AqQx1e4NaS4HP1AuwO+OOYuRl1bnV6/BKgyLRuJfsq1a2YifxzsPVdQfOu0OiV4HWI6C hSTdvDdHKvkIxSQTxdyjsbdlCo30x4se2htTH/E4LMjIzrgl2wHbz+YawmZ2J42GYxci IUDAQiDJ0aKHz7bjvxXqUkjlzGRhMFHc54LIIJlnNAyza1egXvauWyk5+73L3N+IAllx 2obg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727259312; x=1727864112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xm9CdzNjdFxXiQLDIbBOl19NIoTai2DZ2tEF/6IV/ts=; b=bCqKT8obMmnUYyGBOWj62/VZkMdD4LQBgz4hjRTBPUOUhr1DsMvaZn5y1FOxtGUXjG vA99dHLu/+I07p8tWUUOv6WgNopiBNbOyzje6/89va3dtea7YVqR7UfZSjQLc8YJHugA xqHbEMkmR/gkGPCQxGMVYCkvKvN0d1fany3ENoclXAHGyM8vkBZgF/Ekgb3gNuMF0bMZ eX5LFcUCwblTCrvksNln3F9J/In0IRik+YjIgCCsB35iVRmz5OFtejlMPZdA5w9Dma2H kcx12KenOSu52KWvTdHXz+75pVFpplf7Ku++pF9GQfFymsFvK15EIveAuOWilB/evGMc RW2g== X-Forwarded-Encrypted: i=1; AJvYcCVdCu995kQ3YMI4J2UUj8x4Xb0xsb9Ph2NYAaf1f37pcTdCn+kZWcxGCDtYqMkkYdob+IfnQSgGcFY=@lists.infradead.org X-Gm-Message-State: AOJu0YyHvNoVfXVzYkZMkpvIzMKf5QBn/UDCx2Nzsz50dtrkzQRNt4lM a6ESFN6pxEcDFdrwmyffG3d3hJUyy0uIqI6qRAQI3c7HNOShg8QE X-Google-Smtp-Source: AGHT+IFrUhPfnR1ZpaYpm6503WQfwgTFcsU1lGXcEyJha8rBKvGPhx/LgRwNZvRJtSCOoqRvLwLrDw== X-Received: by 2002:a05:600c:310f:b0:42c:bd5a:945b with SMTP id 5b1f17b1804b1-42e9611dd5dmr15299805e9.21.1727259312318; Wed, 25 Sep 2024 03:15:12 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-37cbc1560a7sm3628194f8f.0.2024.09.25.03.15.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 03:15:12 -0700 (PDT) From: Christian Marangi To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Saravana Kannan , Christian Marangi , Florian Fainelli , Thomas Bogendoerfer , Wolfram Sang , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Bianconi , upstream@airoha.com Subject: [PATCH 3/3] mtd: parser: add support for Airoha parser Date: Wed, 25 Sep 2024 12:13:59 +0200 Message-ID: <20240925101422.8373-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240925101422.8373-1-ansuelsmth@gmail.com> References: <20240925101422.8373-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240925_031514_353887_9E5399CC X-CRM114-Status: GOOD ( 30.30 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Add support for Airoha parser based on a post parse ofpart function. Airoha partition table follow normal fixed-partition implementation with a special implementation for the ART partition. This is always the last partition and is placed from the end of the flash - the [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ansuelsmth(at)gmail.com] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add support for Airoha parser based on a post parse ofpart function. Airoha partition table follow normal fixed-partition implementation with a special implementation for the ART partition. This is always the last partition and is placed from the end of the flash - the partition size. To enable this special implementation for ART partition, the relevant node require the "airoha,dynamic-art" compatible. With that declared, offset value is ignored and real offset is updated with the calculated value. Due to usage of specific bad block management driver, the MTD size might vary hence the ART partition offset needs to be dynamically parsed and can't be declared statically. Signed-off-by: Christian Marangi --- drivers/mtd/parsers/Kconfig | 10 +++++ drivers/mtd/parsers/Makefile | 1 + drivers/mtd/parsers/ofpart_airoha.c | 57 +++++++++++++++++++++++++++++ drivers/mtd/parsers/ofpart_airoha.h | 18 +++++++++ drivers/mtd/parsers/ofpart_core.c | 6 +++ 5 files changed, 92 insertions(+) create mode 100644 drivers/mtd/parsers/ofpart_airoha.c create mode 100644 drivers/mtd/parsers/ofpart_airoha.h diff --git a/drivers/mtd/parsers/Kconfig b/drivers/mtd/parsers/Kconfig index da03ab6efe04..d6c53aa16ea6 100644 --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig @@ -72,6 +72,16 @@ config MTD_OF_PARTS flash memory node, as described in Documentation/devicetree/bindings/mtd/mtd.yaml. +config MTD_OF_PARTS_AIROHA + bool "Airoha EN7815 partitioning support" + depends on MTD_OF_PARTS && (ARCH_AIROHA || COMPILE_TEST) + default ARCH_AIROHA + help + This provides partitions parser for Airoha EN7815 family devices + that can have dynamic "ART" partition at the end of the flash. + It takes care of finding the correct offset and update property + with it. + config MTD_OF_PARTS_BCM4908 bool "BCM4908 partitioning support" depends on MTD_OF_PARTS && (ARCH_BCMBCA || COMPILE_TEST) diff --git a/drivers/mtd/parsers/Makefile b/drivers/mtd/parsers/Makefile index 9b00c62b837a..d67f9b4d39ac 100644 --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_MTD_BRCM_U_BOOT) += brcm_u-boot.o obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o ofpart-y += ofpart_core.o +ofpart-$(CONFIG_MTD_OF_PARTS_AIROHA) += ofpart_airoha.o ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o diff --git a/drivers/mtd/parsers/ofpart_airoha.c b/drivers/mtd/parsers/ofpart_airoha.c new file mode 100644 index 000000000000..5e2cc7b6376b --- /dev/null +++ b/drivers/mtd/parsers/ofpart_airoha.c @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2024 Christian Marangi + */ + +#include +#include +#include + +#include "ofpart_airoha.h" + +int airoha_partitions_post_parse(struct mtd_info *mtd, + struct mtd_partition *parts, + int nr_parts) +{ + struct mtd_partition *part; + int len, a_cells, s_cells; + struct device_node *pp; + struct property *prop; + const __be32 *reg; + __be32 *new_reg; + + part = &parts[nr_parts - 1]; + pp = part->of_node; + + /* Skip if ART partition have a valid offset instead of a dynamic one */ + if (!of_device_is_compatible(pp, "airoha,dynamic-art")) + return 0; + + /* ART partition is set at the end of flash - size */ + part->offset = mtd->size - part->size; + + /* Update the offset with the new calculate value in DT */ + prop = kzalloc(sizeof(*prop), GFP_KERNEL); + if (!prop) + return -ENOMEM; + + /* Reg already validated by fixed-partition parser */ + reg = of_get_property(pp, "reg", &len); + + /* Fixed partition */ + a_cells = of_n_addr_cells(pp); + s_cells = of_n_size_cells(pp); + + prop->name = "reg"; + prop->length = (a_cells + s_cells) * sizeof(__be32); + prop->value = kmemdup(reg, (a_cells + s_cells) * sizeof(__be32), + GFP_KERNEL); + new_reg = prop->value; + memset(new_reg, 0, a_cells * sizeof(__be32)); + new_reg[a_cells - 1] = cpu_to_be32(part->offset); + if (a_cells > 1) + new_reg[0] = cpu_to_be32(part->offset >> 32); + of_update_property(pp, prop); + + return 0; +} diff --git a/drivers/mtd/parsers/ofpart_airoha.h b/drivers/mtd/parsers/ofpart_airoha.h new file mode 100644 index 000000000000..3e8a8456c13a --- /dev/null +++ b/drivers/mtd/parsers/ofpart_airoha.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __OFPART_AIROHA_H +#define __OFPART_AIROHA_H + +#ifdef CONFIG_MTD_OF_PARTS_AIROHA +int airoha_partitions_post_parse(struct mtd_info *mtd, + struct mtd_partition *parts, + int nr_parts); +#else +static inline int airoha_partitions_post_parse(struct mtd_info *mtd, + struct mtd_partition *parts, + int nr_parts) +{ + return -EOPNOTSUPP; +} +#endif + +#endif diff --git a/drivers/mtd/parsers/ofpart_core.c b/drivers/mtd/parsers/ofpart_core.c index abfa68798918..8e86fa4f3bbd 100644 --- a/drivers/mtd/parsers/ofpart_core.c +++ b/drivers/mtd/parsers/ofpart_core.c @@ -16,6 +16,7 @@ #include #include +#include "ofpart_airoha.h" #include "ofpart_bcm4908.h" #include "ofpart_linksys_ns.h" @@ -23,6 +24,10 @@ struct fixed_partitions_quirks { int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); }; +static struct fixed_partitions_quirks airoha_partitions_quirks = { + .post_parse = airoha_partitions_post_parse, +}; + static struct fixed_partitions_quirks bcm4908_partitions_quirks = { .post_parse = bcm4908_partitions_post_parse, }; @@ -192,6 +197,7 @@ static const struct of_device_id parse_ofpart_match_table[] = { /* Generic */ { .compatible = "fixed-partitions" }, /* Customized */ + { .compatible = "airoha,fixed-partitions", .data = &airoha_partitions_quirks, }, { .compatible = "brcm,bcm4908-partitions", .data = &bcm4908_partitions_quirks, }, { .compatible = "linksys,ns-partitions", .data = &linksys_ns_partitions_quirks, }, {},