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: 817901 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DEF5137C35; Sun, 4 Aug 2024 17:44:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722793473; cv=none; b=gq+ojF0V1vnB4BQDwZZG6fgV5tMLw/EWZj7O/afaJYABwzyo+i81onnJ/EIRyFO3zbii/ObT9mnCOscx0sjDb+/h15oYLEHaS0hFKP5e2YEyLiZXg4gA/1tQBKrJ9ETJtb5bDXwhMAECzly/9gppIB5hoCFNVYj3OMF9oj8Tw2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722793473; c=relaxed/simple; bh=5LbPMzmNGfuxlauoWeKMsm0e6brfLsdQfHcfl/8nZRs=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p2a1NmKz2az9HB8HK/ejg4gOdHQRn+l9+hzrgoy08OgfBADspvBwVeqH0rlhcD5edne6d0noP9pXpzOhkX06uEszhwm/xtBd8lBg3mNYdwC/MS4wVRm6ivINtbsQVeCMOvVXxDxnxQy0IzWI5i+LNiLx8Aod99tCKIeMlBPMooU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KF/hmTht; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KF/hmTht" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3684e8220f9so2684608f8f.1; 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=vger.kernel.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=KF/hmThtjO+KptQRH5cSSRgkGofUJFRU4KrYK08XRHYkgeSEhu83nxhbB5jGvBmaqQ rqikIXgxSJBW1lBmHPd7+juDLPBndDzU6ajUHIfc1DWShug8VDbq5hAS8uwWFhFL3Ryj tG0kfm/0otl0DMo8MH8yhc8R9ZSKNU2idAg4yTjhNZx7zD0h8IQMNVbBE/EXNlmCk9bx cQR4yzBX1c7WRtIY/60VRe5+U55NvvHG1b/QyrohlKDASZgjThyLxq1Z7tZWmG6lKkm4 gFy5Q/SWMAjx4YZ9rdtDiVu97R7ej1iupZIOkYdknFwyrfcoZPYdspkKzaNpHEX1KRgP KHkw== 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=v1QgsDTx0sj6by2kAxlcz6HhxNv0sYAw2Ewz4ZNLE4dx8Mc9ZNyxBTojXSTmWnTyOo o3+ygutuCVLcADaWMPQHZqHIMIv5iY4s45ZfIgzPH5zqXud2ehwwl4JvTCIPcHW2reir Gjhrm+yESxfLWCaBSifEVCf3Qi/rz0ooPuHPqLGNABQ8xTIT/HDNPTHK1icK1U5FP+wa agiUn5OGSi2WZ0b7UA2OeZANWiWiZDaVEr/24Dg3MOioapJYRq2haDe2LjLf/j4MHdxr agZxYHzN1WFm5WkR/5XXqvXIOpc5ZgbYemkLN/mBUDCiCllWyyE4ALtrCHxdKIrtCYNL VSaQ== X-Forwarded-Encrypted: i=1; AJvYcCXhO5UR3gNHyXXzQPjWpDkcLYtsITY3qNI2bBRnps1H9Bk47+6uwRIt+NMnYK9WH9ji2bOfu/YE1591QTDasHwoNBevUttfuZ7fCpEnaxF1VoJ+xEWSNHriIRNp+nMCrGj937jIexChE5v9HlxO1gBdVS4fACVCZJtRKVLZXBcLiFd7qQ== X-Gm-Message-State: AOJu0YzfoYaHp9C917Bj8Kp87+liyfdlROoQtBWlrH9JVdkNpMvXcN/p tMXB5EJSLau30myJVuzMh/R1TpoY3VnhusS/l/OjNiAMD0btdsda 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> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 816677 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF4CD139D1A; Sun, 4 Aug 2024 17:44:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722793475; cv=none; b=WOib50Fxd2l2uBNZ17Ql9bO7Y/fBxdW6klv13XniOySHZmFR3pfKgPcqu+huSuCAGfFJ7rNSgSrZbjOtU5jrKHvbPPNy9nmBpKBGqkyB2kNH8uEsqJZWh8TkTawa5HDPz4wDnSa3rQY25U1wgYm5VA/GwG+uSyQWY2aRwzCJasM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722793475; c=relaxed/simple; bh=P6tl98PPpFGrbbFj5w75g3BxJxNbMlbPQduy4dlyBE0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rj4F61L/aQ1/7yxEJBXG7nA7pKg6eKbfwoiVLdwlIty9J3Iw6pTPOp7GBplKdoGwMsnj9dvYfIxtzpPLt5z+q96AS/pmqtzVbgZiXqsP/mroTYLhl4mzbsrmbQ/da0brk3zLnyNfRHv4hhrt1wfB3YMg+GWKL6nfw63OxWveMmQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OnCwZQEM; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OnCwZQEM" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-42809d6e719so67802645e9.3; 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=vger.kernel.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=OnCwZQEM08v/Zujyjcil9c/frULNyHyWxpWQDLCNM4L5fEqQaL+6EkVzl5H1RtJezm +WIeOJ1+NoHPh3mdLIX4Hm1NK9qFCB8Rfq9aMbFkV5LY4Eo02AZPsnoNPuv1t08tAz4S TU6wNvnLKQ7pKWYTx19cHc0mu4D4oORoNtcb1IaOz9211dnEwAly0MmilvHr6j/UjIJY 8T/DnC+xKbfGW7YRpf6Vi2B5vfoM3QgHFDLJNcJ3jvMDW3fFK/Asle28W3WRh3v4d/is WhjCzDhmQpt8OxjsnqETwCnAjDzsVnIfoYTFisQJyX30XQ5Y5Cas0VNxCqVzz3SulLEY SfOg== 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=AHH6eEB8JexnN4lv/3SunAg0+KfVXMdjdU46YcnQagfdo6nSMEi+GqqbkMSHlS+S3E 3ABRQEDEs2XUTzdW4pjqTgqx6dmR1OIzWKXUfDHPCoFh0qC0c73ewZ75VKtw/rKaRUHj Eo52Evh33MgWcuoUIwRqUwBFqfJvO/TDUwC8YRyE96ii4ChgmoJ494h1r2UVVjp/K+Lk IO7nL820vBx6iG4+NIxlDwLHdZ0YYWPStKJsk3J+uvDeePtdnml7UEc6/lZp0iAdGOp8 0gSvTLVHcg2CgTMhLEtQDhHbF5SFyYUNnji8aPq5RzvLdLazJGV6FNPVQOZ+s1hgM3dx EI9w== X-Forwarded-Encrypted: i=1; AJvYcCVBr/DBCiYdGfClDIkhS9ceKKKRFsBc0Vw8kM9235iOYJ1Ggq0m9OhyPhtVLc6GU9GIynZ0jk7aniG7N8qCP6pN/LaKcO/ugfih9UAWPQhy9eugIiB2GMLNmEEBuGdcc0PROf1cdcB5clLRFBCh7TIl/IPRQSpIVHZQudWlDzCEnqH5xw== X-Gm-Message-State: AOJu0YwdPruq8kXBrSZI67VLq8M4/sFv3gCAtxxWthgYFbSSjjtBZ2iH /mUesmgbUHZFDI0V8uPAw2aquYPntAJwRUM21UvDLJVJpJY/Q2jA 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> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 817900 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 830D113AD29; Sun, 4 Aug 2024 17:44:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722793478; cv=none; b=ZSbwp0SowJLTeKbjTCnH2XoKemsLexqFQiYHDErWbUeGiCRJM5mpMRPnlr8b2rsXe96SexcwC8PdbB1Tdev5xIS/iuMWfZIxqvfeNU3dupABoc3vdwoAvPFYw/C2DyOzPVJ0OzLwl/D0GqdP1oTi8icn1wBaUGyuqVAqNia8Zek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722793478; c=relaxed/simple; bh=0sysWhwNmnNKfHFiwRVWuNqKt3+jxEFZ3zFpJ5/W2Kg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U8BL7HzWOW3gqJO3nIGXMmLuhAfmFHWQ2LMN3P/O/ubgJGnSZP4GF9zWYZL/bgL5NzkI7QjxZgAARI2qFDEE5WK/sl8zl6Pn9fOTdXxlz0KxjmbWz33L0/h1HOLEGEgvHcU9odjVRXsoxwMcMBVA8+ucPF+JCo3L60ZUs6iAerY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jTAeNyHE; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jTAeNyHE" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-428163f7635so66246455e9.2; 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=vger.kernel.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=jTAeNyHEc6Oi3acm0BHrbQeMVAx1dtSkUcfpiasWxd1BKMe1Ibr46XVgvtu4YWIJfJ nsntfXXa+7LCcTALQKnqzc8/CautyJTtjHHERLvbY4DDc7PvQusnDSSIyt3fL/RAKwqR +rDtl+BrBiN/ch7DnJrt2gopn3QddBGLBoGE+uEw9gh5TFM4fqeBUAeCszIQVpmvxZV0 vJHurBiDPmpNLzVC5QqruKgOA4Jzd4z0dXEU63j9YeYoN/Suov/vkbk2N9RcswF6sV7d 3d8aaWanwjZTbEgZxJpE5lY0+5/NYh3dSaHuj+SQSDzVMqlNucWllvSl7xSf5UFhzGK0 uVoQ== 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=c7ESUf0785QkR2VsVaoxawqHNjclLeNUzAkwI2avJDVDZ9hV2etZTCgQ9RmkFQWDF9 HMQjIeHqAOMJ7GTEzGQCslNzinKolHKlXEn+LmO2QLmYieQCVdmomQED4Fur4wQmjfNR sVg4xrGkv18gLcgtmZbm73QJiB0TyoEeUIZHftKVZsoOjhbysuvwaW3Uoz3isIBxj0AX gR1HIcnnZ+o7OWAYNRXCUtysv6S7Ms1rDgQ6dSI1n6Aj6gOmBQ6IO5/J3hZI8l8QEqc9 ZZ0X2P9uMM8G/6ms1jVbGOIo8bdf4uvFc8DXOFNuEB1/42TlBXRa0pGX5pcryl+w41Tp XMVA== X-Forwarded-Encrypted: i=1; AJvYcCUrW/l2uM6ua3l75y+CZYy8D/m08D16gzkoOwRaf8Oxtq6eJTr4lDT/UMK28D+bpUC9Y+SAy/94SScQD25dAsPreCGLZUHM2TH/wYIM0mBk5R5h4i3U8zJl5hyrdtxcOgfEPTgdm0tVeam3rG5JBWoNo5yYB+afR4l0Wo1ZX+EkVgpbrw== X-Gm-Message-State: AOJu0YzwPb1QQ2pu7HIt+iAU4GhgS6YQ94e2D1TY8Ie5SjU7grRVTr3u /yNM2b4uGJEMHztY9gkYJjwo7eV/FQWMAI+SIHDYJSFpK2xrSXco 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> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 816676 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DB8A13B7BC; Sun, 4 Aug 2024 17:44:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722793481; cv=none; b=d50AfIpeTcaezsHYubgLIdr71j06xiXVjsHcX3ZkXABXGzvX43MvyAlJXVeD7T+ZKmvgn/aE0t1qxdMZtuO1vaA1MgT5HkB00NoDAP7ad7sY8pXm+69H2xKy4c/vftG0mCPwCqMoFQsviF8XgYetJ36fHWwC/CErxIyWaW+mF90= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722793481; c=relaxed/simple; bh=i39wCXbk/q1Tvo8ZjWFPqjdA9TSVJhHTaL2sBpHLfj4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MoRqJ5jQbgLkjQmG+dtMDVKgrj7uvFX1hWEvc0tTQbrHwcxZ3abPmC3MNmcMv0cqz0LT3H3DNR+Z1W5HeRPUEe4g/l++9FAAVKyhnLJBRUlQ9bRHRsJkRtaOYqnCu4gkNoybgdzrvuwTBiIhHf3bfuW5H7UHBtF6GLV6pIBZCSQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hk49D1FB; arc=none smtp.client-ip=209.85.208.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hk49D1FB" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2ef2d96164aso108270761fa.3; Sun, 04 Aug 2024 10:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722793477; x=1723398277; darn=vger.kernel.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=hk49D1FBGKjjF1vX1GuJooQ8x8VaIsrLZ02BZ4M2WbCCr0yHJ73aP5rf9Ygf6SZOjH aAwIxlsGH69L+Vf4dPslpA8rXpFBLCwiPYCZGkivlPC+nzybYnImHk0VV10ZlJJf12pZ ABFQZcU3JamDWpm78UQpxzhbMs2RihO+aUH8h2XSg1iM1PRvtGG5uvJXNxD4YwpNKppM pVZ5G0K1p13Eo+RNMVP1QcAdrV6G7hw7jQnl+mL5bGKlDHpUWXmIWNHyjDZCyLycBxnS +dYG1/cvhbTrQwAv5LTxgK+Uzwq2UNXB+lQU4opoCccwwySb+b2HQppqa4etGBlBVuxv E/Yg== 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=eZCdUhLejz07H10G+KfLPz2U3ydv19Wnn/dbhEzcnq+KBXSxRjKF5vkqzpaLCpunVN VdTG6Ij09kpRtPL9ynOi1xYERiKO3q3C7d/qkPPp7dmoLKsYwbfuWuzkuVQUydoLLvq8 i2Haw6ttrgEgk6FZL3McRhP2Dzcrx/4NUR8X+lopamXoSzUGidYe2BIw/n4kAZx0HWCY QQcS8UY7JOKYwv0BPwvldQvIubGQw+Q9fQeY7pLBXlmILj5D9tjxjaEsAYlWXxTmj0Cq 5MpFmMSY5sY9oI7nk5YD77FB0NwvmLQPCHMovYfWlHP3C/nYe5rrYv88swjlgqqjIcLZ cm4g== X-Forwarded-Encrypted: i=1; AJvYcCUL16gbz07YwOUBF9wZoSmRvrk9b+oueGWnM8royWCz6QWI7hBZa9T7cD5BNkTn9+5zkjk7xIabU9MP5PBSKkZ8s7Jee5NgxScBrSM9rQ7tf47QSdX6x/r0ByFvYjR3rsrgMRKae+zldFKMyg+zc3oHISo8QFHgG5HeDHvNZm149nUeGA== X-Gm-Message-State: AOJu0YyFPPci09rs3kwKdbS3GvQOcEYjqsNA8iVX6QX2R3ipR3n1uQ2H LhJMeX2Lk6rOXArXZbzy5r1rRPsfxmq1OwAvuLgrdYTEHJpxhsCV 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> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 817899 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A4CE13C684; Sun, 4 Aug 2024 17:44:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722793483; cv=none; b=UXzMpBy0mtSRk9k3o6mjLBDGPmt5S3HHqZ751Tn5XR87Iv0fDuxv3QInun0LJ5Sxh+8cjgeJyh98UBGPXB5/oO4Igw6bN4Tu8z0ZU9NkJJphj/zMd2xbRzosEbPW8Hs6AB6cv1Ke/1gxxN0ND4+x+zQtiJXscXna6c9W1hcyh1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722793483; c=relaxed/simple; bh=oX/ZKMzDsgeqI5cjVzfnGmIF6ySpnog9LxLFYO3bQKE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PYhod9c9RjVt4o0ho5ykA+ezkqsd4hxoh2eecgf/2AEqLLf2u95VjpHrDlKdDp3s9DfWKynbcEzPj3wAS+JdeLP2JMYNTScTGBYnrbLjQPLeS0xMyNrtob/H7eDmZhjmV6uf/x2181LagPMGKmaQ8PeFoo21HMfvBP7IZXJqkC0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TalXd8I4; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TalXd8I4" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2f025b94e07so123614351fa.0; 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=vger.kernel.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=TalXd8I4fK4eWg9LprzcT2+zwz7GlJ/v0k5zMZQDB9zT9xcU/kS7h3wyZbXQckUdIM 8Ns6YebrOiunGPFFMtRHqccQVDDhbVyfiqx1mUXquutwaGkPMUn/DkVL20XjQWDD4Y20 n8vQg1sN3ufaYkK2MhUseBWmJV48e1hba+VrKrbuyhEQoa/uTmCpt1yKOfkUS9wusblB LXBGVpDuQm3K/h/OMMRU9A/KWGWehShom7SGiWk7jEM1aWs51V2Fcxv+zbSeXhGTj8/p uRBS0WavuX+0sifFhryCJprs8EyscGsWN3FZ1kF43T1z/giC9nvRmLhZVcAqooNWe728 Wn9Q== 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=Q33EQYqOOtEwKfMjzh7ifED8AehH2G0LpAjnMZS3YI66MZ0nMdk1I1Rh538lq2o23v 7S+dmwhT3O4bi3qlIIPIzRrM2IccDZj1ihDD5Rcf4N/enS+OJbFu2mNzEt2/t3LnsfpM vAO7A8RMMl4fLE+zVXsqBW4ls9GLqfjysp6erE6aD6R68LznDlkOIvrAPB0vKtJPqeS/ iA2TNZ/b+gCH1A7Z/rTOOX8qJYv7Rh2QBiFFDGlaV2qYYeEiuSnVtc5mNU/KGRwRgacH zn5/zdfIP2AEDuSt4aa0o3NMahtmFdEDWFYgyYALMAN+JmBnd0Jzo/43XJYBWXacoEgy ugPg== X-Forwarded-Encrypted: i=1; AJvYcCWD45zabf+dITj3EAYN4MwF4oO0UgL01kDCcTrbqQDnFqIz7iKyYCGoWg/Py5Id67k/8f/hXFlZ6IcxnMNK3m2jzoL5pDhXT/UsOHuhJUyoG8kUx4GGUKda0Ph+1GH5QM5tZ2tXTLD1VW2AAWu/VUb+gA1iFGovbE9M3tgQ+zId6S5vPQ== X-Gm-Message-State: AOJu0YxIDOrfPu9W5Og6rRmBOZ3/negzzA0N0EFUPh4NglDBC4q1p0eF vTka5VDaP8lk122VtoPk3vLTnh2zwMzvlWOK0tQkwnQJaHtqH3kt 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> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 816675 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7082A13C9B3; Sun, 4 Aug 2024 17:44:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722793486; cv=none; b=JX+J7okosr4GylRW+FylPTvpfm6Zm1ufWLcDInhokg8I9Kgp5AI4SDULPSLlDguPm90KB/0InYfuteX/eEHGXp+TrvdN8iZHTnKKaRKHBRUYVfd/dVCCgAaIPgZCxIGlP2y/fEg+anWmf38meWkUo3d+gcxLty9AglklspVgDzM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722793486; c=relaxed/simple; bh=lmFBhiEFLBTNsYdGWhN1b++NrZ+263IZTBSJ7kubIr0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MtpGp3pn/n8NB8/FpvZRwdFllaHUlGCMIupkvyaAJDoH/a8dvW9rwedF3ThQsc+sPZqxUle62bcV0i6JCLxNYg28t08ndLpyonbkvQXYCTOZVqiMQlQ6c8z38ds6uQ+ookiRYYnNFofeVWzRLkkxD2Pt/Km/HON10bmaZr/yEwI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EDGYKwkG; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EDGYKwkG" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4281ca54fd3so58153025e9.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=vger.kernel.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=EDGYKwkGKiZj9hr6qh6zBNxbLtkYsvyMxIDlaVtTJvMOnT/JgYPeiHlm2/dzBQkEqI kz7J8Nfuh7+8EUSq5b6zNbGC1vvf45m+sFTevNtR/qt+FGd769SNz4Sds+aVhf4JdZY+ idb1dWbgAzXdEVq2QhUMJ4B52qVOjJB++xK3SikF7yRhgby7yREUOwMmKTV2RLqrk83j 0b5KSg3Sg8pldrqFdwh9jNoGiKjZLuwGUWj+qk3mogOi2vTYuDWoiggfOLuhKKHdG9h6 XteCawB13GrIQoVG7icKAEjgmRY0OtY0JHCy7RQ+3gTGlsZXXzxpXc/VtWV6kS/tYwAe fBLg== 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=IkcpEYVtVhn4QN4GVNsxdoDKLMfSpiaA2gfkSkM2ZpMQ1jpG4VoghEfICc1eTSRt6w npW2vXNzp9TkRa4RKWyQC0uMj1GCXiRQlZ9TAYuAu1nXNSle8Nft4xNtGeOoD5Phf6kb OhI+TC1vDcmmtWTmTfJnVTyHCDl5+afJzJxX8kaHLkUbXAoL7XdO5jOpmB22x/Yw6rU/ oiy2CfDdaNz+0eZVXLpQhGM0vLdnD6h0xMtLHFpBwYcpQNf+eGu9VBprrkVWTbDajTkA T2OX+MbzmYZF104n9krtJZJNB8rjGYyJjCpu6NxvBPCJglagO2xAuwlFRVBGJhYQzUjt tmiA== X-Forwarded-Encrypted: i=1; AJvYcCVVVFbQel7k8K6k3Fq9Avc/SEyldWWap0tXfOx8htN2FqZoczsiRuJpjPKdu7REwpgG4n8kJ32/vzfT5fMtYhRXK/xE4Hr+RcrENG8BzgaLW6OccScBpifXkAyA9XC9/Jv3ZT2eblRuWoKBB1ZfahWPlFbl5emjqp0/FW2coPAGF+AaOg== X-Gm-Message-State: AOJu0YxdSfAjQOz/klo/xNN9fdSlwF+DlMZfc0ZyqYu03Hg1BL6fS75S LyFdKIpdWmazPqj3S2LrHz0X1ScL3uiCM+rQsjnUxAFZjPWnG/pv 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> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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, }, {},