From patchwork Sun Aug 4 17:44:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1968835 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4WcRm56hnkz1ybS for ; Mon, 5 Aug 2024 03:44:53 +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=lSDJnBo3zSf3PD2Zc1A+jNvuPIyojVTeBnT2/54gbo8=; b=BXnHU8AXdGicit LlqrstO3G+KMJPcbE63wo/5kWQJtgOYchNfROPUPIzyK5pW79UmByb4gT5aIEpNFMD5vCWHjtg4UF NDx9yovItt2wytEsgabsLRC2FHklCxOe4hjHpOFFfPUqrTjgYTt6LEObQG2o7Qk7cCGyfySqtaJbY vaDYbTL6d7DFph4hrROPuvhME7sfmMvPP+fhxzHLtPDnpZUMwny7/yPnvzB4J+I5h0c3k7U9PfbPU Bo3dathQsKbqnKUY7l4+E838Ho2A8AQzFzZvErdhdv1JFbOHo9izZt+gfjvVz0tLGXzJQCMVOTXJf ZZkPKDq/7P3L4IvfVTAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1safHW-0000000DgvE-3xFJ; Sun, 04 Aug 2024 17:44:34 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1safHU-0000000Dgtw-1sum; Sun, 04 Aug 2024 17:44:33 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-368313809a4so2763383f8f.0; Sun, 04 Aug 2024 10:44:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722793470; x=1723398270; 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=N4Tqx/xl+do4nmfv0ZFIXdX55krJHtI/dy8e3uyNR1Y=; b=g11TvcJtEdjUDt2DaViK0o8i4sVPz+L9lfvDJJOWPDOpMPaWf164kGSOezIoZ4ASS3 5fhhtHHh8c41NJWkNsEvElTdN3SbQkBySerqv/E0NJcimoTLvy1NC1um1XHEL00zC1Yj lUtBdDYzX6XruAzvWHfBtarWPWfWLyGt118SOQjtfq+XZfa21G/qGT5j97OzRccgyjwz yVCXZ/THYQVgrMo2TlNO7r2BSAPssYQhZ9BkD1nfcUGNGM7rp7RTWfPEaB4sCsn19VUJ eMDl7FsfE3PorAOj6G03AbFFy8jC42Oa1OtzsE2wyPX0djhBF13DJvGb0cWFS5AuQO6W 3V6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722793470; x=1723398270; 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=N4Tqx/xl+do4nmfv0ZFIXdX55krJHtI/dy8e3uyNR1Y=; b=U/aHKGDXUXR10JO6ypzHxFJuvVB1ahqHWcPgBSeLxmrFN7V6BxwQWm4JRQgluO2rjF YjZO+fRfiqsMiFO/j3PugUPHKvUrPaKjRhlmJbE0ZEV12zv4W4Nib+9xrHibX4DHIX17 22CjVWiT2WkI+o4f47kF3+UComS+d7IpZaLuaRDzi/9o55Zfu0R7YAkWXxT9DXYE5WGo 16mPfvontsyDYALxzn0sxRL/N/LXXCuXdxBVucskb0y5jljHY3rE4l9OZk2l1/DrhVIN /xKmWeMJbEZa1yqpECr9spftkDBEUkd7LmnK3lZmpWxefehE3VsSjJBfM2wY3pWK8yzK 4Bzw== X-Forwarded-Encrypted: i=1; AJvYcCUaKueC6NVF0corPexcjfEfprgFSKIFewsFS/n3LB2IS394uQow5sw/dpl4lfj5Lx5qgReXQQ9hEsrTk2kud1eLvOjdplGEi4FQmzzo/PLsLzdjf3xyUahdjJnDQ2JbbkoKExhhUkimdHu0oObB X-Gm-Message-State: AOJu0YzAjA47Zu7t4aFart13AcyY9FInrJRnQubQebJaMaFrl2/lmH8k xJ36zm4WZzXofFzuADdPYizl03Uit1rnNyqjVNNhAmMx63vp594g X-Google-Smtp-Source: AGHT+IEmGipmy6C03p1fUHWreExFigGkvjGoxjZh2tkYrSz+71MUHqO1UlAfqWKZFbKWjp32T3vinQ== X-Received: by 2002:a05:6000:b50:b0:367:938f:550 with SMTP id ffacd0b85a97d-36bb35de344mr8566122f8f.25.1722793470174; Sun, 04 Aug 2024 10:44:30 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-428e6e0357asm109530485e9.12.2024.08.04.10.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Aug 2024 10:44:29 -0700 (PDT) From: Christian Marangi To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Joern Engel , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Christian Marangi , Wolfram Sang , Florian Fainelli , Thomas Bogendoerfer , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org Subject: [PATCH v2 1/6] dt-bindings: nvme: Document nvme-card compatible Date: Sun, 4 Aug 2024 19:44:05 +0200 Message-ID: <20240804174414.18171-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240804174414.18171-1-ansuelsmth@gmail.com> References: <20240804174414.18171-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240804_104432_497642_7C8F4538 X-CRM114-Status: GOOD ( 14.78 ) 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: Document new nvme-card compatible to permit defining fixed-partition in DT by the use of the block2mtd module to use block devices as MTD. Signed-off-by: Christian Marangi --- .../devicetree/bindings/nvme/nvme-card.yaml | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvme/n [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:429 listed in] [list.dnswl.org] 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 Document new nvme-card compatible to permit defining fixed-partition in DT by the use of the block2mtd module to use block devices as MTD. Signed-off-by: Christian Marangi --- .../devicetree/bindings/nvme/nvme-card.yaml | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvme/nvme-card.yaml diff --git a/Documentation/devicetree/bindings/nvme/nvme-card.yaml b/Documentation/devicetree/bindings/nvme/nvme-card.yaml new file mode 100644 index 000000000000..20e9a877fac4 --- /dev/null +++ b/Documentation/devicetree/bindings/nvme/nvme-card.yaml @@ -0,0 +1,78 @@ +# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvme/nvme-card.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVME Card + +maintainers: + - Christian Marangi + +description: | + This documents describes the devicetree bindings for a NVME controller + child node describing a nvme-card. + +properties: + compatible: + const: nvme-card + + partitions: + $ref: /schemas/mtd/partitions/partitions.yaml + +required: + - compatible + +additionalProperties: false + +examples: + - | + pcie { + #address-cells = <3>; + #size-cells = <2>; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + nvme@1,0 { + compatible = "pci144d,a809"; + + reg = <0x00010000 0 0 0 0>; + #address-cells = <1>; + #size-cells = <1>; + + card { + compatible = "nvme-card"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + bootloader@0 { + label = "bootloader"; + reg = <0x00000000 0x00080000>; + }; + + tclinux@80000 { + label = "tclinux"; + reg = <0x00080000 0x02800000>; + }; + + tclinux_slave@2880000 { + label = "tclinux_slave"; + reg = <0x02880000 0x02800000>; + }; + + rootfs_data@5080000 { + label = "rootfs_data"; + reg = <0x5080000 0x00800000>; + }; + }; + }; + }; + }; + }; From patchwork Sun Aug 4 17:44:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1968834 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4WcRm56l4bz1yds for ; Mon, 5 Aug 2024 03:44:53 +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=pQNjTwW+MOpp9C5Q/MHr5cvRe4inORamchhN1WnnaDA=; b=sbneLcAWmuSOv9 hFTgJtW49Vidxr+r11Y7fIKlNaHkhoXPS2nrh8vQuYn2+cUQYEJki/BQfQC75q2mZQADFqFw1SUC2 eWtIpjGtrG17C7jgLIiH9LfR9Kqqa2ceoxxJFh6bIsj8vAL5xGVWhSu8oeEV+nwbvM9pNfOrgm+Pb kA3TZo/j5UZPu6l/N7YTNqNyq7Mkt59RKYk4t7rIi376jajfD69dCiGyfKIYSzpRb+vvS9L+nZHEA bMCithXQ/AijMoLES3QZDWIZ+0StPsta/JCmzxr6iUXlU5j7gv3dsAKK1FwjL90BmiJk+/RBYR+3x cDjYVYutn1ini4ZmlAfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1safHY-0000000Dgvg-0zMv; Sun, 04 Aug 2024 17:44:36 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1safHW-0000000DguQ-03ou; Sun, 04 Aug 2024 17:44:35 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-427fc97a88cso67939045e9.0; Sun, 04 Aug 2024 10:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722793472; x=1723398272; 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=NJElgdSeo7tFBhUWI5Y2VGkmcaarTUGB2bJhxj7nOts=; b=K8z8gMZ7BL9qsooCkXLPlo2AxcpT4TSjOtMoKYYisu5BcLqYyDtWZWji2910FMWhek zlBbC9wd24WzR+0GWT8sMZxjiJOhR4FWZiSH5gFb/ykzd1OQBEuJqKdcMMObyqoRgrPv OPS31wqBNUyZgDy2Yjj/FlF3FAEkNHDYyWkqgfjJxxkek1BQHoxdc5/tUcKa700AKWmo oET2AcljtmiRvxA32eGMQlKlRftxhft7RO3QJ4M4mNWGmLQxcFzg6V2v2xjrMllrsttW Clad14n0MIpoJ/P1yppAIYpzVtO+PBZjyVYGqLR0MC5Pm45wJ0wI2DgpEKPccI8nXBNd XX2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722793472; x=1723398272; 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=NJElgdSeo7tFBhUWI5Y2VGkmcaarTUGB2bJhxj7nOts=; b=m6hgfN85Vr6LpCvVN1S2vQynRMTl2QflZrTmLiZwf9ijQehrWTHRDEuIMO4VYLXlQZ 2DeaSKfVRPB8fauleNMxNhzwnT4fGWdrdTtXqgF00l24670EgtIQk9yAJTbiwwWiLXy0 1WckT1sJgeBmsbUSZvHa1j0hG/YYcIrbGZav2gfUimNZoHpak/J393LH+90ks43LgiDe 5hbW6xhX9B2o0QFFzDXO1bTXfpc+uATYA1lHvH8P64wCjYzJ1UTd/fxIoyiYtL9Gctaw etGSaEfboy2VTsyOV9SpX/jVWn6oOCPLZL5WwaizxFcwLU/pcCDL9QAha40gV4Wox3/2 Qysg== X-Forwarded-Encrypted: i=1; AJvYcCVxb9N5AyD0sdWi3Yzh/Tkawrqdk/RGDXycoFvIgfWJtGpKhhI+3Hf9NWRnDOt/4XuVwv5AnmW2h8rAxpFCn7k7OXKicDCrD3SQyAZtAEbftqVDHLxKkjLwPQhpZuji5kTLLqbRPt0o134SEhYo X-Gm-Message-State: AOJu0YwFsdXkQpaf5wtNLt4nJjcch7tRXqYXvaosurfuuKWLnOVKeDUF iaecb8BKW+xI0kjyOkOHS3ARUmxeExpTZxXC8UdwDCJaJD4bQJ7+ X-Google-Smtp-Source: AGHT+IF6h/dGDHwUKaeJf81/S6Xw4YXN06iaLrsJ+xyLkFLlhqRSyGV1A+2MwoRSks+8BuECDOiQtg== X-Received: by 2002:a05:600c:470e:b0:426:59fe:ac2d with SMTP id 5b1f17b1804b1-428e6b9369bmr73165125e9.32.1722793472007; Sun, 04 Aug 2024 10:44:32 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-428e6e0357asm109530485e9.12.2024.08.04.10.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Aug 2024 10:44:31 -0700 (PDT) From: Christian Marangi To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Joern Engel , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Christian Marangi , Wolfram Sang , Florian Fainelli , Thomas Bogendoerfer , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org Subject: [PATCH v2 2/6] nvme: assign of_node to nvme device Date: Sun, 4 Aug 2024 19:44:06 +0200 Message-ID: <20240804174414.18171-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240804174414.18171-1-ansuelsmth@gmail.com> References: <20240804174414.18171-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240804_104434_092680_BBB655B3 X-CRM114-Status: GOOD ( 14.94 ) 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: Introduce support for a dedicated node for a nvme card. This will be a subnode of the nvme controller node that will have the "nvme-card" compatible. This follow a similar implementation done for mmc where the specific mmc card have a dedicated of_node. Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:330 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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 Introduce support for a dedicated node for a nvme card. This will be a subnode of the nvme controller node that will have the "nvme-card" compatible. This follow a similar implementation done for mmc where the specific mmc card have a dedicated of_node. This can be used for scenario where block2mtd module is used to declare partition in DT and block2mtd is called on the root block of the nvme card, permitting the usage of fixed-partition parser or alternative ones. Signed-off-by: Christian Marangi --- drivers/nvme/host/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 053d5b4909cd..344523274d1b 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -4651,6 +4652,7 @@ void nvme_uninit_ctrl(struct nvme_ctrl *ctrl) nvme_hwmon_exit(ctrl); nvme_fault_inject_fini(&ctrl->fault_inject); dev_pm_qos_hide_latency_tolerance(ctrl->device); + of_node_put(ctrl->device->of_node); cdev_device_del(&ctrl->cdev, ctrl->device); nvme_put_ctrl(ctrl); } @@ -4771,6 +4773,8 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, else ctrl->device->groups = nvme_dev_attr_groups; ctrl->device->release = nvme_free_ctrl; + ctrl->device->of_node = of_get_compatible_child(ctrl->dev->of_node, + "nvme-card"); dev_set_drvdata(ctrl->device, ctrl); return ret; From patchwork Sun Aug 4 17:44:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1968837 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4WcRm60QXDz20Fg for ; Mon, 5 Aug 2024 03:44:52 +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=oa6DcZChtVfsdSlC1EcT5LNZkRFInVx71Gajvm0THCA=; b=j5iwUNubqSdLj7 ehCH1dGOB3rgnrlm4LGbn8b2PJqRJvkGVm9Nz7BEYjPdZPAleZSl+mrV07K0MpQuR4MEnsFmyUeER 3chxAzet7RNUyTi5nNFpMhScJcgvqCSacw/RLV3tMtjh2OoHTEL5IPTOLgdI5xz7vD0h5EPG+DS3z PJwHDRD/Ly14TfaF1VaRcYogj3nQQhgP1AVNvA6VACwLX6Vc9CQLncly8BGK4X6Lc7JdIW2KKAWie 6yXnrYL3S/i7RVTRAwDC5uD8hrmpFe/HJOvFMipq+b23I987xhTzziPGCtDEceUk0FXNg68GeDoDU lyrfFebUy/rnGq+8wP/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1safHb-0000000Dgxo-1kZV; Sun, 04 Aug 2024 17:44:39 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1safHY-0000000DgvW-39Px; Sun, 04 Aug 2024 17:44:38 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42812945633so68224705e9.0; Sun, 04 Aug 2024 10:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722793475; x=1723398275; 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=zJtL0MfF3HGZoWE7QS0/OcrDoRKxdV59VhkJ0rmXwsw=; b=Y7gkkzaOzvTApkhkTq+6YytY60Zkn1Mq4XJo2Oj2HIdQzHWFvWqjahFt6AT0GnfKnn bbVcxSPiYl4LNWJVEJo4zU0KKJ/wfdFGFIm40gD79I4mVSM2pJqeRxh04otqIIkhxYGW 7n21C0WMkJGCHdCAodHxkfJIkjJWLP+rYqKTccdQjUr3i4eDSuRSfAxuo2AqHg/imvuw grVXAjKcFwThs6TV5dWgR8b9KhBOxmW7cpBxnHwy+0XmmocT9X0fIu6nC0o+20aFPj9G WPIX5UXfn491xqMd1qQbSElxNZ7IFttKTrvO+YQmoEodbmkp+ZmZCEYICl3K3EuCImRE 99BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722793475; x=1723398275; 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=zJtL0MfF3HGZoWE7QS0/OcrDoRKxdV59VhkJ0rmXwsw=; b=hwNAOqpnUpFmiL1F81MIoI4CzWbvjmnj0jEFI9VlcWsZ/hlOJjgXDfwneUPtOgE5nC lAuvVQ6oBlcOFkKAL5/KnEJsUdHKF2MzEqp45i3ICwnDAJCPlaWPSMdOG4E1V0zX9BUu XW4pvHhAlOUaNVnc8/njjjVecAGoHCjDdNpovB535Ax6TqrUgci2T4NdZkbUpSkcavJV GW+rW9GMqAXCQUN2Zc87I0W8wi72J9iD0xPwTMNyRhT5oo/j1ExabRN+qeXQtLaf+n4s IFcW1rvCKLOTVYVrzhc2oVIttpV4B0aCX1j+gucMgH+q5FrK43aK4chsTF1mOX+lKNUj XdAA== X-Forwarded-Encrypted: i=1; AJvYcCXurwKD2uoTPGsrMbODwAifew9fsWkU0gGTg+t73/FiLs1OHiyLCXt0UCjF6Juf41MKUzk3G/i3BXCbzlqjXbj4SXKsGMfqRg7lpg1GctxVAx4+W5zdmza92VtB9FtZJuXRc7Y/SL6EurVpOztX X-Gm-Message-State: AOJu0Yw8tyXD8aHokAWkD9qNdpHhFkciGxuR/07SugAvAqfXXEEb264i cqwo2PUNAnCz8w8BBHpE+s4/SkRLXm7HW/wu45QLrsgDiDfsgi+y X-Google-Smtp-Source: AGHT+IFN8eD9eeHRek82k2yYE+fWbJDyGcXBovLeKVHyNRAcWSy58vdincZxAdx4fAZXLwmahnfYCg== X-Received: by 2002:a05:600c:3acc:b0:426:5f7d:addc with SMTP id 5b1f17b1804b1-428e6b8380dmr57122375e9.37.1722793474565; Sun, 04 Aug 2024 10:44:34 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-428e6e0357asm109530485e9.12.2024.08.04.10.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Aug 2024 10:44:34 -0700 (PDT) From: Christian Marangi To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Joern Engel , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Christian Marangi , Wolfram Sang , Florian Fainelli , Thomas Bogendoerfer , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org Subject: [PATCH v2 3/6] dt-bindings: mmc: add property for partitions node in mmc-card node Date: Sun, 4 Aug 2024 19:44:07 +0200 Message-ID: <20240804174414.18171-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240804174414.18171-1-ansuelsmth@gmail.com> References: <20240804174414.18171-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240804_104436_798307_9DD4B062 X-CRM114-Status: GOOD ( 12.37 ) 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 property for defining partitions node in mmc-card node to define partitions in DT by the use of the block2mtd module to use block devices as MTD. Signed-off-by: Christian Marangi --- .../devicetree/bindings/mmc/mmc-card.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:32c listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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 property for defining partitions node in mmc-card node to define partitions in DT by the use of the block2mtd module to use block devices as MTD. Signed-off-by: Christian Marangi --- .../devicetree/bindings/mmc/mmc-card.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/mmc-card.yaml b/Documentation/devicetree/bindings/mmc/mmc-card.yaml index fd347126449a..0f32d24417bc 100644 --- a/Documentation/devicetree/bindings/mmc/mmc-card.yaml +++ b/Documentation/devicetree/bindings/mmc/mmc-card.yaml @@ -26,6 +26,9 @@ properties: Use this to indicate that the mmc-card has a broken hpi implementation, and that hpi should not be used. + partitions: + $ref: /schemas/mtd/partitions/partitions.yaml + required: - compatible - reg @@ -45,4 +48,41 @@ examples: }; }; + mmc1 { + #address-cells = <1>; + #size-cells = <0>; + + card@0 { + compatible = "mmc-card"; + reg = <0>; + broken-hpi; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + bootloader@0 { + label = "bootloader"; + reg = <0x00000000 0x00080000>; + }; + + tclinux@80000 { + label = "tclinux"; + reg = <0x00080000 0x02800000>; + }; + + tclinux_slave@2880000 { + label = "tclinux_slave"; + reg = <0x02880000 0x02800000>; + }; + + rootfs_data@5080000 { + label = "rootfs_data"; + reg = <0x5080000 0x00800000>; + }; + }; + }; + }; + ... From patchwork Sun Aug 4 17:44:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1968836 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4WcRm607b6z1yfJ for ; Mon, 5 Aug 2024 03:44:53 +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=QFNH6rLZcRbqSC/M7jX6e7cne+Ib0SWNir99onyphDU=; b=1E0B1IqPQXKq0V 8MbhfviuDKD/T0brBFm88KtxlgKo26f6TjgxHqU/ZGczmAtXRZorHKWMqn8HjB8aT+FKZk2vZCxZR qya7mmXUP6oU+aWLXAr7HPKz0jzN4STbm8JWdLV+LY0m0IHwq5uN1uMMPgxy6d8Yk/hmvJhjyqw07 bkTpAvRANV6atXvPdSYYZCRY4xjFZDj7kX1uiQPbZrSBDwDoR8LcNSoSl0TUPov+w6EuBd1G9rygZ JWSqE/T43QUp10I0Q0NqlLJ0arAfcRGyJZlx+umQu/A9X0YoQr5y3el33/2KKD4SmeVfPkuMqIURb Z9SkKN9mY+xaRqUEQesA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1safHe-0000000Dh0N-2HS9; Sun, 04 Aug 2024 17:44:42 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1safHb-0000000Dgx5-1tYD; Sun, 04 Aug 2024 17:44:41 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2f040733086so110276741fa.1; Sun, 04 Aug 2024 10:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722793477; x=1723398277; 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=1AwITVf2WPGSBxmw93SjsOJVEu1oqZyIKeUGfTrfzs4=; b=V7kKbc9KQ8FDDDL/NF0V8g329mi5CeoOfdZFQAA3nWrxWwAxSNU+TtGwh/YsOAmA9X hpdmqhMLlJSSesPubSsvz1u7qtxZ+OK8pCg7KQ64DDxLh1yqoWCMlCXnvY2YX6+3Xngj Fk/yCsnueOOdGKdSP7kIdB6e5PfJHpjTZIg+YKs2nRbymOwEhg1kBU5v9kscChZni7g0 KIWrCUc6lRPCKV6TQcJcNqLIJpKm1LO7aBASejCCC4nbAZTJgGuCpDARoYLUuOFKXqfR 1U5Luk1FLKQEEPuhCdEmI/nnLN9z4Kg1X7/SEQEoM9ZjXycfFbe9T969rixV8L3/lfIv 5exQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722793477; x=1723398277; 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=1AwITVf2WPGSBxmw93SjsOJVEu1oqZyIKeUGfTrfzs4=; b=lCtu6GiVVZX/fM6oGD3UE2/r6ATUtD7JXovkB1+rkCwHEEG1OHBBOZTsBalHi688Bi z/7KJ2quRvfmTp3jYBr0rtWoxxA4pzQx2Tq7/H50zDmIlSDSDkSydHOcWodP/ZnYR/rH 1Jy/gPSwOY5omIM+XQaWPFgFsGEJ4B5nyefYui77+Vv71c9jLvNN8tw25O6fwsYOQKAR 4nABPKAf2iyD+8gzLAfTsXtF9PnXVEyMO38Jok8akjjV/7l5zjYvrQHLiGXpKpAJqYo5 zROpwkX7W1o8op5TIHuy0YfbLZQEUWGgmcXdosZqZ8z4D8CJRuB+2xZ2JY3E6jGLARD9 Y0og== X-Forwarded-Encrypted: i=1; AJvYcCXBn+yNDuFg06hKZGD60VcCcDBTb/43JZ7DP8Ob5ibSB1kbA3VNwhwSQl8bd3oJhGMh5xDQyjueNoQYOeK7ZdDosBysJwXVyqAh++AxJ25/JHofM+Ln98xsiXbzMbsELv3MF9hlxeq59C/u69WI X-Gm-Message-State: AOJu0YwFNiBHv0otaizM7QjMhLvy87cxhMPYr43x0CYbX8cKNoNZyir1 c+S6/vkLT8hmM+LzEB2jhah6QNLgzyd9FqAgu5G2CKPoMlXuLZwPaPtnCw== X-Google-Smtp-Source: AGHT+IHwTmhJSwb0UG1rOpSRK6ekgmxd5y81uHXMaKyWlIHKHAQERVOHMSA2nnFtlJccl0EgNbQB/Q== X-Received: by 2002:a05:651c:213:b0:2f0:1ead:b72d with SMTP id 38308e7fff4ca-2f15aaa3e9amr61952151fa.12.1722793477247; Sun, 04 Aug 2024 10:44:37 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-428e6e0357asm109530485e9.12.2024.08.04.10.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Aug 2024 10:44:36 -0700 (PDT) From: Christian Marangi To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Joern Engel , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Christian Marangi , Wolfram Sang , Florian Fainelli , Thomas Bogendoerfer , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org Subject: [PATCH v2 4/6] block2mtd: attach device OF node to MTD device Date: Sun, 4 Aug 2024 19:44:08 +0200 Message-ID: <20240804174414.18171-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240804174414.18171-1-ansuelsmth@gmail.com> References: <20240804174414.18171-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240804_104439_543162_01FC7DBC X-CRM114-Status: GOOD ( 16.60 ) 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: Attach device OF node to MTD device if defined and the root blockdev is being used to add support for partitions defined in DT node. This permits the usage of fixed-partition or alternative parser with the use of block2mtd module. Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:233 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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 Attach device OF node to MTD device if defined and the root blockdev is being used to add support for partitions defined in DT node. This permits the usage of fixed-partition or alternative parser with the use of block2mtd module. Signed-off-by: Christian Marangi --- drivers/mtd/devices/block2mtd.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index b06c8dd51562..8ff9787edc24 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c @@ -265,6 +265,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size, struct file *bdev_file; struct block_device *bdev; struct block2mtd_dev *dev; + struct device *ddev; loff_t size; char *name; @@ -324,6 +325,15 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size, dev->mtd.priv = dev; dev->mtd.owner = THIS_MODULE; + /* + * Check if we are using root blockdev. + * If it's the case, connect the MTD of_node to the ddev parent + * to support providing partition in DT node. + */ + ddev = disk_to_dev(bdev->bd_disk); + if (ddev == &bdev->bd_device) + dev->mtd.dev.of_node = of_node_get(ddev->parent->of_node); + if (mtd_device_register(&dev->mtd, NULL, 0)) { /* Device didn't get added, so free the entry */ goto err_destroy_mutex; @@ -337,6 +347,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size, return dev; err_destroy_mutex: + of_node_put(dev->mtd.dev.of_node); mutex_destroy(&dev->write_mutex); err_free_block2mtd: block2mtd_free_device(dev); @@ -515,6 +526,7 @@ static void block2mtd_exit(void) struct block2mtd_dev *dev = list_entry(pos, typeof(*dev), list); block2mtd_sync(&dev->mtd); mtd_device_unregister(&dev->mtd); + of_node_put(dev->mtd.dev.of_node); mutex_destroy(&dev->write_mutex); pr_info("mtd%d: [%s] removed\n", dev->mtd.index, From patchwork Sun Aug 4 17:44:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1968838 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=TYjbWKAj; 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=jFXLepCn; 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 4WcRm916kGz20Mt for ; Mon, 5 Aug 2024 03:44:57 +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=Zxhb8PHw4HtxD43GHcVxUQzMmf3igRxpfkME+Y7Suvg=; b=TYjbWKAjWoGCi6 XpRvhgtD/xgv0fAQLHCeS7o5rJFOZSpEAApeakAu/GT6tn+uWPWsqPcdc2o2cPNQHNVkUPH69KEyF YqMwOJCyLA+SGUF1iWhzC/ByRbyr1rsocxzjHtUrHRJAUdOeHOU4H1U9PC56GW+Ge8dI4LIdKTb3b 1i8fy2RGUGsjqTXsBoCNDPIlRMZ+tOJOZ3qWjPmOP2gZ6sstrFAs1Ek1gOS3N5qm6EWVi/1tASrlt nC5OX6uBKMSzcAyO0ZtswKeyOAqhwzacTMINNnNyMeSX+89aa1DAN9ARLHsU9E1isNAHU/VU8qZDg 8pysTB1wOenwTa2nba/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1safHi-0000000Dh3p-0GvO; Sun, 04 Aug 2024 17:44:46 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1safHe-0000000Dgz9-1AKJ; Sun, 04 Aug 2024 17:44:44 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2ef2cce8be8so120107901fa.1; Sun, 04 Aug 2024 10:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722793480; x=1723398280; 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=fvAc4YhKm/u3S+4O+Aw+vXQgk5wKoMLQshnx93IPvPo=; b=jFXLepCnzM4leVp4kEZ5jyfrX4fc7UtwR1RkhPXOq7Oeeq4oEpqeCnnaRZhTESN5wW WqVnDcl8YolUIFM/gI8rBRk9pxo4gj1kuYoASw3cfvM2cRWIn8uK04GvBCZmONQQyQy+ PyyhyNzm3DseBrdJ38zDDNLq7D4RkYzVRGgKPr5PMQVIxJd+LkBlDDTVi0KomZ9QDAUH 7cUq35gjpY2XbhVoxldqHuNk86IpABl0sChzoHvb7BadVbiYI1nwETyxhFBi/thO6UVq xsz2CX/Xh5CYcpMjKznQvPLzZ48zA5MAh008Rd9phIfPDp4kqfKVNBIbaP77IO/be2H0 PbYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722793480; x=1723398280; 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=fvAc4YhKm/u3S+4O+Aw+vXQgk5wKoMLQshnx93IPvPo=; b=ZEsIRxTCx/R5gb7omEL85JPqCCFddj/pKy1ja44WMldm1RW8ek/RI2V9fSS2kE2jGM m2vxV3eohf08fzUXc+Lpytpyau9SeqwQyg8eP5eQxPZ6iVhAHLe6R69mSGXu4XtXgoxD yDhrvTqiFzQMhILbQHq4t7wK00KxmPI9bTJD2xBsia/gy9WM8KhYAkkfRdS4MTQHgOPH WVwUuG6XFY6CSEl478vc6RFf+bCNHTYTmAsWYwm7RYwWqSZqPf1nc2ugacWrDHEDpU1r qSKvHkKy8oCvHcavy276X9833iQ2qJ3dUAq6qAbwOhJ7lrM4LIsfhDVTHcFP8OyX47MM V8xA== X-Forwarded-Encrypted: i=1; AJvYcCXMTkuJ7IroiH+0gAAXaK9ch5tiuRsayd4/1j7LhSiuA1ZemzI+fg9QpVjOANBAkktRYg5iLL/5b+BKb0Zo8RlkTronP8a1c4pbaU6+wxvJQ9D1QNNdLKhdnIaE4U5Zpz+3YbHW4fer6bweKw0H X-Gm-Message-State: AOJu0YysTckWT5yqsie03GZtYBtw2kajl026NzwxjBd3M/7dMFZ4/7D9 DMOyEFMELqIMpJ1ta2nqf/QzzM3yAAB/gUd0aIiqJY/ZQcuW9w/n X-Google-Smtp-Source: AGHT+IFU8AJjmTAyV92JRJYtOdqk61Rt6Gt62ZAN8oIR6M3nrfeJsTuXcuqLW4SL5nh2FbVIg6bieg== X-Received: by 2002:a2e:9794:0:b0:2ef:284e:1d07 with SMTP id 38308e7fff4ca-2f15aa97d16mr69060581fa.13.1722793479648; Sun, 04 Aug 2024 10:44:39 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-428e6e0357asm109530485e9.12.2024.08.04.10.44.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Aug 2024 10:44:39 -0700 (PDT) From: Christian Marangi To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Joern Engel , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Christian Marangi , Wolfram Sang , Florian Fainelli , Thomas Bogendoerfer , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org Subject: [PATCH v2 5/6] dt-bindings: mtd: Add Documentation for Airoha fixed-partitions Date: Sun, 4 Aug 2024 19:44:09 +0200 Message-ID: <20240804174414.18171-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240804174414.18171-1-ansuelsmth@gmail.com> References: <20240804174414.18171-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240804_104442_365932_31F1D2DE X-CRM114-Status: GOOD ( 17.02 ) 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. The offset of this special partition is not well [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:236 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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 it depends on flash bad block management that might require reserving additional 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 +++++++++++++++++++ 1 file changed, 80 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..8d7221561f51 --- /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 it depends on + flash bad block management that might require reserving additional space at the + end of the flash. + + This binding allows defining all fixed partitions and marking the last one to + detect the correct offset. + +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>; + }; + }; From patchwork Sun Aug 4 17:44:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1968839 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=W3vunUMl; 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=LiGpbpuK; 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 4WcRmR0WZpz1yZl for ; Mon, 5 Aug 2024 03:45:11 +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=1SvEYhgsXIUmO0L8s5qlrCavXc3teYBTPWMF1wEH+Kc=; b=W3vunUMlu/6qZi O+BtN1oRhawsxPNG6+A9SAluW2bWknhuU8mZhCg1hMQReFAh5mEotFs6FKmicY+bH9LiMl99W06Hl vEyMYCwxIZxSdA2TGhWJi3hybNiKeTPrZS3U1XR/o7fAmhcZYYCFCdVY8aCberyxwY6D6HJrR/wcq qSq8IgwYq13X2xbrt0g0sdoKnT3N8SeDKkVRllndiojypllgWziGGLbmuUH4KJI9vjq8L096oTk6S 03QL1pH+63r+20NOzLGG1Z7u3G2UlNoHWDtvgky5wMBDJmpWUHDQ5bGNqRGnalqD45OX8QsVYqeGh QP6kSuzwV6H2u6AA9NiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1safHt-0000000DhEf-456l; Sun, 04 Aug 2024 17:44:58 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1safHg-0000000Dh17-2Pdu; Sun, 04 Aug 2024 17:44:46 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4281ca54fd3so58153045e9.2; Sun, 04 Aug 2024 10:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722793483; x=1723398283; 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=9UVSgx2w+2h8saQn7Nf58i+A85otGYnCOTiNQf2qOnE=; b=LiGpbpuKs1k7M7IkmWEk6SHJomsxYg8fAWQw3gvVYQeDPuHEcp5Jd3fN8G0udcN+RZ +VrLvmRu6gf1zqrxCRKNO9pAZ7wkc8JvJeje/9TiDMv4yUQHWnqnAD0M02hwbiC7Sphm 0rIL/pyUuzgOf4F8ePrHWpWYrYfdtLHVyELWO0+jvHunHFPn5ShIhahLAJvRpfD2sVk3 cwa1YaVMJYesCdZHEA1iX94fHVZzLwex2dZCBE+E2ruHDzWRnismQlO3rqxE8NqIDJsu eiPTZCdboOI6qYV9zfwfdxUVgFcOClLVyLTjiecFdOw1qOqznxJ8j/fCwLv7duqCnSSV 0wjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722793483; x=1723398283; 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=9UVSgx2w+2h8saQn7Nf58i+A85otGYnCOTiNQf2qOnE=; b=H7CTfG0aEfS4H+vvccUP2M7jmYvsvuxBdhGjE+3bwq00r3BqL5MGoujeC2749UpYPF h0X+LbCibnTi9Bl1Q/3fernmTww8jmkZ59mxoY38mxx8dWFzi0uM9OiXmBd2fL67Bzmf dcK/l8AeUDOmw3ilZxgsscHfxDoW3csGj3aiMlaytBB5lQ4M0vzFvjCiEsKu9mqSX4PZ ainla0moo6ZO7ofglrMDfcBi6F5RasQ8bv/+aghvVTLagYcTV/KtBY3W0e+hT+EWmihv 9nrs/oQsvjr4JojbnNwp6BbVd8yxOkwu6vJAtbe3mY7lq81HO0QgGwaI6h7QgFLq14AE GZrQ== X-Forwarded-Encrypted: i=1; AJvYcCVCK8gxGOzzUwuF89ed9NRUyO+XF8m9oxyu+V3DYQuWep/ixxIIsZGX1lPCQcMNYqLX9c0m2IoC3YP8isSDhngED6D3xbbRSv8Sv1XtvCrywNElxIiAUw2F6Lwt3olx3ODGe6C7aeqho4mAUVxH X-Gm-Message-State: AOJu0YzRkmr7Vl/olI0h4Ww95+TJCJIK5lz7QkcHJdIlZ9LUrnw9E5iQ 2c1d/uEcdkCmbrTbAk37p0rheYFd/bGaeD5FTuLpbmeadbK+VG7w X-Google-Smtp-Source: AGHT+IEDPxzd3sx2oWn1F3P5fvzhOdH1szNT0s2kg9Hk1mFyBChT102gESKjdtASr5YYir/D+vGkrQ== X-Received: by 2002:a7b:c846:0:b0:426:6f17:531 with SMTP id 5b1f17b1804b1-428e6afe872mr64997295e9.13.1722793482561; Sun, 04 Aug 2024 10:44:42 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-428e6e0357asm109530485e9.12.2024.08.04.10.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Aug 2024 10:44:42 -0700 (PDT) From: Christian Marangi To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Joern Engel , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Christian Marangi , Wolfram Sang , Florian Fainelli , Thomas Bogendoerfer , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org Subject: [PATCH v2 6/6] mtd: parser: add support for Airoha parser Date: Sun, 4 Aug 2024 19:44:10 +0200 Message-ID: <20240804174414.18171-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240804174414.18171-1-ansuelsmth@gmail.com> References: <20240804174414.18171-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240804_104444_694213_7DB8590D X-CRM114-Status: GOOD ( 30.58 ) 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 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:32e listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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 | 56 +++++++++++++++++++++++++++++ drivers/mtd/parsers/ofpart_airoha.h | 18 ++++++++++ drivers/mtd/parsers/ofpart_core.c | 6 ++++ 5 files changed, 91 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..905df53f7716 --- /dev/null +++ b/drivers/mtd/parsers/ofpart_airoha.c @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2024 Christian Marangi + */ + +#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 e7b8e9d0a910..9e078636d158 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, }, {},