From patchwork Thu Mar 21 19:32:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13599307 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54019134412; Thu, 21 Mar 2024 19:33:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049628; cv=none; b=rAMKIDS6XygnD/+vQmeEBlA4NCBYzbOKen5g5rF8K3OTW2YcTtn07sHk9Js8AbA6zwmc+/6xvyWaGWwueJSvS8C5CPPJenF2yp8eHW1YMMEOfAnd+4eYxGyz32AOpwzoqrPl0hstNKH6IIiWjYNpD93t/Np3yHUmTVYD3xJmhyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049628; c=relaxed/simple; bh=xWOwvbPZgST6WT++t4v3lHbMbLvITOiRaYTKtbxJdgw=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Y8GzDDoenjgb0ZCY1xJy32n1jfTkSbSSxQHGlKTYn5VBBi9rkZymjlJDaioU/otAelHnxwpXuyvT/ShXiRkxFMLp1/TSK4GGNDgp0g/4Wq0HinJA2pAzWN5gYRoBya5h1I2REOT/6JTcaVhpbKqK3vIa2ULZX9ESqXmI5PdjZwc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1rnOAE-0000Db-2U; Thu, 21 Mar 2024 19:33:22 +0000 Date: Thu, 21 Mar 2024 19:32:48 +0000 From: Daniel Golle To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ulf Hansson , Jens Axboe , Daniel Golle , Dave Chinner , Jan Kara , Thomas =?iso-8859-1?q?Wei=DFschuh?= , Damien Le Moal , Li Lingfeng , Christian Brauner , Christian Heusel , Min Li , Adrian Hunter , Avri Altman , Hannes Reinecke , Christian Loehle , Bean Huo , Yeqi Fu , Victor Shih , Christophe JAILLET , Dominique Martinet , "Ricardo B. Marliere" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 1/8] dt-bindings: block: add basic bindings for block devices Message-ID: <28dcc69ecf9d55e95991d8f2a8e19f71bbd32af0.1711048433.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Add bindings for block devices which are used to allow referencing nvmem bits on them. Signed-off-by: Daniel Golle --- .../bindings/block/block-device.yaml | 22 ++++++++ .../devicetree/bindings/block/partition.yaml | 51 +++++++++++++++++++ .../devicetree/bindings/block/partitions.yaml | 20 ++++++++ 3 files changed, 93 insertions(+) create mode 100644 Documentation/devicetree/bindings/block/block-device.yaml create mode 100644 Documentation/devicetree/bindings/block/partition.yaml create mode 100644 Documentation/devicetree/bindings/block/partitions.yaml diff --git a/Documentation/devicetree/bindings/block/block-device.yaml b/Documentation/devicetree/bindings/block/block-device.yaml new file mode 100644 index 0000000000000..c83ea525650ba --- /dev/null +++ b/Documentation/devicetree/bindings/block/block-device.yaml @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/block/block-device.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: block storage device + +description: | + This binding is generic and describes a block-oriented storage device. + +maintainers: + - Daniel Golle + +properties: + partitions: + $ref: /schemas/block/partitions.yaml + + nvmem-layout: + $ref: /schemas/nvmem/layouts/nvmem-layout.yaml# + +unevaluatedProperties: false diff --git a/Documentation/devicetree/bindings/block/partition.yaml b/Documentation/devicetree/bindings/block/partition.yaml new file mode 100644 index 0000000000000..86b61e30f9a41 --- /dev/null +++ b/Documentation/devicetree/bindings/block/partition.yaml @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/block/partition.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Partition on a block device + +description: | + This binding describes a partition on a block device. + Partitions may be matched by a combination of partition number, name, + and UUID. + +maintainers: + - Daniel Golle + +properties: + $nodename: + pattern: '^block-partition-.+$' + + partnum: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Matches partition by number if present. + + partname: + $ref: /schemas/types.yaml#/definitions/string + description: + Matches partition by PARTNAME if present. + + partuuid: + $ref: /schemas/types.yaml#/definitions/string + description: + Matches partition by PARTUUID if present. + + nvmem-layout: + $ref: /schemas/nvmem/layouts/nvmem-layout.yaml# + description: + This container may reference an NVMEM layout parser. + +anyOf: + - required: + - partnum + + - required: + - partname + + - required: + - partuuid + +unevaluatedProperties: false diff --git a/Documentation/devicetree/bindings/block/partitions.yaml b/Documentation/devicetree/bindings/block/partitions.yaml new file mode 100644 index 0000000000000..fd84c3ba8493b --- /dev/null +++ b/Documentation/devicetree/bindings/block/partitions.yaml @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/block/partitions.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Partitions on block devices + +description: | + This binding is generic and describes the content of the partitions container + node. + +maintainers: + - Daniel Golle + +patternProperties: + "^block-partition-.+$": + $ref: partition.yaml + +unevaluatedProperties: false From patchwork Thu Mar 21 19:33:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13599308 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A1AD134412; Thu, 21 Mar 2024 19:34:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049644; cv=none; b=tD/PbiJ89EFLsGGQ8BmAltuaqb3JFizdkzCkU9W5AqJacBdHmxV0Rze1dxQh46AsMEh6+J/V9OMOZ8LEUTThiePE7WqmT+F6qy9AmY6luCTSORSRY52rALvNM6GO/uheL2feOMm1beH7I9z1elvOqRV2zjkWnJ/OqGviKB50WGc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049644; c=relaxed/simple; bh=iNGDld9u54N94elt2btzH/2NeaV6UoMBtCRIT7nPB8o=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OAZTa5AST99eDdc9EEsr9KatyR2fHmwe/qIWQ532bTKAmYvdfca2RxT7U22LZg5eUdKJGKihnf27NS24jX7wGolGn5wa9Nw4q8kLDyn7rsyKbL+mhe6e+lp0xoTiEt7/mERb30Wn9CcPW8ssep1UHh1a+9KMXAi2PXC+FF2ikic= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1rnOAZ-0000ER-2y; Thu, 21 Mar 2024 19:33:44 +0000 Date: Thu, 21 Mar 2024 19:33:39 +0000 From: Daniel Golle To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ulf Hansson , Jens Axboe , Daniel Golle , Dave Chinner , Jan Kara , Thomas =?iso-8859-1?q?Wei=DFschuh?= , Damien Le Moal , Li Lingfeng , Christian Brauner , Christian Heusel , Min Li , Adrian Hunter , Avri Altman , Hannes Reinecke , Christian Loehle , Bean Huo , Yeqi Fu , Victor Shih , Christophe JAILLET , Dominique Martinet , "Ricardo B. Marliere" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 2/8] block: partitions: populate fwnode Message-ID: <3a6ed620b0c2fef2fc2bab0cc4991c62796acd99.1711048433.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Let block partitions to be represented by a firmware node and hence allow them to being referenced e.g. for use with blk-nvmem. Signed-off-by: Daniel Golle --- block/partitions/core.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/block/partitions/core.c b/block/partitions/core.c index b11e88c82c8cf..c40ba88837373 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -10,6 +10,8 @@ #include #include #include +#include + #include "check.h" static int (*const check_part[])(struct parsed_partitions *) = { @@ -281,6 +283,43 @@ static ssize_t whole_disk_show(struct device *dev, } static const DEVICE_ATTR(whole_disk, 0444, whole_disk_show, NULL); +static struct fwnode_handle *find_partition_fwnode(struct block_device *bdev) +{ + struct fwnode_handle *fw_parts, *fw_part; + struct device *ddev = disk_to_dev(bdev->bd_disk); + const char *partname, *partuuid; + u32 partno; + + fw_parts = device_get_named_child_node(ddev, "partitions"); + if (!fw_parts) + fw_parts = device_get_named_child_node(ddev->parent, "partitions"); + + if (!fw_parts) + return NULL; + + fwnode_for_each_child_node(fw_parts, fw_part) { + if (!fwnode_property_read_string(fw_part, "partuuid", &partuuid) && + (!bdev->bd_meta_info || strncmp(partuuid, + bdev->bd_meta_info->uuid, + PARTITION_META_INFO_UUIDLTH))) + continue; + + if (!fwnode_property_read_string(fw_part, "partname", &partname) && + (!bdev->bd_meta_info || strncmp(partname, + bdev->bd_meta_info->volname, + PARTITION_META_INFO_VOLNAMELTH))) + continue; + + if (!fwnode_property_read_u32(fw_part, "partno", &partno) && + bdev->bd_partno != partno) + continue; + + return fw_part; + } + + return NULL; +} + /* * Must be called either with open_mutex held, before a disk can be opened or * after all disk users are gone. @@ -355,6 +394,8 @@ static struct block_device *add_partition(struct gendisk *disk, int partno, goto out_put; } + device_set_node(pdev, find_partition_fwnode(bdev)); + /* delay uevent until 'holders' subdir is created */ dev_set_uevent_suppress(pdev, 1); err = device_add(pdev); From patchwork Thu Mar 21 19:33:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13599309 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 377BC132C37; Thu, 21 Mar 2024 19:34:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049658; cv=none; b=MTIRbaIyGguKAZ5EZFxDNsHbz1lx3nvwhZYllMR4edrXciTEv0yIwXmmNxqtGU/AKgF7hezkBWXi436Yog91lCGiOx0PpNlCa75MiiHirYJHAXR0vjP7ZSLN8dCPGEmZ6aEwKuar84OVOdvQJzYykxJWrCIW+ENO8wDqf5QMPds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049658; c=relaxed/simple; bh=riNJOLS1PDkHeYFfgxlyU2hpU4+11KYkJC8sj8wJoVw=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rBnRT1fSOg6UQFuQwR6lXwuJ9EDf6VqJr6afi62135KFoDK7KzdcMkO7W+gnkci/9dneScer+LWGqUmQ5p+vSA+4SOg+J3nKPQKl2zOB8+Ec4Q4sOtN88uZBlubNfRorSpLpa/UwfRaV5epfS0UpQrXyGMHOqdWAMJNCcRNcvRU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1rnOAj-0000Ex-2q; Thu, 21 Mar 2024 19:33:54 +0000 Date: Thu, 21 Mar 2024 19:33:49 +0000 From: Daniel Golle To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ulf Hansson , Jens Axboe , Daniel Golle , Dave Chinner , Jan Kara , Thomas =?iso-8859-1?q?Wei=DFschuh?= , Damien Le Moal , Li Lingfeng , Christian Brauner , Christian Heusel , Min Li , Adrian Hunter , Avri Altman , Hannes Reinecke , Christian Loehle , Bean Huo , Yeqi Fu , Victor Shih , Christophe JAILLET , Dominique Martinet , "Ricardo B. Marliere" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 3/8] block: add new genhd flag GENHD_FL_NVMEM Message-ID: <89abd9ab93783da0e8934ebc03d66559f78f6060.1711048433.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Add new flag to destinguish block devices which may act as an NVMEM provider. Signed-off-by: Daniel Golle --- include/linux/blkdev.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c3e8f7cf96be9..f2c4f280d7619 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -81,11 +81,13 @@ struct partition_meta_info { * ``GENHD_FL_NO_PART``: partition support is disabled. The kernel will not * scan for partitions from add_disk, and users can't add partitions manually. * + * ``GENHD_FL_NVMEM``: the block device should be considered as NVMEM provider. */ enum { GENHD_FL_REMOVABLE = 1 << 0, GENHD_FL_HIDDEN = 1 << 1, GENHD_FL_NO_PART = 1 << 2, + GENHD_FL_NVMEM = 1 << 3, }; enum { From patchwork Thu Mar 21 19:34:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13599310 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6183D13442F; Thu, 21 Mar 2024 19:34:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049671; cv=none; b=CmwRJFfT/Dv+fqGS6BqITLmT9hNC7ULkayfFLTPt2yMAE+t7HdfcT52Ls8dGiOeDRwuifc+6EWFhOm4iiDAIHm/CpmzzeTIK0B8oYWw9D4nfoox6AtEkViVGWOEhIIgbr6KxkCitZNzbjKZIf9lzidpck7EeqikVxmjSt8BSf7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049671; c=relaxed/simple; bh=2znTf4TvUOVXG3srG4NVYvSOtJ1j3xaikOmb5ufQK+M=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=quh2ubw0bLy9QEVdha5mjVGleMjyT/ErzcFNIBSsDTPTE8AyymnOq7CMBKCx4So8i8KYyVXBVCj+9QJdjeq8AtYF+ZrhDwg7M5e7gbCOecCHQPNwSIMRIYdxIP4wAf0NNrV82xzYbrdWfuW+VX3ub/vjRcM1YR6iSWBWZbIlbn4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1rnOAu-0000Fp-13; Thu, 21 Mar 2024 19:34:04 +0000 Date: Thu, 21 Mar 2024 19:34:00 +0000 From: Daniel Golle To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ulf Hansson , Jens Axboe , Daniel Golle , Dave Chinner , Jan Kara , Thomas =?iso-8859-1?q?Wei=DFschuh?= , Damien Le Moal , Li Lingfeng , Christian Brauner , Christian Heusel , Min Li , Adrian Hunter , Avri Altman , Hannes Reinecke , Christian Loehle , Bean Huo , Yeqi Fu , Victor Shih , Christophe JAILLET , Dominique Martinet , "Ricardo B. Marliere" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 4/8] block: implement NVMEM provider Message-ID: <7555db6eb71d4ccb2b9d5ebe3b41dc34088c6316.1711048433.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: On embedded devices using an eMMC it is common that one or more partitions on the eMMC are used to store MAC addresses and Wi-Fi calibration EEPROM data. Allow referencing the partition in device tree for the kernel and Wi-Fi drivers accessing it via the NVMEM layer. Signed-off-by: Daniel Golle --- MAINTAINERS | 5 ++ block/Kconfig | 9 +++ block/Makefile | 1 + block/blk-nvmem.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 184 insertions(+) create mode 100644 block/blk-nvmem.c diff --git a/MAINTAINERS b/MAINTAINERS index 8c88f362feb55..242a0a139c00a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3662,6 +3662,11 @@ L: linux-mtd@lists.infradead.org S: Maintained F: drivers/mtd/devices/block2mtd.c +BLOCK NVMEM DRIVER +M: Daniel Golle +S: Maintained +F: block/blk-nvmem.c + BLUETOOTH DRIVERS M: Marcel Holtmann M: Luiz Augusto von Dentz diff --git a/block/Kconfig b/block/Kconfig index 1de4682d48ccb..b1d4c88c70040 100644 --- a/block/Kconfig +++ b/block/Kconfig @@ -229,6 +229,15 @@ config BLK_INLINE_ENCRYPTION_FALLBACK by falling back to the kernel crypto API when inline encryption hardware is not present. +config BLK_NVMEM + bool "Block device NVMEM provider" + depends on OF + depends on NVMEM + help + Allow block devices (or partitions) to act as NVMEM prodivers, + typically used with eMMC to store MAC addresses or Wi-Fi + calibration data on embedded devices. + source "block/partitions/Kconfig" config BLK_MQ_PCI diff --git a/block/Makefile b/block/Makefile index 46ada9dc8bbfe..03c0bfa8642df 100644 --- a/block/Makefile +++ b/block/Makefile @@ -34,6 +34,7 @@ obj-$(CONFIG_BLK_DEV_ZONED) += blk-zoned.o obj-$(CONFIG_BLK_WBT) += blk-wbt.o obj-$(CONFIG_BLK_DEBUG_FS) += blk-mq-debugfs.o obj-$(CONFIG_BLK_DEBUG_FS_ZONED)+= blk-mq-debugfs-zoned.o +obj-$(CONFIG_BLK_NVMEM) += blk-nvmem.o obj-$(CONFIG_BLK_SED_OPAL) += sed-opal.o obj-$(CONFIG_BLK_PM) += blk-pm.o obj-$(CONFIG_BLK_INLINE_ENCRYPTION) += blk-crypto.o blk-crypto-profile.o \ diff --git a/block/blk-nvmem.c b/block/blk-nvmem.c new file mode 100644 index 0000000000000..29f8ac041d76e --- /dev/null +++ b/block/blk-nvmem.c @@ -0,0 +1,169 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * block device NVMEM provider + * + * Copyright (c) 2024 Daniel Golle + * + * Useful on devices using a partition on an eMMC for MAC addresses or + * Wi-Fi calibration EEPROM data. + */ + +#include "blk.h" +#include +#include +#include +#include + +/* List of all NVMEM devices */ +static LIST_HEAD(nvmem_devices); +static DEFINE_MUTEX(devices_mutex); + +struct blk_nvmem { + struct nvmem_device *nvmem; + struct device *dev; + struct list_head list; +}; + +static int blk_nvmem_reg_read(void *priv, unsigned int from, + void *val, size_t bytes) +{ + blk_mode_t mode = BLK_OPEN_READ | BLK_OPEN_RESTRICT_WRITES; + unsigned long offs = from & ~PAGE_MASK, to_read; + pgoff_t f_index = from >> PAGE_SHIFT; + struct blk_nvmem *bnv = priv; + size_t bytes_left = bytes; + struct file *bdev_file; + struct folio *folio; + void *p; + int ret = 0; + + bdev_file = bdev_file_open_by_dev(bnv->dev->devt, mode, priv, NULL); + if (!bdev_file) + return -ENODEV; + + if (IS_ERR(bdev_file)) + return PTR_ERR(bdev_file); + + while (bytes_left) { + folio = read_mapping_folio(bdev_file->f_mapping, f_index++, NULL); + if (IS_ERR(folio)) { + ret = PTR_ERR(folio); + goto err_release_bdev; + } + to_read = min_t(unsigned long, bytes_left, PAGE_SIZE - offs); + p = folio_address(folio) + offset_in_folio(folio, offs); + memcpy(val, p, to_read); + offs = 0; + bytes_left -= to_read; + val += to_read; + folio_put(folio); + } + +err_release_bdev: + fput(bdev_file); + + return ret; +} + +static int blk_nvmem_register(struct device *dev) +{ + struct device_node *np = dev_of_node(dev); + struct block_device *bdev = dev_to_bdev(dev); + struct nvmem_config config = {}; + struct blk_nvmem *bnv; + + /* skip devices which do not have a device tree node */ + if (!np) + return 0; + + /* skip devices without an nvmem layout defined */ + if (!of_get_child_by_name(np, "nvmem-layout")) + return 0; + + /* + * skip devices which don't have GENHD_FL_NVMEM set + * + * This flag is used for mtdblock and ubiblock devices because + * both, MTD and UBI already implement their own NVMEM provider. + * To avoid registering multiple NVMEM providers for the same + * device node, don't register the block NVMEM provider for them. + */ + if (!(bdev->bd_disk->flags & GENHD_FL_NVMEM)) + return 0; + + /* + * skip block device too large to be represented as NVMEM devices + * which are using an 'int' as address + */ + if (bdev_nr_bytes(bdev) > INT_MAX) + return -EFBIG; + + bnv = kzalloc(sizeof(struct blk_nvmem), GFP_KERNEL); + if (!bnv) + return -ENOMEM; + + config.id = NVMEM_DEVID_NONE; + config.dev = &bdev->bd_device; + config.name = dev_name(&bdev->bd_device); + config.owner = THIS_MODULE; + config.priv = bnv; + config.reg_read = blk_nvmem_reg_read; + config.size = bdev_nr_bytes(bdev); + config.word_size = 1; + config.stride = 1; + config.read_only = true; + config.root_only = true; + config.ignore_wp = true; + config.of_node = to_of_node(dev->fwnode); + + bnv->dev = &bdev->bd_device; + bnv->nvmem = nvmem_register(&config); + if (IS_ERR(bnv->nvmem)) { + dev_err_probe(&bdev->bd_device, PTR_ERR(bnv->nvmem), + "Failed to register NVMEM device\n"); + + kfree(bnv); + return PTR_ERR(bnv->nvmem); + } + + mutex_lock(&devices_mutex); + list_add_tail(&bnv->list, &nvmem_devices); + mutex_unlock(&devices_mutex); + + return 0; +} + +static void blk_nvmem_unregister(struct device *dev) +{ + struct blk_nvmem *bnv_c, *bnv = NULL; + + mutex_lock(&devices_mutex); + list_for_each_entry(bnv_c, &nvmem_devices, list) { + if (bnv_c->dev == dev) { + bnv = bnv_c; + break; + } + } + + if (!bnv) { + mutex_unlock(&devices_mutex); + return; + } + + list_del(&bnv->list); + mutex_unlock(&devices_mutex); + nvmem_unregister(bnv->nvmem); + kfree(bnv); +} + +static struct class_interface blk_nvmem_bus_interface __refdata = { + .class = &block_class, + .add_dev = &blk_nvmem_register, + .remove_dev = &blk_nvmem_unregister, +}; + +static int __init blk_nvmem_init(void) +{ + return class_interface_register(&blk_nvmem_bus_interface); +} +device_initcall(blk_nvmem_init); From patchwork Thu Mar 21 19:34:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13599311 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1BBC13442F; Thu, 21 Mar 2024 19:34:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049676; cv=none; b=RwoT3qAEvNIb3QwNFag/1V7ldnD3ExeiyNfhZf90OWF7dBsA8jVwoNGuoO7jLcjmIX7TJ90Z3Nv8lEwX+qHaBoY36hJ3sdDBZisn2qaZSe4KXjSS3wo1k89spNfBALAyYao0P94eERbVUI6DcqKxqn6qPt0ByB/d9mBKg3v+c6E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049676; c=relaxed/simple; bh=VQOLGE5b1WT05ny2MJKIquB+OOdiTR6lMQ9qYMzFM0I=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ksk7hU5+OvOHWxYpvmhJB050C/rZ0cQ7uXIclYqJuOcKv20rSHSF9NL8VlZYJBqs0WguzDpzMgGSW7TgQgPlYEF2xlqJ9vPqhbVysqeq1LDZyn2+16+7nF4Lo47YpufwxvGZlCC3XHZM3OC+uIa1nNDmtW8T8RV0oumFwjCsLvI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1rnOB5-0000GQ-0D; Thu, 21 Mar 2024 19:34:15 +0000 Date: Thu, 21 Mar 2024 19:34:11 +0000 From: Daniel Golle To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ulf Hansson , Jens Axboe , Daniel Golle , Dave Chinner , Jan Kara , Thomas =?iso-8859-1?q?Wei=DFschuh?= , Damien Le Moal , Li Lingfeng , Christian Brauner , Christian Heusel , Min Li , Adrian Hunter , Avri Altman , Hannes Reinecke , Christian Loehle , Bean Huo , Yeqi Fu , Victor Shih , Christophe JAILLET , Dominique Martinet , "Ricardo B. Marliere" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 5/8] dt-bindings: mmc: mmc-card: add block device nodes Message-ID: <8d837b883de9f9d745819c5304cfb8aed9a6085c.1711048433.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Add nodes representing the block devices exposed by an MMC device including an example involving nvmem-cells. Signed-off-by: Daniel Golle --- .../devicetree/bindings/mmc/mmc-card.yaml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/mmc-card.yaml b/Documentation/devicetree/bindings/mmc/mmc-card.yaml index fd347126449ac..95ccbda871d24 100644 --- a/Documentation/devicetree/bindings/mmc/mmc-card.yaml +++ b/Documentation/devicetree/bindings/mmc/mmc-card.yaml @@ -26,6 +26,18 @@ properties: Use this to indicate that the mmc-card has a broken hpi implementation, and that hpi should not be used. + block: + $ref: /schemas/block/block-device.yaml# + description: + Represents the block storage provided by an SD card or the + main hardware partition of an eMMC. + +patternProperties: + '^boot[0-9]+': + $ref: /schemas/block/block-device.yaml# + description: + Represents a boot hardware partition on an eMMC. + required: - compatible - reg @@ -42,6 +54,39 @@ examples: compatible = "mmc-card"; reg = <0>; broken-hpi; + + block { + partitions { + cal_data: block-partition-rf { + partnum = <3>; + partname = "rf"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom@0 { + reg = <0x0 0x1000>; + }; + }; + }; + }; + }; + + boot1 { + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr: macaddr@a { + compatible = "mac-base"; + reg = <0xa 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; }; }; From patchwork Thu Mar 21 19:35:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13599312 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 555DC134416; Thu, 21 Mar 2024 19:35:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049741; cv=none; b=I1cuQgA895M58oL8fmUejqSULD6qoz3uS01YK1s85QqonVcOmGBqOb0sLzvkvIfQarJFzH4MNnGn0SoPqHMKVrP/WuWUVGdw0hAeFbRJo+1Xxp57QGexg9RvWZnebxkXHzXcIEAAhE+gwb3Y7DFfTobH39WCBdZHbALvLo48Ccg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049741; c=relaxed/simple; bh=MrUm4sok0/sW2mdOlQzqjBZTUNsycS8FdxaU87EdmU4=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gL3O9m2Ciwu+eBHuYnnPNWSrerPMAYY3r5vf+DE2FshupBpBt+FNIL28PaAX4s3jWfFq0r+VrpR/ZID9C5Lwtnhaf1t7g9nLibnSfjFiPl9zkwP8435CDH5hTqxE79/qPGZ08uTVUXEJQMQzB9vaY+XvLxLNFnAlwYu4azsdn/4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1rnOC7-0000JE-25; Thu, 21 Mar 2024 19:35:19 +0000 Date: Thu, 21 Mar 2024 19:35:15 +0000 From: Daniel Golle To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ulf Hansson , Jens Axboe , Daniel Golle , Dave Chinner , Jan Kara , Thomas =?iso-8859-1?q?Wei=DFschuh?= , Damien Le Moal , Li Lingfeng , Christian Brauner , Christian Heusel , Min Li , Adrian Hunter , Avri Altman , Hannes Reinecke , Christian Loehle , Bean Huo , Yeqi Fu , Victor Shih , Christophe JAILLET , Dominique Martinet , "Ricardo B. Marliere" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 6/8] mmc: core: set card fwnode_handle Message-ID: <3e086100bfae725f74e4f8a51bb4477a182395e1.1711048433.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Set fwnode in case it isn't set yet and of_node is present. Signed-off-by: Daniel Golle --- drivers/mmc/core/bus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 0ddaee0eae54f..e1c5fc1b3ce4b 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -364,6 +364,8 @@ int mmc_add_card(struct mmc_card *card) mmc_add_card_debugfs(card); card->dev.of_node = mmc_of_find_child_device(card->host, 0); + if (card->dev.of_node && !card->dev.fwnode) + card->dev.fwnode = &card->dev.of_node->fwnode; device_enable_async_suspend(&card->dev); From patchwork Thu Mar 21 19:35:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13599313 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10A6B134720; Thu, 21 Mar 2024 19:36:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049768; cv=none; b=VHdSxcDKUM8QfpiWR1+EJgYoOhYMaLBn6UcTlLrCnpzZATe/lT7ZHhNeXOFr4oOX3CeNYZ+NH+m7b524Xc7M4M8ndQamjbr/KquHjDEI+Z9wsfxAXkJT7iDkaJSVrd7s0m69IBXkpr34O/AuM8sdLHhWJnXdfz7/cSGsDwZ1zzo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049768; c=relaxed/simple; bh=+WqGCWepyys8XN9kGbVvy3zBzdke5WnUfuDS6v5KvYo=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=f3qq07u+KpC7uGj71TvbXuq0wK6TSxTTDAU1dhyYwNbAUjwsrTcKLglPSWfnhZMQ7ni06Pd3+52/Rr5/gDEz3eWV4cHZYL4va/+C0i9A+vEx+rdkJR5cke9LtfwIfZ32AeURmAt1Xqeh2W+XkDdJvFh4vMOfA/VueQ69K6NUugU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1rnOCZ-0000KR-1x; Thu, 21 Mar 2024 19:35:47 +0000 Date: Thu, 21 Mar 2024 19:35:43 +0000 From: Daniel Golle To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ulf Hansson , Jens Axboe , Daniel Golle , Dave Chinner , Jan Kara , Thomas =?iso-8859-1?q?Wei=DFschuh?= , Damien Le Moal , Li Lingfeng , Christian Brauner , Christian Heusel , Min Li , Adrian Hunter , Avri Altman , Hannes Reinecke , Christian Loehle , Bean Huo , Yeqi Fu , Victor Shih , Christophe JAILLET , Dominique Martinet , "Ricardo B. Marliere" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 7/8] mmc: block: set fwnode of disk devices Message-ID: References: Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Set fwnode of disk devices to 'block', 'boot0' and 'boot1' subnodes of the mmc-card. This is done in preparation for having the eMMC act as NVMEM provider. Signed-off-by: Daniel Golle --- drivers/mmc/core/block.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 64a3492e8002f..5b7dfd4a21fa5 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2463,6 +2463,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, int area_type, unsigned int part_type) { + struct fwnode_handle *fwnode; struct mmc_blk_data *md; int devidx, ret; char cap_str[10]; @@ -2559,6 +2560,12 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled); + fwnode = device_get_named_child_node(subname ? md->parent->parent : + md->parent, + subname ? subname : "block"); + if (fwnode) + device_set_node(disk_to_dev(md->disk), fwnode); + string_get_size((u64)size, 512, STRING_UNITS_2, cap_str, sizeof(cap_str)); pr_info("%s: %s %s %s%s\n", From patchwork Thu Mar 21 19:36:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13599314 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AC83134738; Thu, 21 Mar 2024 19:36:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049784; cv=none; b=gMbFQYj6DgHPkYgUlL8XAM4AYlCRugrnwzMspTRY3cO433PHD/3AoXXEmfwM6XBdzWLBaKoWk+lofI6XRy4sR5QkjbcG2/Dm/CH4vPe+Pu5DxOfhGMCM4wzCKNs8y6hNWsMekggSWkBml/7lME+LX3L04y7uyAv0kLrDZq87PmA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049784; c=relaxed/simple; bh=75x//W7RDIHAUZfwPjE9NS58D1kinAORLhAfTLl8XUI=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=a8f8sFLh5U0Fiwddiy5e8UjkspWVmKZ19Uo54H61rLpWBrC3urQZ75wy8c10h/mwMHP/9qAmp09Vsz9prx0J40DL2k4geBtyLsdDDYEDRVViI0Tl2Hq0Sjb5s6yQp6Oe0Z7PkZ5FIr5zHam+f1fNmPifDt2cjuUU+8ycThkMgLI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1rnOCt-0000LF-0j; Thu, 21 Mar 2024 19:36:07 +0000 Date: Thu, 21 Mar 2024 19:36:03 +0000 From: Daniel Golle To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ulf Hansson , Jens Axboe , Daniel Golle , Dave Chinner , Jan Kara , Thomas =?iso-8859-1?q?Wei=DFschuh?= , Damien Le Moal , Li Lingfeng , Christian Brauner , Christian Heusel , Min Li , Adrian Hunter , Avri Altman , Hannes Reinecke , Christian Loehle , Bean Huo , Yeqi Fu , Victor Shih , Christophe JAILLET , Dominique Martinet , "Ricardo B. Marliere" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 8/8] mmc: block: set GENHD_FL_NVMEM Message-ID: <8c10008a7be4664920db332d4baef5755d92531e.1711048433.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Set flag to consider MMC block devices as NVMEM providers. Signed-off-by: Daniel Golle --- drivers/mmc/core/block.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 5b7dfd4a21fa5..157e6d0aed495 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2516,6 +2516,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, md->disk->major = MMC_BLOCK_MAJOR; md->disk->minors = perdev_minors; md->disk->first_minor = devidx * perdev_minors; + md->disk->flags = GENHD_FL_NVMEM; md->disk->fops = &mmc_bdops; md->disk->private_data = md; md->parent = parent;