From patchwork Mon Dec 20 16:46:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 1571131 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=meLTU+7U; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JHlqp1bCBz9sCD for ; Tue, 21 Dec 2021 03:47:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=LnArHqs/euCV1xlB8SnSjvboEs75Iifo9Ndme1b+jl8=; b=meLTU+7UzlcLft ffuwmVKJr7S1FR0bJ8nxg5L+S7XZGFEG/3WDBwy6gzxMOO6GItXQrjbMRJ5uF7pmz3CIzjSjaDPlq 7ek/u7ct9GzkS65hfPo1M5Pk/a9jZMrYWIPJysW2TVeDDGrp2ThZXp3BgfDENhhOQKzMbkRObFZ8o 4Uhk/jKGMAk00HBb99CIYcJNB1q1U0XOAn++VpQtj/SYHGFkDn1bZwPakoAEEAACfXZosOEnqkZep k7wBBZHsVa9PR/ISpAHy/B9oPj3Wyg6WW8Sidq3LZV/dQSiQ3PGgyssadG2hpulxroHpx0Pgn/Ho1 yTq5aAapeDqteSkTeTJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzLnw-003MYU-Qk; Mon, 20 Dec 2021 16:46:28 +0000 Received: from mga14.intel.com ([192.55.52.115]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzLns-003MWX-JQ for linux-mtd@lists.infradead.org; Mon, 20 Dec 2021 16:46:26 +0000 X-IronPort-AV: E=McAfee;i="6200,9189,10203"; a="240442507" X-IronPort-AV: E=Sophos;i="5.88,220,1635231600"; d="scan'208";a="240442507" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2021 08:46:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,220,1635231600"; d="scan'208";a="484114729" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 20 Dec 2021 08:46:18 -0800 Received: by black.fi.intel.com (Postfix, from userid 1001) id 34F35144; Mon, 20 Dec 2021 18:46:25 +0200 (EET) From: Mika Westerberg To: Tudor Ambarus , Mark Brown Cc: Lee Jones , Boris Brezillon , Michael Walle , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Jonathan Corbet , Mauro Lima , Alexander Sverdlin , Andy Shevchenko , Hans-Gert Dahmen , Mika Westerberg , linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org Subject: [PATCH v5 0/3] mtd: spi-nor / spi / MFD: Convert intel-spi to SPI MEM Date: Mon, 20 Dec 2021 19:46:22 +0300 Message-Id: <20211220164625.9400-1-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211220_084624_761616_1386970B X-CRM114-Status: GOOD ( 19.88 ) X-Spam-Score: -5.0 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi all, Based on discussion on the patch I sent some time ago here: http://lists.infradead.org/pipermail/linux-mtd/2021-June/086867.html Content analysis details: (-5.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [192.55.52.115 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hi all, Based on discussion on the patch I sent some time ago here: http://lists.infradead.org/pipermail/linux-mtd/2021-June/086867.html it turns out that the preferred way to deal with the SPI flash controller drivers is through SPI MEM which is part of Linux SPI subsystem. This series does that for the intel-spi driver. This also renames the driver to follow the convention used in the SPI subsystem. The first patch improves the write protection handling to be slightly more safer. The following two patches do the conversion itself. Note the Intel SPI flash controller only allows commands such as read, write and so on and it internally uses whatever addressing etc. it figured from the SFDP on the flash device. Previous versions of the patch series can be found here: v4: https://lore.kernel.org/linux-mtd/20211118130543.11179-1-mika.westerberg@linux.intel.com/ v3: https://lore.kernel.org/linux-mtd/20211013114432.31352-1-mika.westerberg@linux.intel.com/ v2: https://lore.kernel.org/linux-mtd/20211007112132.30934-1-mika.westerberg@linux.intel.com/ v1: https://lore.kernel.org/linux-mtd/20210930100719.2176-1-mika.westerberg@linux.intel.com/ Changes from v4: * Correct check in intel_spi_cmp_mem_op() * Added tag from Boris Changes from v3: * Create an array of supported opcodes and reject everything else. * Fix checkpatch warnings reported by Mauro * Added tags from Lee and Mauro Changes from v2: * Added tag from Andy * Check buswidth in intel_spi_supports_mem_op() and return false if octal mode is asked. The Intel controllers support buswidths 1-4 but this is not exposed to software. It figures this itself through SFDP tables. * In case of software sequencer, support same opcodes than we support with the hardware sequencer if found in the opcodes table. Changes from v1: * Arrange dependencies in Kconfig entries the same way in both glue drivers. * Added empty lines between different subsystem includes. * dev_err() to single line * Return intel_spi_sw_cycle() directly in intel_spi_erase(). * Drop redundant elses. * Fixed typo in the commit message of the patch 3/3. Mika Westerberg (3): mtd: spi-nor: intel-spi: Disable write protection only if asked mtd: spi-nor: intel-spi: Convert to SPI MEM Documentation / MTD: Rename the intel-spi driver Documentation/driver-api/mtd/index.rst | 2 +- .../mtd/{intel-spi.rst => spi-intel.rst} | 8 +- drivers/mfd/lpc_ich.c | 59 +- drivers/mtd/spi-nor/controllers/Kconfig | 36 - drivers/mtd/spi-nor/controllers/Makefile | 3 - drivers/mtd/spi-nor/controllers/intel-spi.h | 21 - drivers/spi/Kconfig | 39 + drivers/spi/Makefile | 3 + .../intel-spi-pci.c => spi/spi-intel-pci.c} | 49 +- .../spi-intel-platform.c} | 21 +- .../intel-spi.c => spi/spi-intel.c} | 827 ++++++++++++------ drivers/spi/spi-intel.h | 19 + include/linux/mfd/lpc_ich.h | 2 +- .../x86/{intel-spi.h => spi-intel.h} | 12 +- 14 files changed, 699 insertions(+), 402 deletions(-) rename Documentation/driver-api/mtd/{intel-spi.rst => spi-intel.rst} (94%) delete mode 100644 drivers/mtd/spi-nor/controllers/intel-spi.h rename drivers/{mtd/spi-nor/controllers/intel-spi-pci.c => spi/spi-intel-pci.c} (84%) rename drivers/{mtd/spi-nor/controllers/intel-spi-platform.c => spi/spi-intel-platform.c} (65%) rename drivers/{mtd/spi-nor/controllers/intel-spi.c => spi/spi-intel.c} (57%) create mode 100644 drivers/spi/spi-intel.h rename include/linux/platform_data/x86/{intel-spi.h => spi-intel.h} (64%)