From patchwork Sat Oct 26 07:53:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Mahapatra, Amit Kumar" X-Patchwork-Id: 839108 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2086.outbound.protection.outlook.com [40.107.92.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58ED3187850; Sat, 26 Oct 2024 07:54:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729929249; cv=fail; b=E+E+uTihvLUZlfqB6BFgWIWi+khmSgq7zqgc43mli+nHmEjDQOeGiuvwChtcxP519yUfjVkxN6TfC+j0jbYTcFfnPx2VlKoUQXZGbCSCM2VsmsZeh5Adx5ZXosLbcSLdftxc2sP3DiZUrccoZbDYklYMmyVTM+4v7i8lCRrs9+w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729929249; c=relaxed/simple; bh=oiAnf2OTO/OXBRxpxtLXqfhN9DfSLK5aFiOKWSrOVqE=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=lARHSmuHGdtox+oLJNyYjlrB8VfZwd1mJTg38jiZa52KUpPze7VAVOtYmVFWq0XqntJedzXOGXeQSrW/UgClrqpR9pUVi0hfCCii9o7PczT7aJ74oUJ7KIt9cAwOFMvaTBSq6mTjjMGILMX0TutMK7AWdKg/9PSAbDekibdatsg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=VzzSAhIk; arc=fail smtp.client-ip=40.107.92.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="VzzSAhIk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tHotzg0n1+ezvf408CQ+tF82XOKThWuVPyEClIXEBroMGbitdiQphZyqHX/3TrbeR3/xbuDj+Q0C+om7TdHYQ44j9LKA3qGTqE38hAx1E6CBlnaoT/zwvlOMsGRKvslgTOshqCYmwDfPToshSwM4RR/jrfqKhaYBaqcXP8aNU5aq8lmQXMSNWrnlE9UgABhrqo5qzo8kdRDVqdHnGcJVtXVaiwy+p4AK++HURNekYNBJc+tVW357TrlJDhxSfkVp6JPC4ndyooFNyqZdiy3Abilq0ABgGxYZ3MpYvoEm78Opjcx/0GU+rkg11I1kPts83+VeMn5H+E28qkWuFOwdlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lCkx8x6mHsRXwVvB+TNKNXjz58tewrfQLQaerKE0Bnk=; b=ebyMPDZPATJyG+Z/Qg5MDZAVlgV7hSgoW4OqEk7XaBOk9D47pYDoUPCB2vUgcdx5oooxQB+oCqM/7clG8DEA448cVKkPK4fkiEmTipRTZ0RtWVTIjJ7IoszR8CrgaomdElA4Y92AwObl/NPz7AojtQQQV3SHvSxW2GU7xUTFo9yjpDwK614RDsw7WD6QKTlxKJWwvnaz6WEUMYVSvvhfPszEPeSGthH83s/wm83eisNYu1UwMLsX/wTsqH4pL3dGu8PpRFEt72GxdyPr2XULaBKT0+68o8co9IqaDe+nSe6+bZC7KqBz1lLGLx8oNVMMX8Or6USUkSjQNsNBwkv2Xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lCkx8x6mHsRXwVvB+TNKNXjz58tewrfQLQaerKE0Bnk=; b=VzzSAhIka1EsnzhwTLxJzCQ//WOc3WC6pwFIrbzgSxM9Fn8kgyVlCh1d8I0Z389HL2nSeX09BhZN6OsXpgY9IFnymW/b1QRAE4ep1JY1sxtIOjZD5e6obA04avMtyy5GMavvW9M28Vyr8ZxjsbHP5TkmLqtuAIKxKHEr6QFgfhE= Received: from BN9PR03CA0429.namprd03.prod.outlook.com (2603:10b6:408:113::14) by DS0PR12MB7828.namprd12.prod.outlook.com (2603:10b6:8:14b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Sat, 26 Oct 2024 07:54:02 +0000 Received: from BL02EPF0001A0FE.namprd03.prod.outlook.com (2603:10b6:408:113:cafe::f4) by BN9PR03CA0429.outlook.office365.com (2603:10b6:408:113::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21 via Frontend Transport; Sat, 26 Oct 2024 07:54:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF0001A0FE.mail.protection.outlook.com (10.167.242.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Sat, 26 Oct 2024 07:54:02 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 26 Oct 2024 02:54:01 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 26 Oct 2024 02:54:00 -0500 Received: from xhdakumarma40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Sat, 26 Oct 2024 02:53:54 -0500 From: Amit Kumar Mahapatra To: , , , , , , , , , CC: , , , , , , , , , , , , , , Amit Kumar Mahapatra Subject: [RFC PATCH 0/2] Add support for stacked and parallel memories Date: Sat, 26 Oct 2024 13:23:45 +0530 Message-ID: <20241026075347.580858-1-amit.kumar-mahapatra@amd.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Received-SPF: None (SATLEXMB05.amd.com: amit.kumar-mahapatra@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A0FE:EE_|DS0PR12MB7828:EE_ X-MS-Office365-Filtering-Correlation-Id: 39930f44-7c50-4111-2fbc-08dcf5935b8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|1800799024|376014|7416014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?SZpLtGsVCV+uD00y4GVFhyKE21aTSSz?= =?utf-8?q?F1bGi9/LHq9KNZi+TEuzy2cDAQ8+klm+VA7dA7xvu5kKkESz99cfZtBy1S9ElGCYX?= =?utf-8?q?ktMqYdvm0I8ojulFOwf9Tk5rwivACYz0QHLVICAGWTrvw0X4IMS4F7bioLljhkn2d?= =?utf-8?q?4Ggi0hoGThX5nHedEDoJqwq+e/z172CkBaXaWIXNQ3+LdqNLfITQxMBoDvG+ftloY?= =?utf-8?q?erxBo8prrEiKm53XvTFnzBsZbw9nzueAui95g+KthY66P9kleDcdAru4UJW//20UQ?= =?utf-8?q?hkgriseM8htyqLZzc/PyycREnwQVoCItUQWKL8p+yYUZY1vYLSSsFdwRQETClBsOR?= =?utf-8?q?gyVJr3S4DNucObY0T+9yewODWct8lm89oDyh8Grx1FLM65MtuXGdl947TxQEp9KsI?= =?utf-8?q?AQp4DDph2r4Oc/zjbXcrMOmAuY3KdIcxAh+YVwEiUunoJhYHAgsqlKnCd7G2PBgSn?= =?utf-8?q?apj0Cl9pEnuAXSFAjujureVamaz28Q+87JmbK2dc2r7ZzpqJ3AXhboG7U5I6Swf3+?= =?utf-8?q?AiV03p00fNWZfq4nsa+RnH4sKK6itK31kS4ER4xlkARtmdYtjmd7MsVJPfFZZFS6j?= =?utf-8?q?19IkYNU/viWrzWOuPCOxxuF/I1aM/Vxt/q9tcdt54h19C3RlwRYzYBmL7JjKVjU8R?= =?utf-8?q?mKgJTB6l3i920KFpuxqOF1XiQh1zy/X6gF9j3IgyRIvB45BU/1Cp81XASMA+AFoMy?= =?utf-8?q?DpZrg/PBQZoFKId/NUTkaSYpajBhMM7UiTHpTBl2CQsM/izxBTROla0hq70j7Vx02?= =?utf-8?q?7fczKXWRAdrB8F+ADnqkhDDWpVV9rM6GykMvcgoU6QKIljNKZB8wnOM3wOACq4dzT?= =?utf-8?q?gNZdw3rRXcqYi2u0B0MEYerTiHDitqqxrZCQ+xY35+a0X+UIC8oUv/6U2UUltQs94?= =?utf-8?q?mzChjKF1xstG4+70c4uhzwew10cPvphkKWgWMb0GansAjyXd/pY8tWXO41m1p3J7Q?= =?utf-8?q?Byhhao9y4SsD+lSYpHuiMQ0VV1sZ1Zws5zOlSREYRkKf5eYUoO4V0PrLlH33OQbe6?= =?utf-8?q?Au7+hrmHGMofTdKgMmnRlwldi1Jn5ufGeDiH8RtqtA2/+dd4scJ8Pgg7JsG9F4t5K?= =?utf-8?q?LVuw3SU5lCVL5PK2s5yXWt+oCDQk/xlaioJ0+r/zdw6Vw4WVDyOMdEEofGMZoXCzS?= =?utf-8?q?jXSdA70rshs5vIfvh3gB68LzESD0kqKi2tkpZNQ/0FZSNKbAtLeNdNEUvOvepoia5?= =?utf-8?q?SPlUPrty/BaQEUc/D41LkW3okiUDSLSJK3ciH9nzmDQh4ntBNbW51JjHdi+Jpf2Lj?= =?utf-8?q?voB/9WAWvG7ZqPKmRoxIwqMJBvGemxat1MgimRJNdeljRKExtPYB7H4BG1rFf47k/?= =?utf-8?q?srWuIqbdshKP?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(1800799024)(376014)(7416014)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2024 07:54:02.4119 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39930f44-7c50-4111-2fbc-08dcf5935b8d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A0FE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7828 Hello Everyone, Following an email discussion with Miquel regarding the binding changes and overall architecture for implementing support for stacked and parallel memories, I’m sharing this RFC to initiate a discussion on the proposed updates to current bindings and to finalize the implementation architecture. Before diving into the main topic, here is some background on stacked and parallel memories. The AMD QSPI controller supports two advanced connection modes(Stacked and Parallel) which allow the controller to treat two different flashes as one storage. Stacked: Flashes share the same SPI bus, but different CS line, controller driver asserts the CS of the flash to which it needs to communicate. Stacked mode is a software abstraction rather than a controller feature or capability. At any given time, the controller communicates with one of the two connected flash devices, as determined by the requested address and data length. If an operation starts on one flash and ends on the other, the core needs to split it into two separate operations and adjust the data length accordingly. Parallel(Multi-CS): Both the flashes have their separate SPI bus, CS of both the flashes will be asserted/de-asserted at the same time. In this mode data will be split across both the flashes by enabling the STRIPE setting in the controller. Parallel mode is a controller feature where if the STRIPE bit is set then the controller internally handles the data split during data write to the flashes and while reading data from the flash the controller internally merges data from both the flashes before writing to the controller FIFO. If STRIPE is not enabled, then same data will be sent to both the devices. In parallel mode both the flashes should be identical. For more information on the modes please feel free to go through the controller flash interface below [1]. Mirochip QSPI controller[2] also supports "Dual Parallel 8-bit IO mode", but they call it "Twin Quad Mode". Initially in [3] [4] [5] Miquel had tried to extend MTD-CONCAT driver to support Stacked mode, but the bindings were not accepted. So, the MTD-CONCAT approach was dropped and the DT bindings that got accepted [6] [7] [8] that describes the two flash devices as being one. SPI core changes to support the above bindings were added [9]. While adding the support in SPI-NOR Tudor provided additional feedback, leading to a discussion on updating the current stacked and parallel DT bindings. Proposed Solution: The solution has two parts: 1. Update MTD-CONCAT Update MTD-CONCAT to create virtual concatinated mtd devices as defined in the device tree. 2. Add a New Layer Add a new layer between the SPI-NOR and MTD layers to support stacked and parallel configurations. This new layer will be part of spi-nor, located in mtd/spi-nor/, can be included/excluded via Kconfig, will be maintained by AMD and will: - During probing, store information from all connected flashes in stacked or parallel mode and present them as a single device to the MTD layer. - Register callbacks and manage MTD device registration within the new layer instead of spi-nor/core.c. - Make minimal changes in spi-nor/core.c, as stacked and parallel handling will be managed by the new layer on top of SPI-NOR. - Handle odd byte count requests from the MTD layer during flash operations in parallel mode. [1] https://docs.amd.com/r/en-US/am011-versal-acap-trm/QSPI-Flash-Device-Interface [2] https://ww1.microchip.com/downloads/aemDocuments/documents/MPU32/ProductDocuments/DataSheets/SAMA7G5-Series-Data-Sheet-DS60001765.pdf [3] https://lore.kernel.org/all/20191113171505.26128-4-miquel.raynal@bootlin.com/ [4] https://lore.kernel.org/all/20191127105522.31445-5-miquel.raynal@bootlin.com/ [5]https://lore.kernel.org/all/20211112152411.818321-1-miquel.raynal@bootlin.com/ [6] https://github.com/torvalds/linux/commit/f89504300e94524d5d5846ff8b728592ac72cec4 [7] https://github.com/torvalds/linux/commit/eba5368503b4291db7819512600fa014ea17c5a8 [8] https://github.com/torvalds/linux/commit/e2edd1b64f1c79e8abda365149ed62a2a9a494b4 [9]https://github.com/torvalds/linux/commit/4d8ff6b0991d5e86b17b235fc46ec62e9195cb9b Thanks, Amit Amit Kumar Mahapatra (2): dt-bindings: mtd: Add bindings for describing concatinated MTD devices dt-bindings: spi: Update stacked and parallel bindings .../mtd/partitions/fixed-partitions.yaml | 18 +++++++++++++++ .../bindings/mtd/partitions/partitions.yaml | 6 +++++ .../bindings/spi/spi-controller.yaml | 23 +++++++++++++++++-- .../bindings/spi/spi-peripheral-props.yaml | 9 +++----- 4 files changed, 48 insertions(+), 8 deletions(-)