From nobody Wed Feb 11 08:11:42 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 906E1C77B60 for ; Tue, 4 Apr 2023 17:17:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235908AbjDDRRH (ORCPT ); Tue, 4 Apr 2023 13:17:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235849AbjDDRRB (ORCPT ); Tue, 4 Apr 2023 13:17:01 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6465B2683; Tue, 4 Apr 2023 10:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1680628620; x=1712164620; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=i+Jlcq7+ozFYtO3gopneWBMGEdmaY2LDJGZxZu3AEuw=; b=sNto0DczWSZo2MZF1875OA4cp8SG4t+w8IYGeyiC/oNTB14UTtotNvab aYpI87/A9uIYafSmaBVYvJqPiRrvFAbccEJy/yozzOf9pxoAhb4JPJyPw ZxPPsYCoAkfshjS3/qMijpG9AaZU1wZeaSUrRub/+ak1n2Va0yoQDIfdi SWXgNDFIrHmNVP2OLrpq4Q1nIDA0dftpDnnnolsNbHP7xmBQBVqwOZr8z chPfS/vcddPkBj+UYv4MdxMdKudjvfN8RO7uupnnSn0isi1m+nh9Rveif 6kvH5ftWnoLfz9wK0EgebJKxwKjxre0N4O7eFlY/SqPYXwgMd7RhQ5yuo Q==; X-IronPort-AV: E=Sophos;i="5.98,318,1673938800"; d="scan'208";a="219405872" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Apr 2023 10:16:49 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 4 Apr 2023 10:16:49 -0700 Received: from CHE-LT-UNGSOFTWARE.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 4 Apr 2023 10:16:47 -0700 From: Tharun Kumar P To: CC: , Subject: [PATCH SPI for-next 1/3] spi: mchp-pci1xxxx: Fix length of SPI transactions not set properly in driver Date: Tue, 4 Apr 2023 22:46:11 +0530 Message-ID: <20230404171613.1336093-2-tharunkumar.pasumarthi@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404171613.1336093-1-tharunkumar.pasumarthi@microchip.com> References: <20230404171613.1336093-1-tharunkumar.pasumarthi@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In=C2=A0pci1xxxx_spi_transfer_one API, length of SPI transaction gets clear= ed by setting of length mask. Set length of transaction only after masking length field. Fixes: 1cc0cbea7167 ("spi: microchip: pci1xxxx: Add driver for SPI controll= er of PCI1XXXX PCIe switch") Signed-off-by: Tharun Kumar P --- drivers/spi/spi-pci1xxxx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-pci1xxxx.c b/drivers/spi/spi-pci1xxxx.c index 1c5731641a04..419a1d3a5c2e 100644 --- a/drivers/spi/spi-pci1xxxx.c +++ b/drivers/spi/spi-pci1xxxx.c @@ -199,8 +199,9 @@ static int pci1xxxx_spi_transfer_one(struct spi_control= ler *spi_ctlr, else regval &=3D ~SPI_MST_CTL_MODE_SEL; =20 - regval |=3D ((clkdiv << 5) | SPI_FORCE_CE | (len << 8)); + regval |=3D ((clkdiv << 5) | SPI_FORCE_CE); regval &=3D ~SPI_MST_CTL_CMD_LEN_MASK; + regval |=3D (len << 8); writel(regval, par->reg_base + SPI_MST_CTL_REG_OFFSET(p->hw_inst)); regval =3D readl(par->reg_base + --=20 2.25.1 From nobody Wed Feb 11 08:11:42 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10857C77B60 for ; Tue, 4 Apr 2023 17:16:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235767AbjDDRQ5 (ORCPT ); Tue, 4 Apr 2023 13:16:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232447AbjDDRQy (ORCPT ); Tue, 4 Apr 2023 13:16:54 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FAE8D3; Tue, 4 Apr 2023 10:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1680628613; x=1712164613; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=r3aKOSdvH+07JEB/Anw6Ara6+1P1wt7dI3yReMFX3Bg=; b=TaMnRRARwZtp4GrvTbsBhb36wadtjwWnH+u68RNZvU/BRqTW9xQtLA4D arOuWtArvkddOaQR2UbnqljGrZ69wsHeX3mizLFLH6SBsC+Q2oWwMaOMt eDkggoQwE3xMUCimbo87ipgLqOyl4kCos0U2DDC2n8K9fg8gkpvc4+2Kq v+sQl3fdizajU5voMUtRr9Fmo2SdsTsbWACU11/IOCI1glelvJWwQK0ve U8CPaeHD3rvVlmZGTUNbRf2TbgSd1/AoOHAvr/uIkVWICWhSAJEfKp9Rl NxsjAc7z2rIR7Q3mJqh3427nmhAAJjH/mwZexI2Tn59IbzQijxhOGzV5+ w==; X-IronPort-AV: E=Sophos;i="5.98,318,1673938800"; d="scan'208";a="204973525" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Apr 2023 10:16:52 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 4 Apr 2023 10:16:52 -0700 Received: from CHE-LT-UNGSOFTWARE.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 4 Apr 2023 10:16:51 -0700 From: Tharun Kumar P To: CC: , Subject: [PATCH SPI for-next 2/3] spi: mchp-pci1xxxx: Fix SPI transactions not working after suspend and resume Date: Tue, 4 Apr 2023 22:46:12 +0530 Message-ID: <20230404171613.1336093-3-tharunkumar.pasumarthi@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404171613.1336093-1-tharunkumar.pasumarthi@microchip.com> References: <20230404171613.1336093-1-tharunkumar.pasumarthi@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" pci1xxxx_spi_resume API masks SPI interrupt bit which prohibits interrupt from coming to the host at the end of the transaction after suspend-resume. This patch unmasks this bit at resume. Fixes: 1cc0cbea7167 ("spi: microchip: pci1xxxx: Add driver for SPI controll= er of PCI1XXXX PCIe switch") Signed-off-by: Tharun Kumar P --- drivers/spi/spi-pci1xxxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-pci1xxxx.c b/drivers/spi/spi-pci1xxxx.c index 419a1d3a5c2e..82d4bfeea1fa 100644 --- a/drivers/spi/spi-pci1xxxx.c +++ b/drivers/spi/spi-pci1xxxx.c @@ -58,7 +58,7 @@ #define VENDOR_ID_MCHP 0x1055 =20 #define SPI_SUSPEND_CONFIG 0x101 -#define SPI_RESUME_CONFIG 0x303 +#define SPI_RESUME_CONFIG 0x203 =20 struct pci1xxxx_spi_internal { u8 hw_inst; --=20 2.25.1 From nobody Wed Feb 11 08:11:42 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE2E7C761A6 for ; Tue, 4 Apr 2023 17:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235876AbjDDRRE (ORCPT ); Tue, 4 Apr 2023 13:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235778AbjDDRQ6 (ORCPT ); Tue, 4 Apr 2023 13:16:58 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CF66D3; Tue, 4 Apr 2023 10:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1680628616; x=1712164616; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7Z6kt8KKvWipPWeST1v16fNQUW3GnVVk+Du/WWg0CeI=; b=CRkjgRxyV5GCAMxf453Wt1lCdtw9xJUdboUaI+apiSUTXf39yBdICYqG VwtKqLXas84sOKikgAk2woGdXFgnV6Vo1PwJn33ajtM3ZnDjkQVy4VU3t yw/VxpLV0SEQimnJmND/D6qQk8WANO4t/EHlndD0CYA9rNoTR0/gJMGbz +QILxiCf2knqaXRXw/XGUKopfgOmwCAUl3XxtxTGLaINOpOJCYjYBHKRz qe/orz3A07MFLTMBws2i8CWIP3llqfwPUZkei0klArXZ/m7Nvaut2x4fs I99WStVLitWjeZM/Lh4Y6+TsU3lqJOtJB5OEVJWuBUf918lrld9qwVs9s w==; X-IronPort-AV: E=Sophos;i="5.98,318,1673938800"; d="scan'208";a="145482306" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Apr 2023 10:16:56 -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.2507.21; Tue, 4 Apr 2023 10:16:56 -0700 Received: from CHE-LT-UNGSOFTWARE.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 4 Apr 2023 10:16:54 -0700 From: Tharun Kumar P To: CC: , Subject: [PATCH SPI for-next 3/3] spi: mchp-pci1xxxx: Fix improper implementation of disabling chip select lines Date: Tue, 4 Apr 2023 22:46:13 +0530 Message-ID: <20230404171613.1336093-4-tharunkumar.pasumarthi@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230404171613.1336093-1-tharunkumar.pasumarthi@microchip.com> References: <20230404171613.1336093-1-tharunkumar.pasumarthi@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Hardware does not have support to disable individual chip select lines. Disable all chip select lines by using SPI_FORCE_CE bit. Fixes: 1cc0cbea7167 ("spi: microchip: pci1xxxx: Add driver for SPI controll= er of PCI1XXXX PCIe switch") Signed-off-by: Tharun Kumar P --- drivers/spi/spi-pci1xxxx.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-pci1xxxx.c b/drivers/spi/spi-pci1xxxx.c index 82d4bfeea1fa..4445d82409d6 100644 --- a/drivers/spi/spi-pci1xxxx.c +++ b/drivers/spi/spi-pci1xxxx.c @@ -114,17 +114,14 @@ static void pci1xxxx_spi_set_cs(struct spi_device *sp= i, bool enable) =20 /* Set the DEV_SEL bits of the SPI_MST_CTL_REG */ regval =3D readl(par->reg_base + SPI_MST_CTL_REG_OFFSET(p->hw_inst)); - if (enable) { + if (!enable) { + regval |=3D SPI_FORCE_CE; regval &=3D ~SPI_MST_CTL_DEVSEL_MASK; regval |=3D (spi_get_chipselect(spi, 0) << 25); - writel(regval, - par->reg_base + SPI_MST_CTL_REG_OFFSET(p->hw_inst)); } else { - regval &=3D ~(spi_get_chipselect(spi, 0) << 25); - writel(regval, - par->reg_base + SPI_MST_CTL_REG_OFFSET(p->hw_inst)); - + regval &=3D ~SPI_FORCE_CE; } + writel(regval, par->reg_base + SPI_MST_CTL_REG_OFFSET(p->hw_inst)); } =20 static u8 pci1xxxx_get_clock_div(u32 hz) @@ -199,7 +196,7 @@ static int pci1xxxx_spi_transfer_one(struct spi_control= ler *spi_ctlr, else regval &=3D ~SPI_MST_CTL_MODE_SEL; =20 - regval |=3D ((clkdiv << 5) | SPI_FORCE_CE); + regval |=3D (clkdiv << 5); regval &=3D ~SPI_MST_CTL_CMD_LEN_MASK; regval |=3D (len << 8); writel(regval, par->reg_base + @@ -223,10 +220,6 @@ static int pci1xxxx_spi_transfer_one(struct spi_contro= ller *spi_ctlr, } } } - - regval =3D readl(par->reg_base + SPI_MST_CTL_REG_OFFSET(p->hw_inst)); - regval &=3D ~SPI_FORCE_CE; - writel(regval, par->reg_base + SPI_MST_CTL_REG_OFFSET(p->hw_inst)); p->spi_xfer_in_progress =3D false; =20 return 0; --=20 2.25.1