Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2898385rdb; Wed, 4 Oct 2023 15:23:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0uGXOwbyR0iS7d5sTgCuUIUCHDxPbaatIHbGEADt7ycGTXhu8WWGvXcTHzq7RiKYIKavs X-Received: by 2002:a17:902:c449:b0:1c5:a09e:170a with SMTP id m9-20020a170902c44900b001c5a09e170amr3000025plm.54.1696458197781; Wed, 04 Oct 2023 15:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696458197; cv=none; d=google.com; s=arc-20160816; b=mC7WbvLOgZI/kfJ2zVZGSBvXxauZPWHsRWBu9LeHe/dBx0GNQjzWlsLhn510D1fz4g twFi2lL13nRQgLOHaTBfUCmHVBoK0GhaZ3saLn0EwCBoEm4juu0d6KLwUM8dSsBIuzhi gnxfO5VLEy0spX3BLsgKoNWzaRix84VLDyrb0R/EX75QKncwH9Uv1FESpDvOWqZlRfjR 9uEuyZrnNCdsQy2/H1HNdH8/+K+pRiKfTkirhFOFf4O9rHxIboPEVVipxWpZFsT3miuW PM0QfYjCTbagBVRz/NQ2tXBZWqk/8TkFucW70Bisl8yRl4ZVQSO4wbMHs7m8ddZCMzHi 0nNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dfOp8t/SWXoAMbVxsmdWr6p/Yay0CylcPPBrARczmbM=; fh=XQzgxiPMj/Cqsom9sWl23DkvcXkGD6r/vx0NuuBn5R0=; b=f1N6lVitLKiU0A8LyrcPaXhTfL1zaK807CRr+jJRbY8hLgTuNmG0cQRlo2sTXQqTjP gfhdxjAfOZqR5yinQLwpVMjMhqKrEWJlY9xr9uWDPn9v108w6l10rWJNrgG9bJQ8SjL0 Cf085PwapwKlLfVpApQjEN9Ou9DdheZzUm21Qr4U2OApFYUZc66IzBkLVksSU1ZHPJvL w9LPJlrAClLr+jDlSilLvYbYYD/PEVf6ruhQ0QTL8UCicmjYjMd0aj/O5+RT1c/plfa+ GafnBMtWzsYom4fucVhFxwTrCo+hVV4KjppfwAQH3U771wu36A6Ru3zvlTsNlJ6DpBsi Rc8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=clzmPzVF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id kv4-20020a17090328c400b001ae40e07fb0si116830plb.216.2023.10.04.15.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 15:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=clzmPzVF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0379783B6BC7; Wed, 4 Oct 2023 15:23:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237432AbjJDWXK (ORCPT + 99 others); Wed, 4 Oct 2023 18:23:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236114AbjJDWXB (ORCPT ); Wed, 4 Oct 2023 18:23:01 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0BD610F; Wed, 4 Oct 2023 15:22:56 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 664391C0006; Wed, 4 Oct 2023 22:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1696458175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dfOp8t/SWXoAMbVxsmdWr6p/Yay0CylcPPBrARczmbM=; b=clzmPzVFVf89AykIKBa1Jei5WFbi6RaZdA04K8dmqtHHD9JYr1WRT+l6ekSwU4VadGsfHV xw8Q6S9IB8kfK5yLAo9UsXwIr0159hMbyBU9VPO5iI2WxsQ6D/PVqGjxKWpy6PeRMnOdXe yA4oxOO8L1qdRPIJVXmLWxokyQvCF3y1+obtnEYkB9n/jK1hwGeLhvpi6V2J6D60v/ZZG/ h+jYZQsgi7jSPUo7kZ5fQ4SSoNND2+dkBkZ5IeYSmkbxJAxvKhOEnPiX9yH4E7pw7MiRrq 83fmb4fxXptRJ7wGOxGvAe1DG5XfJQt7psHim2krZBao1pkp3KBXoUfoMbongw== From: Miquel Raynal To: Srinivas Kandagatla , Greg Kroah-Hartman Cc: Michael Walle , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Rob Herring , Frank Rowand , devicetree@vger.kernel.org, , Robert Marko , Thomas Petazzoni , Luka Perkov , Randy Dunlap , Chen-Yu Tsai , Daniel Golle , Miquel Raynal Subject: [PATCH v11 6/7] ABI: sysfs-nvmem-cells: Expose cells through sysfs Date: Thu, 5 Oct 2023 00:22:35 +0200 Message-Id: <20231004222236.411248-7-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231004222236.411248-1-miquel.raynal@bootlin.com> References: <20231004222236.411248-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 04 Oct 2023 15:23:16 -0700 (PDT) The binary content of nvmem devices is available to the user so in the easiest cases, finding the content of a cell is rather easy as it is just a matter of looking at a known and fixed offset. However, nvmem layouts have been recently introduced to cope with more advanced situations, where the offset and size of the cells is not known in advance or is dynamic. When using layouts, more advanced parsers are used by the kernel in order to give direct access to the content of each cell regardless of their position/size in the underlying device, but these information were not accessible to the user. By exposing the nvmem cells to the user through a dedicated cell/ folder containing one file per cell, we provide a straightforward access to useful user information without the need for re-writing a userland parser. Content of nvmem cells is usually: product names, manufacturing date, MAC addresses, etc, Signed-off-by: Miquel Raynal Reviewed-by: Greg Kroah-Hartman --- Documentation/ABI/testing/sysfs-nvmem-cells | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-nvmem-cells diff --git a/Documentation/ABI/testing/sysfs-nvmem-cells b/Documentation/ABI/testing/sysfs-nvmem-cells new file mode 100644 index 000000000000..7af70adf3690 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-nvmem-cells @@ -0,0 +1,21 @@ +What: /sys/bus/nvmem/devices/.../cells/ +Date: May 2023 +KernelVersion: 6.5 +Contact: Miquel Raynal +Description: + The "cells" folder contains one file per cell exposed by the + NVMEM device. The name of the file is: @, with + being the cell name and its location in the NVMEM + device, in hexadecimal (without the '0x' prefix, to mimic device + tree node names). The length of the file is the size of the cell + (when known). The content of the file is the binary content of + the cell (may sometimes be ASCII, likely without trailing + character). + Note: This file is only present if CONFIG_NVMEM_SYSFS + is enabled. + + Example:: + + hexdump -C /sys/bus/nvmem/devices/1-00563/cells/product-name@d + 00000000 54 4e 34 38 4d 2d 50 2d 44 4e |TN48M-P-DN| + 0000000a -- 2.34.1