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 6DE07C433FE for ; Thu, 20 Oct 2022 08:48:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E2A5F84DE2; Thu, 20 Oct 2022 10:48:17 +0200 (CEST) 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="FQtArIQ6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ACDE984AEB; Thu, 20 Oct 2022 10:48:16 +0200 (CEST) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 AEBDB84AEB for ; Thu, 20 Oct 2022 10:48:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=d-gole@ti.com Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 29K8mASs022456; Thu, 20 Oct 2022 03:48:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1666255690; bh=3nbTNvk/E0D4EseDWkFOhHx1nc5osi8cNc/91xK7uxU=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=FQtArIQ6fmLKeFCY70YuzUHsT+dy8aVpSRfdj5AYeuhvhdhQJvs6EqKpJ4liJgbAM z+r1J98+BdxgmDhJvhFXVsakpBAiAwBaDYlMqUJbyG+GQx9SBKODU3rbdbsqSoc/iQ FM4YghiB4NbMh+ce0oPuGq11v33GkJMJ8JRVoY9M= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 29K8mARK039483 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 20 Oct 2022 03:48:10 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6; Thu, 20 Oct 2022 03:48:10 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6 via Frontend Transport; Thu, 20 Oct 2022 03:48:10 -0500 Received: from [10.24.69.26] (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 29K8m7wA041884; Thu, 20 Oct 2022 03:48:08 -0500 Message-ID: <83a0c926-6063-56f2-c4af-5cb99ffedea5@ti.com> Date: Thu, 20 Oct 2022 14:18:07 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH] spi: spi-mem: ease checks in dtr_supports_op() Content-Language: en-US To: Tom Rini CC: Vaishnav Achath , Nishanth Menon , Vignesh Raghavendra , , Jagan Teki References: <20221020083424.86848-1-d-gole@ti.com> From: Dhruva Gole In-Reply-To: <20221020083424.86848-1-d-gole@ti.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit 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 Forgot to add in CC, + Jagan Teki (maintainer:SPI) On 20/10/22 14:04, Dhruva Gole wrote: > Remove the extra conditions that cause some cases to fail prematurely > like if the data number of bytes is odd. The controller can handle odd > number of bytes data read in DTR Mode. Don't fail supports op for this > condition. > > Signed-off-by: Dhruva Gole > --- > > For a deeper context, refer to a cover letter from an earlier patch > series: > https://lore.kernel.org/u-boot/20221019064759.493607-1-d-gole@ti.com/T/#m3fd93bdcc30b3b5faada6abe45a4104388afc300 > Here, I am trying to boot from OSPI Flash present on board the AM62-SK > EVM. However, despite enabling the necessary configs and DT nodes, my > boot flow seemed to be failing. I then came to know that the condition > causing this failure was that my generated DTB was of odd number of > bytes. > So, while loading the dtb from the Octal SPI NOR Flash to the memory, > the data.nbytes was odd which made the supports_op > function return false. This check feels a little too strict at the > spi-mem stage and we should let the controller decide what to do in case > of odd bytes in DTR. After applying this patch, I was able to > succesfully boot the AM62SK EVM without any issues. > > I would also like to justify this patch by pointing the community to the > equivalent code in the linux kernel, in drivers/spi/spi-mem.c, where this check > is absent as well. > > The controller does work with odd number of bytes and I have not seen > any sort of bugs in the absence of this supports_op check. Hence, feel > that it is safe enough to discard this check from here. > > drivers/spi/spi-mem.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c > index 8e8995fc537f..eecc13bec90d 100644 > --- a/drivers/spi/spi-mem.c > +++ b/drivers/spi/spi-mem.c > @@ -181,10 +181,6 @@ bool spi_mem_dtr_supports_op(struct spi_slave *slave, > if (op->dummy.nbytes && op->dummy.buswidth == 8 && op->dummy.nbytes % 2) > return false; > > - if (op->data.dir != SPI_MEM_NO_DATA && > - op->dummy.buswidth == 8 && op->data.nbytes % 2) > - return false; > - > return spi_mem_check_buswidth(slave, op); > } > EXPORT_SYMBOL_GPL(spi_mem_dtr_supports_op); -- Thanks and Regards, Dhruva Gole