From patchwork Tue Oct 1 22:18:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 832311 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 F08C91CEEAF; Tue, 1 Oct 2024 22:20:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727821239; cv=none; b=cnbzKjm2D/ZZxRtusBjaoSGs4Kv3MkLrFrWedtENaD1lUiwfYt5bRRfqjZxOlqnst2I95rJfHdL3zLLVnz6+JfDo3yYWLC+K/sTL4hWjJ56bCHRSf1d8TpSWlaEIJ5ZhE6p8pdvEiLnVAHk5+GBmRtEoUTBRxWngjPtx0EoKVsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727821239; c=relaxed/simple; bh=vIZUmOhkctrpxNjE/bq31Se+xRGgI8VKyz9uNEv0GsQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cZH2dVBRkTkm7YlZfK5z0yh/3mcEC6ch1jnjaFHshAzYjvUUEMzhkfy5XmGpbLLjS2PCD7o+ws0II7ne8f3p0lHItT+bAq5esVFKrcIBflo5lmeAckV8JKKwfeeTSaPMRdsU5YbWn2lsZDXP4DLhMkcVQmbXQDOIoxJo80dM9nw= 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=Fmk7GpL8; arc=none smtp.client-ip=209.85.221.49 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="Fmk7GpL8" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3770320574aso4047754f8f.2; Tue, 01 Oct 2024 15:20:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727821236; x=1728426036; darn=vger.kernel.org; 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=4T9c6jNuxQUPP/Rbzo55YkzEPcrdsPIICvkg9bn4/tM=; b=Fmk7GpL8Qvb5P/c+KfqQtQQ3He9GYc0x071DBDbVPe5sW+/cQsb6eQC6FPRmGx8QS9 JFM/FT0ih8mwEVNvrw/MxUQvNYqh+eJFk2CPUfv9uwI6Xygl3yeuJaTRkgQgbcvHh94s 7OvAakFRbFtT0X0TjhfCCrX1KcXrGs+QmbgqHMLC41/aSJr1AHmjTFmck9I+yG8IqS4g OkonA5ob+mPJu50XYsUO9MABr3Emi6F+fC0M1H+wo/xDQoWl8Og5DQtlI9QF0NOEuNUx Z62ZuSUb8NI4tgx4euaYcPq7+HOvyP/Oz0ox2Ad3fNWC/snKhmTImb0KIxzr7MZJdcB5 fHgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727821236; x=1728426036; 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=4T9c6jNuxQUPP/Rbzo55YkzEPcrdsPIICvkg9bn4/tM=; b=CoBWvqnAeogQORiFvgzsBpEhxv00zPSbxFwXjC9ii2/zy1W2BF0Zz99W+9SiHfiiXW FFNpC2NQ9qi5zPPIjC0mGbQQmfNI79m61zPvx7o2d4fFmKmPTIb29zrmxKlobWcV5tSy bYrkT52PTV9FJdBi75DLLIUuLU3WL63NGjhcIct6Aiq/PBXTRp430B6Eg9JjOuTMv4q0 nNJYnoc1x7Vb7gbcIQjs+CZ3rhvxaf/XTuTZt16oT+4Zh+Tm9Z3PVL5dFX4blh0Alswn Ql3unXJ86AqgOeQvxLV3bucsY75uKLN1fQbV3UOY02vMCm2tw8P4/T3GpLavMP9RCTeq uLTQ== X-Forwarded-Encrypted: i=1; AJvYcCULeFuyrHJRDxectYtkKxO+JVvj8/rGL4Otx1qPqLQBTPO4tBq6VYR9BILomeVx3wEuqE2zMkyoenr7NyE=@vger.kernel.org, AJvYcCVfnBE3Esen9RSEgz294vNCMcSPIDFIRXDckpNB01ykDfL54NinSJuoYmIbfAyWDomgv1/gy3Uiy4Dj@vger.kernel.org, AJvYcCVplV7xHdLh4Xdo8Rp1XAjmelnjpZgcVuyWtQobf3uDY7cFY0hLkNqOnZMaGZEhgiW/NFbMp25oRSEBdVd6@vger.kernel.org, AJvYcCWc47F34IefXi5CM5bk2yXz4a6XZEaNrndV6YTvz0oFmThiNJ05BXjbNaN6h2LzcPN0uqzVkFwhAtnU@vger.kernel.org, AJvYcCWleUFUpHlb/Ef10+/+GvERAtKc6OXFFqlspS4vBmYF3GLH9dYoxOXmTTA2VZBLswKTrvYTJlMqtCqp@vger.kernel.org X-Gm-Message-State: AOJu0Yx8m3cfu/oVuxYKyuP3aOjqrReR2Li5nDFm+XgzmzkkdAeGpX7R te9KtiGnFOS3KXj/oRm/RG0bPXYH0PizhykK8+1PYFK502mioy7c X-Google-Smtp-Source: AGHT+IEt+YQcOoLcKfh2IDWaQAcIDbyDapw5vyX/WVp3rTT/HXNLy7PwAC3w39nnsMjur95PNYjA3Q== X-Received: by 2002:a05:6000:18a1:b0:37c:d569:467e with SMTP id ffacd0b85a97d-37cfba20c94mr705520f8f.59.1727821235960; Tue, 01 Oct 2024 15:20:35 -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-37cd57427fbsm12677089f8f.100.2024.10.01.15.20.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 15:20:34 -0700 (PDT) From: Christian Marangi To: Jens Axboe , Jonathan Corbet , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , INAGAKI Hiroshi , Daniel Golle , Christian Brauner , Al Viro , Ming Lei , Jan Kara , Li Lingfeng , Christian Heusel , Avri Altman , Adrian Hunter , Linus Walleij , Mikko Rapeli , Riyan Dhiman , Jorge Ramirez-Ortiz , Dominique Martinet , Jens Wiklander , Christophe JAILLET , Li Zhijian , linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, Lorenzo Bianconi , Miquel Raynal , upstream@airoha.com Cc: Christoph Hellwig Subject: [PATCH v5 1/6] block: add support for defining read-only partitions Date: Wed, 2 Oct 2024 00:18:53 +0200 Message-ID: <20241001221931.9309-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001221931.9309-1-ansuelsmth@gmail.com> References: <20241001221931.9309-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 defining read-only partitions and complete support for it in the cmdline partition parser as the additional "ro" after a partition is scanned but never actually applied. Signed-off-by: Christian Marangi Reviewed-by: Christoph Hellwig --- block/blk.h | 1 + block/partitions/cmdline.c | 3 +++ block/partitions/core.c | 3 +++ 3 files changed, 7 insertions(+) diff --git a/block/blk.h b/block/blk.h index c718e4291db0..f300212d3e98 100644 --- a/block/blk.h +++ b/block/blk.h @@ -558,6 +558,7 @@ void blk_free_ext_minor(unsigned int minor); #define ADDPART_FLAG_NONE 0 #define ADDPART_FLAG_RAID 1 #define ADDPART_FLAG_WHOLEDISK 2 +#define ADDPART_FLAG_READONLY 4 int bdev_add_partition(struct gendisk *disk, int partno, sector_t start, sector_t length); int bdev_del_partition(struct gendisk *disk, int partno); diff --git a/block/partitions/cmdline.c b/block/partitions/cmdline.c index 152c85df92b2..da3e719d8e51 100644 --- a/block/partitions/cmdline.c +++ b/block/partitions/cmdline.c @@ -237,6 +237,9 @@ static int add_part(int slot, struct cmdline_subpart *subpart, put_partition(state, slot, subpart->from >> 9, subpart->size >> 9); + if (subpart->flags & PF_RDONLY) + state->parts[slot].flags |= ADDPART_FLAG_READONLY; + info = &state->parts[slot].info; strscpy(info->volname, subpart->name, sizeof(info->volname)); diff --git a/block/partitions/core.c b/block/partitions/core.c index ab76e64f0f6c..abad6c83db8f 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -373,6 +373,9 @@ static struct block_device *add_partition(struct gendisk *disk, int partno, goto out_del; } + if (flags & ADDPART_FLAG_READONLY) + bdev_set_flag(bdev, BD_READ_ONLY); + /* everything is up and running, commence */ err = xa_insert(&disk->part_tbl, partno, bdev, GFP_KERNEL); if (err) From patchwork Tue Oct 1 22:18:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 832168 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 419991CF2AF; Tue, 1 Oct 2024 22:20:40 +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=1727821242; cv=none; b=r+2BMxOCOTQTNhsg+0cYTbwh3ltzheMGgUCsSRnC+sgzDxWDUm5Qr7LL8+1xtbQDHNyEcXlAcGsP7ODRdSimG5OTPrmQ00UiKIjEUDTT/fblMyDkM8BCI24NiwMbIefOddwxUseHsHyHVaW+xuSnVOFtR4SBoIR98MNANrrECLo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727821242; c=relaxed/simple; bh=AvSpeRPjeVRXz5j8dQKUo3Zt1JFIF3gH9S62HhEmPeo=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tmQub9VXZGNGy24ofd9b/fJtaldfYtzpmvo145MizEtH3shaYY9OY93S98Erbj3rCGKDNYC1EnPbx/LYyyss/oR3LbDKFQ5voQLfApT8B5sCirjs6IGFhAKLLTxh8HfBEC4dMUDSiWC2YZWMOWoRGxfo2PD2mmDYIAaKVoWkQgs= 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=bYWc+uzB; 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="bYWc+uzB" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-42cafda818aso57939885e9.2; Tue, 01 Oct 2024 15:20:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727821239; x=1728426039; 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=36HmyHvoEEpKMI8/Stc+TIqGBije17bfud9rEk2jFTM=; b=bYWc+uzBWvH5QL9CXyyZvxSKrB3M+1gJn7bhGvOJlrCmXSw+JxBGagel+poM1IWgX4 ODnZmrUGEn52TK2gVWgOge/wG9ZabvKFckD0Mk4gl2hr/qWbaV/4f8wX7KcD4GxRxQJy tC9JqBuqJBZzybdzptz3+bpSfCvKGAv+i7sONr74OeT+EZj7F26zRKhMvgQ7gi3NVRNY T6DsjQJsOYpSQpVduN+4CWTAsbZ7Y+tZD4iki1Doh+pzBiZzub8lkZk8Jsyc8w/DxPI9 LmmLEgBwbZHEohhDI5gWUdTUXkPbn4i8JihBduWpRhb7JbbD3Oa68+Z0JqcFLDLW76sX jJOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727821239; x=1728426039; 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=36HmyHvoEEpKMI8/Stc+TIqGBije17bfud9rEk2jFTM=; b=itKD4wr9IqwkBxFTjz1fS2Oqrf78FEELl2j0jsXWCJhhFSMc7wlS8b+wlp/bdKsZpG 0J4rYoPDh/fYO64EY0DHN2mozQxsofLIkgK4RnbOky5bbEwpS/AKXTfVEa8gGMWYCgDY gZpHEdG+NQ54n8rBkWAPGEnquxLJrWIvZZBIAH2CuYOhILo0TjktIpgYJHJrtvZlqVjO /i+IxBC6RPMhBfzPqOkkWkVzgt2ZtIYWISLtLpUdTSNF8dT+telIPEpZcBXc8/Mu14jz PQoVrAMbeLAaCIMsobeJazUPeAsZoTDpe1z/JOfJHyn7HLsPrJ2JMAVzhR4GfKyLjmYv tPqw== X-Forwarded-Encrypted: i=1; AJvYcCU/8gr6urstTjs1WnTX97K/di4Oc2/ALccRcsnCJek6jmC3W5MOjXkQaH6TS+sPqjZsFg3n9R2wyn1j@vger.kernel.org, AJvYcCUGNLtSm9tORSFxdy2/m8IozP1hbCGus7nj4bhdGqPt9+4fdeV9zMVxmJfojk2kgORhO2XiURIpWiiE@vger.kernel.org, AJvYcCUfDwxeirsw5t1T3yoe13Szr8RIix0mht+LNWGjw+7WvOcxSLXctbz+aQwwF2W1Ntnk5BYuIQcR3BFMxrE=@vger.kernel.org, AJvYcCUzI12b3kmkB3a0ElQnJHcxkuA8w7Bri3qRpv5ttopTo4zNvDF5ESt0HH/7IyaZc2d6xW4VwQ8SoQmH22RC@vger.kernel.org, AJvYcCWhDXoIjQNDAFzBzPpYx+/BWbR1d9/XdflAKwQTyubPpEnR3Icqv2htwPp0Vf3456474+MobZ4AgyN9@vger.kernel.org X-Gm-Message-State: AOJu0Yx1nEv+Q9nUvuGXib64Ar+QRfE8TyDeUhcc2YabYXr0kEoMmBzO qpJqwtQipIG0QywcKvbNu2WyEU/vCu5wUtV6DxCTuSM0GEUySNeO X-Google-Smtp-Source: AGHT+IGIDPxjQ+V4nk5hK7ebrKIAFPgPpB4BaP2+JauvZQ+jCU4eMkLt/5R1XilbQgftoTFXdvGVxQ== X-Received: by 2002:a5d:5043:0:b0:374:c16d:6282 with SMTP id ffacd0b85a97d-37cfba12323mr683317f8f.55.1727821239214; Tue, 01 Oct 2024 15:20:39 -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-37cd57427fbsm12677089f8f.100.2024.10.01.15.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 15:20:38 -0700 (PDT) From: Christian Marangi To: Jens Axboe , Jonathan Corbet , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , INAGAKI Hiroshi , Daniel Golle , Christian Brauner , Al Viro , Ming Lei , Jan Kara , Li Lingfeng , Christian Heusel , Avri Altman , Adrian Hunter , Linus Walleij , Mikko Rapeli , Riyan Dhiman , Jorge Ramirez-Ortiz , Dominique Martinet , Jens Wiklander , Christophe JAILLET , Li Zhijian , linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, Lorenzo Bianconi , Miquel Raynal , upstream@airoha.com Subject: [PATCH v5 2/6] docs: block: Document support for read-only partition in cmdline part Date: Wed, 2 Oct 2024 00:18:54 +0200 Message-ID: <20241001221931.9309-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001221931.9309-1-ansuelsmth@gmail.com> References: <20241001221931.9309-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 support for read-only partition in cmdline partition for block devices by appending "ro" after the (partition name). Signed-off-by: Christian Marangi --- Documentation/block/cmdline-partition.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/block/cmdline-partition.rst b/Documentation/block/cmdline-partition.rst index 530bedff548a..526ba201dddc 100644 --- a/Documentation/block/cmdline-partition.rst +++ b/Documentation/block/cmdline-partition.rst @@ -39,13 +39,16 @@ blkdevparts=[;] create a link to block device partition with the name "PARTNAME". User space application can access partition by partition name. +ro + read-only. Flag the partition as read-only. + Example: eMMC disk names are "mmcblk0" and "mmcblk0boot0". bootargs:: - 'blkdevparts=mmcblk0:1G(data0),1G(data1),-;mmcblk0boot0:1m(boot),-(kernel)' + 'blkdevparts=mmcblk0:1G(data0),1G(data1),-;mmcblk0boot0:1m(boot)ro,-(kernel)' dmesg:: From patchwork Tue Oct 1 22:18:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 832310 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 C21C51CF5DD; Tue, 1 Oct 2024 22:20:43 +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=1727821245; cv=none; b=OutVdappPiFsAXVo7iKmk6+6lmsOfzAgQWBZtGWh0AehNenF7EbLz5sb6j+9jlvxCMNQKcahi8oKYxeUxNh+riHBMNuepYHFTVuZv95ZpidhyJVgW4YzGfNATdDmUpqvo7FI3tHG6VFfidO+i5hAwtL8xjTwnzeIlNe5BkThopk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727821245; c=relaxed/simple; bh=uFj2dvFYNBFuFJirSb+yihT/EV1akv6TTLSHucJpP6E=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gg1FnhugrBfr0LGgVw9qvxYmr+cVJNR4GJq/BPjH04/7qbJf4vM1nLUlVEPfWpCJx4C5ee+62bzwn8R1/1g0Y37UcVEJBljrIz0Mqt9OV7HK6P5A47ldE0v/zFZi1OEUQuoTCXpxssI0e93s7Tv7Wr4YqmH63d2pUBmNyMp9RDA= 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=Nm1WOQ9S; 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="Nm1WOQ9S" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-37cc810ce73so3503705f8f.1; Tue, 01 Oct 2024 15:20:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727821242; x=1728426042; 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=UvkeCfAFF2+TrOZNYfnjZ9TAqZKaKEt38PpwPlqvY1M=; b=Nm1WOQ9SgslqM8QNzwdi1DjVJkoHlE0e9LmeKdRHfjts3+fs1Z8I5eeUQkdHdDzaXy 6VRUqzMUsORpb9BMyk2+TZRdmry+EA26oakcK64t0CsLq+85Kjj1NpgS192PbhMrclXH rqd443zFwG8SJI2iCP0LZRK0/+r9z2vFdWXeAQWd0+SvNXjfM3tvUq8tNELMVL4IPt7X ZKTXqx3rGhEmb9PdExJCeuKE12KvQRubKtPWReRTQJnwtq8SmLAl/MBTa+5wLWgtOT/z tuRk2FfRHFsDx8dv4ZTUDDskIkIkfFD9pI8ImN9RPVNNXQZBXBPwg06uI8M2tEulIYXV DgAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727821242; x=1728426042; 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=UvkeCfAFF2+TrOZNYfnjZ9TAqZKaKEt38PpwPlqvY1M=; b=ulIxoi4rfTiLK/l0DQO7f0UGLVqmS/AmxD/UQj1Ao2tBisWfr5iZJxog2xfUrbZaSv GjNhcCaouym+qkQsli7/tesc4HrYL7MLMtQQ3lTnjyBE3Z7n1fmiAOF2OYTBO4cYd1vE fronrp2yF4H+IYT1OOFsBdRSF4DhhnzKx/3TUVSPY2MmfEiMAvcF/mmVKCaLsiV5Rtu9 tB13yX+ux8X2EisyPRTjZUimnyYYqbsWRtNXe5wssJWyS3JxG6lXIi38M5VXADvf654S b9ykxC8My5JGsrctQu+aUHSFfBuyjf8ybtAvkFj33GGoWlXG4L9m0klitPbgyGzKZoZ9 nHGg== X-Forwarded-Encrypted: i=1; AJvYcCV9UvND8BtfQJnbkChv9Xfk1cVzwBscRHHhO23ku08oXgGHI0tLQnE5AW9bydwPwh/pBYBt1a6YhQiH@vger.kernel.org, AJvYcCVsZmUnT3nwNpfyFGwW7gva99UzaRDln35rtLuW0PnUJb2CiSQvj5Cua43d1z4xLzgs/8dTynr58OY+@vger.kernel.org, AJvYcCWhODZzERSnSQxjL3BG4fKzLpm8UhrOu+IvOe166WWwQHGp3OMPGQeavMQ7Odu6IedjfM7wtlPhuBiAGz0=@vger.kernel.org, AJvYcCX+LDbE2D0esO68aKNlSLo2P6+iYb/3N67RpzURIPRCs0qULxFZ90V1+tS9Fh06qox/+XWrs5Q6P1s+QLWW@vger.kernel.org, AJvYcCXeaXKvz+edRlz0/EUAFh0y4+6LKSTSQuKTGaVd6F8/3DDyTbIxnLKBxSyc6JdUOjbYU5AKUU2UJviT@vger.kernel.org X-Gm-Message-State: AOJu0YyPV/9+RM3bZ9OL6saLMXFSqbpU0NbJPz1D80bXU5+Xfx6qyOlu F/IKOhFsdd5n71e/GEJAyPelOCs74Amh/NiJ5hDI2osa0YuyD16S X-Google-Smtp-Source: AGHT+IGdzj7eGjtzUH2e4oHAiqm3ikbyp7r4ZRQP5cTIPq03W/eHfzzj9TqfTqlU00uAZm44bq5y4A== X-Received: by 2002:adf:f98f:0:b0:371:8688:1660 with SMTP id ffacd0b85a97d-37cfba08fd6mr566868f8f.51.1727821241723; Tue, 01 Oct 2024 15:20:41 -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-37cd57427fbsm12677089f8f.100.2024.10.01.15.20.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 15:20:41 -0700 (PDT) From: Christian Marangi To: Jens Axboe , Jonathan Corbet , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , INAGAKI Hiroshi , Daniel Golle , Christian Brauner , Al Viro , Ming Lei , Jan Kara , Li Lingfeng , Christian Heusel , Avri Altman , Adrian Hunter , Linus Walleij , Mikko Rapeli , Riyan Dhiman , Jorge Ramirez-Ortiz , Dominique Martinet , Jens Wiklander , Christophe JAILLET , Li Zhijian , linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, Lorenzo Bianconi , Miquel Raynal , upstream@airoha.com Subject: [PATCH v5 3/6] block: introduce device_add_of_disk() Date: Wed, 2 Oct 2024 00:18:55 +0200 Message-ID: <20241001221931.9309-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001221931.9309-1-ansuelsmth@gmail.com> References: <20241001221931.9309-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 device_add_of_disk() as a variant of device_add_disk() that permits to pass and attach a fwnode to disk dev. This variant can be useful for eMMC that might have the partition table for the disk defined in DT. A parser can later make use of the attached fwnode to parse the related table and init the hardcoded partition for the disk. Signed-off-by: Christian Marangi --- block/genhd.c | 21 +++++++++++++++++++-- include/linux/blkdev.h | 3 +++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 1c05dd4c6980..0fc595895f1d 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -391,8 +391,9 @@ int disk_scan_partitions(struct gendisk *disk, blk_mode_t mode) * This function registers the partitioning information in @disk * with the kernel. */ -int __must_check device_add_disk(struct device *parent, struct gendisk *disk, - const struct attribute_group **groups) +static int __device_add_disk(struct device *parent, struct gendisk *disk, + const struct attribute_group **groups, + struct fwnode_handle *fwnode) { struct device *ddev = disk_to_dev(disk); @@ -452,6 +453,8 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk, ddev->parent = parent; ddev->groups = groups; dev_set_name(ddev, "%s", disk->disk_name); + if (fwnode) + device_set_node(ddev, fwnode); if (!(disk->flags & GENHD_FL_HIDDEN)) ddev->devt = MKDEV(disk->major, disk->first_minor); ret = device_add(ddev); @@ -553,8 +556,22 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk, elevator_exit(disk->queue); return ret; } + +int __must_check device_add_disk(struct device *parent, struct gendisk *disk, + const struct attribute_group **groups) +{ + return __device_add_disk(parent, disk, groups, NULL); +} EXPORT_SYMBOL(device_add_disk); +int __must_check device_add_of_disk(struct device *parent, struct gendisk *disk, + const struct attribute_group **groups, + struct fwnode_handle *fwnode) +{ + return __device_add_disk(parent, disk, groups, fwnode); +} +EXPORT_SYMBOL(device_add_of_disk); + static void blk_report_disk_dead(struct gendisk *disk, bool surprise) { struct block_device *bdev; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index bf1aa951fda2..7d41f35f1065 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -725,6 +725,9 @@ static inline unsigned int blk_queue_depth(struct request_queue *q) #define for_each_bio(_bio) \ for (; _bio; _bio = _bio->bi_next) +int __must_check device_add_of_disk(struct device *parent, struct gendisk *disk, + const struct attribute_group **groups, + struct fwnode_handle *fwnode); int __must_check device_add_disk(struct device *parent, struct gendisk *disk, const struct attribute_group **groups); static inline int __must_check add_disk(struct gendisk *disk) From patchwork Tue Oct 1 22:18:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 832167 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 2719D1CF7AE; Tue, 1 Oct 2024 22:20:45 +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=1727821247; cv=none; b=XkXJrAyJrHlgXALHeT0BfTstk+V5Sj1PnECbnqPitxkGb/Y2uiSKpQ4EQvk8fbTUqw5zmHe0e94PQDLlnk5gpnws8LPJa1ZCkRRYVoe6Z4CyLaMqLc9Lkvlrm7BcV1CygG0VE43Q3Dlct6huisdFNGVSTeB0akWNFHE+d+GRtXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727821247; c=relaxed/simple; bh=TW0txKX9e4roa0YNw5Cx9O90dBfiPbgGU4uRu7+BdK0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ivVUu6Hsqc6aj9puKy9GX+Un/9/dMuiZNLvLharILxnTTsmqi5pTYiTlgNzlSwJXQ6TCeIOMceOlSoe+x5hn9amTvtAhFqR5ZDFO4wHa9SicGeSNb8ohFDVBp+eznUAFfCEa/hchyv30IL18hJFVEneEBZzhKUJVYfBBmbuAsoA= 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=e9dTqUbN; 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="e9dTqUbN" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-42cde6b5094so53475895e9.3; Tue, 01 Oct 2024 15:20:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727821244; x=1728426044; 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=iJzhFl4gjtFcw96QhqUK28d5tLTRI0Tg3FOFtHUxokA=; b=e9dTqUbN/YyFK2E4NxY3xfUrrrTeO5jN0zP1zV1uPT7bQ9zBc8Sygke9ypVKlijBdb zVnJNFnwIwPaMYg/Aot3vxAzELcjUNqt6HyDCfHiW92eVU8zoTt9SQ4I/FPnoOfRuV9Q Sw6ZZTL+nRXdiYOBuJJLcxDeTeIfbNgZfZgqWJ/zJrTgFq5RXoB6GyXRnHMCDXqlc/9p sDM4PpwHCOzwxA0ijpAZPoDO1ExHIuoPiSrOcVkaQrGiA3wbuFPgysrnhkyxJbH3dO9P 6iZS7dZvLZyRRUgZBT3ZaVrIzVSZaoteegkaxuOltIzsKsD/Zgzouyi6E7eS3w6DDbeL bSog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727821244; x=1728426044; 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=iJzhFl4gjtFcw96QhqUK28d5tLTRI0Tg3FOFtHUxokA=; b=ngOI7lY0FUsZ/xz0pcNHiV2m9NuhKvxcnSf5yvkLTL1/Y+W0G2yvijLYIn2NB8d7P0 dSwu8RlXBuW2xBRc2CbbyZI+QXCOzGGlIfB2KetfV+jlMBld8gPwb1EvLLUdAGv6CzCk uKIGaNzTWpMk5Jzpk4U5/TW1pNAYFjaPkG5I0GlPGKbN7LBBHG/9gkBUze6KPuyYNpuY iAg0k2n9s/2X6kmeqjBuOvq5PfN0zYFw4hCj2ytZQnKMXqsASlL0BruvDSgUfvpldNNL KmWKsMqBSe2Bte5KWWuEubHZj36225OxzUCH3YbPNClTRSuZbbmqxjNynl0M4/FQiKns Qn+Q== X-Forwarded-Encrypted: i=1; AJvYcCUZA7vZJvQg7e6xLLws8F0ZjFLp+f0dp3/wvMr6e9gcwrkLdOntQJW4TwqYAZAAjBQS4+5+0IbMQ8wG@vger.kernel.org, AJvYcCV4psNMoupdiVle57366UuMnNFTfCoIK2VTrj1Mx0qrqAQKf1FCMYJH4n5vVK+a/62IAFwh4Dtg6PnR@vger.kernel.org, AJvYcCV8ZWVeH5clE7t32m+DTGRyGse8wSus8WU9dctxNINmyJLgi5s1+yf2V2XJoX9wyxLrr65HpMv6BHu5@vger.kernel.org, AJvYcCWefwe9I0cmaiAweQLyYtNze/zrIZmFeFriG+9R23as/P2RsaCI5LyvvVItc/oG9zo9XXzE+ELymH7PA/wV@vger.kernel.org, AJvYcCXEYkSyGEFi8IYoFEy6/GCDIDstkfhZAhGfzj/qhPXwTylYQADQSSVqA9l1yNay5xz343Ke5Ta8qIbSwDk=@vger.kernel.org X-Gm-Message-State: AOJu0YzvLLta3j0vK6EZYtrjIRxhYIUKphpTKFdcC14X5g7OD35tqVSk 5QcwirH5B9pcCcrhprr0zY3yq7Td+zSX3lAIef+vfmOZmFi4iwDs X-Google-Smtp-Source: AGHT+IF3fiUQP9TkqnLPw81ZBK96R8d2ahsysc3BpTVUjWAy4kA0+9Xy4jNeUdlI0vwXFMGBkZFFbA== X-Received: by 2002:a5d:4532:0:b0:374:c64e:3fe7 with SMTP id ffacd0b85a97d-37cfba25cacmr671779f8f.59.1727821244244; Tue, 01 Oct 2024 15:20:44 -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-37cd57427fbsm12677089f8f.100.2024.10.01.15.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 15:20:43 -0700 (PDT) From: Christian Marangi To: Jens Axboe , Jonathan Corbet , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , INAGAKI Hiroshi , Daniel Golle , Christian Brauner , Al Viro , Ming Lei , Jan Kara , Li Lingfeng , Christian Heusel , Avri Altman , Adrian Hunter , Linus Walleij , Mikko Rapeli , Riyan Dhiman , Jorge Ramirez-Ortiz , Dominique Martinet , Jens Wiklander , Christophe JAILLET , Li Zhijian , linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, Lorenzo Bianconi , Miquel Raynal , upstream@airoha.com Subject: [PATCH v5 4/6] mmc: block: attach partitions fwnode if found in mmc-card Date: Wed, 2 Oct 2024 00:18:56 +0200 Message-ID: <20241001221931.9309-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001221931.9309-1-ansuelsmth@gmail.com> References: <20241001221931.9309-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 partitions fwnode if found in mmc-card and register disk with it. This permits block partition to reference the node and register a partition table defined in DT for the special case for embedded device that doesn't have a partition table flashed but have an hardcoded partition table passed from the system. JEDEC BOOT partition boot0/boot1 are supported but in DT we refer with the JEDEC name of boot1 and boot2 to better adhere to documentation. Also JEDEC GP partition gp0/1/2/3 are supported but in DT we refer with the JEDEC name of gp1/2/3/4 to better adhere to documentration. Signed-off-by: Christian Marangi Reviewed-by: Linus Walleij --- drivers/mmc/core/block.c | 55 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index f58bea534004..01c4ee223156 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2501,6 +2501,56 @@ static inline int mmc_blk_readonly(struct mmc_card *card) !(card->csd.cmdclass & CCC_BLOCK_WRITE); } +/* + * Search for a declared partitions node for the disk in mmc-card related node. + * + * This is to permit support for partition table defined in DT in special case + * where a partition table is not written in the disk and is expected to be + * passed from the running system. + * + * For the user disk, "partitions" node is searched. + * For the special HW disk, "partitions-" node with the appended name is used + * following this conversion table (to adhere to JEDEC naming) + * - boot0 -> partitions-boot1 + * - boot1 -> partitions-boot2 + * - gp0 -> partitions-gp1 + * - gp1 -> partitions-gp2 + * - gp2 -> partitions-gp3 + * - gp3 -> partitions-gp4 + */ +static struct fwnode_handle *mmc_blk_get_partitions_node(struct device *mmc_dev, + const char *subname) +{ + const char *node_name = "partitions"; + + if (subname) { + mmc_dev = mmc_dev->parent; + + /* + * Check if we are allocating a BOOT disk boot0/1 disk. + * In DT we use the JEDEC naming boot1/2. + */ + if (!strcmp(subname, "boot0")) + node_name = "partitions-boot1"; + if (!strcmp(subname, "boot1")) + node_name = "partitions-boot2"; + /* + * Check if we are allocating a GP disk gp0/1/2/3 disk. + * In DT we use the JEDEC naming gp1/2/3/4. + */ + if (!strcmp(subname, "gp0")) + node_name = "partitions-gp1"; + if (!strcmp(subname, "gp1")) + node_name = "partitions-gp2"; + if (!strcmp(subname, "gp2")) + node_name = "partitions-gp3"; + if (!strcmp(subname, "gp3")) + node_name = "partitions-gp4"; + } + + return device_get_named_child_node(mmc_dev, node_name); +} + static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, struct device *parent, sector_t size, @@ -2509,6 +2559,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, int area_type, unsigned int part_type) { + struct fwnode_handle *disk_fwnode; struct mmc_blk_data *md; int devidx, ret; char cap_str[10]; @@ -2610,7 +2661,9 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, /* used in ->open, must be set before add_disk: */ if (area_type == MMC_BLK_DATA_AREA_MAIN) dev_set_drvdata(&card->dev, md); - ret = device_add_disk(md->parent, md->disk, mmc_disk_attr_groups); + disk_fwnode = mmc_blk_get_partitions_node(parent, subname); + ret = device_add_of_disk(md->parent, md->disk, mmc_disk_attr_groups, + disk_fwnode); if (ret) goto err_put_disk; return md; From patchwork Tue Oct 1 22:18:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 832309 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 41E431CF7DF; Tue, 1 Oct 2024 22:20:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727821251; cv=none; b=nVMqf5nNLutsC+no0IGJ0COu5t81qJ6gOlfz1vjXL5/R8tj8WRo8BXJOUilcwY/E2HrWkdOo+lLJh0QLi25sF+jFvlsS0WEpUIP8oomDeYCxnv7hU66ZhY4uR87saUIyhIS7oNf+ESI5ssyWXUDPwa5hKJCx+nYmGRJBnTXNFjw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727821251; c=relaxed/simple; bh=OwoSKnytU2lo8Y70wF6lF1REL5Hoitw9aEPEvbYRD/I=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lDL+xn9ueOS5KVszOfYCqOuH6oTRIR4hHGp0QpoG0XBRdXZe18VRcSeAHIed3vldnnPJe+MAdKkJ/ey1Oqa/lOO8IenRg3gMLMkYaCaefVjCKK22u2KAutJ2EElN2NPgDuJPvxSf5P8YaqZdCTTEEC5YadwCgRvTljxxNtQ5oVA= 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=WcFqdIU+; arc=none smtp.client-ip=209.85.128.50 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="WcFqdIU+" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-42cafda818aso57940655e9.2; Tue, 01 Oct 2024 15:20:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727821248; x=1728426048; 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=k4AkUu8bjS9tIJ6QbG7OaPFKTVmhOX5XEg0AdMpU3gU=; b=WcFqdIU+gSV0Dx32kbUbuGW4+rOUvHt2GTwRDFDMoA60o/IMZD5dDWWoCKOtNDIAxP jhVn6Wo1f/pyBOel6vNzJhp4OrHCRp0XQMWgh7txtu3H9hvAvqRxAxmNljB+txPIp1hw zLCm4GGp816wvMYZQcXcB8TfbDA5EKO0UOGvlqh7Agl2DcRmpFdn/s7r53+IY/9rGIt2 /CDxMyQwFoX6YiTF7u7Fe84rmOXdAKfPkP6+fWgXJpsRIpEjCZS7+WsZw/PUpia8meRS RTsAtkTjJ1QiBKw82mVAuqYi4iues2kncIg1aerM1uibuobXviMkX6O/KE4npBHjhWzB +IDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727821248; x=1728426048; 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=k4AkUu8bjS9tIJ6QbG7OaPFKTVmhOX5XEg0AdMpU3gU=; b=hx0Hi6MlwwwBNpHfstwgOqJAaIAymypYHzjsiCtCwJGdqiE7mVDSbqPF3+hY75tcFF 194fPt5pYrRbCAc4/BFOT9DpPL2NVMpotcVWVzGW31RJ+6lRcQ5hIoqMx0F2fsuO3dGR +wNm5IYy4ses4VKUYMwOzZE/eIFXG/v+pYr/42pDi1SJekmnuE8knjKd82SG17dttdIt FdBya+vjS/l0X+ZXNwGZaq0j7oKXG+VdTXFUbdwPwOOIkdNVKw7igdpwR8d0sz7Al1K7 4HNQ4kve9PSOzbkzfKt12iUOhXqCpI+xI3RGUiVspbUCUniV9Jo9e9TW13xHaci+VuG9 TM9A== X-Forwarded-Encrypted: i=1; AJvYcCUJGKBLunKigQQEdQzaS5GTNoKqQXS2WwjgkrtGdqDtj4la5pN5+jYmdMeUEbR0uIjOtDOenLTliPIi@vger.kernel.org, AJvYcCV0IvMJiaBz0dTYMV4mN14QsINhAvF+vomwV37FZfdVKSsE+GdAXr0a+RwkdeTKOdRWwZc46odSRci/@vger.kernel.org, AJvYcCVNb4CkjS6LwJAPu3pI1Tjt9mhyQvzeg4i/KYz+PeEadWXP9j+WFPqKflLJ4z79rb0tTWDNQ4bqrmyeB3o=@vger.kernel.org, AJvYcCXNfSrZYlwrzmNYWsHmqi/oBiqV+9oKt4bVyvcIc66TpGvZC0NIwu9nWVQ+6j3fQjH56l+IGKwNAu3qJcTs@vger.kernel.org, AJvYcCXkNIGf8Mxgbsochb1a+f29PQLqnojwZWA+f4Cb6rE6svNwqhrq+I/CunQ4pLunXkdNpJKg73am5lPQ@vger.kernel.org X-Gm-Message-State: AOJu0Yy8lELI4QWuV+pD6NRemaaB/czwTgoYAGVhvI6vWXWUfwfYpDhw CAJtDZ2TeSh+AFS5UVpxHm/rCDkk8Fykj2eTgmDQXsAi6AICVEHk X-Google-Smtp-Source: AGHT+IEB0pxd++8ewSjqWqNceMDYbX1czBZlzOasDEvdeiL50XPFZ+s6vBysrS7bvy9zMGbP7yMudQ== X-Received: by 2002:adf:cd09:0:b0:37c:ced2:843b with SMTP id ffacd0b85a97d-37cfb8c744bmr760852f8f.20.1727821247236; Tue, 01 Oct 2024 15:20:47 -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-37cd57427fbsm12677089f8f.100.2024.10.01.15.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 15:20:46 -0700 (PDT) From: Christian Marangi To: Jens Axboe , Jonathan Corbet , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , INAGAKI Hiroshi , Daniel Golle , Christian Brauner , Al Viro , Ming Lei , Jan Kara , Li Lingfeng , Christian Heusel , Avri Altman , Adrian Hunter , Linus Walleij , Mikko Rapeli , Riyan Dhiman , Jorge Ramirez-Ortiz , Dominique Martinet , Jens Wiklander , Christophe JAILLET , Li Zhijian , linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, Lorenzo Bianconi , Miquel Raynal , upstream@airoha.com Subject: [PATCH v5 5/6] block: add support for partition table defined in OF Date: Wed, 2 Oct 2024 00:18:57 +0200 Message-ID: <20241001221931.9309-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001221931.9309-1-ansuelsmth@gmail.com> References: <20241001221931.9309-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 partition table defined in Device Tree. Similar to how it's done with MTD, add support for defining a fixed partition table in device tree. A common scenario for this is fixed block (eMMC) embedded devices that have no MBR or GPT partition table to save storage space. Bootloader access the block device with absolute address of data. This is to complete the functionality with an equivalent implementation with providing partition table with bootargs, for case where the booargs can't be modified and tweaking the Device Tree is the only solution to have an usabe partition table. The implementation follow the fixed-partitions parser used on MTD devices where a "partitions" node is expected to be declared with "fixed-partitions" compatible in the OF node of the disk device (mmc-card for eMMC for example) and each child node declare a label and a reg with offset and size. If label is not declared, the node name is used as fallback. Eventually is also possible to declare the read-only property to flag the partition as read-only. Signed-off-by: Christian Marangi Reviewed-by: Christoph Hellwig --- block/partitions/Kconfig | 9 +++ block/partitions/Makefile | 1 + block/partitions/check.h | 1 + block/partitions/core.c | 3 + block/partitions/of.c | 116 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 130 insertions(+) create mode 100644 block/partitions/of.c diff --git a/block/partitions/Kconfig b/block/partitions/Kconfig index 7aff4eb81c60..ce17e41451af 100644 --- a/block/partitions/Kconfig +++ b/block/partitions/Kconfig @@ -270,4 +270,13 @@ config CMDLINE_PARTITION Say Y here if you want to read the partition table from bootargs. The format for the command line is just like mtdparts. +config OF_PARTITION + bool "Device Tree partition support" if PARTITION_ADVANCED + depends on OF + help + Say Y here if you want to enable support for partition table + defined in Device Tree. (mainly for eMMC) + The format for the device tree node is just like MTD fixed-partition + schema. + endmenu diff --git a/block/partitions/Makefile b/block/partitions/Makefile index a7f05cdb02a8..25d424922c6e 100644 --- a/block/partitions/Makefile +++ b/block/partitions/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_CMDLINE_PARTITION) += cmdline.o obj-$(CONFIG_MAC_PARTITION) += mac.o obj-$(CONFIG_LDM_PARTITION) += ldm.o obj-$(CONFIG_MSDOS_PARTITION) += msdos.o +obj-$(CONFIG_OF_PARTITION) += of.o obj-$(CONFIG_OSF_PARTITION) += osf.o obj-$(CONFIG_SGI_PARTITION) += sgi.o obj-$(CONFIG_SUN_PARTITION) += sun.o diff --git a/block/partitions/check.h b/block/partitions/check.h index 8d70a880c372..e5c1c61eb353 100644 --- a/block/partitions/check.h +++ b/block/partitions/check.h @@ -62,6 +62,7 @@ int karma_partition(struct parsed_partitions *state); int ldm_partition(struct parsed_partitions *state); int mac_partition(struct parsed_partitions *state); int msdos_partition(struct parsed_partitions *state); +int of_partition(struct parsed_partitions *state); int osf_partition(struct parsed_partitions *state); int sgi_partition(struct parsed_partitions *state); int sun_partition(struct parsed_partitions *state); diff --git a/block/partitions/core.c b/block/partitions/core.c index abad6c83db8f..dc21734b00ec 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -43,6 +43,9 @@ static int (*const check_part[])(struct parsed_partitions *) = { #ifdef CONFIG_CMDLINE_PARTITION cmdline_partition, #endif +#ifdef CONFIG_OF_PARTITION + of_partition, /* cmdline have priority to OF */ +#endif #ifdef CONFIG_EFI_PARTITION efi_partition, /* this must come before msdos */ #endif diff --git a/block/partitions/of.c b/block/partitions/of.c new file mode 100644 index 000000000000..7ddde69bcdc2 --- /dev/null +++ b/block/partitions/of.c @@ -0,0 +1,116 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include +#include +#include +#include "check.h" + +static int validate_of_partition(struct device_node *np, int slot) +{ + int a_cells, s_cells; + const __be32 *reg; + u64 offset, size; + int len; + + reg = of_get_property(np, "reg", &len); + + a_cells = of_n_addr_cells(np); + s_cells = of_n_size_cells(np); + + /* Make sure reg len match the expected addr and size cells */ + if (len / sizeof(*reg) != a_cells + s_cells) + return -EINVAL; + + /* Validate offset conversion from bytes to sectors */ + offset = of_read_number(reg, a_cells); + if (offset % SECTOR_SIZE) + return -EINVAL; + + /* Validate size conversion from bytes to sectors */ + size = of_read_number(reg + a_cells, s_cells); + if (!size || size % SECTOR_SIZE) + return -EINVAL; + + return 0; +} + +static void add_of_partition(struct parsed_partitions *state, int slot, + struct device_node *np) +{ + struct partition_meta_info *info; + char tmp[sizeof(info->volname) + 4]; + int a_cells, s_cells; + const char *partname; + const __be32 *reg; + u64 offset, size; + int len; + + reg = of_get_property(np, "reg", &len); + + a_cells = of_n_addr_cells(np); + s_cells = of_n_size_cells(np); + + /* Convert bytes to sector size */ + offset = of_read_number(reg, a_cells) / SECTOR_SIZE; + size = of_read_number(reg + a_cells, s_cells) / SECTOR_SIZE; + + put_partition(state, slot, offset, size); + + if (of_property_read_bool(np, "read-only")) + state->parts[slot].flags |= ADDPART_FLAG_READONLY; + + /* + * Follow MTD label logic, search for label property, + * fallback to node name if not found. + */ + info = &state->parts[slot].info; + partname = of_get_property(np, "label", &len); + if (!partname) + partname = of_get_property(np, "name", &len); + strscpy(info->volname, partname, sizeof(info->volname)); + + snprintf(tmp, sizeof(tmp), "(%s)", info->volname); + strlcat(state->pp_buf, tmp, PAGE_SIZE); +} + +int of_partition(struct parsed_partitions *state) +{ + struct device_node *partitions_np, *np; + struct device *ddev = disk_to_dev(state->disk); + int slot; + + partitions_np = of_node_get(ddev->of_node); + if (!partitions_np || + !of_device_is_compatible(partitions_np, "fixed-partitions")) + return 0; + + slot = 1; + /* Validate parition offset and size */ + for_each_child_of_node(partitions_np, np) { + if (validate_of_partition(np, slot)) { + of_node_put(np); + of_node_put(partitions_np); + + return -1; + } + + slot++; + } + + slot = 1; + for_each_child_of_node(partitions_np, np) { + if (slot >= state->limit) { + of_node_put(np); + break; + } + + add_of_partition(state, slot, np); + + slot++; + } + + strlcat(state->pp_buf, "\n", PAGE_SIZE); + + return 1; +} From patchwork Tue Oct 1 22:18:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 832166 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 51B101CFEB1; Tue, 1 Oct 2024 22:20:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727821252; cv=none; b=NhCDkpVBG30GFOdVJ90IjZ2nTSWEpZaZEeWjYHeb5dO6mgC6NgMlS8ufJ8INyxBHP4QTSi2Ke4J0kJvgOk19cCFKJzhN1A+O4jL6i5UxwfU3kDnzPw7CxSMYl3rYeN/jnM143nyTseSJUQ4R0sUuairDp3FVr9io4+z8Hkd3DsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727821252; c=relaxed/simple; bh=ZGJWblZQ6mWDeDX3xWjLX4Hq31Cq8jNHK7pdlF6Useg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HpeJUJ/ukTdVOvFi7W69+6RJN234FyJDNd3W5N44ffqJIy/Q7Xiq5FoyL2BN6l9jzIzPbfCqRUyQOEQtXsrYKIQAM6O9t0B9STM6n7wN8WyDxO89wMe9aBu7jAaXhJ8val4y7YAHWUk5ZQSQIsun0GGcOripf2l6Te8U8pLLbTQ= 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=e/2PcnVF; arc=none smtp.client-ip=209.85.128.42 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="e/2PcnVF" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-42cb57f8b41so74016325e9.0; Tue, 01 Oct 2024 15:20:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727821250; x=1728426050; 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=gcRl7SYPnHXphMlwKdbFcqFdVK4YyXteBvfwt/gFJ9s=; b=e/2PcnVFqVxSzpcUATNlcHesczaLStp6YCzi39PkRzNBJQcFdTL06q0oBK19FBMlKg ESFigPQaE9jlZ7ZBv3OKcFatITmPM5pyBB957wn/maWwuG5TM2xQ1nECSA0E7eKLyjui FDrxoHwZcVCtGgOLDXLk3p/jVlDO0KbOeOFMo5EIslKxjSCXWZjabSh2zfyueImh9Jaw ihTHR1RiZQcf1CW6Wbvm+glBeMdnEPaEwdUY5zMdaWm7RKotfPIlEsKz6mqDP+IzCaun Q9TUCbcFVWUr9qqhzU2d8s80m0rB7YDcJrB2XMLYpa5pS5lRz0BAX06EwtWTi793qjzZ hDmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727821250; x=1728426050; 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=gcRl7SYPnHXphMlwKdbFcqFdVK4YyXteBvfwt/gFJ9s=; b=IinZxOi6Y1Aw4fopUbbg3TqYif2nwEjHi5xrg6tCTj+Ka+1AMzLllpxWaYa8o0Dclc vHfwgsOYuFzqR+j5OJ3/OfpGG5mhK2h43jtISJ2cjW+GpYaRC3w0mZ5GI8oBnXFQd4J0 YsQratVfqZoCslBGRCNibl3zh+D8zO4sLw4G1LQEksW57E8YtrLDt2kIqkvMZmD+I7br iRFUgwMhD9t1gXMGZaOwlxriQGr/1OAs/+qszkIn7kYS9U6Vtt3+eD3AVZGgEO2DVUeO TLGCWBA6cQJeq8sb3GcPe6Ue5DqmHG1dHJ6uDXJqwonIUEN9733EbHcSzpIf1fzAz5SR AC/A== X-Forwarded-Encrypted: i=1; AJvYcCUQIhQj9Xm+jQT6raOsieW9vb1fz81ODVnXy+02ToS/BizKZulEmPpiBwR48lZ6RmJFNC9NFmf3NHj4jZ4=@vger.kernel.org, AJvYcCWev9md2385wC891U4QCGO9kioM4vPHTo80ytEy6X55pQ2gX9Lbv2Fm6XrWzSyZXlFEWqIgrK/vkmCx@vger.kernel.org, AJvYcCWqYDddXdaklTS/FpuN4vL1p1B49H1YSRsHMg9NSj5WbZEU0XFCuZUox+LJQy52gXG5r3IWj5+egqCmcmg0@vger.kernel.org, AJvYcCXS7cFK1wdM0g6CaUQOFMz9HZbNBRwfP8DIMMhQD0/mqPosgMLH19aGCVgt4dqFK0KMqIkZ5v+g+dCS@vger.kernel.org, AJvYcCXr0vfdh9/VflTRYlbg4Dbos2Crdz/FcLK219ZChTg4xFIROj+p4B2xacxOhSXhGwDrLezo0hD2zO6L@vger.kernel.org X-Gm-Message-State: AOJu0YxJlQq2KhUHN1C8hiTKIpaSL4NNid6pKzVsKUA6tmMitnPSieyi D9Fj/T8aXZ4Y6FpKLpslN3YWcM3ir6FwUjkcDWopAlSut/Br1UDH X-Google-Smtp-Source: AGHT+IG7WeKRTItajpBK4SbfYQ6nw9VbEZOfPkIyKbhJk/0ty0lEMpKeTh3MQUz4EbpOtFm3SFoaFA== X-Received: by 2002:a05:600c:5254:b0:42c:b220:4769 with SMTP id 5b1f17b1804b1-42f778f65ebmr7833955e9.32.1727821249579; Tue, 01 Oct 2024 15:20:49 -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-37cd57427fbsm12677089f8f.100.2024.10.01.15.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 15:20:49 -0700 (PDT) From: Christian Marangi To: Jens Axboe , Jonathan Corbet , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , INAGAKI Hiroshi , Daniel Golle , Christian Brauner , Al Viro , Ming Lei , Jan Kara , Li Lingfeng , Christian Heusel , Avri Altman , Adrian Hunter , Linus Walleij , Mikko Rapeli , Riyan Dhiman , Jorge Ramirez-Ortiz , Dominique Martinet , Jens Wiklander , Christophe JAILLET , Li Zhijian , linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, Lorenzo Bianconi , Miquel Raynal , upstream@airoha.com Subject: [PATCH v5 6/6] dt-bindings: mmc: Document support for partition table in mmc-card Date: Wed, 2 Oct 2024 00:18:58 +0200 Message-ID: <20241001221931.9309-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001221931.9309-1-ansuelsmth@gmail.com> References: <20241001221931.9309-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 support for defining a partition table in the mmc-card node. This is needed if the eMMC doesn't have a partition table written and the bootloader of the device load data by using absolute offset of the block device. This is common on embedded device that have eMMC installed to save space and have non removable block devices. If an OF partition table is detected, any partition table written in the eMMC will be ignored and won't be parsed. eMMC provide a generic disk for user data and if supported (JEDEC 4.4+) also provide two additional disk ("boot1" and "boot2") for special usage of boot operation where normally is stored the bootloader or boot info. New JEDEC version also supports up to 4 GP partition for other usage called "gp1", "gp2", "gp3", "gp4". Signed-off-by: Christian Marangi Reviewed-by: Linus Walleij Reviewed-by: Rob Herring (Arm) --- .../devicetree/bindings/mmc/mmc-card.yaml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/mmc-card.yaml b/Documentation/devicetree/bindings/mmc/mmc-card.yaml index fd347126449a..1d91d4272de0 100644 --- a/Documentation/devicetree/bindings/mmc/mmc-card.yaml +++ b/Documentation/devicetree/bindings/mmc/mmc-card.yaml @@ -13,6 +13,10 @@ description: | This documents describes the devicetree bindings for a mmc-host controller child node describing a mmc-card / an eMMC. + It's possible to define a fixed partition table for an eMMC for the user + partition, the 2 BOOT partition (boot1/2) and the 4 GP (gp1/2/3/4) if supported + by the eMMC. + properties: compatible: const: mmc-card @@ -26,6 +30,24 @@ properties: Use this to indicate that the mmc-card has a broken hpi implementation, and that hpi should not be used. +patternProperties: + "^partitions(-boot[12]|-gp[14])?$": + $ref: /schemas/mtd/partitions/partitions.yaml + + patternProperties: + "^partition@[0-9a-f]+$": + $ref: /schemas/mtd/partitions/partition.yaml + + properties: + reg: + description: Must be multiple of 512 as it's converted + internally from bytes to SECTOR_SIZE (512 bytes) + + required: + - reg + + unevaluatedProperties: false + required: - compatible - reg @@ -42,6 +64,36 @@ examples: compatible = "mmc-card"; reg = <0>; broken-hpi; + + partitions { + compatible = "fixed-partitions"; + + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; /* Kernel */ + reg = <0x0 0x2000000>; /* 32 MB */ + }; + + partition@2000000 { + label = "rootfs"; + reg = <0x2000000 0x40000000>; /* 1GB */ + }; + }; + + partitions-boot1 { + compatible = "fixed-partitions"; + + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bl"; + reg = <0x0 0x2000000>; /* 32MB */ + read-only; + }; + }; }; };