From nobody Fri Oct 3 02:14:59 2025 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 94AE321C19E; Mon, 8 Sep 2025 04:14:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757304895; cv=none; b=hZUDMuwYDn7je8bQ1IFV8u8WtP8NBhuHVgmRG3QgkjCiU2K3HQJ4mibLbhG+ZOR8rugUUkzczTBLh0BmEs4luBVqPE9C9WId/QRNLOvIgITXOTRcn+TwO8csJbDZVaVfJPkFTSZDYg7sXHNiQXMOqwLEYclv70tyg1wf07Q8i5k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757304895; c=relaxed/simple; bh=TaxTNHBdSP7EOxa2FDGkct94U6DiFXOc0lCmhlPSLXo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=gdHWp48/Oi9tCkKYQ7kCncQmHeNs+5WeTQUUR4Id4SO6/aHxoLuA/id2151uSipMdxmrc0aGDktxPAGDkzjZToFFsfvBLwR6nuOYu+jLFpHpwLJiomm1JRcK2NWnP/qFNrBhAXuoySgLHO+2Jql2SxEk2q0HY2sNCt2TpBPkafo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=BazBsN1F; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="BazBsN1F" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1757304893; x=1788840893; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=TaxTNHBdSP7EOxa2FDGkct94U6DiFXOc0lCmhlPSLXo=; b=BazBsN1FWfhz8N7Nm5MxJjgOX/2qjFMhJrFcrZnsBoAV9e2cWQFP2d6D u1ovrGApo68BklNWNcmcRcnWMlkxAD6zK8/nwc/afe5ZZ2u/Xp3qfxhkZ 1Z1GwuQSLAms9EwwNASZY2hCkwlPouCA8+a/8TKweXEihW2DA06C6HRUJ kqcaoOKjgi/y6I8ViUBhVFeHO7HwreBLAe8TRJOVVOhlu1VvcSCsoqFWe g3LgsgFi3LQFlySOkh3Klpc52Rb9w9M7aDqprnR3XEFjJSLon4k1zc+YB bLjQmnxk7w+CqF0Sfowt+4JoB7HsBByyseyuUYHxfkVOSWfVRi7VGJ99l A==; X-CSE-ConnectionGUID: YPpoJm/ATHeRsyPuBZAjnw== X-CSE-MsgGUID: iE5TQrUwRqSlvvSizkydqA== X-IronPort-AV: E=Sophos;i="6.18,247,1751266800"; d="scan'208";a="213580664" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Sep 2025 21:14:44 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Sun, 7 Sep 2025 21:14:31 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 7 Sep 2025 21:14:25 -0700 From: Dharma Balasubiramani Date: Mon, 8 Sep 2025 09:44:16 +0530 Subject: [PATCH v2 1/5] dt-bindings: spi: Document sam9x7 QSPI Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250908-microchip-qspi-v2-1-8f3d69fdd5c9@microchip.com> References: <20250908-microchip-qspi-v2-0-8f3d69fdd5c9@microchip.com> In-Reply-To: <20250908-microchip-qspi-v2-0-8f3d69fdd5c9@microchip.com> To: Mark Brown , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Nicolas Ferre" , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus CC: , , , , Dharma Balasubiramani X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757304860; l=877; i=dharma.b@microchip.com; s=20240209; h=from:subject:message-id; bh=TaxTNHBdSP7EOxa2FDGkct94U6DiFXOc0lCmhlPSLXo=; b=DLoXyTlSpsFareduqI73PqFwjH7aGX3JHj6RS6MuMTORSH6v5mlfGLJRzb8RKkbOLr9UMNHYY xlfR6JbXnskAqNPvAb8UNDD1Z7bZH3nbQ9t+5keQ6R3jSxNKRz9daKH X-Developer-Key: i=dharma.b@microchip.com; a=ed25519; pk=kCq31LcpLAe9HDfIz9ZJ1U7T+osjOi7OZSbe0gqtyQ4= Document the sam9x7 quad spi that supports interface to serial memories operating in - Single-bit SPI, Dual SPI, Quad SPI and Octal SPI - Single Data Rate or Double Data Rate modes Signed-off-by: Dharma Balasubiramani Acked-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/spi/atmel,quadspi.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/spi/atmel,quadspi.yaml b/Doc= umentation/devicetree/bindings/spi/atmel,quadspi.yaml index b0d99bc10535..c17114123034 100644 --- a/Documentation/devicetree/bindings/spi/atmel,quadspi.yaml +++ b/Documentation/devicetree/bindings/spi/atmel,quadspi.yaml @@ -17,6 +17,7 @@ properties: enum: - atmel,sama5d2-qspi - microchip,sam9x60-qspi + - microchip,sam9x7-ospi - microchip,sama7g5-qspi - microchip,sama7g5-ospi =20 --=20 2.43.0 From nobody Fri Oct 3 02:14:59 2025 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 1E20D21D596; Mon, 8 Sep 2025 04:14:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757304895; cv=none; b=TUZDQG/HAzuKDhHDsuPkw1KIfj9tWJsyMARWQtBg/SZPrmNIsJkCEBwtG2vxY/oxvkAMyqOzqhWWjBT2mex6OGvbti2TKJsGqNMQfw/oXVIv4kDxBWsTIqU1p5PfB/e+5H8O8EO36tnZvxguqBGf13Uw4TEX2WbZY4dx9PL0u5Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757304895; c=relaxed/simple; bh=e9VWFRSwNpYXqnNmw9kbScIHMnZuxvIjyF1UMqscb90=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=YhnulC8GL/+Ze0JA+67z7FtRvq10WhNgnOa5znvGSv+rfSzoSqNw/BnnNs3iA0nAOgc3uC0JYranjVxtGxBXyPjyn1oLk5X1UUg56h7rk+QsaqeJeqLPXz3XWQ6RtzbTuah09iMQJYRT2W4sC24yI8deomoVodttVMvAnOqZxPs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=XdAUPq0o; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="XdAUPq0o" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1757304894; x=1788840894; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=e9VWFRSwNpYXqnNmw9kbScIHMnZuxvIjyF1UMqscb90=; b=XdAUPq0oubTCiYk4Y0c4T2WSJvr/IACpulj5dUaMkUccvvNv9ewQelkm t+8ix1PjZ8oqiouyNX7wyA/DW2wP3sNH/Z0qNNraOIfM2vn7A06lKVzpZ GMBJmvBhQH7AYcC3q3S4PDBxJUGXhpO/fL7GOD4xzzONEroOfo1+S+Pu1 3/XKB5gOCwB21mI0dkyNLy3M0GTSQyqsOgggkiaQkdrKoyn/KRErD5AMH pZl4U+ynB1f5C/M64RoMcn0ONWAp/F9aUbHgWOY09BEpGCmzaDrcZF7Bu CngBQjvalnWmmxhiRZGOMsfaodk6ivDLfEss6q8YVaaYduVV+ILvwzB/C w==; X-CSE-ConnectionGUID: YPpoJm/ATHeRsyPuBZAjnw== X-CSE-MsgGUID: 4Igph96/SsG5PGgXO/ZyWQ== X-IronPort-AV: E=Sophos;i="6.18,247,1751266800"; d="scan'208";a="213580665" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Sep 2025 21:14:44 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Sun, 7 Sep 2025 21:14:37 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 7 Sep 2025 21:14:31 -0700 From: Dharma Balasubiramani Date: Mon, 8 Sep 2025 09:44:17 +0530 Subject: [PATCH v2 2/5] dt-bindings: spi: Define sama7d65 QSPI Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250908-microchip-qspi-v2-2-8f3d69fdd5c9@microchip.com> References: <20250908-microchip-qspi-v2-0-8f3d69fdd5c9@microchip.com> In-Reply-To: <20250908-microchip-qspi-v2-0-8f3d69fdd5c9@microchip.com> To: Mark Brown , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Nicolas Ferre" , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus CC: , , , , Dharma Balasubiramani X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757304860; l=1008; i=dharma.b@microchip.com; s=20240209; h=from:subject:message-id; bh=e9VWFRSwNpYXqnNmw9kbScIHMnZuxvIjyF1UMqscb90=; b=6jOxPORoqvCAYlEQ2RH11LrjiHEQFOayPVVeqs6SddsJiROpczeZmNLAGV8voKzkBebeQND/V 5yUM/g0bDFfA6ZsMtqIqwfhw6zGMOxnJ3DwNLIxVJ+30TDbCw31CRlR X-Developer-Key: i=dharma.b@microchip.com; a=ed25519; pk=kCq31LcpLAe9HDfIz9ZJ1U7T+osjOi7OZSbe0gqtyQ4= sama7d65 has 2 instances of the QSPI controller: =E2=80=A2 One Octal Serial Peripheral Interface (QSPI0) supporting DDR. Oct= al, Twin-Quad, HyperFlashTM and OctaFlashTM protocols supported. =E2=80=A2 One Quad Serial Peripheral Interface (QSPI1) supporting DDR/SDR. Signed-off-by: Dharma Balasubiramani Acked-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/spi/atmel,quadspi.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/atmel,quadspi.yaml b/Doc= umentation/devicetree/bindings/spi/atmel,quadspi.yaml index c17114123034..30ab42c95c08 100644 --- a/Documentation/devicetree/bindings/spi/atmel,quadspi.yaml +++ b/Documentation/devicetree/bindings/spi/atmel,quadspi.yaml @@ -18,6 +18,8 @@ properties: - atmel,sama5d2-qspi - microchip,sam9x60-qspi - microchip,sam9x7-ospi + - microchip,sama7d65-qspi + - microchip,sama7d65-ospi - microchip,sama7g5-qspi - microchip,sama7g5-ospi =20 --=20 2.43.0 From nobody Fri Oct 3 02:14:59 2025 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 3513922069A; Mon, 8 Sep 2025 04:14:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757304896; cv=none; b=TUQOO1ISCbLpwIJ6EwhgEHaaI0t6CvpNutmr4SjVnZjNHs/lvTd/XyCzkWLTqlDai0x6fQZbvvtR2M87qBHZ6n+msD4ckjYfqa5TlfV7kHUWyAlP+RJTvJH9tLjyGHpJXtGf7QTfUovMXajQ2EZWTONb+CdefgOvlVzoPxwn6f0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757304896; c=relaxed/simple; bh=cKX3n6rWGFJTfk7tDF/mwopWyS5qJib2v8JtC7r6+18=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=aERrCaf5ike5Ge/bW7Z021bXw5dBMqY6PUqRLvOxMXVtKaGGSbT6QNoomZZmam8xUbezLAaLP74kganuUU2osfrIN10cEBWjyIet3pcBpy9kwQjQU7DQAT1LxEG8NdWS9qywmgRhg66gSnsEIli/A49XYEb+oC0KnhjcZAtiBAY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=xjQcn7g8; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="xjQcn7g8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1757304895; x=1788840895; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=cKX3n6rWGFJTfk7tDF/mwopWyS5qJib2v8JtC7r6+18=; b=xjQcn7g8y+TiUtBchPgaKeXZppqtyllKS3Vkq1P5ouCRUHMTezsB+eVD xSbPGsGpPy8fV+skBTKW0Uaz5EMuwoqtxXMTmA510MkU5gVepxH9hrEEh QcB3HeyfsN/Kmtwx2Gx+fA/93L04AT18P4ZaATr+8BRMZPajmW505hRiR D1IroV+9Z8CyddVVz1lng/pLuANsknxsbDD6vz1mj0vdwCU47auJlTSyA GBJq7/8RpIoX8GSp1V+dMYMUh+NXcC1aqMQQBY+qGwp6VJc2Nkm/UKgDm cPOBdNa9AUh5XY3LdznLUWxDOvihKEPVbHKOyitOtYz7KA+uHFw/lf4FK g==; X-CSE-ConnectionGUID: YPpoJm/ATHeRsyPuBZAjnw== X-CSE-MsgGUID: ABxv/VRIQNGiwnMqtgYHlw== X-IronPort-AV: E=Sophos;i="6.18,247,1751266800"; d="scan'208";a="213580666" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Sep 2025 21:14:45 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Sun, 7 Sep 2025 21:14:44 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 7 Sep 2025 21:14:38 -0700 From: Dharma Balasubiramani Date: Mon, 8 Sep 2025 09:44:18 +0530 Subject: [PATCH v2 3/5] spi: atmel-quadspi: add padcalib, 2xgclk, and dllon capabilities Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250908-microchip-qspi-v2-3-8f3d69fdd5c9@microchip.com> References: <20250908-microchip-qspi-v2-0-8f3d69fdd5c9@microchip.com> In-Reply-To: <20250908-microchip-qspi-v2-0-8f3d69fdd5c9@microchip.com> To: Mark Brown , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Nicolas Ferre" , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus CC: , , , , Dharma Balasubiramani , Varshini Rajendran X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757304860; l=5762; i=dharma.b@microchip.com; s=20240209; h=from:subject:message-id; bh=5JBcqmcHgI/B+uULblX7KzhNUtP6rsZ4FszumigJ6xc=; b=eDwA/G/s0MdJlnAvlkj5O80FXqbNtSMaSe1UnaeJtbM1KyglVumruMOULgRuHGGecX8U2zFzN 1pEZ6m9vY0RCYR8hDGVZQ+6Fz+ipFSYL/aoGzaEBkI6ZGlmeCCAv+yo X-Developer-Key: i=dharma.b@microchip.com; a=ed25519; pk=kCq31LcpLAe9HDfIz9ZJ1U7T+osjOi7OZSbe0gqtyQ4= From: Varshini Rajendran Introduce capability flags for SoC-specific variations of the QuadSPI controller: - has_padcalib: controller supports pad calibration - has_2xgclk: requires GCLK at half the data rate (2x clocking) - has_dllon: controller supports DLL clock Set `has_padcalib` for Octal controllers that provide pad calibration support. Use `has_2xgclk` for controllers that require the GCLK to run at twice the data rate. Differentiate SoC integration variants with the `has_dllon` flag and set it as needed. Signed-off-by: Varshini Rajendran Signed-off-by: Dharma Balasubiramani --- drivers/spi/atmel-quadspi.c | 92 +++++++++++++++++++++++++++++------------= ---- 1 file changed, 60 insertions(+), 32 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 4e9bfd26aa80..83cea5faff78 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -262,6 +262,9 @@ struct atmel_qspi_caps { bool has_ricr; bool octal; bool has_dma; + bool has_2xgclk; + bool has_padcalib; + bool has_dllon; }; =20 struct atmel_qspi_ops; @@ -1027,13 +1030,25 @@ static int atmel_qspi_set_pad_calibration(struct at= mel_qspi *aq) aq, QSPI_PCALCFG); =20 /* DLL On + start calibration. */ - atmel_qspi_write(QSPI_CR_DLLON | QSPI_CR_STPCAL, aq, QSPI_CR); + if (aq->caps->has_dllon) + atmel_qspi_write(QSPI_CR_DLLON | QSPI_CR_STPCAL, aq, QSPI_CR); + /* If there is no DLL support only start calibration. */ + else + atmel_qspi_write(QSPI_CR_STPCAL, aq, QSPI_CR); =20 - /* Check synchronization status before updating configuration. */ - ret =3D readl_poll_timeout(aq->regs + QSPI_SR2, val, - (val & QSPI_SR2_DLOCK) && - !(val & QSPI_SR2_CALBSY), 40, - ATMEL_QSPI_TIMEOUT); + /* + * Check DLL clock lock and synchronization status before updating + * configuration. + */ + if (aq->caps->has_dllon) + ret =3D readl_poll_timeout(aq->regs + QSPI_SR2, val, + (val & QSPI_SR2_DLOCK) && + !(val & QSPI_SR2_CALBSY), 40, + ATMEL_QSPI_TIMEOUT); + else + ret =3D readl_poll_timeout(aq->regs + QSPI_SR2, val, + !(val & QSPI_SR2_CALBSY), 40, + ATMEL_QSPI_TIMEOUT); =20 /* Refresh analogic blocks every 1 ms.*/ atmel_qspi_write(FIELD_PREP(QSPI_REFRESH_DELAY_COUNTER, @@ -1049,23 +1064,28 @@ static int atmel_qspi_set_gclk(struct atmel_qspi *a= q) int ret; =20 /* Disable DLL before setting GCLK */ - status =3D atmel_qspi_read(aq, QSPI_SR2); - if (status & QSPI_SR2_DLOCK) { - atmel_qspi_write(QSPI_CR_DLLOFF, aq, QSPI_CR); + if (aq->caps->has_dllon) { + status =3D atmel_qspi_read(aq, QSPI_SR2); + if (status & QSPI_SR2_DLOCK) { + atmel_qspi_write(QSPI_CR_DLLOFF, aq, QSPI_CR); + ret =3D readl_poll_timeout(aq->regs + QSPI_SR2, val, + !(val & QSPI_SR2_DLOCK), 40, + ATMEL_QSPI_TIMEOUT); + if (ret) + return ret; + } =20 - ret =3D readl_poll_timeout(aq->regs + QSPI_SR2, val, - !(val & QSPI_SR2_DLOCK), 40, - ATMEL_QSPI_TIMEOUT); - if (ret) - return ret; + if (aq->target_max_speed_hz > QSPI_DLLCFG_THRESHOLD_FREQ) + atmel_qspi_write(QSPI_DLLCFG_RANGE, aq, QSPI_DLLCFG); + else + atmel_qspi_write(0, aq, QSPI_DLLCFG); } =20 - if (aq->target_max_speed_hz > QSPI_DLLCFG_THRESHOLD_FREQ) - atmel_qspi_write(QSPI_DLLCFG_RANGE, aq, QSPI_DLLCFG); + if (aq->caps->has_2xgclk) + ret =3D clk_set_rate(aq->gclk, 2 * aq->target_max_speed_hz); else - atmel_qspi_write(0, aq, QSPI_DLLCFG); + ret =3D clk_set_rate(aq->gclk, aq->target_max_speed_hz); =20 - ret =3D clk_set_rate(aq->gclk, aq->target_max_speed_hz); if (ret) { dev_err(&aq->pdev->dev, "Failed to set generic clock rate.\n"); return ret; @@ -1088,11 +1108,16 @@ static int atmel_qspi_sama7g5_init(struct atmel_qsp= i *aq) if (ret) return ret; =20 - if (aq->caps->octal) { + /* + * Check if the SoC supports pad calibration in Octal SPI mode. + * Proceed only if both the capabilities are true. + */ + if (aq->caps->octal && aq->caps->has_padcalib) { ret =3D atmel_qspi_set_pad_calibration(aq); if (ret) return ret; - } else { + /* Start DLL on only if the SoC supports the same */ + } else if (aq->caps->has_dllon) { atmel_qspi_write(QSPI_CR_DLLON, aq, QSPI_CR); ret =3D readl_poll_timeout(aq->regs + QSPI_SR2, val, (val & QSPI_SR2_DLOCK), 40, @@ -1458,19 +1483,19 @@ static int atmel_qspi_sama7g5_suspend(struct atmel_= qspi *aq) =20 clk_disable_unprepare(aq->gclk); =20 - atmel_qspi_write(QSPI_CR_DLLOFF, aq, QSPI_CR); - ret =3D readl_poll_timeout(aq->regs + QSPI_SR2, val, - !(val & QSPI_SR2_DLOCK), 40, - ATMEL_QSPI_TIMEOUT); - if (ret) - return ret; - - ret =3D readl_poll_timeout(aq->regs + QSPI_SR2, val, - !(val & QSPI_SR2_CALBSY), 40, - ATMEL_QSPI_TIMEOUT); - if (ret) - return ret; + if (aq->caps->has_dllon) { + atmel_qspi_write(QSPI_CR_DLLOFF, aq, QSPI_CR); + ret =3D readl_poll_timeout(aq->regs + QSPI_SR2, val, + !(val & QSPI_SR2_DLOCK), 40, + ATMEL_QSPI_TIMEOUT); + if (ret) + return ret; + } =20 + if (aq->caps->has_padcalib) + return readl_poll_timeout(aq->regs + QSPI_SR2, val, + !(val & QSPI_SR2_CALBSY), 40, + ATMEL_QSPI_TIMEOUT); return 0; } =20 @@ -1607,12 +1632,15 @@ static const struct atmel_qspi_caps atmel_sama7g5_o= spi_caps =3D { .has_gclk =3D true, .octal =3D true, .has_dma =3D true, + .has_padcalib =3D true, + .has_dllon =3D true, }; =20 static const struct atmel_qspi_caps atmel_sama7g5_qspi_caps =3D { .max_speed_hz =3D SAMA7G5_QSPI1_SDR_MAX_SPEED_HZ, .has_gclk =3D true, .has_dma =3D true, + .has_dllon =3D true, }; =20 static const struct of_device_id atmel_qspi_dt_ids[] =3D { --=20 2.43.0 From nobody Fri Oct 3 02:14:59 2025 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 89BC01E990E; Mon, 8 Sep 2025 04:15:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757304927; cv=none; b=oWuNOeFGQ/a0SE5qqqFlmiUBINSaBDpiyr2amR0w7M6eLtiOZ8NBH0ZYLzGCP2/pEhT4hMiOAH3IUGK4chvj7aTm893O/Xh3enp2T2PGDV35MTc6gc2vu/N5YOIyj1MPR8HmPmCIxPO66IbrvZFj1f+yIB2PbELe8teYoaROsvY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757304927; c=relaxed/simple; bh=8vcpSjNT1k5A4ehuUfwjip6OpA9XYu1lbAAriuBL9r4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=OKsAE1N8vmxRe1y5ngxr1eskYdqga78WFx2+Pj1O7/u7vkyh+dEPa1YGrqxs1ZjWyEeeOZJfM2hDojWD6tB91nFc+QsBqB59VPVaSePpTxVjtoJ5NXpGmVBpQWQ3ISAi82V5rrA/M8XMxEpwXLPH49wxfNLwPD7/AdqmxdGQhV8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=MwMnNg+8; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="MwMnNg+8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1757304925; x=1788840925; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=8vcpSjNT1k5A4ehuUfwjip6OpA9XYu1lbAAriuBL9r4=; b=MwMnNg+8dtVI8wBnDG2+zuWp4q5ki7Pmyil8WMyewcQXp+UcD0aA8Fct K/vIZj1+MMf6WVu7kFA4I5CDTxSCtsazAqpoUFhP8n3UeAjdDW3TbWBRa jK6T0WoGRSLbapvH+Aan3Y6IHUHIr0BCkDsNamASLTYT7Hgseywpybg0V N4f3+PlUlU799gNvmNW8QOE99yJacgPa3Xl6gSgTsZ3bV+TYlObuddX3r nRmsfH3WpPY96e7ae/g1zPPeCE8lUb3qrqFsfqG7sq1h3Yr2BPrVJCwkD ndBCx5Ss8ZtpAU9xSHvhc6iD/5OuYqiWt0J2XaymKdmwcjlQHMJGHPU4L w==; X-CSE-ConnectionGUID: q/SJvp4uQvCY0cG18DoX1w== X-CSE-MsgGUID: cfbswviiQeitLmdrMu/BIg== X-IronPort-AV: E=Sophos;i="6.18,247,1751266800"; d="scan'208";a="46742455" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Sep 2025 21:15:24 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Sun, 7 Sep 2025 21:14:51 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 7 Sep 2025 21:14:45 -0700 From: Dharma Balasubiramani Date: Mon, 8 Sep 2025 09:44:19 +0530 Subject: [PATCH v2 4/5] spi: atmel-quadspi: add support for SAM9X7 QSPI controller Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250908-microchip-qspi-v2-4-8f3d69fdd5c9@microchip.com> References: <20250908-microchip-qspi-v2-0-8f3d69fdd5c9@microchip.com> In-Reply-To: <20250908-microchip-qspi-v2-0-8f3d69fdd5c9@microchip.com> To: Mark Brown , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Nicolas Ferre" , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus CC: , , , , Dharma Balasubiramani , Varshini Rajendran X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757304860; l=1692; i=dharma.b@microchip.com; s=20240209; h=from:subject:message-id; bh=f7DOA5wDFdEWR6ikCwi4zK/5qKnnx4GBTbYYi9JaLJw=; b=QWZQc/2bKKOSQPBR5mGGCLwOKCSMrVZSDACQTUrUEup4zCt8TwjUc+WAgX+v4459P9KgEk+34 MqFWLf/rikaDsUQmMqRiuUIUXRFIyjg4tHN074oxyt7swTFwJtncRwD X-Developer-Key: i=dharma.b@microchip.com; a=ed25519; pk=kCq31LcpLAe9HDfIz9ZJ1U7T+osjOi7OZSbe0gqtyQ4= From: Varshini Rajendran Add support for the QuadSPI controller found on the SAM9X7 SoC. This controller does not implement pad calibration. It supports operation up to 100 MHz, and requires the GCK to run at twice the data rate. Signed-off-by: Varshini Rajendran Signed-off-by: Dharma Balasubiramani --- drivers/spi/atmel-quadspi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 83cea5faff78..342cdd6e8d64 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -63,6 +63,7 @@ =20 #define SAMA7G5_QSPI0_MAX_SPEED_HZ 200000000 #define SAMA7G5_QSPI1_SDR_MAX_SPEED_HZ 133000000 +#define SAM9X7_QSPI_MAX_SPEED_HZ 100000000 =20 /* Bitfields in QSPI_CR (Control Register) */ #define QSPI_CR_QSPIEN BIT(0) @@ -1627,6 +1628,16 @@ static const struct atmel_qspi_caps atmel_sam9x60_qs= pi_caps =3D { .has_ricr =3D true, }; =20 +static const struct atmel_qspi_caps atmel_sam9x7_ospi_caps =3D { + .max_speed_hz =3D SAM9X7_QSPI_MAX_SPEED_HZ, + .has_gclk =3D true, + .octal =3D true, + .has_dma =3D true, + .has_2xgclk =3D true, + .has_padcalib =3D false, + .has_dllon =3D false, +}; + static const struct atmel_qspi_caps atmel_sama7g5_ospi_caps =3D { .max_speed_hz =3D SAMA7G5_QSPI0_MAX_SPEED_HZ, .has_gclk =3D true, @@ -1660,6 +1671,10 @@ static const struct of_device_id atmel_qspi_dt_ids[]= =3D { .compatible =3D "microchip,sama7g5-qspi", .data =3D &atmel_sama7g5_qspi_caps, }, + { + .compatible =3D "microchip,sam9x7-ospi", + .data =3D &atmel_sam9x7_ospi_caps, + }, =20 { /* sentinel */ } }; --=20 2.43.0 From nobody Fri Oct 3 02:14:59 2025 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 7F59A21B19D; Mon, 8 Sep 2025 04:15:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757304929; cv=none; b=Z7tKcLYkbuaXtD2WQcslB6RBKph7uHSFLJLSSSoTzSOGHE7kB/BVsN4gKyvi9wbKN88xDFcMV6QJ3j0E7ja/TFefuVcj5osNZddmUE7q4b3eivH/gyAF5orXrLyy+1iV7d6ldjBt76KoHFNwBbbfOAiz8LMDJu+QxNH2yGwJ14w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757304929; c=relaxed/simple; bh=vx2kNy0+HhAu9oJXF7h1H6iRH7NO2rPLGfr4zC9bQyA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=uTgFYXU2/pctYXaPiXzABkJsOccppY33jUIDAG9KN6nJ0zTXqLMSjx1xVgYfUHW8CJfDN4vqGcFWm1OKMKkw/qWOysB65hgOaW2uFHjJl+lDsswrCe3A4VH6GkyKDEmSSxDd0gLrcnygwCH0p6SXAl1ShP3423OcfgcypLJh6xA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=sDinFn7a; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="sDinFn7a" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1757304927; x=1788840927; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=vx2kNy0+HhAu9oJXF7h1H6iRH7NO2rPLGfr4zC9bQyA=; b=sDinFn7aWVSSXiFbA2iG+fne536vUhAZtTy2w/JnOnS7Ul2wiScF+uHL PQ3b2Y/fcWeowFys/HVv0VRmMrd/8SFgUrduWhx7aIVTGq+5rr4ZHjfkw 8lywOpxj8Codi/qvbJXf/6BPaH1IJtUaAZ1kHD4y66vtIIW+bY+7oHvii lL61g/eQ9qAIxgrppsvMjfzG5bgGp4pq+4Jr73h8R6EVl+gDkbtX/yRFw hlXmT9s1ebrt8hBPAZBpYUvEMRZkk7mDVcE9Iuo46Tus079UJColoCYJT 6JT/s1ynhUW98TkmVcyxlwfhmdxprdtM0GOr/IAKErGiAR/iJGH+dN6oQ w==; X-CSE-ConnectionGUID: q/SJvp4uQvCY0cG18DoX1w== X-CSE-MsgGUID: ZJVDMuJtRJitEtb3JxJQeA== X-IronPort-AV: E=Sophos;i="6.18,247,1751266800"; d="scan'208";a="46742463" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Sep 2025 21:15:26 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Sun, 7 Sep 2025 21:14:58 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 7 Sep 2025 21:14:52 -0700 From: Dharma Balasubiramani Date: Mon, 8 Sep 2025 09:44:20 +0530 Subject: [PATCH v2 5/5] spi: atmel-quadspi: Add support for sama7d65 QSPI Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250908-microchip-qspi-v2-5-8f3d69fdd5c9@microchip.com> References: <20250908-microchip-qspi-v2-0-8f3d69fdd5c9@microchip.com> In-Reply-To: <20250908-microchip-qspi-v2-0-8f3d69fdd5c9@microchip.com> To: Mark Brown , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Nicolas Ferre" , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus CC: , , , , Dharma Balasubiramani , Varshini Rajendran X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757304860; l=1545; i=dharma.b@microchip.com; s=20240209; h=from:subject:message-id; bh=f0BEjRg0ecgW3mbWEOamZAvt1r/7v97MsNFu6rAL6n8=; b=00YL9K3Oot2eHMDWKTvLcLPGPfmcIclFGVvDwqZ2I+XnJFnXS2UbKtOsqxFGJmo9H+6F6i3TO rGVpcQg7n+0C48LlkIsVwYrLigv/DAIZ+NKDIiZnA4Itk2gfbvheFqX X-Developer-Key: i=dharma.b@microchip.com; a=ed25519; pk=kCq31LcpLAe9HDfIz9ZJ1U7T+osjOi7OZSbe0gqtyQ4= From: Varshini Rajendran Add support for sama7d65 QSPI controller and define its caps. Signed-off-by: Varshini Rajendran --- drivers/spi/atmel-quadspi.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 342cdd6e8d64..d7a3d85d00c2 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -1638,6 +1638,24 @@ static const struct atmel_qspi_caps atmel_sam9x7_osp= i_caps =3D { .has_dllon =3D false, }; =20 +static const struct atmel_qspi_caps atmel_sama7d65_ospi_caps =3D { + .max_speed_hz =3D SAMA7G5_QSPI0_MAX_SPEED_HZ, + .has_gclk =3D true, + .octal =3D true, + .has_dma =3D true, + .has_2xgclk =3D true, + .has_padcalib =3D true, + .has_dllon =3D false, +}; + +static const struct atmel_qspi_caps atmel_sama7d65_qspi_caps =3D { + .max_speed_hz =3D SAMA7G5_QSPI1_SDR_MAX_SPEED_HZ, + .has_gclk =3D true, + .has_dma =3D true, + .has_2xgclk =3D true, + .has_dllon =3D false, +}; + static const struct atmel_qspi_caps atmel_sama7g5_ospi_caps =3D { .max_speed_hz =3D SAMA7G5_QSPI0_MAX_SPEED_HZ, .has_gclk =3D true, @@ -1675,6 +1693,15 @@ static const struct of_device_id atmel_qspi_dt_ids[]= =3D { .compatible =3D "microchip,sam9x7-ospi", .data =3D &atmel_sam9x7_ospi_caps, }, + { + .compatible =3D "microchip,sama7d65-ospi", + .data =3D &atmel_sama7d65_ospi_caps, + }, + { + .compatible =3D "microchip,sama7d65-qspi", + .data =3D &atmel_sama7d65_qspi_caps, + }, + =20 { /* sentinel */ } }; --=20 2.43.0