Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1018599lqb; Wed, 29 May 2024 19:14:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZ52NORyCulPI69cfpwSTgCjPSX4Z6LzaciJ5gmmkOwhoXx39EG7L3W4k4oV8XDZOZlzIsa4lZ/ugQiF//hO4BKkC7cx1hhhKhABGofA== X-Google-Smtp-Source: AGHT+IEQSYw7pJUFBKU8drM9QPnut8yVZb8ECHqaToBPrz5uWUgy0is2dI4tYLe4mr/qwb7ml9Kz X-Received: by 2002:a17:903:2444:b0:1f3:266b:ea23 with SMTP id d9443c01a7336-1f6192f163dmr9066575ad.13.1717035243059; Wed, 29 May 2024 19:14:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717035243; cv=pass; d=google.com; s=arc-20160816; b=Yf2wPnng28Yi5sMq50bEMWgwpCOK0nhnXwPggHmvwuY3WOqlj6STeKCn2TTBB9amMy oypc5DBNvelcJl2hecF3greglzlnbEXr0lUTDD9Tt5L9pOWUkZwVpndxJnRipHov4hAr HqD9t4SImT3tpqiu8g1NxfIvreaWSKyL2lwQ/zRmtcb6NEjhEFn9TA4QELUFJvPcqbfN VWkNEcOhP3kxRr0VzMfL0QMwP874Ajz2hYJEo6Q63a9IKcakmNLOGgyL5wCavTmuh3tI eYA1riVYkyQctetLOrEd2l1dVW8gwYYAvKtTb7YsbIgu1Pdsrbw8Uvm56UMjA9OcMRmV fXGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:to:from:date; bh=NuvOzp/qP9QI90XXOvFF59NNhpRuxiEQHvDW2YCTnqc=; fh=PTscWTIHcoR2vyQtw5VESTy9e97dUqI8eGwoqj4vbiM=; b=iEa6IbFrTk7GF6NkS8mF0q9TS3J1wCD23YhWsrlQcE+8vuHJqcuaCM7O3R4uZjU9Uh eAoP8PYrdLxHG+iB8ema7tq1M0RG56uSbD+mSHfEcr9dBhcf7ERFU0SmNoxU/+JCbFPP CWBhS2HHu2JpFnnTUY/pu2VfawOPy9zqrp01JfWX/LjrJVLMw0uLkREeJYa5CJL6zh8L A4FN8X9KXH2LZCPhtjma0jQ7ex6OXEzgjGZiJ8SGvPB9QnulmYdFJyFI2LTfV1+c2Sv5 i6WZzE9krUWDg2V7Lg/Q/VkcD3acaTsIq9XJ+l8Bz4q4zXXfrIoeiazRPY5yC2Ot9MCd kzGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-194876-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194876-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c96f4a4si108498985ad.291.2024.05.29.19.14.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 19:14:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194876-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-194876-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194876-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8870C285798 for ; Thu, 30 May 2024 02:14:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B45F91DA53; Thu, 30 May 2024 02:13:47 +0000 (UTC) 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 9AED018040; Thu, 30 May 2024 02:13:45 +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=1717035227; cv=none; b=DbRQYTRr9g/zNaiY7M+emlf0+RWCTockkgY73taENR48wbeol/nX9g+RJvlWdbXfdyy+82GLiV2z9wxc4vje1gILOb6OVfkRLraQXvhxIgdEngl6MfIhgVb/OV2bprR5KI6D762/h4s/FM3B9G1fNdX4nDWk1xWq0RCNvp7Iiso= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717035227; c=relaxed/simple; bh=i6vBjYMdFnnLJpM5QWR1zTf8u6cNKoHy8dOt9MG9lIA=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=PhG3xWXxNvwOB8y71AklSUge3nJBqFj6zCNyeos8haJ6QLgNMlX0XhnhtGsSyG5uP0EvvefoVJQwuxyks8PQQ5sOct4qJuxu0oxc0346IxFpth3nGAw/5IIa1qH6HW1xWN7ncGPU0L44pEW7qMEDzK2kRPpPcokab8ztvv2Eris= 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.97.1) (envelope-from ) id 1sCVHr-000000004cn-1BZJ; Thu, 30 May 2024 02:13:03 +0000 Date: Thu, 30 May 2024 03:12:54 +0100 From: Daniel Golle To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ulf Hansson , Jens Axboe , Srinivas Kandagatla , Daniel Golle , Dave Chinner , Jan Kara , Christian Brauner , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Al Viro , Li Lingfeng , Christian Heusel , Min Li , Avri Altman , Adrian Hunter , Hannes Reinecke , Mikko Rapeli , Yeqi Fu , Victor Shih , Christophe JAILLET , Li Zhijian , "Ricardo B. Marliere" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH v2 0/9] nvmem: implement block NVMEM provider Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On embedded devices using an eMMC it is common that one or more (hw/sw) partitions on the eMMC are used to store MAC addresses and Wi-Fi calibration EEPROM data. Implement an NVMEM provider backed by a block device as typically the NVMEM framework is used to have kernel drivers read and use binary data from EEPROMs, efuses, flash memory (MTD), ... In order to be able to reference hardware partitions on an eMMC, add code to bind each hardware partition to a specific firmware subnode. Overall, this enables uniform handling across practially all flash storage types used for this purpose (MTD, UBI, and now also MMC or and in future may also other block devices). As part of this series it was necessary to define a device tree schema for block devices and partitions on them, which (similar to how it now works also for UBI volumes) can be matched by one or more properties. --- This series has previously been submitted as RFC on July 19th 2023[1] and most of the basic idea did not change since. Another round of RFC was submitted on March 5th 2024[2]. Changes since v1 sent on March 21st 2024 [3]: - introduce notifications for block device addition and removal for in-kernel users. This allows the nvmem driver to be built as a module and avoids using class_interface and block subsystem internals as suggested in https://patchwork.kernel.org/comment/25771998/ and https://patchwork.kernel.org/comment/25770441/ [1]: https://patchwork.kernel.org/project/linux-block/list/?series=767565 [2]: https://patchwork.kernel.org/project/linux-block/list/?series=832705 [3]: https://patchwork.kernel.org/project/linux-block/list/?series=837150&archive=both Daniel Golle (9): dt-bindings: block: add basic bindings for block devices block: partitions: populate fwnode block: add support for notifications block: add new genhd flag GENHD_FL_NVMEM nvmem: implement block NVMEM provider dt-bindings: mmc: mmc-card: add block device nodes mmc: core: set card fwnode_handle mmc: block: set fwnode of disk devices mmc: block: set GENHD_FL_NVMEM .../bindings/block/block-device.yaml | 22 ++ .../devicetree/bindings/block/partition.yaml | 51 +++++ .../devicetree/bindings/block/partitions.yaml | 20 ++ .../devicetree/bindings/mmc/mmc-card.yaml | 45 ++++ block/Kconfig | 6 + block/Makefile | 1 + block/blk-notify.c | 88 ++++++++ block/partitions/core.c | 41 ++++ drivers/mmc/core/block.c | 8 + drivers/mmc/core/bus.c | 2 + drivers/nvmem/Kconfig | 11 + drivers/nvmem/Makefile | 2 + drivers/nvmem/block.c | 198 ++++++++++++++++++ include/linux/blkdev.h | 10 + 14 files changed, 505 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 create mode 100644 block/blk-notify.c create mode 100644 drivers/nvmem/block.c -- 2.45.1