Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2935796pxy; Mon, 3 May 2021 11:13:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOTbDU4dhbHSvBNC7CQhs2524AsEHqWsDUP562nMgPD2U2pDiEn5I3jWiewZdc1s5FmmE0 X-Received: by 2002:a63:4c26:: with SMTP id z38mr20154375pga.415.1620065513433; Mon, 03 May 2021 11:11:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620065513; cv=none; d=google.com; s=arc-20160816; b=mCkTDT7xLxwG40U8VBq6JLQrbX7ujRiWMlVJKlgak1401V0RIKH39gzeFxpeebrfd9 9UOpV8XnJAZ9gyo61eeSOyN8NMQx9umoliHDYY1CfdscTxVb9hBcwwlAJ0S9fsvidrAw 8hN7Uh8mNejVw8fZV4Y5pLHVOHS/GRIuThw8R82IV5tgm4/Arg94nFkbCfiwQ89+Zhql xSSR6fXQI3SL3ar60o2p75UwqTWgMKnO9VnuhvMlaiCY84YsP/KxJM0Rxzcoo4ig50ER YPAtcEFQp56Bih/nVJ9KpAT65VCcfZJMxgsLkDk8rC0te7zNuXC2d/Hydb9UhM5+dS3s oc8A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=9KttZtarF6opM3O8v0iI0WEtIdwrMkc9FPFepsHdxOY=; b=sCUpkQNt6rRf9jfJcLvTYWrfYskP5AoIOQ37EDVODngft810J6DU3z8xFvJwv0B/Tt NhWA5Pn9kxzD6txQIId0zMes5ylIvGi67rMHW+EtorrF51kbGrVSpBD4yrxjCbbCGqt0 o5+Ltdr6iNbGB4Y+GMsfnSFHCCybt2cMO7ePpS1lP5ZCsSmdVr0N7VO8+19cFzjks8dI 9k/HLm/LWgAcUX0veXGKO/VVlV1kXPxRIAjFfrIn9WbjXEvZzy7UF20CbKXEQ6xOLz5i 7yq4IrwaPX/5GqFy3ZZcLI6B1Eg/b40tjz8YP92w+dl3yCxodRrJOIl+Q4x2q33slgsB 0ctQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=GhVjVlD1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l11si474899plg.400.2021.05.03.11.11.41; Mon, 03 May 2021 11:11:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=GhVjVlD1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230503AbhECP5x (ORCPT + 99 others); Mon, 3 May 2021 11:57:53 -0400 Received: from ssl.serverraum.org ([176.9.125.105]:56205 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230236AbhECP5x (ORCPT ); Mon, 3 May 2021 11:57:53 -0400 Received: from mwalle01.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:fa59:71ff:fe9b:b851]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 1042922172; Mon, 3 May 2021 17:56:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1620057418; 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; bh=9KttZtarF6opM3O8v0iI0WEtIdwrMkc9FPFepsHdxOY=; b=GhVjVlD1Oh6MBSGhe/qvjJf2yBNKe75GP9hK5cQ/Rwp/vH15ZlpiSqL5WXnpQkXh9eHiZG jMNI5juEHaEb9XSJdnQQkCzeH3ngoaDvXJPIJRVUpDONgHTVitUENolLboJFg9p6ewF+er JqMF44rwkm6tLEubus1K+2Lqe1SjIa4= From: Michael Walle To: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Cc: Tudor Ambarus , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Alexander Williams , Yicong Yang , Heiko Thiery , Michael Walle Subject: [PATCH v4 0/2] mtd: spi-nor: support dumping sfdp tables Date: Mon, 3 May 2021 17:56:49 +0200 Message-Id: <20210503155651.30889-1-michael@walle.cc> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam: Yes Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the possibility to dump the SFDP data of a flash device. More and more flash devices share the same flash ID and we need per device fixups. Usually, these fixups differentiate flashes by looking at differences in the SFDP data. Determining the difference is only possible if we have the SFDP data for all the flashes which share a flash ID. This will lay the foundation to dump the whole SFDP data of a flash device. This is even more important, because some datasheets doesn't even contain the SFDP data. Fixups for these kind of flashes are nearly impossible to do. I envision having a database of all the SFDP data for the flashes we support and make it a requirement to submit it when a new flash is added. This might or might not have legal implications. Thus I'd start with having that database private to the SPI NOR maintainers. Changes since v3: - move spi-nor attributes into spi-nor/ subdirectory, suggested by Alexander Williams. Changes since v2: - use .dev_groups of the driver to attach the attributes - add manufacturer attribute - rename attribute name to partname - add ABI documentation Changes since v1: - use sysfs_emit() - add comment about the allocation of the sfdp dwords - free SFDP memory in the error path - use BIN_ATTR_RO(sfdp, 0) - use spi_nor_read_sfdp() Changes since RFC: - Don't read SFDP data after probe. The flash might already be switched to 8D-8D-8D mode. Instead, cache the SFDP data - add two sysfs files: jedec-id and name - change the file mode of the sfdp file from 0400 to 0444. There is no hardware access anymore. Michael Walle (2): mtd: spi-nor: sfdp: save a copy of the SFDP data mtd: spi-nor: add initial sysfs support .../ABI/testing/sysfs-bus-spi-devices-spi-nor | 31 +++++++ drivers/mtd/spi-nor/Makefile | 2 +- drivers/mtd/spi-nor/core.c | 1 + drivers/mtd/spi-nor/core.h | 12 +++ drivers/mtd/spi-nor/sfdp.c | 58 ++++++++++++ drivers/mtd/spi-nor/sysfs.c | 93 +++++++++++++++++++ include/linux/mtd/spi-nor.h | 2 + 7 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor create mode 100644 drivers/mtd/spi-nor/sysfs.c -- 2.20.1