From patchwork Wed Oct 2 22:11:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 832308 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CFA519885B; Wed, 2 Oct 2024 22:13:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727907226; cv=none; b=DVa0wwuBeoWDGEP8gZvTY6Jr5P902fUPSPk87ThuRNVILrht/XhDKc1VXdR8fXA4XSPEVZqt0Pd6JJQxW4mWeledG+jVlK9H3loqts6/zgiVvyYChPvMrhGxHoe/gqMzuSyIP0cmeVF2WHHHlDH4sDzHdxxvqbSkD0EOAxA40xA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727907226; c=relaxed/simple; bh=vIZUmOhkctrpxNjE/bq31Se+xRGgI8VKyz9uNEv0GsQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D4Qldwg1fG6DLgZbU30UGAtnhMoBDwa1aMWGNW0+v+2YQuGI/wmo5PBWeV2jTPjVmOKx0yfaWLRG1aEnh9SzRp2ifCitmpU1aGZ0iCOq82LTDKBwhMWTWN1RIHCVW8H2h+FZcqTJE7PnmWUAfFNve4goPlhzfpd4UQlEqGnNp8U= 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=hJdHh1pD; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hJdHh1pD" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-42cbb08a1a5so2074785e9.3; Wed, 02 Oct 2024 15:13:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727907223; x=1728512023; 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=hJdHh1pDDc/wwQTw1aH+f3MPnAAzQk3DMfCYsLppvZPPYaGo78s+XDY2QXpl3ivF4r Eyz/AUgGwiC8x8WZRCy/FpG2MCcERU+gdpV7RG1U6rpDXr096E3wwTFr3hQ7LfqvTnPP 36qyfooIgE6X3oSHR0sge39+pEkwBfo6D3MTj1AhEBbsLJLu5lWkbrvnTaZ8LXvtoYJ9 M/wuQmundepYbRPFahGic1sD7nFKeeIo5z9YqJq1eFJP29TZRWmHTigs5j4J2bPT7rQJ f7080xDkLKLc7rm0wJthIK5p2UwIn/il7pZ5ylhwDJOewxDkvzjp71O54Jb/8PFV34Dx 52fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727907223; x=1728512023; 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=MVscUUG2gEGv9d6tUtSnasGfj9rBzAloA870R6IwFR1D9dy43OgL4+SjCiNZmDARTV NuoST+LQmcXqUd5KBNBqa3udHPnLSgITFcfaAUlPv2eYRkLw8OPsLRDtx8MrnkWn/EX9 8MzwzGGSeBJ9/t8d/x95CTcOMvCLpvsm4BRbFR80k5rUyjnoOsY8nxwQoT54aCb1b4Rs ukXJYJh/HIEXLkLzu3R8wzm3YX4ZeSmQ5DLc3Tb2vQ/PzrQZ09QxcKcpCXslh9EMPXd1 L/zHIH9Qc4C8s4tmE8/tRBvdXw1Zd8NOe3E6PTuLTUIUOu6nqnMIfz36i5cWIB+kRg8G oAXw== X-Forwarded-Encrypted: i=1; AJvYcCU+2Dzzyz9xOSLWhnz9phH2zF2pQ36xtob8mKqTRRF/+kwM4/Yzu7inF+NwumN71iB1WKXYvR9B4mpl8FDp@vger.kernel.org, AJvYcCUpC9Kyml93hrrTza8hKvcNrGkTiAlyqZZCQG9wlEZh7fBlgIzifXckEtF3LuwqnkjLgLVku/4TZenw@vger.kernel.org, AJvYcCUzPqRGZNUYuXLjCt5TxUWIM/6DBBsb4/J/4T+b/cTtWxMrpmLW6B10ITJzgedDP1HYNw7myZIpkbyP8PU=@vger.kernel.org, AJvYcCWOTmP0JSUVj+R8PkkRCqi+mBH7iKJodNG8lnSipQ9SirY0h/QgEKhIaZPiDRJeKyddA1OJqA5ILi7X@vger.kernel.org, AJvYcCXANXhrP0uWNe+jQ+I5X22zZcFzAZGv0Zik9Sfw9hw0umMh0HdigEINv90M7oftYE5GSCG2CBl+bwCr@vger.kernel.org X-Gm-Message-State: AOJu0YycjLqnYW3QWTPIecME6w3GIduK6RhOuN2kCK20XlxZaMauahmd vmSz0cyDS05IfD62P6QMonl2KmAtMbWdtZp4jDc/w83GPlnQXRqR X-Google-Smtp-Source: AGHT+IHVMWSt0Q6Br7yza0Y32FBkOq5Dsl21VP0EwCtbgpPqez3dioXXC+VpAgoAGlxYRcWXNuPDcA== X-Received: by 2002:a05:600c:500d:b0:426:5416:67e0 with SMTP id 5b1f17b1804b1-42f778f435fmr36503995e9.31.1727907223052; Wed, 02 Oct 2024 15:13:43 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42f79ead1absm29218245e9.17.2024.10.02.15.13.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 15:13:42 -0700 (PDT) From: Christian Marangi To: Jens Axboe , Jonathan Corbet , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , Daniel Golle , INAGAKI Hiroshi , Christian Brauner , Al Viro , Ming Lei , Li Lingfeng , Christian Heusel , Avri Altman , Linus Walleij , Adrian Hunter , Riyan Dhiman , Mikko Rapeli , Jorge Ramirez-Ortiz , Li Zhijian , Dominique Martinet , Jens Wiklander , Christophe JAILLET , 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, Christoph Hellwig Cc: Christoph Hellwig Subject: [PATCH v6 1/6] block: add support for defining read-only partitions Date: Thu, 3 Oct 2024 00:11:41 +0200 Message-ID: <20241002221306.4403-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241002221306.4403-1-ansuelsmth@gmail.com> References: <20241002221306.4403-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 Wed Oct 2 22:11:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 832643 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.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 4F3F219CC26; Wed, 2 Oct 2024 22:13:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727907229; cv=none; b=FvGW5fNUdyvoSdNpG2GBCopkHyG2zRvlgL+TCDqDPQZYQ2H31i8Ex7SACSsIkmP7UsAqSSTwBkgEpGg752bP4rJDvHpHm22JPaSc5hvmaIRukILuoYYx3U+8K+DmXazarvQTgA/kpgZN5404Ej/NT27gqiHE+5UkakbozvN0Q28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727907229; c=relaxed/simple; bh=AvSpeRPjeVRXz5j8dQKUo3Zt1JFIF3gH9S62HhEmPeo=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J/cfp6m37aDfqZC9FBRYsAAzAioYV8iElHvzT7qqdUiOmqy6L4wAz8zi2adwZKZRKYrWQgClC3U5xoTOA4RE9nClhF4+pUw5a5tlMe/AeFJazxFsR3pwaOt78n93qEkdBHr55Z0fY5TiZIcd1iZwqeQiyPVZVFaQaQLWsePDhPI= 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=MvmCBBDe; arc=none smtp.client-ip=209.85.128.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="MvmCBBDe" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-42cb5b3c57eso1994875e9.2; Wed, 02 Oct 2024 15:13:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727907226; x=1728512026; 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=MvmCBBDeKJ2xGkG8i/VHa4nCuDG/ZaxWYhCzNjlMgoRH0CgWx20lBPj8ocJ60ml+JV RfEOikBFYf6rl7dSOs9PSDjXw7EIq4wQLWIV1T/82kDcChphJ1kmSza4sHvMDPfpfW++ NMo130zJRD5L2jpyxzHj7fV6fvSxszjIjrO3POV8eCLK3Yn3tZNrj5Q0IDRGdx4XrqeU k8tw8bfXgHhLhFg4XxxpiDQcGlqMmJ7nZ+KohtzbtM47wC0n3CBueiZz5FOw8OsFr4QQ d4JT9aa+hE4wy2r25ttmpWvqo+OKMGdLsGE9h9dhOu4edy297FVf9Kv398mC74at0vwk ky4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727907226; x=1728512026; 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=iEdcbVk+EuVLvwH67vRN6Qbc8QmlYsudZNQs4v9M5aveSUoo5Gbs2om15WsaLdEdjK hmezPvb48VuA6cz8AEM4xX0/N4PfYwp8U7melk28HnXDHckq6unPGn0eDardy0e85QHX AtEK5dJdjud3R3o7FdDj1YDhUEtcxT7IYI76rYY0AYxv2MeUzbh5JtjzTrN5ictk6VOv iH3HidhxPLf0epU4BJ1jEi9gR1LDg7jlfAxIfrWNAsj7PSrzBtpgOuibGW6AcVb7Xszn V+F05eg+jQKEOrTtJqBvatNl1NxypgefGTFX3TMKUbigM18egkFWywh/t2HPN9wG0rpd iw+w== X-Forwarded-Encrypted: i=1; AJvYcCUCKuuputubzpxPX/s76FhyvJYt/qG38y1XN998Q1mEEkFgqcmOzlbvaGqaWGA8rWGWaI4oeSozSUqy@vger.kernel.org, AJvYcCVCZ0Nkg6hzYTLc3ZcBM/YXPAJt44IN9U7hbpYUXVMXYwApMyCci0XdncfzBIAevZjHO5aUE4DkhWNkYk8=@vger.kernel.org, AJvYcCX9WwuxRN+qswI6tcrt9gaPVZ48bM1Eig63ZrpyXMjHNUFv9R3uKPy9XmoZjn7DjwIVQdauqoFX5r+Q@vger.kernel.org, AJvYcCXkZNdf25CsypyFl+YNlR13wSEEu4r+vq0LKiSSbC5PGUJYgXERm0EJB0VOijLmM1Lt964IdXreTxIc@vger.kernel.org, AJvYcCXlgSWaiogFtjXdnPaLIkQyMsRWjZnAswLD4TJCzTZoIS2HdqGNsxgUj9YFAhJ2Mj4P8z1OLIr5vBcuHugU@vger.kernel.org X-Gm-Message-State: AOJu0YxffibpOYusnmnUFE7OJNDSyAM/wKqdIe9npy+Yv1xP9s1gCCqb Hb7Xjc2QvyQFEsgCufmBDvZYmY6a4rbdebj3ZAsltj8Hfm+GqmYe X-Google-Smtp-Source: AGHT+IH8zG6IQs/9tpO/SHQNvoOax51SUD4BoKGMr+glZVZqZQshRljrFpilX+Z23SlVh4aYkxEc8w== X-Received: by 2002:a05:600c:6dd9:b0:42e:93af:61c5 with SMTP id 5b1f17b1804b1-42f77948002mr35767695e9.14.1727907226194; Wed, 02 Oct 2024 15:13:46 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42f79ead1absm29218245e9.17.2024.10.02.15.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 15:13:44 -0700 (PDT) From: Christian Marangi To: Jens Axboe , Jonathan Corbet , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , Daniel Golle , INAGAKI Hiroshi , Christian Brauner , Al Viro , Ming Lei , Li Lingfeng , Christian Heusel , Avri Altman , Linus Walleij , Adrian Hunter , Riyan Dhiman , Mikko Rapeli , Jorge Ramirez-Ortiz , Li Zhijian , Dominique Martinet , Jens Wiklander , Christophe JAILLET , 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, Christoph Hellwig Subject: [PATCH v6 2/6] docs: block: Document support for read-only partition in cmdline part Date: Thu, 3 Oct 2024 00:11:42 +0200 Message-ID: <20241002221306.4403-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241002221306.4403-1-ansuelsmth@gmail.com> References: <20241002221306.4403-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 Wed Oct 2 22:11:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 832307 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 31D7119E7F3; Wed, 2 Oct 2024 22:13:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727907232; cv=none; b=nq3YEWBhjz0qlIp1NZ2Dod5ZDrqdKdB5g2kHj/v90O8viXPW7RJMiyatjOdLXy9T7n8HJw69r+p98j5P9K26xXCZbeI3HEG2nfgVeiOg5vAjJntyqV0/kkEr6xlURXz2wjFf2YdXpFvypUjGCoKC9UGCGpXVkslJAGjCFyb3v8M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727907232; c=relaxed/simple; bh=R6u21lJQXFNnRlPRZqRDOeZ1baSlH/7f2ouLC6yhy+s=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OAmwyUuV7X6LcK1eTPOVqU8PZfEBbPZb9IizLgV8/swdQ+5NuOMOSxWvs9aHSf/1fmwMEfFZXnMdfsUpRabi5sYxmJDRIVdfPHCMMOxwn+HfUp0JLir+7U1ouSE0ssyAyTq3CFQCny/YXHevx9bttSbdKBlGy5ldc6kjVLxgorw= 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=YqVw/CPG; arc=none smtp.client-ip=209.85.128.47 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="YqVw/CPG" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-42cb5b3c57eso1995135e9.2; Wed, 02 Oct 2024 15:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727907229; x=1728512029; 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=bCCt52yzo7zLbL4p9hv8SgURf+U+fcbnakLfmIN0V0o=; b=YqVw/CPGnoMfQouLXiqelVg4lmh4kMwym9QSDfr1k5itzEN6IOjnVhJhMa+6wOpHOy oBHJpR90UV87QqrVPIWePwrd0uZxW4d/p51R98WMxvSOtV1uyhI6in7CgxsDm5qkZX/w 2JKYpV9/B0U7oa/1GABgCxdJpXiVIuB/NeQPtFHOI3MasTZ1omHiS/S7cy1BNfaeeO9s MsrpaHscRCAa6n5CBuqdxM0hxvBq98bTHxs8Sa2w4kvI/vnbU75VPuolmDNXdqJ32AIc GHb4ldy2hjHjGO3tiBbaw2tmQfelXOpO8+jubynqposfqZtyo9b4iwboUVjNhzGMha16 GT0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727907229; x=1728512029; 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=bCCt52yzo7zLbL4p9hv8SgURf+U+fcbnakLfmIN0V0o=; b=mmjhwBeKBrlZ5OdDu9dRHUX31xsC7BWA6RC+Ft8s6zsd9SpGB8nQHyLa17Ytfj7y+q JatcIAlqhFVkxmFnP1gJJeOhIBhT1tG2JZgIBVxCtv8vVt92CUUvImmqwhRyPgYgP0AA j44StvAa1METDfNoRI0JpksQ83nrS0oyHA1ehj9Tm8ugR+x6zcs+KGVsvMfddGOzbuSV 7w8i6JVHa2fBnOtgz/fplYs0rxPRCl+JIbQp7YgHG88z2SbvyynzcTHCAKcj8G7LZOIr tAyCHl/gQimIlgx/jDLBH2zHmYoK1mMknfBY10tpzjRmcBTFmS+RjHfl9k99ph6d9g4v YOtQ== X-Forwarded-Encrypted: i=1; AJvYcCUbBNjT2qwNnFVZWnpmuXdSMtjmdYkD6xz6z7v285kBpRnnH15QzP6FWLMUICFZc803+WXRph+mh7L1@vger.kernel.org, AJvYcCVMeHZdkOQfpR61NxEBEP5hdhmPTqaiX70lFzJR9ETvRSk/TGZEYjCOZ7xm7LzsQ00ut2lV8wT5zRR2@vger.kernel.org, AJvYcCVOmwsbbdz7Waq8F6vzbjLIiikKsicR6hQUca5dFO/o6OlGMpikysznS2P1LPErsStTTf5Q2aekdW6/223z@vger.kernel.org, AJvYcCVPDJwO0t8xHnBgTNoPMOH/A1lFl3b9S9x+Tm7p63vgl/o4VXDy7vq+BjAxVtDDEYkaHgfQOgtVtx2baUw=@vger.kernel.org, AJvYcCWTF70gHdyupaKCGW96EBAmP6VtcARJizkDwVHfr+7mdvcY3VnPQHsJGT2OL08JaKvEzSo7SfS4sjxu@vger.kernel.org X-Gm-Message-State: AOJu0Yz7guvnPpiVoDSDLax5jP6ZBwmD2HYspPS6Nm54ocWdKzeonBri G4HJSNahkqoBa32TuxmiFHdYaUsdynvf2q36JNGC0neL2OWJcbCs X-Google-Smtp-Source: AGHT+IHbJ2VGvDWq9QrfhQabMZJM8rJ89EGNrryJEQbKFGMgmxsiqQCKWjbdtW00ydatiZXlORy+OA== X-Received: by 2002:a05:600c:4fc8:b0:428:18d9:9963 with SMTP id 5b1f17b1804b1-42f778f3821mr39279815e9.22.1727907229071; Wed, 02 Oct 2024 15:13: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 5b1f17b1804b1-42f79ead1absm29218245e9.17.2024.10.02.15.13.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 15:13:48 -0700 (PDT) From: Christian Marangi To: Jens Axboe , Jonathan Corbet , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , Daniel Golle , INAGAKI Hiroshi , Christian Brauner , Al Viro , Ming Lei , Li Lingfeng , Christian Heusel , Avri Altman , Linus Walleij , Adrian Hunter , Riyan Dhiman , Mikko Rapeli , Jorge Ramirez-Ortiz , Li Zhijian , Dominique Martinet , Jens Wiklander , Christophe JAILLET , 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, Christoph Hellwig Subject: [PATCH v6 3/6] block: introduce add_disk_fwnode() Date: Thu, 3 Oct 2024 00:11:43 +0200 Message-ID: <20241002221306.4403-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241002221306.4403-1-ansuelsmth@gmail.com> References: <20241002221306.4403-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 add_disk_fwnode() as a replacement 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. device_add_disk() is converted to a simple wrapper of add_disk_fwnode() with the fwnode entry set as NULL. Signed-off-by: Christian Marangi Reviewed-by: Christoph Hellwig --- block/genhd.c | 28 ++++++++++++++++++++++++---- include/linux/blkdev.h | 3 +++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 1c05dd4c6980..bc30eee7ab16 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -383,16 +383,18 @@ int disk_scan_partitions(struct gendisk *disk, blk_mode_t mode) } /** - * device_add_disk - add disk information to kernel list + * add_disk_fwnode - add disk information to kernel list with fwnode * @parent: parent device for the disk * @disk: per-device partitioning information * @groups: Additional per-device sysfs groups + * @fwnode: attached disk fwnode * * This function registers the partitioning information in @disk - * with the kernel. + * with the kernel. Also attach a fwnode to the disk device. */ -int __must_check device_add_disk(struct device *parent, struct gendisk *disk, - const struct attribute_group **groups) +int __must_check add_disk_fwnode(struct device *parent, struct gendisk *disk, + const struct attribute_group **groups, + struct fwnode_handle *fwnode) { struct device *ddev = disk_to_dev(disk); @@ -452,6 +454,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,6 +557,22 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk, elevator_exit(disk->queue); return ret; } +EXPORT_SYMBOL_GPL(add_disk_fwnode); + +/** + * device_add_disk - add disk information to kernel list + * @parent: parent device for the disk + * @disk: per-device partitioning information + * @groups: Additional per-device sysfs groups + * + * 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) +{ + return add_disk_fwnode(parent, disk, groups, NULL); +} EXPORT_SYMBOL(device_add_disk); static void blk_report_disk_dead(struct gendisk *disk, bool surprise) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index bf1aa951fda2..c0f50f977f5e 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 add_disk_fwnode(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 Wed Oct 2 22:11:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 832642 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 9B7D619E98C; Wed, 2 Oct 2024 22:13:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727907235; cv=none; b=W3X88Z+jyJ6KVLPaUckQclT0k90aMTJrJ2h/35RF7rWUagkVYTRJ1E3L9bGh3prANougdk7tlhr2V4/E3sOV9xQgXg3AGRg0XT28/5GhaSW7au0fZ60zLKm7VNrl6qZ1iuzzuHApR5f1wslk1oP266tewlfM8bsyY/uJ9Ws7iXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727907235; c=relaxed/simple; bh=qBrpQ0OapihIETdTqtZmWQZZ6yy1lqfSHQgAjBqAJ8w=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r6fuSqW3P9N97osr+WyJ0B62icVCbJNPFQsgDu+odujBuwhIy24U8xoNc4rIZ5snymrBj5YivI27RfJ1Wm7KzA+3XFzHtq6Y17p5zJDFgzZ9EUiqRYmFZsoJNSxtPXpqbz8vC0KWG1gS1BfwqY9xQZK9/Kor1sXI7/Uc3I5GVUY= 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=lxm8O27n; arc=none smtp.client-ip=209.85.128.43 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="lxm8O27n" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-42cafda818aso1928935e9.2; Wed, 02 Oct 2024 15:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727907232; x=1728512032; 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=Oc8lpQtVqxlF5EBGWgyVqr5bkZcHuTE/5Ln0cX5+BQ8=; b=lxm8O27ndD1IovRPmEHIyBt4dfqminLY6UmhRfL7quK31n3BbKZqN8GdxBRyCFWB42 W81y5qhVDty4pppgD0PgfHjeWjtB2X20jckpQ/GqnVmMnxqtLM3R8MHjtrqUEsf+v0oi woq+xNJFx3W40ECzPUJqyPEKae/4qPZIvcOwBheAZxokqcPO4/rzCshronGjtjAKuCgL 6w/U/53MHkJ54ziZdKVAhNOcqzoc1Wy+x2y/Wizw2qcQS3YJuaCSxL94jG0JY9FQZGjJ 34WbO4pCgXaIXrBMP0Mcz0F3y4RWQceyaMSiHajo1jSjvzN0E8TumAF5zopv11pWSgqS 7acw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727907232; x=1728512032; 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=Oc8lpQtVqxlF5EBGWgyVqr5bkZcHuTE/5Ln0cX5+BQ8=; b=lnNmgS+mIU7WCAryE5wzUqkwUDQDm3K2J3WCD+NVNk6rGdyePWAkdamYFdVeFNFGCX Mnwo3EiMZjI9J4U7akig+uO2emomfiy4IkYwcD1PU5+7tHhbQHIqSGy7y+fH3A3/pRyU ct9TYK8GBXLcFoSv9XfZFFaeZwH4V/l/4JDgTwfOSIXXfecI3TG3PfcxnUHlxoZLuXD/ ThrbZtFCetJ4updBEuV/ETD+mVyqXeC60hw/+eKh7U/ws1sxv3UJLcjTVzZQ0nZqVKBn fl1AzSV23oFLhcfYa8vdRSSxSmj/mGn2fKZjc35wNlH3uy8HEvNJ07WGITZDYrRfo1Sq BaGQ== X-Forwarded-Encrypted: i=1; AJvYcCU2o0k/neOQ7FAUzZz7IOvIGIt00zGxtnIx5u61lECmz2HGrhZzuA9Xc8XKxlkaCDmMcaDiZivAxxXS@vger.kernel.org, AJvYcCUgoCHLSCWcXeVWg0N1We5pxgVQw31j5GP/w7b9yJTfM5V9Th5d43Qtm+l22e0H05vxhbBr/mJ00PAS@vger.kernel.org, AJvYcCWP0v8Tb0+GUZWUUAF0Z5CLJB4vvN+YC/UkkPJVIYS/uPzXx18BmzL0Ab6SjYKYhL6hhc6PMDJlS0rNTuM=@vger.kernel.org, AJvYcCXSiplaGOtrYufMBz9c0cF8QXu7kkY9zmcJzyoBsFy2mIkkGTa9JXN+2yp6GNuFis68VewzNshwXO1J@vger.kernel.org, AJvYcCXW4JlmXsEDHQHpWQ4Bx4QZV+0Q0cboHaX5FjlllgM6qVyYOh6htZQrACf3fkK1M/xeUrAp5CO4YhMVRy23@vger.kernel.org X-Gm-Message-State: AOJu0YyOFsR3kV6ZfLFjZCNbbI3eZTfGbEqC+czqATMmrwwQz3klAhrD iu0eqZkI25CNEKDd61c1AMZZG7YdLT7jfFHuEjYYm8Zmc14O6ZnZ X-Google-Smtp-Source: AGHT+IHrLc+U7lAjjtGt7GZ1uGyyMTu09XhAfXdEeCsNqOHh9RGHrZ02SW/Rm37DHFy3T1Yd4xOG8g== X-Received: by 2002:a05:600c:3b05:b0:42c:acb0:ddb6 with SMTP id 5b1f17b1804b1-42f777b7325mr34382125e9.9.1727907231663; Wed, 02 Oct 2024 15:13:51 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42f79ead1absm29218245e9.17.2024.10.02.15.13.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 15:13:50 -0700 (PDT) From: Christian Marangi To: Jens Axboe , Jonathan Corbet , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , Daniel Golle , INAGAKI Hiroshi , Christian Brauner , Al Viro , Ming Lei , Li Lingfeng , Christian Heusel , Avri Altman , Linus Walleij , Adrian Hunter , Riyan Dhiman , Mikko Rapeli , Jorge Ramirez-Ortiz , Li Zhijian , Dominique Martinet , Jens Wiklander , Christophe JAILLET , 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, Christoph Hellwig Subject: [PATCH v6 4/6] mmc: block: attach partitions fwnode if found in mmc-card Date: Thu, 3 Oct 2024 00:11:44 +0200 Message-ID: <20241002221306.4403-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241002221306.4403-1-ansuelsmth@gmail.com> References: <20241002221306.4403-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..d7eadf2b407f 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 = add_disk_fwnode(md->parent, md->disk, mmc_disk_attr_groups, + disk_fwnode); if (ret) goto err_put_disk; return md; From patchwork Wed Oct 2 22:11:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 832306 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 2FAE819F118; Wed, 2 Oct 2024 22:13:55 +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=1727907238; cv=none; b=nPYaZZh4bG7mP0DbEXXHFYSkD1tHb6J6Cye7x/9cojV4J4tTZp8q+jUDQ7O0rOhJMvAQBaRtyOrC7OoN1bz1Dq11GNmAsfXDZj0ZguB//Ou16WSZAqAsnhHACMjdklm06FdpQxdXDW4i0As5dlcK4F1XANVCvenWMkuTvOHlDRQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727907238; c=relaxed/simple; bh=q+7Rx61HQ8wAyF0VBzlMN/9HWZXUHIpSk8xFA2Mt5yk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QtsFq+p/jc3EvZ4rpszzfyPvnljYw/g26y8+YXMdyUjCEKvJTbYQ053mtxLj8aia3VONtEyAIDgMQaGv600Jn+otUDBa56AxRZDEKZs9g68RnXUSx7y6+O26avsOvNigXrKgv2J0ywmAOYpXQan1jdJfc/sUfZp3DqbTMkdGoQc= 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=X0w4cg+Z; 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="X0w4cg+Z" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-42cb8dac900so1913195e9.3; Wed, 02 Oct 2024 15:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727907234; x=1728512034; 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=O5BLqLkzjd+8imWtdXlNJCotcWIcabn4SehzzKXfQR8=; b=X0w4cg+ZkvkOhWv3YZKhLOJsbg8N8c1Eyb0eESombmxlxiMu4aGqQxcpWAXM9gXylm BD7N5786eEDlXo2DUVBbOZqvlEOS9hWtgXEHjJ1Ig4orZEYfu1qt+64lCnMCPZuT3ga1 KZgr8AxBxraf2f18RDjSe2LkyQi0XydjX3d2Wl6ZRdZ0uGvCAfgcv324jQbaqpnlGHaL HYDHYMd4cJYalHuz4qx0fS5zKqpsr3nD829ubYUeqQDP66MH23PaRSMv217+YZjzuQIv nyPkSgWekkm9HqH8KN0h0avT3unYmFzImJR12tXvbP13WNe/wptYoMKvlkA/3vg6LxQH GpJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727907234; x=1728512034; 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=O5BLqLkzjd+8imWtdXlNJCotcWIcabn4SehzzKXfQR8=; b=T2sUfLkkCF7h1HhJ0WKbeRmB5LqJc5FlutVGCy1WX3gMHHO+zHylqSDX3zGvaOhaQp Wrt+gNteBpKdu4U1JzR464v36om75/uAy+PWv2s/f/bD2f9EgJJnd1LARz6Tgho59y2c OWX7PEkMea4KSC5UyCQyU7UcpwuaRKlvWMqvUnzWtRqtajWRS3451PTGBjsWyKa1ZNI3 ALgIojbeBlvEhM3fbXJEr3nxTAl49vzYDjVWHCbaK7y8KaQ9jHdhpeID79EjIWDArC/H p5wRH/r+y3lO8juYq+F/4kBCKKmr6B2bGVV3mVwOuPXDS+534/Uu5TpeAViK95vKnxAi KSew== X-Forwarded-Encrypted: i=1; AJvYcCU9QtW+BvzkBXAIwWSdREcT6cNfxlOz7PJj7iWwc9zMliTCU4UAX7oq4XN/Zq7tDgib7N7JmmLtStjdwUM=@vger.kernel.org, AJvYcCUeKZ30NF7OT0qroS7U43jRrUieNH4NyaCK//xJAUeusgnMXO0+ftaZZQcP5cdT3kvIytBq/A1sQRUr@vger.kernel.org, AJvYcCUjvI0ZzdCQBdgBYoSa1Oi28Y9dUICI2AQrapo9GwMlCbhwDTtoYfMh+edAul3SpEAy0hfxz2lapC2k@vger.kernel.org, AJvYcCVvKP9EdUvN13qb9eKWELiiS/MGTbRvzSoJ15jkyfasAcECVj4vhRcCAu6yJzYbU9h9Welusv087CeQd3Gu@vger.kernel.org, AJvYcCWUZsh47LH9alOe3lxqjBfCqpkIfW6kACRzfgQtM0aI5Oi9tD6MXTQwdddU78CVbpPOC1qg410blTcA@vger.kernel.org X-Gm-Message-State: AOJu0YypXbVX9hzh2f3V2cpfRTh3x2TVYZ8mpFAsNYpXO08X0gGHlsrf x4kqJVLfuXuwAuoWxKAx47H4cdtMSptOFtRfYcSiFOGDSrAjOK/2 X-Google-Smtp-Source: AGHT+IE2dHx3HMbl76J81laPZhJX3CXS3d/10Coh3qgcJxdllqn+R5iCbku56fuFzLCOMy4uYffQtQ== X-Received: by 2002:a05:600c:4f4a:b0:42c:af06:703 with SMTP id 5b1f17b1804b1-42f778f4393mr35430025e9.31.1727907234211; Wed, 02 Oct 2024 15:13:54 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42f79ead1absm29218245e9.17.2024.10.02.15.13.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 15:13:53 -0700 (PDT) From: Christian Marangi To: Jens Axboe , Jonathan Corbet , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , Daniel Golle , INAGAKI Hiroshi , Christian Brauner , Al Viro , Ming Lei , Li Lingfeng , Christian Heusel , Avri Altman , Linus Walleij , Adrian Hunter , Riyan Dhiman , Mikko Rapeli , Jorge Ramirez-Ortiz , Li Zhijian , Dominique Martinet , Jens Wiklander , Christophe JAILLET , 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, Christoph Hellwig Cc: Christoph Hellwig Subject: [PATCH v6 5/6] block: add support for partition table defined in OF Date: Thu, 3 Oct 2024 00:11:45 +0200 Message-ID: <20241002221306.4403-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241002221306.4403-1-ansuelsmth@gmail.com> References: <20241002221306.4403-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 | 110 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 124 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..4e760fdffb3f --- /dev/null +++ b/block/partitions/of.c @@ -0,0 +1,110 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include +#include +#include +#include "check.h" + +static int validate_of_partition(struct device_node *np, int slot) +{ + u64 offset, size; + int len; + + const __be32 *reg = of_get_property(np, "reg", &len); + int a_cells = of_n_addr_cells(np); + int 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]; + const char *partname; + int len; + + const __be32 *reg = of_get_property(np, "reg", &len); + int a_cells = of_n_addr_cells(np); + int s_cells = of_n_size_cells(np); + + /* Convert bytes to sector size */ + u64 offset = of_read_number(reg, a_cells) / SECTOR_SIZE; + u64 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 *ddev = disk_to_dev(state->disk); + struct device_node *np; + int slot; + + struct device_node *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 Wed Oct 2 22:11:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 832641 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 B323F19F42F; Wed, 2 Oct 2024 22:13:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727907240; cv=none; b=kmBn5CvaRqq2B1cza0uSPisDVIFAo2qnLTBpMt4rE6+bjMFGXNNjEwLhFAjFfRWc3QAJV1vyMFiJgIQuCrSvVC8jn2tODxj7vfGocoIXfjFKHaJ4foZeicmh2JPT4COYRDTlOrRlE7H1VFoTBMvGhxNe2ozlvsXmlX1mMfSIkXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727907240; c=relaxed/simple; bh=jgKRogDhouHxgHp3uWFozI93Z/lGip8Zz1ZZk0ZOOnw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sK/9ch4ABcjOgR2CTBe6cYyXWGEO6hSsY/thZDCFVzstFvwa1t1/PsRh61/TCq2Ym9YNY2ZJLO7bX3Km/F3Lwtfo+yqc7omRREa8PkXq8qG4QI65VKfkIenq8fCtsmFr8p9+z6U8oMFrbbxPdSLHUS2U/AfmPtt4T9roBzkYRMo= 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=TrAELc5d; arc=none smtp.client-ip=209.85.128.47 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="TrAELc5d" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-42cba8340beso8290635e9.1; Wed, 02 Oct 2024 15:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727907237; x=1728512037; 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=2PlY4kQjRGMW2mhTFZj4kRJ1PV/IGOaEuiYkQi7f2Dg=; b=TrAELc5dqbz/9IrH77Z/Rz1yY0xt0k4mnc0eLfyPGvXkEYcP5AkLBEAR47aNTkSsHL r4E0QKsaAPfvCMSFyOWCjhqvhOwQw77IjuRkpjumIlEkanbD+j8jiJujGYRkufSFnB5f 7HkrbMi4P6j76+0BLlRQES05BUlFJ6hwpnxpvZjL49WpQ+Ni6TvPbFVCzhlITWIpYBTJ BQGLuXqnh8jU29JEHauYNm1+GtlDqanLoQtjLRHNWoT/SBhSWyQd4E+45M6V63ze0OiN IFYwPirysahtDcChiX8V1Jlqkm6XUACHrs+LbYWorpGFlu3elH4et32sap8gQEb7Kva/ 5zdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727907237; x=1728512037; 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=2PlY4kQjRGMW2mhTFZj4kRJ1PV/IGOaEuiYkQi7f2Dg=; b=vjeD2K0Ia8hrXtRq7DmBlGeRDkF7bC4qx+jIZjE44sPOrocgElNBxUW2zbT9C06p4J TdLpPVtA7TKJkzhCpyZe3TLdtXgXPA76dx9sCgP6wCRYk9M98NaIHLc4EJ70R+K/ruJG cznORo/YoGoc41E3vQFPl4XgIAPY5+E22afiOFUHz3ZmN1zsZfYY1XYR+idPnD9sYemn ZyIDiUppTsThvd7m9S2kxiHE279zrWydbbSTaa/BHWIxagWO6ZmbJjoUF46T1jI7yt8m c/an6ouuWNRhtjx6DITha/Zf6rtJ2Xweo8dJRSMR3CpwBlBuZfYteNCZ7K3ajROe0AWD G7fw== X-Forwarded-Encrypted: i=1; AJvYcCUa/OEVRopwRdZUuxFpNTUEgzy+f2QxyjJF8h/uszaU5fHrXaHmQHwGjDl8UyH2Q9wMuJfhJVI3pFKCVn8=@vger.kernel.org, AJvYcCVrOC3WyoVyLfoXRMSwHWgNLt0ttpDV91srsNQpW3iShJAe5Azv0rFW/ieDhUVxTGRC0nxdek1bjfyF@vger.kernel.org, AJvYcCWhNj7g0+o46KFu5zX73R2K5ahv75Z3djsDSD/tF2X8Xa+retbOKQoFXO2BjB1DEebFrZAeVmKlk4Lz@vger.kernel.org, AJvYcCWl+hmdxXWuiHXZA/NeDO5MAxfa4LZMxJO3Ruzvd90peLUfJm7pclIyDxPFshpIzpNxzAWUkcs6rUuV@vger.kernel.org, AJvYcCWyCTzmGI0b1yaqRuajNjHYcDJFcVXnM5Vart12cBRwga1Ksp4Ct1C3Sx4qk8/lXayZbn4lJ40/tNMD1b5U@vger.kernel.org X-Gm-Message-State: AOJu0YyxLocMpE8eCWI70kuLnuq95vj+L8eUxVNI0EwsqN6emvdaMMZu husiy6wIbA+jiBNBe6QqNAbSvFcQU8Kc56IjVmGhWNM1fQXaVVq7 X-Google-Smtp-Source: AGHT+IHxkMPF8AkGmoyyfCpyi4PkUp9zju0olvxSD6e2eh/QKcym1EZg6VPGiPFOKaJOPN5w/UF6bg== X-Received: by 2002:a5d:5b85:0:b0:374:c33d:377d with SMTP id ffacd0b85a97d-37d04a7b2f1mr571448f8f.28.1727907236933; Wed, 02 Oct 2024 15:13:56 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42f79ead1absm29218245e9.17.2024.10.02.15.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 15:13:55 -0700 (PDT) From: Christian Marangi To: Jens Axboe , Jonathan Corbet , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , Daniel Golle , INAGAKI Hiroshi , Christian Brauner , Al Viro , Ming Lei , Li Lingfeng , Christian Heusel , Avri Altman , Linus Walleij , Adrian Hunter , Riyan Dhiman , Mikko Rapeli , Jorge Ramirez-Ortiz , Li Zhijian , Dominique Martinet , Jens Wiklander , Christophe JAILLET , 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, Christoph Hellwig Subject: [PATCH v6 6/6] dt-bindings: mmc: Document support for partition table in mmc-card Date: Thu, 3 Oct 2024 00:11:46 +0200 Message-ID: <20241002221306.4403-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241002221306.4403-1-ansuelsmth@gmail.com> References: <20241002221306.4403-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: 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; + }; + }; }; };