From patchwork Sat Aug 5 16:22:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13193 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp548698vqr; Sat, 5 Aug 2023 09:56:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHf7+P0aWNeiu2nlCmntPK7oE8x3ZdcvwIPzNRhBEF4vZxHXwAVPGKm1hPkHNCC8KrcRCfT X-Received: by 2002:a17:902:9895:b0:1bb:2d0b:1a18 with SMTP id s21-20020a170902989500b001bb2d0b1a18mr3658283plp.50.1691254605251; Sat, 05 Aug 2023 09:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691254605; cv=none; d=google.com; s=arc-20160816; b=jBlxQx5QbobMUQqfIKLtvs9S1ZHV5Vf+COeyJt/ofaBvw94gos0yUsePCZP7l5H6tH Q75ygRz6+PS4/stdnDdhx8Uo3QvgzXYMOy5OYEJVoENzLLY32hwOglSpyTNDPCiNFgJP P8aRehVscs3W+5DeuPOUTENZjkVr6A5+Aw2LBS0FO0lcV54HZ4mJWLFXDWHA7ZOcoz5A REetvf8XXVcVop6wDdkgfeMjqwMwkIHVfcjzpHkOH0AwUd0Ib/RqEF2RnzYBITe2lCCE vDLY77bD6493xSRLSizhVEEpaiQLyrwodGzlbs3SDQ8J1fzMfQeYEkgiX/cDi0l9wgUE ovPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date; bh=AStYy3JM2j/UBX1YmlsrSkiwiLIvFPn11TKPf8bZwpg=; fh=WrF5P4rt5GKLKZXFPrBfHwP5VFIZG8GPN/h4vsvn4l4=; b=rKqWeKNeEkqe81lfTxXzrSpn9e2yKFTYYBFjuST0Jris0+8LN3CYCieS2bot7oDePv uRKWhCLFR6rtKnIn4DgA3HSmIg6WJlFlSKDBlPELKAk74ay/eRD/T4R301cFMdG7LiPU O2Y0tPSn5YtKzqZAojveWWWDqGNY075UBPrcqvK2t5UgjMui5PYpFR8WkIDJZ57xRHOw jwGFM9BXMz0/rzBo5zSeuosm7FiNJGsEeJNkpqNtBYGxchwYUYhS/YHe1W+jBojekRDf gttwc3ge6pwvhX+JsFfU2saOw1fzp5oyPmKy3pdRWIJq9Udf6YZ3AmR70dnj4qyRd9uT MBcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kb4-20020a170903338400b001bb8df95094si3215271plb.509.2023.08.05.09.56.31; Sat, 05 Aug 2023 09:56:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229719AbjHEQXT (ORCPT + 99 others); Sat, 5 Aug 2023 12:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjHEQXR (ORCPT ); Sat, 5 Aug 2023 12:23:17 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 050EBCD for ; Sat, 5 Aug 2023 09:23:15 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1qSK3T-0000d8-2m; Sat, 05 Aug 2023 16:23:03 +0000 Date: Sat, 5 Aug 2023 17:22:53 +0100 From: Daniel Golle To: Randy Dunlap , Richard Weinberger , Miquel Raynal , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH v2 0/7] mtd: ubi: allow UBI volumes to provide NVMEM Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773408988747914453 X-GMAIL-MSGID: 1773408988747914453 The series is a follow-up and contains all patches of the previous series "mtd: ubi: behave like a good MTD citizen"[1] which was meant in preparation for implementing the NVMEM provider. The goal is to support embedded Linux devices which got NVMEM bits stored inside a UBI volume. Representing the UBI volume in the Device Tree, adding a phandle to be referenced by NVMEM consumers allows such devices to come up with their correct MAC addresses and device-specific Wi-Fi calibration data loaded. In order to be available for other drivers, attaching UBI devices has to be moved from late_initcall (which is too late for other drivers) to happen earlier. As an alternative to the existing kernel cmdline parameter the Device Tree property 'compatible = "linux,ubi";' inside an MTD partition can be used to have that MTD device attached as UBI device. MTD partitions which serve as UBI devices may have a "volumes" firmware subnode with volumes which may be compatible with "nvmem-cells". In this way, other drivers (think: Ethernet, Wi-Fi) can resolve and acquire NVMEM bits using the usual device tree phandle, just this time the NVMEM content is read from a UBI volume. [1]: https://patchwork.ozlabs.org/project/linux-mtd/list/?series=353177&state=%2A&archive=both Changes since v1: * include patch to fix exiting Kconfig formatting issues * fix typo and indentation in Kconfig Daniel Golle (7): mtd: ubi: improve Kconfig formatting mtd: ubi: block: don't return on error when removing mtd: ubi: block: use notifier to create ubiblock from parameter mtd: ubi: attach MTD partition from device-tree mtd: ubi: introduce pre-removal notification for UBI volumes mtd: ubi: populate ubi volume fwnode mtd: ubi: provide NVMEM layer over UBI volumes drivers/mtd/ubi/Kconfig | 72 ++++++++------- drivers/mtd/ubi/Makefile | 1 + drivers/mtd/ubi/block.c | 186 +++++++++++++++++++++++--------------- drivers/mtd/ubi/build.c | 160 ++++++++++++++++++++++++--------- drivers/mtd/ubi/cdev.c | 4 +- drivers/mtd/ubi/nvmem.c | 189 +++++++++++++++++++++++++++++++++++++++ drivers/mtd/ubi/ubi.h | 6 +- drivers/mtd/ubi/vmt.c | 36 ++++++++ include/linux/mtd/ubi.h | 2 + 9 files changed, 507 insertions(+), 149 deletions(-) create mode 100644 drivers/mtd/ubi/nvmem.c