From patchwork Mon Jul 31 19:10:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 12899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2233681vqg; Mon, 31 Jul 2023 12:56:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlGzVD7N7t8CoGLyfNF7DB1aFn27zgMFp+SlyuGZ5mkSp5hPXalUPiETJedCUYIbXD5qqVod X-Received: by 2002:a17:902:c951:b0:1bb:86d7:4eb1 with SMTP id i17-20020a170902c95100b001bb86d74eb1mr11869352pla.39.1690833377488; Mon, 31 Jul 2023 12:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690833377; cv=none; d=google.com; s=arc-20160816; b=ILhbUy9TGq9X1ZKvy1TVnQnTAeKWOID1NSE6OEE1ETTa8jvBAE1AYP1WC3m8rpOV10 ZFYxq3xjiCjHZEGA26YJRCHByftOoo0lDusXPDaAof6X8C/okM6gmn5n3Gyc6r1srNYW daBmqxp7cuK4HhmJrEpJtiPkPUDO+TkZNNpLS9Kq6PNjLRs5Y3fWVxGdiR/JFhuG5y8U 4TKKLwp83ThsoUHFPo/hb7rAspZricXWJUyZP2nMk8Ihq7hWVc9sbO1oOm29nqojeph6 lEwx3o5wyK6mZvwwQJ0IPVGB6VrIKtWGSMw/ysRZK1Qj2dX5WfLU7gne23Ka857pZ8s4 MYaQ== 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=Os1qKGxNqdZAQqcCiPgAxftl6/Audy2mPvljhcJ17Hk=; fh=kFGsI/e2yvLWxse1j39HJ6gb+i8cDJSBRhHonL9x+u0=; b=p6Gl5UPWdz6VoA23Mj00rPsH/kIyAj12TOoXx0KOPCPYThcqRNvdejX0MKyQQK5lqN cFBnP/LuLhX66eI8NhG90vJUX+IuCxWiRCMIWkniOSpfV7Qp92xx2+qjOvtD7ujbsoT3 v+6NIzRg01rDveZ7R1+keGtZediakubJRbD2eOwbkEJab5bywMmz5a+HkUpWQl+/FlC6 EAf+yq1H7zq0xfcBh+dbX1z0yyRIK3S1eHCNyVNfjiObJU3ZLnjzZEraYyfRFKxQDdQM 9nasCbi0Dr+SzNNeHwu5hwpUTmfWibREDoJigMX1j4G1vWZ8GQh8rb93f5490QbOGJtA 93pQ== 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 s13-20020a170902ea0d00b001bbdd44bbd4si8029979plg.74.2023.07.31.12.56.03; Mon, 31 Jul 2023 12:56:17 -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 S231149AbjGaTLQ (ORCPT + 99 others); Mon, 31 Jul 2023 15:11:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjGaTLP (ORCPT ); Mon, 31 Jul 2023 15:11:15 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2178F12F for ; Mon, 31 Jul 2023 12:11:14 -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 1qQYIK-0001gP-0Q; Mon, 31 Jul 2023 19:11:05 +0000 Date: Mon, 31 Jul 2023 20:10:47 +0100 From: Daniel Golle To: Richard Weinberger , Miquel Raynal , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 0/6] 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,T_SCC_BODY_TEXT_LINE 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: 1772967299774344291 X-GMAIL-MSGID: 1772967299774344291 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 Daniel Golle (6): 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 | 12 +++ 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, 477 insertions(+), 119 deletions(-) create mode 100644 drivers/mtd/ubi/nvmem.c