From patchwork Wed May 4 19:44:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 569295 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp112943mal; Wed, 4 May 2022 12:45:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw58+1cKqiBycljvUJ/M2S/osKFyUJ6BvKg+tR+YhmjoVmIu2Yt+Hh5gCtgvgiCCwZPzXYB X-Received: by 2002:a17:902:b596:b0:158:f23a:c789 with SMTP id a22-20020a170902b59600b00158f23ac789mr23186903pls.57.1651693558846; Wed, 04 May 2022 12:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651693558; cv=none; d=google.com; s=arc-20160816; b=mCLews7fSeNl/uTa8Oz/jU4OiSDrmRKlYQ3P44TLZAG7yDsXK7JYHDNMuIPiyYCFYd PHs1negRaxkfk1LmOcYgJmTc0TFvywlpxibNBmNUXG0eY2cqWD9yt2GjjLZe8VcHnJLN ombGr0ibfuxz4xkHU3dVjoudosrxqOE5gzavs5xL82cP+NprpIquPihfKRpUL/aZVSWG dZ2EQ/uSU1uforoeodjHHWn9nNPCPeY28KYAdcG8mfjJWrVoCK6FyqdWrCH18kgpOTXf XeYh8NAhsrp9Ntcrm/n92w37b4pCJzzLeRG3lrnFCSmv1IXEcq8Z+n/gHo5nUahu0y6+ kkIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dkim-signature; bh=kZNDIpv/BUqu3riFsDK1/tXJq9wgJjmik9/oh+cGcdI=; b=K0cBd5x1gjGGqIc4HpgSz5AJK8NjYwA/VFeNQt9sNGBPDuEhn7pbY3BPjFqEGf8jYS EifVFRRRQSaPDHG9ZadFZMpXsp5TpMpMN6kL1Yly+cNthK0myRlk8njT1d3KcLmCUodR 3T91effJGa6Hdf7NBDPuHFyxYr2Jv1XfknnuCHK+6j99fcDbDs1D1mko2TGZCJ/ky4EC DIuiXQdddxZJ1K1LCDXWUMcVgYOgNWhTsW7LVNW5hUxKN2kH1knqfHt/Wlh9xhMiyIhd 2UujNsl2YjtfYegy/3mAj8EdkHOk9t+UlRs+93QEQwsGRpozFzsMnJfNw67t4g4G40Vp nK0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=J6JDeygy; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=Q8WyrFQ7; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id t13-20020a654b8d000000b0039d945d133fsi20323871pgq.324.2022.05.04.12.45.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 May 2022 12:45:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=J6JDeygy; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=Q8WyrFQ7; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=kZNDIpv/BUqu3riFsDK1/tXJq9wgJjmik9/oh+cGcdI=; b=J6JDeygyEAmm/Z lMotI8/J/AR2joiyn0MofsOpTzsIQ4R13jZdO8EApUN12cHzscTvHwOh+GwNSN7wHcB5Zh36MYGwC uqjrpXYxjGrKOUx1UWZXtJrAXg8jpE6kdm1A05ekOJGUxgJkLt1D3pC9YzR5+aaMEaZF2l3FP7/sf 97maJnD/50IcL+NXjvKadK7igBYgOA2YPIoj3HIiG1BtACok0oXX+Nk5JIS4lb2OJqOKJtputQ6o9 Sjr7D2e5fGzqZkYFUdD9Hk5S3agQmd57T3N8rB4en+TlMoLOf6n3fpBLs3JeOKV4gpGLBwFkbAHhY nxvB9Jz0bVEq+/Kn5k4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmKvw-00CPsv-PX; Wed, 04 May 2022 19:45:12 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmKvt-00CPrS-PK for linux-mtd@lists.infradead.org; Wed, 04 May 2022 19:45:11 +0000 Received: by mail-ej1-x631.google.com with SMTP id kq17so4867033ejb.4 for ; Wed, 04 May 2022 12:45:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lXbSjEbgR2D5btxhA4ub9CSmieSjqXHeqRGJjTDf1Jg=; b=Q8WyrFQ7qHqnZAVLO9JfKecswJDZPNLbiZ5dfSba0bfjG/Vp5+k0XEgbItunmpI3N9 cGrK3mQbxGAaDWfS8EXAP2mh6UiX0UHDPFgf2lwbSk8n0b8TcEJpTt4YnXvhsT3/SMkS kWbo2b3gbjHJzGu4XvdFdDHL+/cnz59j77ciTdhDfExQz+NOquft5fHcEVVTWnamFLa5 m94SSci4QIuK9yC+vfNc31g3Xz9HgglFByaUmB1Xf+1gbWp0L3RYVZvQOSgbZRVe/7h0 dpvlT3MW6919tVzcsES3XP1bbQhXXMsL566LXBE/SDj1zM+IMlFghT0PpbHhnxoxutKh cIUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lXbSjEbgR2D5btxhA4ub9CSmieSjqXHeqRGJjTDf1Jg=; b=p385DGn4AXWZuqHlgZB6uE60H0DuonM5YYcWuPnRuG94b+Nieke8n1A4jw4YTOjGEF SfwsmPLGM3ZHSsMvl9xIzLusCuHvuvv12k/nQcesHM7oc99uOEQhJIFcxTw+zP4D2pZo cRHSkdcM9HTAy2poP0s5DhCY+z8UwJMV17JkwkkxY0NbA5u2c+BMdGaKhh425ofpU5XE cCOhesFKNAiXHQO+hVLooUKxoswz6jRq4/nwx7dWEnQdlWH5rI6/+dHNt9zQze/huaJS tgTBi0Gwj+I+a6XDIOrIhIGA4TRP4zglgwaDRDKaYfYijNrV7RaXWj17MChzVUL3ws8O y32Q== X-Gm-Message-State: AOAM533JLregCXeMqvaFHAbKyQ0s4dyMb9w8uPr6+8oHF73k5jki3EAn AZLrrY7iVhG9mnLxVKvK8xg= X-Received: by 2002:a17:907:c02:b0:6df:fb64:2770 with SMTP id ga2-20020a1709070c0200b006dffb642770mr22664115ejc.221.1651693507588; Wed, 04 May 2022 12:45:07 -0700 (PDT) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id v21-20020aa7d815000000b0042617ba63b8sm9479901edq.66.2022.05.04.12.45.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 May 2022 12:45:07 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-mtd@lists.infradead.org, Srinivas Kandagatla , Daniel Golle , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V2] mtd: call of_platform_populate() for MTD partitions Date: Wed, 4 May 2022 21:44:48 +0200 Message-Id: <20220504194448.17427-1-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220504_124509_862456_DD45FA41 X-CRM114-Status: GOOD ( 16.15 ) X-Spam-Score: 0.1 (/) X-Spam-Report: =?utf-8?q?Spam_detection_software=2C_running_on_the_system_?= =?utf-8?q?=22bombadil=2Einfradead=2Eorg=22=2C?= =?utf-8?q?_has_NOT_identified_this_incoming_email_as_spam=2E__The_original?= =?utf-8?q?_message_has_been_attached_to_this_so_you_can_view_it_or_label?= =?utf-8?q?_similar_future_email=2E__If_you_have_any_questions=2C_see?= =?utf-8?q?_the_administrator_of_that_system_for_details=2E?= =?utf-8?q?_?= =?utf-8?q?_Content_preview=3A__From=3A_Rafa=C3=85=C2=82_Mi=C3=85=C2=82ecki_U?= =?utf-8?q?ntil_this_change_MTD_subsystem_supported?= =?utf-8?q?_handling_partitions_only_with_MTD_partitions_parsers=2E_That=27s_?= =?utf-8?q?a_specific_/?= =?utf-8?q?_limited_API_designed_around_partitions=2E_Some_MTD_partitions_may?= =?utf-8?q?_however_require?= =?utf-8?q?_different_handling=2E_They_may_contain_specific_data_that_needs_t?= =?utf-8?q?o_be_parsed?= =?utf-8?q?_and_somehow_extracted=2E_For_that_purpose_MTD_subsystem_should_al?= =?utf-8?q?low_binding?= =?utf-8?b?IG9mIHN0YW5kYXIgWy4uLl0g?= =?utf-8?q?_?= =?utf-8?q?_Content_analysis_details=3A___=280=2E1_points=2C_5=2E0_required?= =?utf-8?q?=29?= =?utf-8?q?_?= =?utf-8?q?_pts_rule_name______________description?= =?utf-8?q?_----_----------------------_-------------------------------------?= =?utf-8?q?-------------?= =?utf-8?q?_-0=2E0_RCVD=5FIN=5FDNSWL=5FNONE_____RBL=3A_Sender_listed_at_https?= =?utf-8?q?=3A//www=2Ednswl=2Eorg/=2C?= =?utf-8?q?_no_trust?= =?utf-8?b?IFsyYTAwOjE0NTA6NDg2NDoyMDowOjA6MDo2MzEgbGlzdGVkIGluXQ==?= =?utf-8?b?IFtsaXN0LmRuc3dsLm9yZ10=?= =?utf-8?q?_-0=2E0_SPF=5FPASS_______________SPF=3A_sender_matches_SPF_record?= =?utf-8?q?_0=2E0_SPF=5FHELO=5FNONE__________SPF=3A_HELO_does_not_publish_an_?= =?utf-8?q?SPF_Record?= =?utf-8?q?_0=2E0_FREEMAIL=5FFROM__________Sender_email_is_commonly_abused_en?= =?utf-8?q?duser_mail?= =?utf-8?q?_provider?= =?utf-8?q?_=5Bzajec5=5Bat=5Dgmail=2Ecom=5D?= =?utf-8?q?_0=2E2_FREEMAIL=5FENVFROM=5FEND=5FDIGIT_Envelope-from_freemail_use?= =?utf-8?q?rname_ends?= =?utf-8?q?_in_digit?= =?utf-8?q?_=5Bzajec5=5Bat=5Dgmail=2Ecom=5D?= =?utf-8?q?_-0=2E1_DKIM=5FVALID=5FAU__________Message_has_a_valid_DKIM_or_DK_?= =?utf-8?q?signature_from?= =?utf-8?q?_author=27s_domain?= =?utf-8?q?_-0=2E1_DKIM=5FVALID_____________Message_has_at_least_one_valid_DK?= =?utf-8?q?IM_or_DK_signature?= =?utf-8?q?_0=2E1_DKIM=5FSIGNED____________Message_has_a_DKIM_or_DK_signature?= =?utf-8?q?=2C_not_necessarily?= =?utf-8?q?_valid?= =?utf-8?q?_-0=2E1_DKIM=5FVALID=5FEF__________Message_has_a_valid_DKIM_or_DK_?= =?utf-8?q?signature_from?= =?utf-8?q?_envelope-from_domain?= X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org From: Rafał Miłecki Until this change MTD subsystem supported handling partitions only with MTD partitions parsers. That's a specific / limited API designed around partitions. Some MTD partitions may however require different handling. They may contain specific data that needs to be parsed and somehow extracted. For that purpose MTD subsystem should allow binding of standard platform drivers. An example can be U-Boot (sub)partition with environment variables. There exist a "u-boot,env" DT binding for MTD (sub)partition that requires an NVMEM driver. Ref: 5db1c2dbc04c ("dt-bindings: nvmem: add U-Boot environment variables binding") Signed-off-by: Rafał Miłecki --- V2: Fix case for # CONFIG_MTD_PARTITIONED_MASTER is not set master->dev can't be used blindly as it may point to unregistered device and cause WARNINGs --- drivers/mtd/mtdpart.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 357661b62c94..4971fa69d076 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "mtdcore.h" @@ -577,10 +578,16 @@ static int mtd_part_of_parse(struct mtd_info *master, struct mtd_part_parser *parser; struct device_node *np; struct property *prop; + struct device *dev; const char *compat; const char *fixed = "fixed-partitions"; int ret, err = 0; + if (mtd_is_partition(master) || IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER)) + dev = &master->dev; + else + dev = master->dev.parent; + np = mtd_get_of_node(master); if (mtd_is_partition(master)) of_node_get(np); @@ -593,6 +600,7 @@ static int mtd_part_of_parse(struct mtd_info *master, continue; ret = mtd_part_do_parse(parser, master, pparts, NULL); if (ret > 0) { + of_platform_populate(np, NULL, NULL, dev); of_node_put(np); return ret; } @@ -600,6 +608,7 @@ static int mtd_part_of_parse(struct mtd_info *master, if (ret < 0 && !err) err = ret; } + of_platform_populate(np, NULL, NULL, dev); of_node_put(np); /*