From patchwork Thu Mar 21 19:31: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: 1914598 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=devicetree+bounces-52276-incoming-dt=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V0wc16Xq0z1yWp for ; Fri, 22 Mar 2024 06:33:21 +1100 (AEDT) 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 99763B215E8 for ; Thu, 21 Mar 2024 19:33:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F5AA13441E; Thu, 21 Mar 2024 19:33:14 +0000 (UTC) X-Original-To: devicetree@vger.kernel.org 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 53A58133422; Thu, 21 Mar 2024 19:33:11 +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=1711049594; cv=none; b=ryITxzUdfJx3jeZCe/RC6Kck6UZqYgN+XucNGrEIWcMmlS6sWxhcmB30e+la5gtnDx+o8+ahCBDkpQypaX8cccQddqiXJghs+RhumizlI84ycFbmIQFO/4jAEXVfGwM+p8dXaaXuOQkeMy50SfQFDuZ5i/u2I802ex9mDiEqjIc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711049594; c=relaxed/simple; bh=xXa4FF7nQG3CwW6ptYwxB1tD6/Yh0AKEy2Pi0Dfq8GU=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=ANwf1zngs/Np/yvc7/UYXQjVhFuisgFIbZ+AVgckrIixMgkQsDmQ9pj860Ma0DuRMPzkkxjhF4uvAnOXfbkyJstOP5YmDc1fC6mTTjuHVB2CZqxiGfZGtXBgKVDwhCaPCIojrQVeC1t+5qpcJMqbvNwh2TkgjDG5C2/3W+/1U+Y= 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 1rnO9R-0000Cf-2Z; Thu, 21 Mar 2024 19:32:33 +0000 Date: Thu, 21 Mar 2024 19:31: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 0/8] block: implement NVMEM provider Message-ID: Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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). 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] which has received overall positive feedback and only minor corrections have been done since (see changelog below). [1]: https://patchwork.kernel.org/project/linux-block/list/?series=767565 [2]: https://patchwork.kernel.org/project/linux-block/list/?series=832705 Changes since RFC: * Use 'partuuid' instead of reserved 'uuid' keyword to match against PARTUUID. * Simplify blk_nvmem_init(void) function. Daniel Golle (8): dt-bindings: block: add basic bindings for block devices block: partitions: populate fwnode block: add new genhd flag GENHD_FL_NVMEM block: implement 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 +++++ MAINTAINERS | 5 + block/Kconfig | 9 + block/Makefile | 1 + block/blk-nvmem.c | 169 ++++++++++++++++++ block/partitions/core.c | 41 +++++ drivers/mmc/core/block.c | 8 + drivers/mmc/core/bus.c | 2 + include/linux/blkdev.h | 2 + 12 files changed, 375 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-nvmem.c