Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1984390rwd; Mon, 15 May 2023 05:59:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5atGLe/qfakWidAjy9SK2bu7i1X661yEb/y3ypfjKcjA6IS55BmAiE5TGxruS5bcotKofZ X-Received: by 2002:a05:6a20:6a0c:b0:106:70af:a5ca with SMTP id p12-20020a056a206a0c00b0010670afa5camr1815658pzk.38.1684155556578; Mon, 15 May 2023 05:59:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684155556; cv=none; d=google.com; s=arc-20160816; b=thGGDV/stC2hLO54MlRe3VBHqpyVv3WSZwdvDy4MtlmqWNzYD/Ncg88rh4cv7b37is kBgEAkHNSQSSZEfMzcEifZiVk40acvREzURoEdZGtgTZ+dAQQvfLViHJTSDab4AgllVF Fd04/lTJlYEqwZ7ZgsGeJjduAqsb0vl75FGha/RXX68ViUYkvXRRXRnKxCiQKwRzGB7h yTKC5HuRPp8FCDN6QHrhTEIll/MWuI8dJK3sZWNMgk7i42Wh0wkj1o7+XPAxB9Yvzhh5 nCQY/Y9HslLoYe+LDzSembxkypBflUA3uUeTl2/UYUhkeIXO6te+T5gLJO+5I7o+dH3R gj4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=p9o/h+5z2tpJ6ghKbunX+2J/YOG2H11uQhqDGGzJJGs=; b=rjBXnKkZ+z4ccp+mcHvn8wQKv6WoVgAiABfjtqZSN965to/vHRk6/KUnRfehChfnk6 xbOCH6DNPFUiUQzHKCkkNFQZ+7pA+T54G/FaCzajN9hMrkkGNybOdWv4AzFL4Irwctlu 3QW8gRdm0sn2l2oPGbAJuu79O/IQ1BaPlF+XqWVj+C6jQKI18/9KlQM1r9U62R51NpXG bRQtUL9Q0nx6swKwr6wbEupxI5q03Mevab1zUp8XPzLew7mxR10Ebwyin7Oi9h/gMYFL VrgUYBJoDZmm9jsR4SV2vSX7nQ1EZYecbJO+ptQ7FJQcIOdz6nW+18eg5KrBguSh1IZT nBnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=XcGWUNi4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n127-20020a632785000000b005321c340960si5180611pgn.811.2023.05.15.05.59.02; Mon, 15 May 2023 05:59:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=XcGWUNi4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242034AbjEOMz3 (ORCPT + 99 others); Mon, 15 May 2023 08:55:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242088AbjEOMzK (ORCPT ); Mon, 15 May 2023 08:55:10 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1711A19AE; Mon, 15 May 2023 05:55:04 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34F4x0NA022883; Mon, 15 May 2023 07:55:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=PODMain02222019; bh=p9o/h+5z2tpJ6ghKbunX+2J/YOG2H11uQhqDGGzJJGs=; b=XcGWUNi4xrEtsTlLIlmRZYuZUC3v4fp4Ou6Dz8rgMXbf9D4fkosNj4DTall9vA7z08NK zlJYHHhKHqdlmQjH2Q157JGRxJ4VVHsMtwJyc4vev6cz+mIN6ud46XJBxuZw6xHtX3ev vQKL2Ml+K7xJy32kNc0SP2or6AeIZMmuw4Oidq0j0aqF8mznKePbUs5+WPhN3CbZhNVh csW8KJV+nzIAIHn9DuTfFiHSGNl/iBrwXD14nqrnyOM701O7QROKqJb28SNEDoS9UKdz zgpjDcUd7shfMoGvPUcgGy3bP7Xi03BVf7hU6fwDIODbG646rp4d6RHKxosY8Vn9KoV2 gg== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3qj6ymtupp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 May 2023 07:55:00 -0500 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Mon, 15 May 2023 07:54:59 -0500 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Mon, 15 May 2023 07:54:59 -0500 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id F209011A8; Mon, 15 May 2023 12:54:58 +0000 (UTC) Date: Mon, 15 May 2023 12:54:58 +0000 From: Charles Keepax To: "Goud, Srinivas" CC: "broonie@kernel.org" , "linux-spi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "patches@opensource.cirrus.com" Subject: Re: [PATCH 1/2] spi: spi-cadence: Avoid read of RX FIFO before its ready Message-ID: <20230515125458.GT68926@ediswmail.ad.cirrus.com> References: <20230509164153.3907694-1-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-GUID: 1EsWVxX1B7jrP1WIp6kuBTASOcaJxh9v X-Proofpoint-ORIG-GUID: 1EsWVxX1B7jrP1WIp6kuBTASOcaJxh9v X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 15, 2023 at 12:04:38PM +0000, Goud, Srinivas wrote: > >-----Original Message----- > >From: Charles Keepax > >Sent: Tuesday, May 9, 2023 10:12 PM > >To: broonie@kernel.org > >Cc: Goud, Srinivas ; linux-spi@vger.kernel.org; > >linux-kernel@vger.kernel.org; patches@opensource.cirrus.com > >Subject: [PATCH 1/2] spi: spi-cadence: Avoid read of RX FIFO before its ready > >- while (trans_cnt) { > >- cdns_spi_read_rx_fifo(xspi, 1); > >- > >- if (xspi->tx_bytes) { > >- if (xspi->txbuf) > >- cdns_spi_write(xspi, CDNS_SPI_TXD, > >- *xspi->txbuf++); > >- else > >- cdns_spi_write(xspi, CDNS_SPI_TXD, > >0); > >- xspi->tx_bytes--; > >- } > >- trans_cnt--; > >- } > >- if (!xspi->tx_bytes) { > >- /* Fixed delay due to controller limitation with > >- * RX_NEMPTY incorrect status > >- * Xilinx AR:65885 contains more details > >- */ > >- udelay(10); > >- cdns_spi_read_rx_fifo(xspi, xspi->rx_bytes); > >+ cdns_spi_read_rx_fifo(xspi, trans_cnt); > Cadence SPI configured in Slave mode, when threshold is half of FIFO depth cdns_spi_read_rx_fifo() function continuously in read mode, > due to this we see incorrect data received on the Master side as Slave is failed to update the TX FIFO on time. Apologies I am having a little trouble following this are you saying this part of the patch cases issues for you running in slave mode? Thanks, Charles