From patchwork Wed Oct 19 11:50:41 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: 616432 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp230316pvb; Wed, 19 Oct 2022 04:51:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ww42ar8G8ANVxLXGiMuhtLxieyBBPDOuKznvT7CGJu8+qNnWjZtsfj6omh5zc5HXU6a9z X-Received: by 2002:a05:6a00:14ca:b0:563:9296:f34d with SMTP id w10-20020a056a0014ca00b005639296f34dmr7899928pfu.64.1666180288574; Wed, 19 Oct 2022 04:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180288; cv=none; d=google.com; s=arc-20160816; b=tbLL4elxM8mcZg+8QQgeYfwNW+JiDQAY8BW6fU4cPOEl2WW+8HTJ3TsFakPJK0fCaR iRYFpdOrtJcMCMmD1tFygT7E7xyaTkt7Ma0YBkQEXOxuTHDX0g5lo8csoagwjZr9bS2Q V7G0zMZieZDFAXiS3CfDYwbUQtqck7ZP9cZlv5H4H7yUCM+gQAqxbmO07Bt76GaWrxhi Clay0IjK5IaWGFsAe7aEpZBykHSic6HpnpMRHjmGx3bRvz0lFf+QIpXZwbFf1IUVkVvv lqZIDuorbnKJoLXSZXLFF+nEn8HoIfrD9UO1VLD0eCZGElJEQDILkHnRpz5MbHLyLURN sA/w== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature; bh=5GofMAh/0/MPviBLYjXQ06sBtoQ+/j0jYrVJnKDv6dE=; b=wsix8m+2k5D2NVIWD/wORG6bvZG3Mqz1u50X6IJI1DThTvoGsUOS4CU+rWBDo6JfyZ PZDLpZJXv9Jk8dNV7hIsyyFy/qo/2rJkcLW65OAUuvY3hP/AqXdzbWkggPyqoCb34ozN 3VbGeVewOq8Fc9SM11fx7up/fFKS//t+sg+QHDYaz7D8T+qsVqbI6hNLYtjTNnfgUS0I msS+DPMY9h8SpDOKAJjz4uVxnz7IcNaQ41LqwufiooQwUz5GgIMOI5f4ccA0HD3bY4HX V868oxlnABhfW05SY99NMrgmUkROQNQgfRICV4UlgI18NHnqeqyZzAdzzieLssxMWnZJ v9gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=CGMdZlaP; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=OtokJ3G5; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:3::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:3::133]) by mx.google.com with ESMTPS id ne6-20020a17090b374600b0021011c16872si759398pjb.44.2022.10.19.04.51.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 04:51:28 -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:3::133 as permitted sender) client-ip=2607:7c80:54:3::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=CGMdZlaP; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=OtokJ3G5; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:3::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:References:In-Reply-To: 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: List-Owner; bh=5GofMAh/0/MPviBLYjXQ06sBtoQ+/j0jYrVJnKDv6dE=; b=CGMdZlaPPcZgY6 lxYGKekPht41b/gDzfTiECM9iN6e3+Ujs1GAod7vI9Pj3P35X137tVh4RIpUmMzHbiqeQ0DY6PxwW CYdY7Y/YT3d94Bo0ERYSy4FfUDrstyh4nQWyn11oF+J15CLLraV6orxtmzEejOGzVSKBcQJLUI40V 7JW4YddIyBRLSgDSjox6S3hHKtEnD5eOaFVtXiUYbM9eL/fhYAv8PWNEx0Gc9FeOI8QJV8nrnOfbO CiKEYqXifZdxv/c0sZKyXqgjqJgYC0fjx17fFPEDwMp1Bq5oBj/2qWvkYpEO7hkFGD1Ay8SlwSX/S 9QTSIUsh/qcTqk87U6RQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ol7b2-0012D8-Jm; Wed, 19 Oct 2022 11:50:52 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ol7ay-0012BB-JA for linux-mtd@lists.infradead.org; Wed, 19 Oct 2022 11:50:49 +0000 Received: by mail-ed1-x535.google.com with SMTP id r14so24856649edc.7 for ; Wed, 19 Oct 2022 04:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yTGwtjY7Qx3UHK834yfCMHLL0TaAs+yVt4csz4H7rFw=; b=OtokJ3G5ZiLF/OC4iEJMusA6NeuqVEVdAZ9v0gKZ8M5SVAINXZqwJnLLxNhUZUgn8R Q7gUdiErZk0QhUbU84FHgDdN+NzKzliyYGENPzQm0dU8dRuZrN4SxXvFchaXy4nCYdz+ 9m8rfs2Wr8KKCpoURG3k9LjtOE1djHUFfUWmOGsjHt90WSAMwlXlepZVemcfXbkZV882 j1JEIpQJk7vhe8E/4jkP7JzjmN5G4sHQ+WWbRkhH6rjTLvP+rBW440/lpRqjboaxwzsm 78L82AZScEuO4G8Pu7+oje4nyPKYFi1KhoQQibGXkee3QvlrxpWsuo1+dkPwB0MXStJt 3blA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yTGwtjY7Qx3UHK834yfCMHLL0TaAs+yVt4csz4H7rFw=; b=CLoHERwmHUNnZGGGMiiYsj4SXUyx5mLuisVtCBlgpcI56fzpma3WdsXuc//RFrDO3/ pARcL2sNybPIcnMngpLBVJEhHvPLI1m8zoVCYqp1eeCu9VhXhWUVQO5wAhEJHsdo43m0 AujcdVaCcxYrjxkA1AjCabSjAQ4K2MMCNo+GIR10X1EPnZ8+4ryBIIQoDmJj5KHQ8nGK 5710nB2Ddynu9n8H1/PB2jTM0K+Xwak5zBL/5SP6b1Sbw6rjlo0ypGgn7kyKcieiQ8KC RSxo3JIC0xsA/0WlKshQMIVtIYYmIwMv5ol15Pp7UocGajhfrZx00D/HUTctReibTyym avIQ== X-Gm-Message-State: ACrzQf0fPNuWlQv8FyENG3qlgvh2YDt8/FZMijHoSWUudntZyfJaaZLj K5YB4U77hs/olLpfBVmSrFs= X-Received: by 2002:a05:6402:3709:b0:459:279e:fdc6 with SMTP id ek9-20020a056402370900b00459279efdc6mr7180563edb.338.1666180247042; Wed, 19 Oct 2022 04:50:47 -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 dk24-20020a0564021d9800b0045b910b0542sm10377884edb.15.2022.10.19.04.50.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 04:50:46 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski Cc: Mikhail Zhilkin , Christian Marangi , Wolfram Sang , Chaitanya Kulkarni , "Martin K . Petersen" , Jens Axboe , Andrew Morton , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 2/2] mtd: core: set ROOT_DEV for partitions marked as root devices in DT Date: Wed, 19 Oct 2022 13:50:41 +0200 Message-Id: <20221019115041.31805-1-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221019114855.31639-1-zajec5@gmail.com> References: <20221019114855.31639-1-zajec5@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221019_045048_676112_64E72D21 X-CRM114-Status: GOOD ( 15.01 ) 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_T?= =?utf-8?q?his_adds_support_for_=22linux=2Croot-device=22?= =?utf-8?q?_binding_that_is_used_to_mark_root_device_MTD_partition=2E_It=27s_?= =?utf-8?q?useful_for_devices?= =?utf-8?q?_using_device_tree_that_don=27t_have_bootloader_passing_root_info_?= =?utf-8?q?in_cmdline=2E?= =?utf-8?q?_?= =?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?IFsyYTAwOjE0NTA6NDg2NDoyMDowOjA6MDo1MzUgbGlzdGVkIGluXQ==?= =?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 This adds support for "linux,root-device" binding that is used to mark root device MTD partition. It's useful for devices using device tree that don't have bootloader passing root info in cmdline. Signed-off-by: Rafał Miłecki --- drivers/mtd/mtdcore.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 07249af4f890..034b06aff660 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -735,6 +736,12 @@ int add_mtd_device(struct mtd_info *mtd) not->add(mtd); mutex_unlock(&mtd_table_mutex); + + if (of_find_property(mtd_get_of_node(mtd), "linux,rootfs", NULL)) { + pr_info("mtd: setting mtd%d (%s) as root device\n", mtd->index, mtd->name); + ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index); + } + /* We _know_ we aren't being removed, because our caller is still holding us here. So none of this try_ nonsense, and no bitching about it