From nobody Fri Nov 29 02:31:04 2024 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.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 E5AF215C12F; Wed, 25 Sep 2024 10:15:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727259313; cv=none; b=rUByjxWIJLMjecp1qDwxdz8OOJkAXGFAUqlTaef2XIYoSjzslBJs2QpLzRSUlHx8NHhZdUa2HTLbILbVEigRJh/SKSiSWLUhANH7cZbFNhDWn1VBvEHGiEwT1cXA/XiKYBlF3cWthg0ebIObRiSUO5KMtMUdvBSdWfpn0Ndkaxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727259313; c=relaxed/simple; bh=yw1mImiPrjqLQht4OtSvNd0TeQGoObVDJhFgu2dtlzE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pFWLKV69aKv8EuPntAm1LAA0Wp8fFBy6lglgtWGU2a5zBQN7VhOekpa0/8FHE4upo+/dGJ1dII3BT5D032eQiQm+w4PcLTvXEwRqimf9orzT2IU1ZnfNVPJJwiXT4r2h9VL2vBgCoDr9zLH+2WQIQElih19WyqeN4dDxeDTG4I4= 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=d1P7vZGp; arc=none smtp.client-ip=209.85.221.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="d1P7vZGp" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-374d29ad8a7so4524203f8f.2; Wed, 25 Sep 2024 03:15:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727259310; x=1727864110; darn=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=d1P7vZGpwwqgZ3VNhdNnYIAIEzl5QOVA/wrDKvZqYaQxyzhXYDEW4N0Fpp8UFMhHnU cN/d0NZLX5kS93hlLi7Zi3hQzvMq44X6HrUa5p3S6o9i9hQCw3uwRm1Znk7RZl8zR7ln vZ2PbrIg4hBEQq40A1YCvuiRcbibr5Me/sTVJD14nB6MDjSk3eZjZyUfJzTs7HMA3U0m p+yqindUFz0tVGeOGmsWN1/frB1AAIim9tI1B3pEqFrAiwyP3rorU5iaxxV2DSFkV4Rq rUmYbB7uijG/bVIZlUS8CH8Wdp8o7igR84f7crCvsWWpmBHDH+jGSnr3rSUUXDWQLeC1 28zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727259310; x=1727864110; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mH3iAq1TAeBK36lg95WliQsOcKLSEbditM8M8e4wTwE=; b=i2OTbBj+eLJ/g2RyyG6k1+TzdTf0wJ8izPZGeWfIoMFy5KwGut1Iou36vPCNU4n9wu EhItN2QeMQm+L/HCeTJB4WOZ0wxh2h7AzXOfe/RM0ZVCbwP4l7/KJt8YglPAzdC2Lv29 nbrrz9WoUMqq2dLmGMdFlrrueSlR/0sejURwlTCLRYla5jRcVbZWCIdTxTfUmr2oiPj7 GG7eayFYSMNcK6r8SmPcSzDOu4IvvKA8tQA0+4zf7YzXRp2Q8gMmZSTRQCseYnpDPE25 GldKhNfLIQtlB/NzzL4x37gkk5CCd6eDfnq+XPZ7yv7hkC77OccaCtQRcYm2a7tsi2PU TY0A== X-Forwarded-Encrypted: i=1; AJvYcCU4evc+ZIUstJ62lYNBuDGZuRA0xSd6aKeizxV2s2TAx0zWZ9DAb/UteSvDWLJ8GHUN2uNYLi7qF1C3@vger.kernel.org, AJvYcCWuxG39fWKKUEMh9Me6h8BFRemOQda33gMmckiW2uv4eKtCTZ1qUb027agd6yNallCEvmQh15MsLmnpsIVJ@vger.kernel.org X-Gm-Message-State: AOJu0YyMQgrqACqYRZxcDvs3nLaybBVdnzA1st9t3IXPbKSRTUjEUgcl LMQmR8eeS5mMUxRQ21kW+WHTsFIJM8PgLs/SZ1tMbibtVyLI/N+x X-Google-Smtp-Source: AGHT+IEDuMF7AmbE72EiRIWfTyj8UDV6s6Ac8BVbi1Q8y0Keq8ajGW2UzIm9myAL8AG1LUQcAtjFmA== X-Received: by 2002:adf:f1ca:0:b0:374:c8cc:1bb1 with SMTP id ffacd0b85a97d-37cc24b575bmr1521519f8f.39.1727259309987; Wed, 25 Sep 2024 03:15:09 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-37cbc1560a7sm3628194f8f.0.2024.09.25.03.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 03:15:09 -0700 (PDT) From: Christian Marangi To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Saravana Kannan , Christian Marangi , Florian Fainelli , Thomas Bogendoerfer , Wolfram Sang , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Bianconi , upstream@airoha.com Subject: [PATCH 1/3] of: also export of_update_property Date: Wed, 25 Sep 2024 12:13:57 +0200 Message-ID: <20240925101422.8373-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240925101422.8373-1-ansuelsmth@gmail.com> References: <20240925101422.8373-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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) =20 return rc; } +EXPORT_SYMBOL_GPL(of_update_property); =20 static void of_alias_add(struct alias_prop *ap, struct device_node *np, int id, const char *stem, int stem_len) --=20 2.45.2 From nobody Fri Nov 29 02:31:04 2024 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 29710165EF2; Wed, 25 Sep 2024 10:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727259314; cv=none; b=GeSCgRtvqkAKtfkArqI9vternsiROPFrFUZr2wxvQC4ywZOx3dSdYx98HO7avGSSBH8hmFDwmulqaku7Tp0ltlHKW3MvRjgHtEVCNkeuWwNBSb+NGElr7qZy1eZcfziP564NXkdutdQnQ27WQ/XI0LAwaAFSb+JgufIs5QWNW6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727259314; c=relaxed/simple; bh=QucO8gEJfWJotXRfJzgyT4H1qW+PxQlhdlDNc0h4/gk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AwjMGx1WME1W6ckX9U4dmNi7T6HsR/SD8G9qH/eX/I7Shc2dCr2380/ZAwrm7sOysGN2UOMrIcyiHlhxY5VoI+/uekmZaX4ieFZTZ80wzNFDXYFC+RL0bnzqtUyDBN26k0bZRD0suDwARcrPEXBMUu+w8nyxBqvo5Vegzq44tII= 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=NMdvomyo; arc=none smtp.client-ip=209.85.128.45 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="NMdvomyo" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-42cde6b5094so61130925e9.3; Wed, 25 Sep 2024 03:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727259311; x=1727864111; darn=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=q0yqjz/vLAoslnLJDGa7eN7K2Pvc9Kf7CmkO2W3efDk=; b=NMdvomyoyLvTQqgZ1rn+RcL1LUYQA1aEFWikH2dfXZ9toMfsYEQToZgPf6paCnNV5F WxI2LsOQmxMXhX2zX84nkKAwTMxZ2XFXh23EwoX2O9fQZcXbEmdgJmrMNOtfff66yR06 K+TQSGg4mstZBa5qU7Ga1hGN7bOVouBc/88a3FSjVkfgGl8SoYhe1ze8qHMrL7ScOVwR woTc5yq9DdW3Hi1XugksGweLkBH9ovYJaPtUlyekJbN1Px9PknH8Jo6wSVIciM9md6Td ibNv4+w9MMUfBowKfb7gz2cZsESjsV3H5kIwWtBH3eTpfgtLsUnmPyW/UwrycCmvnxYo 0aaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727259311; x=1727864111; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q0yqjz/vLAoslnLJDGa7eN7K2Pvc9Kf7CmkO2W3efDk=; b=HiWp8ziW3psPFZWWhGM4VEEme23wyc1AR3xpXO2MFUJfRhIfI3J9h6QyRTegbHz6O4 jKPV2BxD1n+5c/xQBQbUkaslpO6TTHf3T9UVAzbU2cjFHI9KazCtpbOw70e0l3Be0D1/ 7fVW/Ks5gNHBxTp4wykLEyYFc1qy7XM1JyteDVr8umI4ZhfSsKec57LGNnQxHHJbucWm ozpS+mKKmQRDCSz7Zt6AXd+TzQcewOoFHu1JGJML813wdj6II5SqswX4ZnDpxlO2MwMs kZBr4y/91/QBN5+XEKZcWQqCyuBq+Ka4W+mLCxEJ/5vgqVY2MPaYMSWD85KK1c8z9x6q YZxg== X-Forwarded-Encrypted: i=1; AJvYcCX85FPPGQj8VLTossQdzQwXoKga7Mvm5gUz/VNlI9u1+nlVoc+meDWderfzNM3mY3NjanWJwe+RgxMb@vger.kernel.org, AJvYcCXUgyJQzG+JqkyDsuuFt6x6wRRvUpS21/leEI3fPcjsR4vT3sEJyQz40va4lt3QL3pY8HIUjo7Oso5KtXnI@vger.kernel.org X-Gm-Message-State: AOJu0YxAtrDEOJs/wK9aZ8wao8dohcl1Cs7ZggOyCYyd82bdpbgI7Tho ewv1azQ3bQjHa93qdSH0U53Tw4FQCjOnNoEhrHevl3hZc3BL8lmQ X-Google-Smtp-Source: AGHT+IGGrksQqujrE8tWrONIU2RpDc8dp9sRezir+8ahhKdtMo+RszPM/Z6hhXo38BC01/GaWh/h6Q== X-Received: by 2002:a05:600c:4689:b0:42c:b16e:7a22 with SMTP id 5b1f17b1804b1-42e9610d52fmr15491985e9.12.1727259311130; Wed, 25 Sep 2024 03:15:11 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-37cbc1560a7sm3628194f8f.0.2024.09.25.03.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 03:15:10 -0700 (PDT) From: Christian Marangi To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Saravana Kannan , Christian Marangi , Florian Fainelli , Thomas Bogendoerfer , Wolfram Sang , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Bianconi , upstream@airoha.com Subject: [PATCH 2/3] dt-bindings: mtd: Add Documentation for Airoha fixed-partitions Date: Wed, 25 Sep 2024 12:13:58 +0200 Message-ID: <20240925101422.8373-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240925101422.8373-1-ansuelsmth@gmail.com> References: <20240925101422.8373-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add Documentation for Airoha fixed-partitions compatibles. Airoha based SoC declare a dedicated partition at the end of the flash to store calibration and device specific data, in addition to fixed partitions. The offset of this special partition is not well defined as a custom bad block management driver is used that reserve space at the end of the flash. This binding allows defining all fixed partitions and marking the last one to detect the correct offset. Signed-off-by: Christian Marangi --- .../partitions/airoha,fixed-partitions.yaml | 80 +++++++++++++++++++ .../bindings/mtd/partitions/partitions.yaml | 1 + 2 files changed, 81 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/partitions/airoha= ,fixed-partitions.yaml diff --git a/Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-= partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/airoha,f= ixed-partitions.yaml new file mode 100644 index 000000000000..a45df51065af --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-partiti= ons.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 partiti= ons. + + The offset of this special partition is not well defined as a custom bad= block + management driver is used that reserve space at the end of the flash. + + This binding allows defining all fixed partitions and marking the last o= ne to + detect the correct offset from the new end of the flash. + +maintainers: + - Christian Marangi + +select: false + +properties: + compatible: + const: airoha,fixed-partitions + + "#address-cells": + enum: [ 1, 2 ] + + "#size-cells": + enum: [ 1, 2 ] + +patternProperties: + "^partition@[0-9a-f]+$": + $ref: partition.yaml# + properties: + compatible: + const: airoha,dynamic-art + unevaluatedProperties: false + +required: + - "#address-cells" + - "#size-cells" + +additionalProperties: false + +examples: + - | + partitions { + compatible =3D "airoha,fixed-partitions"; + #address-cells =3D <1>; + #size-cells =3D <1>; + + partition@0 { + label =3D "bootloader"; + reg =3D <0x00000000 0x00080000>; + }; + + partition@80000 { + label =3D "tclinux"; + reg =3D <0x00080000 0x02800000>; + }; + + partition@2880000 { + label =3D "tclinux_slave"; + reg =3D <0x02880000 0x02800000>; + }; + + partition@5080000 { + label =3D "rootfs_data"; + reg =3D <0x5080000 0x00800000>; + }; + + partition@ffffffff { + compatible =3D "airoha,dynamic-art"; + label =3D "art"; + reg =3D <0xffffffff 0x00300000>; + }; + }; diff --git a/Documentation/devicetree/bindings/mtd/partitions/partitions.ya= ml 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 =20 oneOf: + - $ref: airoha,fixed-partitions.yaml - $ref: arm,arm-firmware-suite.yaml - $ref: brcm,bcm4908-partitions.yaml - $ref: brcm,bcm947xx-cfe-partitions.yaml --=20 2.45.2 From nobody Fri Nov 29 02:31:04 2024 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 7B1C6186E4C; Wed, 25 Sep 2024 10:15:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727259316; cv=none; b=sfGxctCMipRKHhLt8OKWZ/NeYviV6CX5rt/rsZMiQvyjUW5y4lgnvSCiXaSTOr/yIVHz2cOBhfaIipWwCg0a84q3/G56g1p2HFKg09XUGfeAWCZBDy4qAzGc/kzRUKyoK8Tzcatsx1KafTxz2b5Qz48LGe+a3Yz0tPPoTd/V4X4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727259316; c=relaxed/simple; bh=43/aBGH/beeq/R6HFa6uglRIgJS7aSs4e4soAOJqPo4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dS+AR1uOpEJWWxAolxqP5GgT74AmrqtfKLsZmzvT1MjWvpgxUx7JHjR8k7apbvUpoPVjWyCVvNCw7Z74Xl4kHLz9PsPghFk0L812s+hu4sddeym3ZGdd/9/pNIIsp7IACoZETEFXOr3Qg7g7J00u7Q3WubHtBXYdZBof6V5Uq4Y= 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=e09VFQkk; arc=none smtp.client-ip=209.85.128.52 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="e09VFQkk" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-42cb806623eso56877305e9.2; Wed, 25 Sep 2024 03:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727259312; x=1727864112; 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=xm9CdzNjdFxXiQLDIbBOl19NIoTai2DZ2tEF/6IV/ts=; b=e09VFQkkBc2fBQk7w9U1qkwxOEEZXc0B9FNMYU/pEH94zCBkNFoch/wiH8fl4YoAVG WL0AJaYHDU0DRSfCMbfN62Z9hD5j6ZAM7nu7b5vJn3k6q/abdX4NCLrQ74QEe9uxU/lw jKnzNK7aF5vv6FAXzxhU0dBgEC7IVLiObyfMv3380HSqtv77+2QUMwOkmgCrHKVftXMI BGC70xfH2ayHOFFS8bE8snCD/PZjKKv0hAIKloHbMW766GuQ17rxPNw8viMALzLbmzur E+brqgB9dkMdC40KrOZq0oESsR244G70mDAHiYWBPrFhpcf37dzeOo8SWhDvMQMd2HIN bw5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727259312; x=1727864112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xm9CdzNjdFxXiQLDIbBOl19NIoTai2DZ2tEF/6IV/ts=; b=avl0pZhvMeiWT8ktDI/KIuyNOGhIVCGEIy7ASDBknhcxamPjAku6hQbBu5C0ndZ5Y/ yRjbvDrrJfndLaujBEt8j3PD+/sjNKGWAs9jWI2pvn3W2YOjDsMJ9cjkVPXzd7TcQ5bH jFDZTzGH5DZ4UapaUdBARo4Snwt4W4kuRwD3feqT1sozeXE0CFWAozI7OWIdItybPHM2 6s4vIP1Y9YL8YaH3mMsxWp+bjJhGODAmJcfgnwYyawUyFIpQ2Pu3HWy6H3uLqZKP81h9 PM9sbV/9efWRE+cpBWED+XhzNbrxuOMvY2jShOr6EXULqiBDtVHjo4ATIcZ+ubDysOpq tbnw== X-Forwarded-Encrypted: i=1; AJvYcCUgWgzvshB+/ZQTWbWmbLDIfDqG6JHApa+25rTKNwrYV7pB1wYrWPcPdj/0gahrPPYYYiUmPpivhfyWFApn@vger.kernel.org, AJvYcCV0aUrY3NZXrMn3x6EIymHJfzTRTu4uDRX4QrvzAOSQ15vvBRJLR7fmiiMyXYK1Q1yibU58d67UeAB4@vger.kernel.org X-Gm-Message-State: AOJu0YwLFnKy6xirbk1soFwQXwhxslVGY/iHkIRzJ2cCUZnXETcqyMRI JZXPxaF5BXXvlxKa/dOkO0clfgaXpgso9qrKE2v17L6VAOIbn60s X-Google-Smtp-Source: AGHT+IFrUhPfnR1ZpaYpm6503WQfwgTFcsU1lGXcEyJha8rBKvGPhx/LgRwNZvRJtSCOoqRvLwLrDw== X-Received: by 2002:a05:600c:310f:b0:42c:bd5a:945b with SMTP id 5b1f17b1804b1-42e9611dd5dmr15299805e9.21.1727259312318; Wed, 25 Sep 2024 03:15:12 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-37cbc1560a7sm3628194f8f.0.2024.09.25.03.15.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 03:15:12 -0700 (PDT) From: Christian Marangi To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Saravana Kannan , Christian Marangi , Florian Fainelli , Thomas Bogendoerfer , Wolfram Sang , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Bianconi , upstream@airoha.com Subject: [PATCH 3/3] mtd: parser: add support for Airoha parser Date: Wed, 25 Sep 2024 12:13:59 +0200 Message-ID: <20240925101422.8373-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240925101422.8373-1-ansuelsmth@gmail.com> References: <20240925101422.8373-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. =20 +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) +=3D brcm_u-boot.o obj-$(CONFIG_MTD_CMDLINE_PARTS) +=3D cmdlinepart.o obj-$(CONFIG_MTD_OF_PARTS) +=3D ofpart.o ofpart-y +=3D ofpart_core.o +ofpart-$(CONFIG_MTD_OF_PARTS_AIROHA) +=3D ofpart_airoha.o ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) +=3D ofpart_bcm4908.o ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+=3D ofpart_linksys_ns.o obj-$(CONFIG_MTD_PARSER_IMAGETAG) +=3D parser_imagetag.o diff --git a/drivers/mtd/parsers/ofpart_airoha.c b/drivers/mtd/parsers/ofpa= rt_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 =3D &parts[nr_parts - 1]; + pp =3D 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 =3D mtd->size - part->size; + + /* Update the offset with the new calculate value in DT */ + prop =3D kzalloc(sizeof(*prop), GFP_KERNEL); + if (!prop) + return -ENOMEM; + + /* Reg already validated by fixed-partition parser */ + reg =3D of_get_property(pp, "reg", &len); + + /* Fixed partition */ + a_cells =3D of_n_addr_cells(pp); + s_cells =3D of_n_size_cells(pp); + + prop->name =3D "reg"; + prop->length =3D (a_cells + s_cells) * sizeof(__be32); + prop->value =3D kmemdup(reg, (a_cells + s_cells) * sizeof(__be32), + GFP_KERNEL); + new_reg =3D prop->value; + memset(new_reg, 0, a_cells * sizeof(__be32)); + new_reg[a_cells - 1] =3D cpu_to_be32(part->offset); + if (a_cells > 1) + new_reg[0] =3D 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/ofpa= rt_airoha.h new file mode 100644 index 000000000000..3e8a8456c13a --- /dev/null +++ b/drivers/mtd/parsers/ofpart_airoha.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __OFPART_AIROHA_H +#define __OFPART_AIROHA_H + +#ifdef CONFIG_MTD_OF_PARTS_AIROHA +int airoha_partitions_post_parse(struct mtd_info *mtd, + struct mtd_partition *parts, + int nr_parts); +#else +static inline int airoha_partitions_post_parse(struct mtd_info *mtd, + struct mtd_partition *parts, + int nr_parts) +{ + return -EOPNOTSUPP; +} +#endif + +#endif diff --git a/drivers/mtd/parsers/ofpart_core.c b/drivers/mtd/parsers/ofpart= _core.c index abfa68798918..8e86fa4f3bbd 100644 --- a/drivers/mtd/parsers/ofpart_core.c +++ b/drivers/mtd/parsers/ofpart_core.c @@ -16,6 +16,7 @@ #include #include =20 +#include "ofpart_airoha.h" #include "ofpart_bcm4908.h" #include "ofpart_linksys_ns.h" =20 @@ -23,6 +24,10 @@ struct fixed_partitions_quirks { int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int = nr_parts); }; =20 +static struct fixed_partitions_quirks airoha_partitions_quirks =3D { + .post_parse =3D airoha_partitions_post_parse, +}; + static struct fixed_partitions_quirks bcm4908_partitions_quirks =3D { .post_parse =3D bcm4908_partitions_post_parse, }; @@ -192,6 +197,7 @@ static const struct of_device_id parse_ofpart_match_tab= le[] =3D { /* Generic */ { .compatible =3D "fixed-partitions" }, /* Customized */ + { .compatible =3D "airoha,fixed-partitions", .data =3D &airoha_partitions= _quirks, }, { .compatible =3D "brcm,bcm4908-partitions", .data =3D &bcm4908_partition= s_quirks, }, { .compatible =3D "linksys,ns-partitions", .data =3D &linksys_ns_partitio= ns_quirks, }, {}, --=20 2.45.2