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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1314C64EC7 for ; Wed, 1 Mar 2023 07:44:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 20A6485C23; Wed, 1 Mar 2023 08:44:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="GSVktaTL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0240B85C0F; Wed, 1 Mar 2023 08:44:24 +0100 (CET) Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6B11E85C0F for ; Wed, 1 Mar 2023 08:44:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=n-jain1@ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3217iFe8080766; Wed, 1 Mar 2023 01:44:16 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1677656656; bh=Ir8sOsHADoHQR3XNMOb6NAemdmWmrXilHuHtwigQ/hI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=GSVktaTLkAiUwgprydtLrpGvW0HrAY7hVlc96QLmAivoVznOvvZAi99HBb7rR+OMG lxh4fUy+PGhMy+vr1y0msFKu+UrX7T29yIAjo/sm365w9I7Qy+BIJPulkrQDFG/lnB rtCJY/nfw6O9MIh/3CPBHXlGixoY8A8PAP3QYLzM= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3217iF09088900 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 1 Mar 2023 01:44:15 -0600 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Wed, 1 Mar 2023 01:44:15 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Wed, 1 Mar 2023 01:44:15 -0600 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3217iEj5109056; Wed, 1 Mar 2023 01:44:15 -0600 From: Nikhil M Jain To: Jagan Teki , CC: Dhruva Gole , Vaishnav Achath , Pratyush Yadav , Vignesh Raghavendra , Nikhil M Jain Subject: [PATCH 2/2] spi: spi-mem: perform odd len check only while writing data Date: Wed, 1 Mar 2023 13:13:46 +0530 Message-ID: <20230301074346.115693-3-n-jain1@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301074346.115693-1-n-jain1@ti.com> References: <20230301074346.115693-1-n-jain1@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean From: Dhruva Gole in spi_mem_dtr_supports_op we have a check for allowing only even number of bytes to be r/w. Odd bytes writing can be a concern while writing data to a flash for example because 8 DTR mode doesn't support it. However, reading ODD Bytes even though may not be physically possible we can still allow for it because it will not have serious implications on any critical registers being overwritten since they are just reads. Cc: Vaishnav Achath Cc: Pratyush Yadav Cc: Vignesh Raghavendra Tested-by: Nikhil M Jain Signed-off-by: Dhruva Gole --- drivers/spi/spi-mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index 57a36f31a5..b7eca58359 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -185,7 +185,7 @@ bool spi_mem_dtr_supports_op(struct spi_slave *slave, * Transactions of odd length do not make sense for 8D-8D-8D mode * because a byte is transferred in just half a cycle. */ - if (op->data.dir != SPI_MEM_NO_DATA && + if (op->data.dir != SPI_MEM_NO_DATA && op->data.dir != SPI_MEM_DATA_IN && op->data.buswidth == 8 && op->data.nbytes % 2) return false; -- 2.34.1