Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4298226pxf; Tue, 23 Mar 2021 07:33:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyivzw6hrm9JXgCCUxPw2XyhKoT4ETJeSw28/IrARkKSWax4/2c2Ggvpgi6gK0bGfp9OoCw X-Received: by 2002:a05:6402:4415:: with SMTP id y21mr4851064eda.70.1616510030962; Tue, 23 Mar 2021 07:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616510030; cv=none; d=google.com; s=arc-20160816; b=b5rFe/9wBKqiuftTx8WI2E0yJRm29nrfMpVgVMDsXzWgHGpB7RWcUpd+d8lV8FZpG8 4TNu4MdSXJMyVs5Aq/pXbUKM73OmL6/Nqqyoj1oKOc0+hyx/ENWSn8cdghQjcCH3Zorr f5LA/538JxSS8KKdqSbzkfhXEaAdDSFDeIeTeVtVDsfdzqgoQzIzWJ2xTnZ3JN0oChaf JZgIwZeXUmGAA9fCZcDnKzbHyjpCFtzRZePIz6k+hVaY4hX37wc8G8oA0fd0YJ4cs0j7 7ac8bhGuCkOrZFZ4eJIUQNGwpuQkQHG0wFwhdxtC+2KXWyg+OGVVPdSEchd1twmkfylp z1Xw== 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=jinu5wK2Fgb90K/Icg26zeiD13m248t4W0EyRWdw7co=; b=pHHwoj25HtNPPpWYnh76WnVKt31ATQHIDRhz1qTitkTMmeBcZnAlU48GlqJTeZf9ze ktpS8/H5a2cVwTNV1UTKx0R6z6fZDwdS5tQt5sqsXrNnmP6x1V+33F/CPnWcup+Ba6/b IRHhGcKWt0l6T/3PSg0KUA/OrKUd85/XAhj82amDT3MOaHsxeYtuFp3IswRYSB1ecOf5 2KdlNatspexxJ0IoqeIUnYy9k2sZHIA1vF0bddv8Y3JuogrZRun8HbcfURI8Eq0e5+tQ 2UN6XcMxN6vapn18lnkTXwHCGJydLYA4q5C1PQqTs+k9Vdm6i4lfAy2JetcFlDF7+ByG zVxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=mM5kW7+C; 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 zc4si6000210ejb.36.2021.03.23.07.33.28; Tue, 23 Mar 2021 07:33:50 -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=mM5kW7+C; 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 S232305AbhCWOcc (ORCPT + 99 others); Tue, 23 Mar 2021 10:32:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232320AbhCWOcB (ORCPT ); Tue, 23 Mar 2021 10:32:01 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E261C061763 for ; Tue, 23 Mar 2021 07:32:00 -0700 (PDT) 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 9A8FD22234; Tue, 23 Mar 2021 15:31:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1616509913; 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=jinu5wK2Fgb90K/Icg26zeiD13m248t4W0EyRWdw7co=; b=mM5kW7+CuKde9AKYczyRxp6riiViJLowJPtKuX8EeTNchN49cKpU2u7dtDW8yXUNaJHy28 EqBYXJZl8JsFd5D1kdoRC4evSKfwQTW8rZTMeY36X8rJa9Z9PDezy32YTlKNbnmBy5OcsB dTKveqHHcTij8yNo+eHLfglp5Mf0gjA= 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 , Michael Walle Subject: [PATCH v2 0/2] mtd: spi-nor: support dumping sfdp tables Date: Tue, 23 Mar 2021 15:31:42 +0100 Message-Id: <20210323143144.12730-1-michael@walle.cc> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 drivers/mtd/spi-nor/Makefile | 2 +- drivers/mtd/spi-nor/core.c | 5 +++ drivers/mtd/spi-nor/core.h | 13 ++++++ drivers/mtd/spi-nor/sfdp.c | 58 ++++++++++++++++++++++++ drivers/mtd/spi-nor/sysfs.c | 86 ++++++++++++++++++++++++++++++++++++ include/linux/mtd/spi-nor.h | 2 + 6 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/spi-nor/sysfs.c -- 2.20.1