From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0352DCCA473 for ; Mon, 25 Jul 2022 09:25:49 +0000 (UTC) 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=sHWDCWIp2zFFaAAYyqOiU/v5+wZ7chq8XRctCAcfq2o=; b=oMby0ZUs1zhEhJ aN3cZLRrCsDWaDyS1B/guBJ09GbdIvT/bW9PPyOw2y8tdfenGh4EGUAFfcrsSQeLeunx01PcUlHIX ksm8zujBVMFmiPyOhNEZZ0Y50ZKQ3oXzBSSPOZvfg7JWqAB03TKRclxkYT0dL1uBUfmw7MnfVFzfJ 6k9b7fCD3Xu+eIQr/7UiaVBjOL56rFXAB3tTSZNhWadZVdixwI+/RTRwJw9A9QRo1rhGbwKXXPuaq dVahXOLt6TmopOVjYCrI6gD6HpqzMrkw7pDnX8Y0OXVjDii9627TTZbahGGP64LxFKhsvRq1AQGhb do+23FdjwmuPiFvXVJrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oFuLA-007WoE-Gj; Mon, 25 Jul 2022 09:25:28 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oFuL6-007WjU-6B for linux-mtd@lists.infradead.org; Mon, 25 Jul 2022 09:25:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1658741124; x=1690277124; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=rarEa0hzKifmeV+igWPEhp3ENO/x6XwSkX2+VTecjfo=; b=hSThYpRe6fV8slDDfecEJkB9xKKBY3m8PJWEgSL2GsS9e5Iz3DrR0sDC nSZQOYe2ab+6rrN3Aq0lE45uKDoak4x7hdfDIHE+z1L6y9SrkN5dQq80X VcQQrUsKQvML9fBumAKCyYtfM5uLP1rB2ccowjxnxibOFF/sHCcBvq3c7 XS/IwmwsoRpF02GS5BC3snKLKT/vv/AlPmIlFNfycSnvz6AzKzPQQj7Pq mSucfuncBXTpXsN/BJKTqlY3D7cLoHrdacp83yplCCJlDJxey/CTXt9gl x9wrFR7tR092hODP+L0G39j0eq+2UKrDFa+9eu8VUNzhusDlsWvQscNXz w==; X-IronPort-AV: E=Sophos;i="5.93,192,1654585200"; d="scan'208";a="169328711" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 25 Jul 2022 02:25:20 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 25 Jul 2022 02:25:20 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Mon, 25 Jul 2022 02:25:18 -0700 From: Tudor Ambarus To: , , , , CC: , , , , Tudor Ambarus Subject: [PATCH v17 0/7] mtd: spi-nor: Add support for Infineon s25hl-t/s25hs-t Date: Mon, 25 Jul 2022 12:24:58 +0300 Message-ID: <20220725092505.446315-1-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220725_022524_391563_CFDB6E97 X-CRM114-Status: GOOD ( 17.35 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org v17 introduces nor->params->addr_mode_nbytes in order to track the number of address bytes of current address mode. This is useful when the flash operates with 4B opcodes but needs the internal address mode for opcodes that don't have a 4B opcode correspondent. Such an example is the Infineon Semper chips which provide 4B opcodes for read/program/erase but do not provide 4B opcodes for Read/Write Any Register. These registers are indexed by address and require the internal address mode of the flash before Read/Write Any Register opcodes are issued. 4B opcodes are preferred over changing the flash's address mode to 4byte, as set_4byte_addr_mode could be done in a non-volatile way and could break the boot sequence. Thus we need to track the flash's internal address mode so that we can use the 4B opcodes together with the opcodes that don't have a 4B opcode correspondent. All other minor comments were addressed as well: - s/address width/ address nbytes where needed - "mtd: spi-nor: spansion: Add local function to discover page size" no longer replaces the hardcoded value of 3 for the number of address bytes. - few patches were dropped as they no longer made sense with the introduction of nor->params->addr_mode_nbytes. The S25HL-T/S25HS-T family is the Infineon SEMPER Flash with Quad SPI. Previous cover letter description and the versioning of changes below: """ The datasheets can be found in the following link. https://www.infineon.com/dgdl/Infineon-S25HS256T_S25HS512T_S25HS01GT_S25HL256T_S25HL512T_S25HL01GT_256-Mb_(32-MB)_512-Mb_(64-MB)_1-Gb_(128-MB)_HS-T_(1.8-V)_HL-T_(3.0-V)_Semper_Flash_with_Quad_SPI-DataSheet-v02_00-EN.pdf?fileId=8ac78c8c7d0d8da4017d0ee674b86ee3&da=t Device ID, SFDP, and test script output: ------------------------------------------------------------ zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname s25hl512t zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 342a1a0f0390 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer spansion zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450080103ff00000114000100ff84000102500100ff81000116c801 00ff8700011c580100ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffe720faffffffff1f48eb086b00ff 88bbfeffffffffff00ffffff48eb0c2000ff00ff12d823faff8b82e7ffe3 ec031c608a857a75f766805c8cd6ddfff938f8a1000000000000bc000000 0000f7f5ffff7b920ffe21ffffdc0000800000000000c0ffc3ebc8ffe3eb 00650090060500a10065009600650095716503d0716503d000000000b02e 000088a489aa716503967165039600000000000000000000000000000000 000000000000000000000000000000000000000000000000716505d57165 05d50000a015fc65ff0804008000fc65ff4002008000fd65ff0402008000 fe0002fff1ff0100f8ff0100f8fffb03fe0302fff8fffb03f8ff0100f1ff 0100fe0104fff1ff0000f8ff0200f8fff703f8ff0200f1ff0000ff0400ff f8ffff03 zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 8a0aa90112e154ae3a797df2c211ef61 /sys/bus/spi/devices/spi0.0/spi-nor/sfdp zynq> test_qspi.sh 6+0 records in 6+0 records out 6291456 bytes (6.0MB) copied, 0.230748 seconds, 26.0MB/s Copied 6291456 bytes from qspi_test to address 0x00000000 in flash Erased 6291456 bytes from address 0x00000000 in flash Copied 6291456 bytes from address 0x00000000 in flash to qspi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0600000 Copied 6291456 bytes from qspi_test to address 0x00000000 in flash Copied 6291456 bytes from address 0x00000000 in flash to qspi_read 8fd5e1d95c3a5b8d7d66ade561f51fe5257897ff qspi_test 8fd5e1d95c3a5b8d7d66ade561f51fe5257897ff qspi_read ------------------------------------------------------------ ------------------------------------------------------------ zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname s25hs512t zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 342b1a0f0390 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer spansion zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450080103ff00000114000100ff84000102500100ff81000116c801 00ff8700011c580100ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffe720faffffffff1f48eb086b00ff 88bbfeffffffffff00ffffff48eb0c2000ff00ff12d823faff8b91e8ffe3 ec031c608a857a75f766805c84d6ddfff938f8a100000000000080000000 0000f7f5ffff7b920ffe20ffffd80000800000000000c0ffc3ebc8ffe3eb 00650090060500a10065009600650095716503d0716503d000000000b02e 000088a489aa716503967165039600000000000000000000000000000000 000000000000000000000000000000000000000000000000716505d57165 05d50000ee72fc65ff0804008000fc65ff4002008000fd65ff0402008000 fe0002fff1ff0100f8ff0100f8fffb03fe0302fff8fffb03f8ff0100f1ff 0100fe0104fff1ff0100f8ff0200f8fff703f8ff0200f1ff0100ff0400ff f8ffff03 zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp f17d9e784602187a0933edec3688e30f /sys/bus/spi/devices/spi0.0/spi-nor/sfdp zynq> test_qspi.sh 6+0 records in 6+0 records out 6291456 bytes (6.0MB) copied, 0.230827 seconds, 26.0MB/s Copied 6291456 bytes from qspi_test to address 0x00000000 in flash Erased 6291456 bytes from address 0x00000000 in flash Copied 6291456 bytes from address 0x00000000 in flash to qspi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0600000 Copied 6291456 bytes from qspi_test to address 0x00000000 in flash Copied 6291456 bytes from address 0x00000000 in flash to qspi_read 3c4cc1be627a88da0364b2a866fbb6ac04dba80e qspi_test 3c4cc1be627a88da0364b2a866fbb6ac04dba80e qspi_read ------------------------------------------------------------ ------------------------------------------------------------ zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname s25hl01gt zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 342a1b0f0390 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer spansion zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450080103ff00000114000100ff84000102500100ff81000116c801 00ff8700011c580100ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffe720faffffffff3f48eb086b00ff 88bbfeffffffffff00ffffff48eb0c2000ff00ff12d823faff8b82e7ffe6 ec031c608a857a75f766805c8cd6ddfff938f8a1000000000000bc000000 0000f7f5ffff7b920ffe21ffffdc0000800000000000c0ffc3ebc8ffe3eb 00650090060500a10065009600650095716503d0716503d000000000b02e 000088a489aa716503967165039600000000000000000000000000000000 000000000000000000000000000000000000000000000000716505d57165 05d50000a015fc65ff0804008000fc65ff4002008000fd65ff0402008000 fe0002fff1ff0100f8ff0100f8fffb07fe0302fff8fffb07f8ff0100f1ff 0100fe0104fff1ff0000f8ff0200f8fff707f8ff0200f1ff0000ff0400ff f8ffff07 zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 1ad5a0d7d7e0e656986c1e678c416a7e /sys/bus/spi/devices/spi0.0/spi-nor/sfdp zynq> test_qspi.sh 6+0 records in 6+0 records out 6291456 bytes (6.0MB) copied, 0.230878 seconds, 26.0MB/s Copied 6291456 bytes from qspi_test to address 0x00000000 in flash Erased 6291456 bytes from address 0x00000000 in flash Copied 6291456 bytes from address 0x00000000 in flash to qspi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0600000 Copied 6291456 bytes from qspi_test to address 0x00000000 in flash Copied 6291456 bytes from address 0x00000000 in flash to qspi_read 50b8cc948f8b05fa5650a6d0ba74be8f95ff3332 qspi_test 50b8cc948f8b05fa5650a6d0ba74be8f95ff3332 qspi_read ------------------------------------------------------------ ------------------------------------------------------------ zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname s25hs01gt zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 342b1b0f0390 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer spansion zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450080103ff00000114000100ff84000102500100ff81000116c801 00ff8700011c580100ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffe720faffffffff3f48eb086b00ff 88bbfeffffffffff00ffffff48eb0c2000ff00ff12d823faff8b82e7ffe6 ec031c608a857a75f766805c8cd6ddfff938f8a1000000000000bc000000 0000f7f5ffff7b920ffe21ffffdc0000800000000000c0ffc3ebc8ffe3eb 00650090060500a10065009600650095716503d0716503d000000000b02e 000088a489aa716503967165039600000000000000000000000000000000 000000000000000000000000000000000000000000000000716505d57165 05d50000a015fc65ff0804008000fc65ff4002008000fd65ff0402008000 fe0002fff1ff0100f8ff0100f8fffb07fe0302fff8fffb07f8ff0100f1ff 0100fe0104fff1ff0000f8ff0200f8fff707f8ff0200f1ff0000ff0400ff f8ffff07 zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 1ad5a0d7d7e0e656986c1e678c416a7e /sys/bus/spi/devices/spi0.0/spi-nor/sfdp zynq> test_qspi.sh 6+0 records in 6+0 records out 6291456 bytes (6.0MB) copied, 0.230712 seconds, 26.0MB/s Copied 6291456 bytes from qspi_test to address 0x00000000 in flash Erased 6291456 bytes from address 0x00000000 in flash Copied 6291456 bytes from address 0x00000000 in flash to qspi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0600000 Copied 6291456 bytes from qspi_test to address 0x00000000 in flash Copied 6291456 bytes from address 0x00000000 in flash to qspi_read e9515a880d836d9fdfa8b2b7c870825fd8300cc1 qspi_test e9515a880d836d9fdfa8b2b7c870825fd8300cc1 qspi_read ------------------------------------------------------------ Changes in v16: - stop restoring read_opcode, read_dummy and addr_nbytes to uninitialized state at SFDP parsing time Changes in v15: - add missing read any reg call in volatile quad enable method (patch 8/8) Changes in v14: - add prerequisite patches for s25hl-t/s25hs-t addition. - squash volatile quad enable method to the patch that adds the flashes to avoid unused function warning. Changes in v13: - Remove patch, Call set_4byte_addr_mode() before spi_nor_quad_enalbe() - Remove patch, Rename local macro - Use 3-byte address width in cypress_nor_quad_enable_volatile() - Add post_sfdp to fix 3 byte erase opcode in 4BAIT Changes in v12: - Rebase on top of Tudor's series https://patchwork.ozlabs.org/project/linux-mtd/list/?series=295933 https://patchwork.ozlabs.org/project/linux-mtd/list/?series=294533 - New patch: Retain nor->addr_width at 4BAIT parse - New patch: Call set_4byte_addr_mode() before spi_nor_quad_enalbe() - New patch: Rename local macro Changes in v11: - Rebase on top of Tudor's series https://patchwork.ozlabs.org/project/linux-mtd/list/?series=294490 - Remove 'nor->info->addr_width for SMPT parse' patch Changes in v10: - Rebase to v5.18-rc1 - Remove dependencies on other series - Use nor->info->addr_width for SMPT parse - Add a local function for page size discovery - Clean up volatile QE function Changes in v9: - Rebase to v5.17-rc6 - Rename function and macro per mwalle's series - Fix some issues in ID table and fixup hook Changes in v8: - Rebase to v5.17-rc4 - Use spi_nor_read_reg and spi_nor_write_reg() Changes in v7: - Some changes were missing in v6 patch. Fix it Changes in v6: - Remove 2Gb dual die package parts and related changes to split mulit die package support into another series of patches Changes in v5: - Fix 'if (ret == 1)' to 'if (ret < 0)' in spansion_read_any_reg() - Add NO_CHIP_ERASE flag to S25HL02GT and S25HS02GT Changes in v4: - Reword 'legacy' to 'default' - Rename spi_nor_read() to spi_nor_default_ready() - Fix dummy cycle calculation in spansion_read_any_reg() - Modify comment for spansion_write_any_reg() - Merge block comments about SMPT in s25hx_t_post_sfdp_fixups() - Remove USE_CLSR flags from S25HL02GT and S25HS02GT Changes in v3: - Split into multiple patches - Remove S25HL256T and S25HS256T - Add S25HL02GT and S25HS02GT - Add support for multi-die package parts support - Cleanup Read/Write Any Register implementation - Remove erase_map fix for top/split sector layout - Set ECC data unit size (16B) to writesize Changes in v2: - Remove SPI_NOR_SKIP_SFDP flag and clean up related fixups - Check CFR3V[4] to determine page_size instead of force 512B - Depend on the patchset below to support non-uniform sector layout https://lore.kernel.org/linux-mtd/cover.1601612872.git.Takahiro.Kuwano@infineon.com """ Takahiro Kuwano (3): mtd: spi-nor: core: Return error code from set_4byte_addr_mode() mtd: spi-nor: spansion: Add local function to discover page size mtd: spi-nor: spansion: Add s25hl-t/s25hs-t IDs and fixups Tudor Ambarus (4): mtd: spi-nor: s/addr_width/addr_nbytes mtd: spi-nor: core: Shrink the storage size of the flash_info's addr_nbytes mtd: spi-nor: Do not change nor->addr_nbytes at SFDP parsing time mtd: spi-nor: core: Track flash's internal address mode drivers/mtd/spi-nor/controllers/hisi-sfc.c | 2 +- drivers/mtd/spi-nor/controllers/nxp-spifi.c | 8 +- drivers/mtd/spi-nor/core.c | 57 +++--- drivers/mtd/spi-nor/core.h | 19 +- drivers/mtd/spi-nor/debugfs.c | 2 +- drivers/mtd/spi-nor/issi.c | 8 +- drivers/mtd/spi-nor/otp.c | 12 +- drivers/mtd/spi-nor/sfdp.c | 32 ++-- drivers/mtd/spi-nor/spansion.c | 185 +++++++++++++++++--- drivers/mtd/spi-nor/xilinx.c | 2 +- include/linux/mtd/spi-nor.h | 4 +- 11 files changed, 239 insertions(+), 92 deletions(-) -- 2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/