From patchwork Sat Oct 22 21:13:17 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: 617499 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1803565pvb; Sat, 22 Oct 2022 14:14:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM60IdZ28V2+41GiXxF/QElqwH6hkAF0ENj+7cPhif5pM18Q7+yTkFFfXWTUR/+3z4YMCbxn X-Received: by 2002:a63:6948:0:b0:46e:af43:14a4 with SMTP id e69-20020a636948000000b0046eaf4314a4mr10596565pgc.391.1666473260168; Sat, 22 Oct 2022 14:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666473260; cv=none; d=google.com; s=arc-20160816; b=WC0ltinTdTiC0804oqjFCO9GttDLoiABdRktivbZwI7l58Wq0rPTOar0/XM7XSyit4 d9AdmgPOyy3RopNjBETUilZsKae37N9aBxEsmVLng6dfiEfOIjaFPFhGC61/1HTn2vXD PaqvPRPKx3Wd+d6YhnLuPsDhq5qSrmGgO9uPSUA1WJBSJ2pAaZcxQ73P//lNkV18zDkF QmToLQ4P6mCR/nuq7pa6Ms7BXcYtuQ9ZCFPqvRj/Tggdjy5+5FPmeuV0rVmG2s8JznSQ aoEQA8lQJHXze6QlQFVK6YRBZhryqjbaBNlUlqqdzQ8nlbHf2MTLEBY9qLgzCgBfRC4p 8hqg== 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=374hRwSmZkevQ4AI0K6sO5+2PGRce7OZqN6zJqlIYPU=; b=qwllge7OP/fKfd9uG5TsYtHgfMgbv0ClFaAXQ7XIkRCweEXIsEz9W16QRTGejLT/XB eh2eRrkDpy+n5yiN60Ogig7z6tQ5csQWAbBCpcp0fi/mb0eQ1xqPEiCLda3s7DiXYN41 iMboN/jY2svw04Lpz9tQMJBidt7n+3fcW1FZk/h9YhVlWNr/jhPwCN5DJSXgw6+HaidG UHD1jE2A6qLqV3vOeW9j6By1g9l3+Sg1Glf7plklJFiY4wnokSRGrSoCchR9NsJWdPvH y+BuRT1Q1meNhSlOWMlAjRiwVdmqxkp+rZvOKuGBL0g0kZD8KI89A2/PYQjkn3byYfB9 SchQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=b94xzeFc; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=NmBEE6eF; 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 w63-20020a638242000000b0046ec9d1ffc7si5363808pgd.692.2022.10.22.14.14.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 14:14:20 -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=b94xzeFc; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=NmBEE6eF; 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: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=374hRwSmZkevQ4AI0K6sO5+2PGRce7OZqN6zJqlIYPU=; b=b94xzeFcdojMsw hD3E5H3JFg4X/jERkL691Sj09DSQGsvUeckBWGljPObNQ2H61dF48Vt8fY8FzZhzDuaFYWt6Nh9I3 N451qOqb5kwEJxeFFkm/CLN0oLObwbG06DKvMrZZ6IQh6BGP8Y6TFG2YuEcTu3xORHcHPy/YHUY01 8CSOQTpcj/jcg90tftHBTiw9JBMXPGA6tKYCXDkl9S32mICbdeuRtRJ7BZBakP77/BHD+txdGOvuO ZVl1tetLyN6c1YNRkQNKAHLfkLkS209V/Z3/q1rgh9uj5X1Qe60q0dNEQkyGX1bF40Uj2kWzKyCMK 2BwV6kzZU766qBb7Df5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1omLoA-00DpBI-7a; Sat, 22 Oct 2022 21:13:30 +0000 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1omLo7-00DpA9-4A for linux-mtd@lists.infradead.org; Sat, 22 Oct 2022 21:13:28 +0000 Received: by mail-ed1-x52a.google.com with SMTP id a5so5048373edb.11 for ; Sat, 22 Oct 2022 14:13:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=C5hHs2S/RQl/JXIwHudGm/5mav5RsuOJ5skKbHJaT7M=; b=NmBEE6eFFqAk065UYolm1o7PT0D3spxPjIpTB1GN4doSOzS/VyF0MqEGtviFaTzcZc kkyskhusTgRHUEXA+SUJWNZZZMtBpySOqUoLqvRB5ZBLRjhEc9KjhLe9c5jK8ry4uTV2 Nk789OK4t4+qNfxNc4QY99Syb9ofJ5Ow89nccso5G+zA4tp0VGicKZTAp9x+JY0nIJAz F+e7O3kIGx94sm6tXjxLuCdaD+lqhx63E8T/5sM8hYbr3w3szKdM8Thn11CAbYOPpln1 t8lbqWF+RU+6NYlfHw/1fmuOYBoXOLkZUGM3TezeU14AoBjoAJHSGDkc9AdSC9EA9b48 y46Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=C5hHs2S/RQl/JXIwHudGm/5mav5RsuOJ5skKbHJaT7M=; b=8NDmEmY7D7r6zfKFjyIb1gcU/2imYnCmkUBpPWjZPFh1BqN1SQC8wJFe3jaXlktbeg 4SZL7rNNexfUf6N0ZQP6ozii2wCLBn3pVyF7niZAOwCVGoEAgcBw6GomL3emSnmAu8qx kkKVMISyA4jd9BDgMtEGtDUbAALeVQ/dmmqMTwGpM63K4WlN4v3th5A40quKbhLrDbPW 5eV2ultKpW7nuMIPQskd6UvGN3KM9np7VQYLim7CZefLvB0VTLwnliSzqm9mTVqGA4Hq AS1dea+gWBScMiEGr3x/yARWZmLYwK3AcsdEzqzdbRIdzSfBQN/aK+MXr/s5kvOUg43c gNcQ== X-Gm-Message-State: ACrzQf0sS/YU8N5ZLDrMhjmSDxXHZbJkwxdKNWBKVIamUpkdEnu87Gvq WAYGwyWa51YGdQrJSVkSsZo= X-Received: by 2002:a17:907:3f23:b0:78e:260a:fc33 with SMTP id hq35-20020a1709073f2300b0078e260afc33mr21579377ejc.152.1666473203739; Sat, 22 Oct 2022 14:13:23 -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 la5-20020a170907780500b0077f20a722dfsm13382584ejc.165.2022.10.22.14.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 14:13:23 -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 V3 1/2] dt-bindings: mtd: partitions: support marking rootfs partition Date: Sat, 22 Oct 2022 23:13:17 +0200 Message-Id: <20221022211318.32009-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-20221022_141327_232382_2C5A7959 X-CRM114-Status: GOOD ( 12.64 ) 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_L?= =?utf-8?q?inux_needs_to_know_what_to_use_as_root?= =?utf-8?q?_device=2E_On_embedded_devices_with_flash_the_only_common_way_to_s?= =?utf-8?q?pecify_that?= =?utf-8?q?_is_cmdline_=26_root=3D_parameter=2E_That_solution_works_with_U-Bo?= =?utf-8?q?ot_which_is_Linux?= =?utf-8?q?_=26_cmdline_aware_but_isn=27t_available_with_all_market_bootloade?= =?utf-8?q?rs=2E_Also_that?= =?utf-8?q?_method_is_fragile=3A_1=2E_Requires_specific_probing_order_on_mult?= =?utf-8?q?i-flash_devices?= =?utf-8?b?IDIgWy4uLl0g?= =?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?IFsyYTAwOjE0NTA6NDg2NDoyMDowOjA6MDo1MmEgbGlzdGVkIGluXQ==?= =?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 Linux needs to know what to use as root device. On embedded devices with flash the only common way to specify that is cmdline & root= parameter. That solution works with U-Boot which is Linux & cmdline aware but isn't available with all market bootloaders. Also that method is fragile: 1. Requires specific probing order on multi-flash devices 2. Uses hardcoded partitions indexes A lot of devices use different partitioning methods. It may be "fixed-partitions" or some dynamic partitioning (e.g. based on parts table). For such cases allow "linux,rootfs" property to mark correct flash partition. Signed-off-by: Rafał Miłecki Reviewed-by: Rob Herring --- V2: Use "linux,rootfs" as more accurate. Thanks Rob. --- .../devicetree/bindings/mtd/partitions/fixed-partitions.yaml | 1 + .../devicetree/bindings/mtd/partitions/partition.yaml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml index ad3ccd250802..d66a6e3bcb56 100644 --- a/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml +++ b/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml @@ -84,6 +84,7 @@ examples: partition@0 { label = "filesystem"; reg = <0x00000000 0x1 0x00000000>; + linux,rootfs; }; }; diff --git a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml index f1a02d840b12..a25cd23a34c0 100644 --- a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml +++ b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml @@ -52,6 +52,10 @@ properties: immune to paired-pages corruptions type: boolean + linux,rootfs: + description: Marks partition that contains root filesystem to mount and boot + user space from + if: not: required: [ reg ] From patchwork Sat Oct 22 21:13:18 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: 617500 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1803568pvb; Sat, 22 Oct 2022 14:14:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sPO/OR8BW9ES1J/IpIqk3TB7g8PEjgE6QHs514tdH+ph1A5ocCdVMjCD2UcU4v5AwzO7b X-Received: by 2002:a05:6a00:13a3:b0:563:6d36:ba58 with SMTP id t35-20020a056a0013a300b005636d36ba58mr25782624pfg.43.1666473261078; Sat, 22 Oct 2022 14:14:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666473261; cv=none; d=google.com; s=arc-20160816; b=CPv7INlmXX88kvOOFg+LRm3ahgOIIT8BGEzn2AjnY1zlL2X6idjuUW3p3k0RfmGzuK sfzgdg0OBtsmn6b9k+YDFJC9DwhMCw7cMtWwqifDP/2VMz1hOd55IE79biyBEqYqPAR/ XBFIAq9eLLTTmrK7LE2hhHfJbKoJWliltMwFE3JuXDozwyHP4LRWgV3LjZYUOcvmRSpK 6DeWj+IrTomLISNjU3WFOb68qtDTI3VZajXfPwjnr/6mTT3F779bYbpsBPucChAOTrgA Q9jLhfayui2k8ptferHlIQYbmlt/7gd63gc5AF0lUNPncN6fdEFEagmFv63UZoZa3br3 i53g== 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=C1Byv6SBYacrGEqH3w09Xl75jmupTSnYo2LEljCWAC4=; b=RlJia6L3DaBi96mku0LAJNa7D6UTyHv2EQUPkf+UKO8Idbl0R4VmDdtDpOuUs8mgWO 4TwjowcL8Lr6p688ACe8r7ycB5Dee0B4UGn8cTsKBZvf4pBSb2rx/r1rNzBkoO4DxWvB qO/60Awudxle6E94zks1X3nJacjSiRClrx6unjCcpQvNmmy25riTYXcpIDPlfp3RPinm 5vCjQHgo6dL5odclZKkoZ6wupgtE32ygObvg04MXzoOlJedFhHiMOS7FiP0phOovWYje Zbhztce8MudQ8B7Qku47YjEo7CbE/fXY4oB3R2RnYu/d4Z/D+K0wpAVPAKnGE0li4oko Y/Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=Tjn4MmB3; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=Juwv+t1R; 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 k1-20020a628401000000b005662e18c93asi28029638pfd.135.2022.10.22.14.14.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 14:14:21 -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=Tjn4MmB3; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=Juwv+t1R; 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=C1Byv6SBYacrGEqH3w09Xl75jmupTSnYo2LEljCWAC4=; b=Tjn4MmB3ABQMZS x6uanZjfXTwMlnQITRKKvTxkZdGi6/jL/PfLl9iFyaU0oOmcG+nUAq+UsrZvUh0U30Xa+eqIdKelF hXntzKlc3icMCtms1H47EBfdM1jbqkvYGjQtB0sW+wxXWHqGog9mLrP7IQ9GLO3pmtN1VPODcubM0 o9SVzn7SADX+4CXlXDZPlJ7h07MbeMUCXW3vEQBE6KE6W8TdDb0oVKNnJQb8YK3W+HumylHZ8nfBx /9p3ZYcUGHb0b45yQzqbUhIclVHS1WOZy6RgnPjcyly9FkoYEoRxskcV3oO42hjm3bZeoaPdk7mRu p++YHRz2Ac7g+uexD4HA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1omLoC-00DpBi-0R; Sat, 22 Oct 2022 21:13:32 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1omLo8-00DpAU-LH for linux-mtd@lists.infradead.org; Sat, 22 Oct 2022 21:13:29 +0000 Received: by mail-ed1-x52c.google.com with SMTP id z97so18087684ede.8 for ; Sat, 22 Oct 2022 14:13:26 -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=sMcPWSUmJnWN6Xepe9O23Js1qxdW09hzjNuw8smzgps=; b=Juwv+t1RTD/CMonD6c03dxDghAH5fYtIui194P1sOuPDqUipKVcMtYq5xsIHFnFu/S 9PuKQH+IEKm9pjZCdY5rKHFMux6oZ6jGSl/kLkoOPzGiCObsf8o8V/BIs4ImZJ24157x vCJ4/stysEk6t20lEO+Guu/3orvGzmm07igbOeQdiKL4A/gMqz8qTwo/gO00Xc+5hgnY D+/QqytyJcYHxhBW/nZccJUnnNV3z2H4Zzo2XIG5Z0M9/WfLUgZfnTa6297r6BzOL5J0 75kjjA5hJtnpm2S/eHxSYDOqznebiuBAghHKBcvY38HOpjFsUNzasVI9q7LASA5P552b gExg== 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=sMcPWSUmJnWN6Xepe9O23Js1qxdW09hzjNuw8smzgps=; b=zKcAMHTTOSHkwKLJYvfafjnAZmDVqa+G8AZwHabHkvzD7A7iDNorAEjTAJNcEW79ko IFcupKu8W0qIoFMQalZGVGp0Yamgb7n/+gFu/yQsaPhrhx9bnVm+YCjyc6RJo3lcAfuR vw1CrToGeFzhGRu8QOUMwPiQsNEqlx7GeYani0CGPdnp1zTe+O9pYAWx7buVIxndd1aY Hla+u+ANxpxA8lNUHK0Pi2oId+OlWQeOoGE8Ev8Qr8VMvKtUtIHb8azKOxrLfUfB8XA2 T7hE/kF+AA1r9+d7zc24uaiexT8Sa6RbM2kLhvCrt0zkR1tRLCL2mnSQhEDWNXmUcXJT sn3g== X-Gm-Message-State: ACrzQf0yCO80Ir+L+wocT4F/wbV3U78tvH6LE1Z8cdw9bu6BBgcPJZop j//zXju2g9tXM8foRR54+/c= X-Received: by 2002:a50:ed03:0:b0:461:9f73:b8d9 with SMTP id j3-20020a50ed03000000b004619f73b8d9mr857808eds.140.1666473205425; Sat, 22 Oct 2022 14:13:25 -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 la5-20020a170907780500b0077f20a722dfsm13382584ejc.165.2022.10.22.14.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 14:13:25 -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 V3 2/2] mtd: core: set ROOT_DEV for partitions marked as rootfs in DT Date: Sat, 22 Oct 2022 23:13:18 +0200 Message-Id: <20221022211318.32009-2-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221022211318.32009-1-zajec5@gmail.com> References: <20221022211318.32009-1-zajec5@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221022_141328_720753_7CAEA5F7 X-CRM114-Status: GOOD ( 14.76 ) 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=2Crootfs=22?= =?utf-8?q?_binding_that_is_used_to_mark_flash_partition_containing_rootfs=2E?= =?utf-8?q?_It=27s_useful?= =?utf-8?q?_for_devices_using_device_tree_that_don=27t_have_bootloader_passin?= =?utf-8?q?g_root_info?= =?utf-8?q?_in_cmdline=2E_?= =?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?IFsyYTAwOjE0NTA6NDg2NDoyMDowOjA6MDo1MmMgbGlzdGVkIGluXQ==?= =?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,rootfs" binding that is used to mark flash partition containing rootfs. It's useful for devices using device tree that don't have bootloader passing root info in cmdline. Signed-off-by: Rafał Miłecki --- V2: Use "linux,rootfs" as more accurate. Thanks Rob. V3: Add IS_BUILTIN(CONFIG_MTD) check to avoid ERROR: modpost: "ROOT_DEV" [drivers/mtd/mtd.ko] undefined! --- drivers/mtd/mtdcore.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 20fcedc3021e..f70a5e66843b 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -735,6 +736,17 @@ 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)) { + if (IS_BUILTIN(CONFIG_MTD)) { + pr_info("mtd: setting mtd%d (%s) as root device\n", mtd->index, mtd->name); + ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index); + } else { + pr_warn("mtd: can't set mtd%d (%s) as root device - mtd must be builtin\n", + mtd->index, mtd->name); + } + } + /* 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