From patchwork Fri Aug 9 17:20:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 818230 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 74671166317; Fri, 9 Aug 2024 23:02:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244551; cv=none; b=oftSEtSUX3RIPLg3jB2DAbB3u3R3d4dR7jDItYvCCqSwBmY9W6F9cVf7SjBrT+pZ+iviPjj2RlwuYY3BjspZO0wYdP9dyxkWDh7NfiTQHP4XjUWSbz4JuM95IZ2ScFYDYRNiAm7TboQaqAolhsY7nBQC65wkLIF9TWRXKBB5l8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244551; c=relaxed/simple; bh=5LbPMzmNGfuxlauoWeKMsm0e6brfLsdQfHcfl/8nZRs=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bwuiA7uQ3S5XV6qInIKkLfIGJsB0egaec/jQ9HNtHfANhJzGRzhRpR3vgNhrkOhDXfK46H6awyP5NUxkUxalLRq9wBbTcTsN7/u/s5URChHGIdIXvXE5qvICGanD6XjMIBYkwd/X74yX9Obyiq06JVtHt/n+j3SMD4MQVg8JvKM= 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=dZyMRSXX; arc=none smtp.client-ip=209.85.128.46 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="dZyMRSXX" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-42816ca782dso18655395e9.2; Fri, 09 Aug 2024 16:02:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723244548; x=1723849348; 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=dZyMRSXXS0gAN1Gc9zS1OVZLLylUhcmbgFbWJIJNoGkQ6HxQoDt4NShJJ05NMRTrFS 4xec7pLPwT6EvgPt54x6emNKaFqliJ7Y3ibEUAwo9EiosaAqcF9/E7/fIEpTeoODFmuS HebstWTfR2gDlTFKN98hmzILlx+flxfaRp1Jpwv/mYF3YusDbQNrzLdwwdjEyzwGzIHj qzr3juMl1hbnfYHLOaGHSsJ5oO8YosnH2A59kpihJb5yOWX5MImqF8YCBDKcatWN7RFo eRdMWwiux8OuaLgRvqAHiqBG7rDF5qUehYO6UfRURQAkjNM3kvRcWQwKPanC/uwn8OMB 1x+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723244548; x=1723849348; 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=bAuqQM6xEEZU1elV9UELCKHKKuu1k+PFS0yC3+EeE9QyN3NVM4BhHJw+LNMzqV/3TH qMrJG0nYCObDyM4opjWzMwmlH5ygZHpqZrE3xMj/oKRwdcE9LdwyyrYdelCRzOavzX5x 4YtF3opV44aDW77Ex0jqTAZ3JvPoHZiBBHJO/+sFNM9QwoVLVa2+ZYzoaIDZpxiqcx2v SyLSf+PKtZ+sdyV8ewVPRggttqmSCAgQ0h9O1ld0o/KJBpN+9TbQstXuwNqjVqM64vwr MoElDueUbqEo71CpefG74lnxfqvgJLr8MYSk+u02lhglTTTD+BmRIBK85NNf6RuzGVA0 W2uw== X-Forwarded-Encrypted: i=1; AJvYcCWyseFm1s6FbMx4N0SbHlqQM03cW6rvA+xgtHLPpAUFiRsuOAYTQIaqno7A+0Tk3lFxeL0vzg7xGAyzjnZTRs/hOwNmFQkQg/3E4MITi6QT5C5ejZXjJrmH0hetD/68XbWPOxNdZn35/Vl6rOvw7xoj/EBugITKpA1Khx74w+6AV0wU9w== X-Gm-Message-State: AOJu0Yx/cbKEtFppcQt1kj0wYkOA7VxdFQXgXz/o1kcU1b/c+s7X0pd9 c7ZxIH2XCjchmEGXlq++yQnljt0ojGz7MT0qGPPQP/JGBOarTJjk X-Google-Smtp-Source: AGHT+IHFgbKyEx10eub1CxAs8MOPrz33JkUp9CHrjEA+O5aqKs/q4nCgeahl2FdAWSLxkS0xZ29OAQ== X-Received: by 2002:a05:600c:568f:b0:428:2e9:65a9 with SMTP id 5b1f17b1804b1-429c3a52c4cmr21777295e9.28.1723244547725; Fri, 09 Aug 2024 16:02:27 -0700 (PDT) Received: from localhost.localdomain (host-87-10-253-138.retail.telecomitalia.it. [87.10.253.138]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429c75044a8sm7987485e9.9.2024.08.09.16.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 16:02:27 -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 , Saravana Kannan , Christian Marangi , Thomas Bogendoerfer , Wolfram Sang , Florian Fainelli , 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 v4 1/7] dt-bindings: nvme: Document nvme-card compatible Date: Fri, 9 Aug 2024 19:20:59 +0200 Message-ID: <20240809172106.25892-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240809172106.25892-1-ansuelsmth@gmail.com> References: <20240809172106.25892-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 Fri Aug 9 17:21:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 818359 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 13F6716D4DE; Fri, 9 Aug 2024 23:02:31 +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=1723244553; cv=none; b=onrGaZ1/35JCfx61v1Mulh7YhALT3TkqpLTGAE8d1SBBkJvl9wXEkIdjJqvZXt9e+FJ6RnQyC+ah0dexwNr2zjUnV2o4WRsVvzVH2K2S3Q0ptZnppK7ZLI+N1c/wlwmHXq+2+Uv7/rh0AqlKMnkLYjmXGlh3v/rbTeF9uXyb3Xk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244553; c=relaxed/simple; bh=P6tl98PPpFGrbbFj5w75g3BxJxNbMlbPQduy4dlyBE0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lZsYuIh1jTD25c3LBIMkaX3HMRuCIdoVMg4IGqLJ2Qdy+DWSvmryicsH9wCggdVQg9E16Q3SOMigb8psFFvpU4KNyRPgkSrs0OkjaDeA2GbThdeQ6qrm0H7xaTX5I3Hps/XQaEDwNZtfgm6z9p7E/UM/fpb6/eOgu3Vwzm+PO3A= 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=aQ5STpiI; 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="aQ5STpiI" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2f189a2a7f8so26297691fa.2; Fri, 09 Aug 2024 16:02:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723244550; x=1723849350; 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=aQ5STpiI548Jc6P+Ykfxfrd7T2wEL7ep3oRoMId3cGoTfmdBzjYlQa5afQHxy1AVCA yBn61oVL+ZkmAZe+nDWsCSd5jRWLNV4c26jfrYO3y1x2H/YGOmzmCZflKfCo+BpvGmAz d5oZbbhgKRHzmAvfqoKQr00GnZS1fhFpmh/t6oDFVJp5LgA7Jnmw9DGAexf4GlYmXFXH 1Ba3cp4CZeUxXkf7IiKDFX/oJcSYU6nrC+bmq9sHm7ZvemiFifcSBxBBeVVcCumEvSZ6 HqXtAX417uuL0nKGNMyrCvWUFm89gUaRlwRIZ45eXiI6c7LMooVp2TLt6eH8D4syTzkt umnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723244550; x=1723849350; 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=U0z+IcQU8u4/+WDrlfUILFdmjjnUlnfrQPQndlniEzOi+MgcliRskJJJDgSG9SgsST Tta/K3jg+1r/84sySxpKYt4wJ4xLn7G3AtQ4KnqfILTLxDhMw+sdXGiDMuMHsoN/v95f Nd0cNHU9oBNQP21O+d/l4bNIihji+0eweUUAFbspanqU1JpqvJRdy9O50TEt5y6wGVTJ P3WWXo88JRUz8DiZUocmyNKo+caix7sGw2SjVifm+S6U2W3QB4+T2ZLIBL4VItPeYNsz Qu5unEn2d9S6ypLd0PpnfpF6XSpSCMM17jd63pYobayWf5as7UCOeLZWtpF4BwpX4MNG nMFw== X-Forwarded-Encrypted: i=1; AJvYcCVLqFebroocQ8dsiwM3c2R5OhS978/a1/xX+/f+20b+esLW1Z9iv2egBNu+xlfSXFy3owcE4loVjb0aPu73OGuIzKP5VVqysWgVfszkWzxYeRikI6LDEW8qCzoldvTV72A0JOqpkkDpKk2DbrUYhiEKHbpFK73LUOEiRT/i/LYDgxcPAQ== X-Gm-Message-State: AOJu0YyeW6/+TYCUHJHXv0i2LszujbCTbe2QhjccbkXC3lUO43hS6OC9 om5OWDCLET0mU1whl9Sy2ctjfnKjuiQFmHXWIcX+s76iJ/sDVrKYaIry5g== X-Google-Smtp-Source: AGHT+IEgI2zjmdRYRlZuFS3JMcj18YcXEyrI/y4EefxeFqU02qwA4OQ98srTe294d8hiQpQ1tz2BoQ== X-Received: by 2002:a2e:98cd:0:b0:2ef:216c:c97 with SMTP id 38308e7fff4ca-2f1a6c65834mr20972061fa.19.1723244549573; Fri, 09 Aug 2024 16:02:29 -0700 (PDT) Received: from localhost.localdomain (host-87-10-253-138.retail.telecomitalia.it. [87.10.253.138]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429c75044a8sm7987485e9.9.2024.08.09.16.02.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 16:02: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 , Saravana Kannan , Christian Marangi , Thomas Bogendoerfer , Wolfram Sang , Florian Fainelli , 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 v4 2/7] nvme: assign of_node to nvme device Date: Fri, 9 Aug 2024 19:21:00 +0200 Message-ID: <20240809172106.25892-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240809172106.25892-1-ansuelsmth@gmail.com> References: <20240809172106.25892-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 Fri Aug 9 17:21:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 818229 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 48C8016D9AB; Fri, 9 Aug 2024 23:02:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244554; cv=none; b=gdWwVcCGG/AraUsM+IFoqedQ9iINbYNlojhFXP0FELX7y/kvPB3kM7deOEadeX9Uf2gDXVehSEa69KZCQ2oMcjicjgQbb2rzFkIsr2isqFFpY56kUUj6sbTdBZvzjouRmbMevQi2YesrqSNadFS7EUcuhoWkiubauKpw2qWkfHs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244554; c=relaxed/simple; bh=0sysWhwNmnNKfHFiwRVWuNqKt3+jxEFZ3zFpJ5/W2Kg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yj7go83GGGzUdhIbGlKpdbTVQ1LLPYxC56cev6thAKQc4X43N8D2W7Yl2ezzDjd13uGHVE7VVDLsvGl8p9asonMhNJMBPxsD1TP2s/REaqIZ+tbob4GlEmurscJSfYVFqoFoIksfsjgNmT351NfjaEfAMq1suaIF18I+ksp62kI= 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=SOGnMd7S; arc=none smtp.client-ip=209.85.128.48 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="SOGnMd7S" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-42122ac2f38so14781005e9.1; Fri, 09 Aug 2024 16:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723244552; x=1723849352; 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=SOGnMd7SpmQgHck4TMbHO7JQo1YvL1mcR3+bq9E3HS+6HAAiw73a1bBJ8nLklaUOMS UgvnxKaWYYuz84rWluyh0aLXmIFp6v/+SlGHDiO3Z31C73AoWbBWI9y0iJknb2jjZwkE OrHFJfVbbWaXI+PES/KmmRzrYJZt0BtOebnSvbJDtfoZLnuPvwdDecwPHP3scHxG2vVg VaZEjkko2L+i3RALIjlAz94VgpxwtSLbB+HfdGMYJwZFyFBpa+q28liK373SsqycH38U KMhOy8JXFNO+iS4+I+gFO9GPFBVJGmJzmfKvwg47Sy2qLoa1dGwohAZ8PuHUNRw5j5Aj moFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723244552; x=1723849352; 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=Ca4bWSraooj+UxhhUgw7Dr+w/JxPr22thDYRLKsSMaZBsCGpLqt77bVoWhQlR685Ru b2+/27IxilRS/s7dm93VDQijnSTTJDrmIe8sPmENfo/JR0AxNyy4jao+tIMYJRC35tL+ KGS7uIHYaX2DOZgGHfYTUy6snFApTLnS4RYHwUqopG6pgiGp66vU0XSk53tFgKeSp8Pe qZqCPa4qBFfxzrhXTYC9mFSwlTDxMs7tbXZCZkeBzLdebWmZ0kRCZ3c1JPZvWxcaFg24 E+2SDFwP7PkE3BHvhDkoh+YeqSXupx1VdRgcm5D6s/dfRf8kpXMiKfIhW+4zwcT7GAJx Hbfg== X-Forwarded-Encrypted: i=1; AJvYcCWJ7AdvRzrpCGogKdTT7I+SUaSncRiHE5QBs2HFztk7txmekeJ8dsqKkVvua9P5YlbGqHr0FTXAv2iLX9Rx07Ik8lNw+jPeG3pQQ8Iv5nmnzOU1Ujaga/sEFOEGdyvPBN+yLTWdYOI48ufhcnHJk8JCtqE6vfEUUlN71IHu+wQPqxJrzg== X-Gm-Message-State: AOJu0YzgHgwuKOBWXifrwdw27PHk2eFX2UKvpyPaO/qfG7I3Rp/9joC7 6S01V93WBwTqYD1u8hFTw8Hd81IyEkKROkSfLEJ3mawN7d+nJtjo X-Google-Smtp-Source: AGHT+IFxZor+5gNGTlA+oAGQcOKniA7tCPtYOXKQQ764BxqhepnN1UfZ1qeLzc7ivDbkqqu6KUpp8w== X-Received: by 2002:a05:600c:4e8d:b0:424:a7f1:ba2 with SMTP id 5b1f17b1804b1-4290b8dee6dmr56055055e9.17.1723244551486; Fri, 09 Aug 2024 16:02:31 -0700 (PDT) Received: from localhost.localdomain (host-87-10-253-138.retail.telecomitalia.it. [87.10.253.138]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429c75044a8sm7987485e9.9.2024.08.09.16.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 16:02: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 , Saravana Kannan , Christian Marangi , Thomas Bogendoerfer , Wolfram Sang , Florian Fainelli , 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 v4 3/7] dt-bindings: mmc: add property for partitions node in mmc-card node Date: Fri, 9 Aug 2024 19:21:01 +0200 Message-ID: <20240809172106.25892-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240809172106.25892-1-ansuelsmth@gmail.com> References: <20240809172106.25892-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 Fri Aug 9 17:21:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 818358 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 C953216DC32; Fri, 9 Aug 2024 23:02:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244557; cv=none; b=mqMkE17qUtO2KmZ3sTy7k+hKkSRMW9g0lQKijxdI2eQ2OhdakDJjZAapHqjOjuiWv/XQgN92xxXPKuj724lh5ZKODEhrBFqvcBPPvQRUtjD8I+zq/7RKksDmiOQ5l6eZdkYDWn4e2aLyub2o2MiEZ04iKZodQHw4KoZaSpFxYDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244557; c=relaxed/simple; bh=i39wCXbk/q1Tvo8ZjWFPqjdA9TSVJhHTaL2sBpHLfj4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PvVpp4F1jMgS8j3D6ror7TtS0Bc4zY0a24gm64KWntxCiK5E3uFbhetjRfm72GI4O6iaV+ZLoDSEp5p4b9VNv2SITDmncjmMLgLdDgST0GfEl9t/hK8XvuvidYEplEQy1zDFIUdGIOIf6qoPudhEuquCrBU1HerY29peByezBOk= 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=G6BM23Fl; arc=none smtp.client-ip=209.85.208.169 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="G6BM23Fl" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2eeb1ba0481so33345651fa.2; Fri, 09 Aug 2024 16:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723244554; x=1723849354; 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=G6BM23FlXcCPTcOak9NDbtS9061t1/JNTXwt18wCvCIJ04vxTlmNgsWjJpFvVwUlZg 3bqc7OQVq6IClgX0bBhwTxP8keh+kaGVsK+/4pHc3P2EWGtuLfv/byQcfVL3FsoWzMES DWtuhtlXrsRPwtMyhVeuAcQqYbcN4C+srncz0s578L31lY5kDCFiSA0B3Rx9G06Wv7uU T5of31F7e+z/fWV+3sHOcTaWooI0Rns6ALzwGZEDHYUWWh245jwcDKk8OAR3c92zYUhu n/a/ysA4ItVmxZ8iF/lfv5gAu9178+rzgssxtPp86b+A9bfWPSS1oucPKhLVqoHoOm0X X40A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723244554; x=1723849354; 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=Yrun9Nvz0xT5z7ArF4ZaBv/mGjE7yQSr8OTqTQYrXSJB+VrgKIsxMUgciZSfOa2bfQ zS3H61QixkK4YPneAyt84nwXgD6RWPJBOcW7KEP8yZIjW2oQ8/u7MUHiFfdYGieUbbOB X+ZEAplNjvnHWXTcKqLzjkbg2tq9fFXgiuBsvur3OFLGhwgl5HSqMVMIQUOiqiTiNzxL gXKxMBvCIo/4k0hWRZrralUDszS56RmfCzOqIYjJ4n15uBbWtu0xK4G4dZQPJDXvAJxe TEYn27Jkl2yfnF311G5ZXQ7E6KU0LlslHpVn6dECLTMIhcorxixvMLqbHAxvzS1BBwE6 QYGQ== X-Forwarded-Encrypted: i=1; AJvYcCU2itlZkj2dESLH7vFCymEeqAr+Qj4sYRr23yji2004hazcKLVCQ3I1rAjMQ0YTejsnhFkD/UlBWiGyiNXEbz5h1X5DGFx8jRTjKSn7CIxd/44ueSQhhaE6Hp9zNp9kUhr62vc1sfa+yyfrEP+6znFeqca58W3ck86w9+ZPo2HhLcoeSQ== X-Gm-Message-State: AOJu0Yw+Uj1dhTfViXGLSnTps4Kv0RC1CIotgjPlPYFRCjdVx0pvcBHS r+NN4cBR2HW2vyWoDjLqEUp5dQXSs1G0BxCjd6igTEVspFpH/5tBFvXOsQ== X-Google-Smtp-Source: AGHT+IEF0Y3NVeo/gUFLIVY34RZUu3ByxZUGMianP0w6Y0uhOo40dlxWIt5krkPxbZ2lUqfhtQM47Q== X-Received: by 2002:a2e:a589:0:b0:2ef:228a:1b86 with SMTP id 38308e7fff4ca-2f1a6c6b8b6mr20863381fa.21.1723244553325; Fri, 09 Aug 2024 16:02:33 -0700 (PDT) Received: from localhost.localdomain (host-87-10-253-138.retail.telecomitalia.it. [87.10.253.138]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429c75044a8sm7987485e9.9.2024.08.09.16.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 16:02:33 -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 , Saravana Kannan , Christian Marangi , Thomas Bogendoerfer , Wolfram Sang , Florian Fainelli , 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 v4 4/7] block2mtd: attach device OF node to MTD device Date: Fri, 9 Aug 2024 19:21:02 +0200 Message-ID: <20240809172106.25892-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240809172106.25892-1-ansuelsmth@gmail.com> References: <20240809172106.25892-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 Fri Aug 9 17:21:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 818228 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.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 0829516DED2; Fri, 9 Aug 2024 23:02:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244558; cv=none; b=gPoS4WxqJtsvmRE/LAy+zh5GMHZsYwT9AqmXQ4XriuIRvVt8q+P+OcJH9G8sddktBgm/7uoG8vRNFoYEjxJI3yA4QXsjgOJ+kMMge8lQs0obRG2Ao4EAAWUG5dubbwWdsvttWnheortbFu9aOzSvdL8ZugQCiNvty5T/FNPHcpI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244558; c=relaxed/simple; bh=yw1mImiPrjqLQht4OtSvNd0TeQGoObVDJhFgu2dtlzE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Nd2iPFKcoaqBMno7RJ++QOf40cHPaNgtDtjDq+V58a+8Kw+V0Ah322m0e3OivOXWjgrjzUmhWVHUDwqkThkA64CDhhpern7h7mPbEB4AevjiKhwB9Z33MuyUz+BcT0T92HJaFwGImvcWarl/YCSOckr5vfOVrvmQku63UeuP5/E= 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=K3q/Cr2U; arc=none smtp.client-ip=209.85.221.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="K3q/Cr2U" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-36bd70f6522so1345482f8f.1; Fri, 09 Aug 2024 16:02:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723244555; x=1723849355; 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=mH3iAq1TAeBK36lg95WliQsOcKLSEbditM8M8e4wTwE=; b=K3q/Cr2U2i/+4BWQLT7P2GIIb4FKAoPnGQcj7TmQNhZvxWM5+fkghEaNfPCtPzcjoK 0m2OxSB2JwKZqWU4mUsSPS9lhweC1flWvhD9atNcsmDS6Exb/bhFjXeFihY4KdUDElQ8 4sJyAyxeoaHHWPkh9RiMe3O2QrkZ94b/KsasoU/gPX7cDFgLgI/gNoomrN68kdCQcsIf 9WLxNQO3Bx40kix5hRT7fE06S74+9sWgesng+UnQd7H4sD8zhcCd9B526Vpfq3d7i1oz Q1e44sIS59+L6i9aGGv5P3zM+qOPDlsHtaHpKNGK9IUTWd+wN0+Ia0lfC20hVdaCwzeo c4Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723244555; x=1723849355; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mH3iAq1TAeBK36lg95WliQsOcKLSEbditM8M8e4wTwE=; b=sAhOrEzPDxjAkvs5ozAASu6Jjcn+BCy5Uv+pE7XQ9R+Z3yjVqDhSwF3PZ2x6/kQ/VL Nw0PEUKnMTE3lZH7cQXJmr23PX96bHsOCfzp7Z5XEYb4LiFa9f5nz93IEe6lgXaA13qW KMj1raQVF00bHOM1nf1VtsNmHrcgqGZWCCVwUNTYSfXOTs/3AYPC6DS2ifdgt4k7B8kC JIxpOXd8S3X1kD6Kmlxmoq2O2dvmjJLdyAxpUODQjHq8ZdKsiIHmddnWug2+lzXn5PQE UrYipDNHli7v4J7bp0ydOhAmNdOwVB25WxxmeOAaGHev09dcHqhKlRaIOAS/zPb7wish yyZA== X-Forwarded-Encrypted: i=1; AJvYcCULQcBGv3okUDNnVggJuGU0MPLtNLEi+cf4tyfeAei9smlQE1AQ941BP1+SCLV0vtC+HgAtpLMgsKgYPEyYT8IToBK82j14gUR9gHB5AdqVLSmlCulNMO/oOZr6YiTB1WsVUzhkqtJDDIkjvj7Y85thrH5AIxfbCl1DD7S/mUcqexQZUg== X-Gm-Message-State: AOJu0YzZ1GjDmPVRg+hYOftXu6X+nJv4IjEju9Vf9bHX+sV0n/XpunWX P3sAyU+WKcU+HEmcWhdCRG8tuhRTukuuKIeG/1NkXL9JPyGj5nsW X-Google-Smtp-Source: AGHT+IEYUgoe/HmhkLHhfaXC3TnoDjBeLv9p7ql+4nY9eg91VGbHZYMA1St4QZZjnSafD8UlbLFHsQ== X-Received: by 2002:adf:e98d:0:b0:367:91d8:a1d2 with SMTP id ffacd0b85a97d-36d5e7fa63fmr2252440f8f.30.1723244555242; Fri, 09 Aug 2024 16:02:35 -0700 (PDT) Received: from localhost.localdomain (host-87-10-253-138.retail.telecomitalia.it. [87.10.253.138]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429c75044a8sm7987485e9.9.2024.08.09.16.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 16:02: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 , Saravana Kannan , Christian Marangi , Thomas Bogendoerfer , Wolfram Sang , Florian Fainelli , 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 v4 5/7] of: also export of_update_property Date: Fri, 9 Aug 2024 19:21:03 +0200 Message-ID: <20240809172106.25892-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240809172106.25892-1-ansuelsmth@gmail.com> References: <20240809172106.25892-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Similar to how is done for of_add_property and of_remove_property, also export of_update_property to permit kmod to use this additional function and correctly update entry in DT. Signed-off-by: Christian Marangi --- drivers/of/base.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 20603d3c9931..b2d523cf4925 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1746,6 +1746,7 @@ int of_update_property(struct device_node *np, struct property *newprop) return rc; } +EXPORT_SYMBOL_GPL(of_update_property); static void of_alias_add(struct alias_prop *ap, struct device_node *np, int id, const char *stem, int stem_len) From patchwork Fri Aug 9 17:21:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 818357 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 DE2C516EBFE; Fri, 9 Aug 2024 23:02:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244560; cv=none; b=OircUqjrqd5COYGlRuXhUSB+duknX+prE1UOQ+XmHX8r2POETUJ8hlNrwu7piW3Bp1gIuu/jrPddauAvY7d/niT1By/fiS2IK9WIUmBSntHCO5QMnyh1HWw6pw+W6AfjNfpntTtx7wkgf/ujj+L5bXHskWbeqFbuJP58jBucGGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244560; c=relaxed/simple; bh=6IE7tvskZW59pVR1UJxmlFcac0npVXGRA3ZaUx+Dgm0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DKn3O04EERmDbUcHXgtvinc2Xj6r3kEFo/XeMsrj0YhRUGsnCU0cBSAtZNeEOwKhCmTrXv+oSoMrAclDzYprDr23qFcZW6UEyqFnWYo0dj0q+2wwqdkwXRfypFxq20FsxgfR06fWC3vGpNkI4C/cvanBlqd9OZgkhgCQpUSRKc4= 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=IDJR4Sdx; arc=none smtp.client-ip=209.85.128.41 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="IDJR4Sdx" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4280c55e488so14898175e9.0; Fri, 09 Aug 2024 16:02:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723244557; x=1723849357; 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=5xBEuESArl0fBfjXYsEhDBEbTfGt9gI5ouD6sU73/GU=; b=IDJR4SdxSxLqNgeXEePRJyA4IdbZdAU7QfxsdH4xoPlhRp8+N0b0ZszmtFuf326YT5 fQyOoivU6WGta8sejgC63LLTotamldOH2fvx+/7jmzYmO5DHAuIQQbflzNYLgV7vvHUL SMRN+KhZuI8NKcCtn54u+QlqYxKGnk4lZ6cnyv7gkOvQhHdiEe0a+e3pC02hj9pIGCUb zDhD5a4ubze/IpchfBOONns7AbO7aI1H+AjKdKirUneoGw2u2uVTBVXnnULCCOvj4ZVL 8gT4q1r/ShKsDHTT3ncNKXm3+QBsTjuPcXT2JRXP0jITXicXkOZSBHSDWh2i7mr9EIA/ tQ7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723244557; x=1723849357; 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=5xBEuESArl0fBfjXYsEhDBEbTfGt9gI5ouD6sU73/GU=; b=FTQxIEFyIY3/o20yp4MJojlteAnQtFPtpFL3hMEz4z4yJMoPSu933TbAC9x2X4vOzK 1mARGiZ87TWGmqPe+bK4x7DMKncuF16de9PIMUhZKADRtlEzHJC2fD/HdSUPR4yQPbYT j2YweJ0Zq5KnZkCP1BpfUigMVSvDGW0ubdkvyvyCYIIN0jlpzfAzXdRAaC6YHmUyiQd7 UPDfqxYJvFrFdhTIygbp/59bcMLpH4Wm8pCWdhtFCpS4RXrDfhHQsj8+th30ipRhXvqv 5fHFKr/s9Uxyza+oQPnlMRWOsmb15oIu5ZYzPygC3A+egVuYO9WO2RCyL6Pa10eieuZN mC2A== X-Forwarded-Encrypted: i=1; AJvYcCUZiSmUfnwLUbrRKO5raSFBDAiv/wTcDOJP+utfxov4DGKCTg5quENtdegXlZ7HCx2xUc55uOMfqfCKK7orwwzO2qZef6u2Cdnv8PONzXHuA57JR/mittiUoLPbxy8hGXlr/wD+nAgAyHCoz/64TPnnzZ+bO+PP4M4mSNACbJth331WwQ== X-Gm-Message-State: AOJu0Yy9Wglqm68eEzTam31h1ABCVH0z7vE7tb3KTIZA5BdrK6PgjxcH nVsXof0xBZSaHs/2FHyUIgWbSwMtO1Rddha2LjHXWsvVnQWg7ly5 X-Google-Smtp-Source: AGHT+IFaIZzfJMZGEZqQdwrs5TglTqfV4r7biRyhTVd339hoMEUvKuDwHH0rtXy2N3qYTRaD/OaGZA== X-Received: by 2002:a05:600c:1394:b0:428:9c0:2ad with SMTP id 5b1f17b1804b1-4290b8deddbmr49137295e9.18.1723244557103; Fri, 09 Aug 2024 16:02:37 -0700 (PDT) Received: from localhost.localdomain (host-87-10-253-138.retail.telecomitalia.it. [87.10.253.138]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429c75044a8sm7987485e9.9.2024.08.09.16.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 16:02: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 , Saravana Kannan , Christian Marangi , Thomas Bogendoerfer , Wolfram Sang , Florian Fainelli , 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 v4 6/7] dt-bindings: mtd: Add Documentation for Airoha fixed-partitions Date: Fri, 9 Aug 2024 19:21:04 +0200 Message-ID: <20240809172106.25892-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240809172106.25892-1-ansuelsmth@gmail.com> References: <20240809172106.25892-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 +++++++++++++++++++ .../bindings/mtd/partitions/partitions.yaml | 1 + 2 files changed, 81 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-partitions.yaml diff --git a/Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-partitions.yaml new file mode 100644 index 000000000000..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>; + }; + }; diff --git a/Documentation/devicetree/bindings/mtd/partitions/partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/partitions.yaml index 1dda2c80747b..ec254e03adf0 100644 --- a/Documentation/devicetree/bindings/mtd/partitions/partitions.yaml +++ b/Documentation/devicetree/bindings/mtd/partitions/partitions.yaml @@ -14,6 +14,7 @@ maintainers: - Miquel Raynal oneOf: + - $ref: airoha,fixed-partitions.yaml - $ref: arm,arm-firmware-suite.yaml - $ref: brcm,bcm4908-partitions.yaml - $ref: brcm,bcm947xx-cfe-partitions.yaml From patchwork Fri Aug 9 17:21: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: 818227 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 64B56176AB8; Fri, 9 Aug 2024 23:02:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244563; cv=none; b=kNLfjaTkFsvcn3kpQCIj8MMT4ia9cg+b+cVwhgaY6wb2/419HUB7TXgK5WXmNPVLImP7gMllClXo9afwn5yZnTO7GMsb+kRxk+z7Nd67u/zNjFJiDyMY02/lc7ZeepXnWr0FF9qd3/a3m3qn5mrr/j0ZuFM/+mVPRkaAEjZeUBY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723244563; c=relaxed/simple; bh=Ax4BMVXvqmSBg6QIo8pDEUgQHsze4QAEeW6gBsTEWoc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CKpGTwpmqzLYTsNPhjYyAuGFd0y6djLP4xOcYBpeQPjTmH6CZefcMfoLw1vv25gPOPgCBEwQpTDI0y/LaySYXxGi3SXgJdrALhPJyyOsSr8wKUehqZNgkD0pCAIISX6oyVlA8hGDg0qWNvameaSkEyIAGSAwcx/7IJshF/okjWk= 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=RwusFdoi; arc=none smtp.client-ip=209.85.208.169 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="RwusFdoi" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2f025b94e07so28934031fa.0; Fri, 09 Aug 2024 16:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723244559; x=1723849359; 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=W8UY9azmTjhPunDkBNM5W4aID9KMi7XRKzM/JmHz9bA=; b=RwusFdoiWqdbpACTRPtCphF45wlGMqfmhfVPD08anmr9jS+/xS3z6KE2haWP5X9t2C qevu8hrnCZiCe32Jm7RRAppLpk7rUpP9F+V5YbGMZ4Ux/45J4lbVSgxUBbfVIbSONfGs f/iFL9b2SCPIGufO5nrQDY5TgrCFgycs+eXl7yWeTBiKDluDUxLbtjg7bWFOSM9cZjt4 aLTz4sCRMnrDmBkJoBjKNhoIT05Sb3Ck+vMEFq+Q3X73AR84M7k7/xROPli9AAnEGOTr pmoZ5tyHQ5wI5j+ILq8lHoH3KwefUl7YMpxvqAuTjiUik1hiOqj62AsLvLiT5Tj0mQ91 ZpYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723244559; x=1723849359; 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=W8UY9azmTjhPunDkBNM5W4aID9KMi7XRKzM/JmHz9bA=; b=q2eZMN1FcKxJD3nl0627f9+R1DkygkD94zt4ENSm58OAUabjHOX3iZhw1qOZz9ZIaR nEwW94eAiLdtKIeyytL2RTugra3v7iznF6gwn9Bs5ySpT7Vi0sHB58Z1Y/TP9fz+vbh6 ChjOXOnAGzd0Dp+OapfAcueQUVefpeaHPxHS/cGhTW6LkgSsggGpNQxjZXYBKeRc10u9 48/C//Tr3URhKAPGwekcWWMf/KtWFA/u14jnAZW5Q+XPh183eDPgkE9BQHM4nuarESWk o1MlfLZ4kl2haqxVBiYDGz2Iags12NdUUdk/EfSo5VHDgzcLKKDw/jN41Gm+pleLvQ1V IR2w== X-Forwarded-Encrypted: i=1; AJvYcCUL7ITanG72sJovzFAp4HNXxxJ4DV8m/BcOQgIzBDz4NaHUSDAHx26x3q3MSFx5X6BOd5WXmMdCzY5QPClTVwU/x1Y/HcRIWX0ac1W5gPV4S9e1CQt1IHGPjJeuBSUivowLiIWDRXbAL0dw86H/rBlgs2P0rB1FWVZsbYCJnPR42IyhTQ== X-Gm-Message-State: AOJu0Yws8fzTo6N06Gp/Mqz2UsmwKWJSnVO4QU1Rk+Lllxwe9JCRm4wn zribSYXo//tTNKIPr98QdlDS5pZthVHA390JPfqslaBQU/84zs11o5PMIg== X-Google-Smtp-Source: AGHT+IEBf39cMvZ+atF9aIQP/rIJt8VoQT1fN0vWpYzEGZAa9wO0kPgv+u0z6JAoBudts8qWd6j9rA== X-Received: by 2002:a2e:a411:0:b0:2ef:2e1c:79ae with SMTP id 38308e7fff4ca-2f1a6c5add1mr22344811fa.19.1723244558978; Fri, 09 Aug 2024 16:02:38 -0700 (PDT) Received: from localhost.localdomain (host-87-10-253-138.retail.telecomitalia.it. [87.10.253.138]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429c75044a8sm7987485e9.9.2024.08.09.16.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 16:02:38 -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 , Saravana Kannan , Christian Marangi , Thomas Bogendoerfer , Wolfram Sang , Florian Fainelli , 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 v4 7/7] mtd: parser: add support for Airoha parser Date: Fri, 9 Aug 2024 19:21:05 +0200 Message-ID: <20240809172106.25892-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240809172106.25892-1-ansuelsmth@gmail.com> References: <20240809172106.25892-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 | 57 +++++++++++++++++++++++++++++ drivers/mtd/parsers/ofpart_airoha.h | 18 +++++++++ drivers/mtd/parsers/ofpart_core.c | 6 +++ 5 files changed, 92 insertions(+) create mode 100644 drivers/mtd/parsers/ofpart_airoha.c create mode 100644 drivers/mtd/parsers/ofpart_airoha.h diff --git a/drivers/mtd/parsers/Kconfig b/drivers/mtd/parsers/Kconfig index da03ab6efe04..d6c53aa16ea6 100644 --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig @@ -72,6 +72,16 @@ config MTD_OF_PARTS flash memory node, as described in Documentation/devicetree/bindings/mtd/mtd.yaml. +config MTD_OF_PARTS_AIROHA + bool "Airoha EN7815 partitioning support" + depends on MTD_OF_PARTS && (ARCH_AIROHA || COMPILE_TEST) + default ARCH_AIROHA + help + This provides partitions parser for Airoha EN7815 family devices + that can have dynamic "ART" partition at the end of the flash. + It takes care of finding the correct offset and update property + with it. + config MTD_OF_PARTS_BCM4908 bool "BCM4908 partitioning support" depends on MTD_OF_PARTS && (ARCH_BCMBCA || COMPILE_TEST) diff --git a/drivers/mtd/parsers/Makefile b/drivers/mtd/parsers/Makefile index 9b00c62b837a..d67f9b4d39ac 100644 --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_MTD_BRCM_U_BOOT) += brcm_u-boot.o obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o ofpart-y += ofpart_core.o +ofpart-$(CONFIG_MTD_OF_PARTS_AIROHA) += ofpart_airoha.o ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o diff --git a/drivers/mtd/parsers/ofpart_airoha.c b/drivers/mtd/parsers/ofpart_airoha.c new file mode 100644 index 000000000000..5e2cc7b6376b --- /dev/null +++ b/drivers/mtd/parsers/ofpart_airoha.c @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2024 Christian Marangi + */ + +#include +#include +#include + +#include "ofpart_airoha.h" + +int airoha_partitions_post_parse(struct mtd_info *mtd, + struct mtd_partition *parts, + int nr_parts) +{ + struct mtd_partition *part; + int len, a_cells, s_cells; + struct device_node *pp; + struct property *prop; + const __be32 *reg; + __be32 *new_reg; + + part = &parts[nr_parts - 1]; + pp = part->of_node; + + /* Skip if ART partition have a valid offset instead of a dynamic one */ + if (!of_device_is_compatible(pp, "airoha,dynamic-art")) + return 0; + + /* ART partition is set at the end of flash - size */ + part->offset = mtd->size - part->size; + + /* Update the offset with the new calculate value in DT */ + prop = kzalloc(sizeof(*prop), GFP_KERNEL); + if (!prop) + return -ENOMEM; + + /* Reg already validated by fixed-partition parser */ + reg = of_get_property(pp, "reg", &len); + + /* Fixed partition */ + a_cells = of_n_addr_cells(pp); + s_cells = of_n_size_cells(pp); + + prop->name = "reg"; + prop->length = (a_cells + s_cells) * sizeof(__be32); + prop->value = kmemdup(reg, (a_cells + s_cells) * sizeof(__be32), + GFP_KERNEL); + new_reg = prop->value; + memset(new_reg, 0, a_cells * sizeof(__be32)); + new_reg[a_cells - 1] = cpu_to_be32(part->offset); + if (a_cells > 1) + new_reg[0] = cpu_to_be32(part->offset >> 32); + of_update_property(pp, prop); + + return 0; +} diff --git a/drivers/mtd/parsers/ofpart_airoha.h b/drivers/mtd/parsers/ofpart_airoha.h new file mode 100644 index 000000000000..3e8a8456c13a --- /dev/null +++ b/drivers/mtd/parsers/ofpart_airoha.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __OFPART_AIROHA_H +#define __OFPART_AIROHA_H + +#ifdef CONFIG_MTD_OF_PARTS_AIROHA +int airoha_partitions_post_parse(struct mtd_info *mtd, + struct mtd_partition *parts, + int nr_parts); +#else +static inline int airoha_partitions_post_parse(struct mtd_info *mtd, + struct mtd_partition *parts, + int nr_parts) +{ + return -EOPNOTSUPP; +} +#endif + +#endif diff --git a/drivers/mtd/parsers/ofpart_core.c b/drivers/mtd/parsers/ofpart_core.c index 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, }, {},