Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6486562rwl; Mon, 9 Jan 2023 08:57:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXvEGpsTDoLtNEEFjrWgtq5Y7BqD+kBSUow71jV6+rA0Jda/qMI21zsMu7rVnADiq95C3WOP X-Received: by 2002:a05:6a00:bf4:b0:581:e6a8:bbf2 with SMTP id x52-20020a056a000bf400b00581e6a8bbf2mr35664158pfu.7.1673283454336; Mon, 09 Jan 2023 08:57:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673283454; cv=none; d=google.com; s=arc-20160816; b=M5I81BIbgGHu7MSTuiwfufzI1wkeGdu/qkGsiMUKI6TdyGbcbmjqES380aP4hDXjAR dCwAVYwkz6Vs2z0O0gpkn6855LNLdT5rXqwpgkFR3iLDbwvxnlEEjyP3Xev488+/LA6e ZEbaQ+dYuyqxhbJLQ+dw7cmJmCiphnzEqfxizC2qD4ZW3YD1wI/WMIkJtxV+mUJLthKa za5LeL1MT7KDYtJJLtxztvuk6ICaZhnDUbbmTUC0dBFvzUB0EUtuV/iPJRNY3WPjMnfP GVpP3SahKgTx4Ocy77Kdbr4nXqlojf0mZdRiF1AUfjA2M3y+44Jsttd6syPSpacWUO/z ak8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=u/YojMvQCgjgpVq2imF+mNJMgcvG5QTIR+KQBSabztA=; b=QZz7SMtMVSA1XVJpEIau00ar+s4AuG7jEtSmUuukoXRU8GkLBE8HcXZGHfP9dtRdwS YvWmFtW4iqFeJ4tEdjrdYLXAgmR8ES+HTpxQHaJ9LTz7iOMQ0Bj9MG7GZYDUBpWXK6+0 8y10rbq8cwBohB1b2C99ZS79X5c8+404OqvkvtwzLgIuzdX1c3vxVxmLXtVLU14bT5v1 n0uUVhX9+A/pcyqBrHN7iVEyTC+KKfkFE87DcBdXQsMnGDXgGBgRfsDS2OuA15exuQHL aeYyMMSZqDRbf2t7UYtJjXPHSAAi073Lg0CVuo02qdHpcQ/f7z+jFv/GZ/TUmatPjhMs 8exg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jqxs8APt; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a056a001ad400b00579f5a64843si10319470pfv.96.2023.01.09.08.57.27; Mon, 09 Jan 2023 08:57:34 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=jqxs8APt; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236699AbjAIQx4 (ORCPT + 53 others); Mon, 9 Jan 2023 11:53:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237165AbjAIQx2 (ORCPT ); Mon, 9 Jan 2023 11:53:28 -0500 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8EED3E0ED; Mon, 9 Jan 2023 08:52:48 -0800 (PST) Received: by mail-lj1-x236.google.com with SMTP id y18so5948158ljk.11; Mon, 09 Jan 2023 08:52:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=u/YojMvQCgjgpVq2imF+mNJMgcvG5QTIR+KQBSabztA=; b=jqxs8APtMoqxBAsze64sbZIiObnKM5mcG4m+PYHo9Wbt2szmZicijlw986fvLX7UkE DQlOhTnCQmlm8PysQ7YuhNW3enHFuvIXMuqQc2wGpdqTTRUSwTbgljcuVw5EzDrg/fac uE5PvAP0onnTZ869icDtYJJ+LTMH2ldRt3C/+ox+BC3YkA89uGFytSbSQIGwXvllIF7H dphJ84b03YY2on+6cGTLLr79cme31F1x5JeVdhFe9C5/t+lK1fREcV1LGlwfotUaCFM2 kaTHASMEUyF3SjhapFRpPWDN04xUsz5Zvk8ZE2OnEd/WRdhVhgKOhsB3gavsOt6nnINZ mXbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=u/YojMvQCgjgpVq2imF+mNJMgcvG5QTIR+KQBSabztA=; b=WL4PYEV86okLqtTkFSesWZQLJyKzreuKDhh3xSEJ/GxIDHprALgDgqnkRveoPoglCY GbBLuJsxS0Do0Z+Uh6BNDbuOaRGdDrb78Tl7Crrn57wuZLR6K+A3Z5Kh1hFQERVI7+ny RlPbafIwSUaPE6EImm8z++1Jq9V5x8WnVmp5PUDyIOXylYqyZQIH/e6E86bvchZyt9Nq ydgWiMD95BNxyr1TjG+1PYtsiXPqcG0t73EHgUi4bXDhJaQYAP7TU/OjncIzPiKCcOwK 2RqmgJRjCRsL4pDgd+/gUou6SZLyGTvii8DPXy+bWG0Xx3uKheQjpBsRaipVCKW5ke5m J05w== X-Gm-Message-State: AFqh2kpra9n+GhlHJims3vIAuyJ0PJp+EJdBNW6dyn6Ej10OeyjEROfh JJENSYybp2AuSBPr2Wx29nMv28BZF7Y= X-Received: by 2002:a05:651c:1992:b0:27f:b2cf:85a0 with SMTP id bx18-20020a05651c199200b0027fb2cf85a0mr18909499ljb.43.1673283167180; Mon, 09 Jan 2023 08:52:47 -0800 (PST) Received: from mobilestation ([95.79.133.202]) by smtp.gmail.com with ESMTPSA id s29-20020a05651c201d00b0028000e909desm973923ljo.136.2023.01.09.08.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 08:52:46 -0800 (PST) Date: Mon, 9 Jan 2023 19:52:44 +0300 From: Serge Semin To: Sudip Mukherjee Cc: Mark Brown , Rob Herring , Krzysztof Kozlowski , jude.onyenegecha@sifive.com, ben.dooks@sifive.com, jeegar.lakhani@sifive.com, linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 02/15] spi: dw: update NDF while using enhanced spi mode Message-ID: <20230109165244.yck7ik26xb4zwtil@mobilestation> References: <20221212180732.79167-1-sudip.mukherjee@sifive.com> <20221212180732.79167-3-sudip.mukherjee@sifive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221212180732.79167-3-sudip.mukherjee@sifive.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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, Dec 12, 2022 at 06:07:19PM +0000, Sudip Mukherjee wrote: > If the transfer of Transmit only mode is using dual/quad/octal SPI then > NDF needs to be updated with the number of data frames. > If the Transmit FIFO goes empty in-between, DWC_ssi masks the serial > clock and wait for rest of the data until the programmed amount of > frames are transferred successfully. > > Signed-off-by: Sudip Mukherjee > --- > drivers/spi/spi-dw-core.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-dw-core.c b/drivers/spi/spi-dw-core.c > index 77c23772bb3d9..8c47a4d14b666 100644 > --- a/drivers/spi/spi-dw-core.c > +++ b/drivers/spi/spi-dw-core.c > @@ -346,7 +346,9 @@ void dw_spi_update_config(struct dw_spi *dws, struct spi_device *spi, > dw_writel(dws, DW_SPI_CTRLR0, cr0); > > if (cfg->tmode == DW_SPI_CTRLR0_TMOD_EPROMREAD || > - cfg->tmode == DW_SPI_CTRLR0_TMOD_RO) > + cfg->tmode == DW_SPI_CTRLR0_TMOD_RO || > + (cfg->tmode == DW_SPI_CTRLR0_TMOD_TO && > + cfg->spi_frf != DW_SPI_CTRLR0_SPI_FRF_STD_SPI)) First CTRLR1.NDF is meaningful for the Tx-only mode if non-zero eSPI mode is enabled and the clock-stretching feature is activated. Second the conditional statement already looks too bulky. Adding new parts will make it even harder to read. What about converting it to something like: < if (cfg->ndf) < dw_writel(dws, DW_SPI_CTRLR1, cfg->ndf - 1); What do you think? -Serge(y) > dw_writel(dws, DW_SPI_CTRLR1, cfg->ndf ? cfg->ndf - 1 : 0); > > /* Note DW APB SSI clock divider doesn't support odd numbers */ > -- > 2.30.2 >