Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1959521pxu; Fri, 18 Dec 2020 02:00:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrprH+Bl0IVkHIPTS9db0ie4o3e8kfxhEy9tnfHpylos/rQYo6Wiio/x85WUE/CPPFAy9m X-Received: by 2002:a17:906:6404:: with SMTP id d4mr3078737ejm.159.1608285645309; Fri, 18 Dec 2020 02:00:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608285645; cv=none; d=google.com; s=arc-20160816; b=uuuLDah5VjCv35cbQZBBRhiZpEIpu/kxsE9WmkrqL58sLQtXD5TNdvBWG7lpwRNM1A c6LqPFCep3iiohEGnybie5p0S/OND90XwDA9OkdAbzHXUeOUg0rtiqhi58VCfn9zcdWI 80lfuMgNXogO5fv78dY/wI3einnG89WivXYu+K/kxVDlGmoczpiaXL+Sevxh0Bv86wOg jAvivlZSIeqvrnVyIh+a9j03IToi2/WoekD9nC2lK4sgwl6eo4rdAsvbQIxd2VFWwju1 9eTmOwJcrMPcsNeP2D+bVonqcOUZZK1tE9K68sqSvoZcLUUZSVUUejlP4DLz1yP2Gneu h7kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=kYauHNCdRaiGwvmS2kAtuqbMqXp6IWuoVwEIFUQU/t0=; b=l9B9I2D0lxGAcJp7fPew2+dzujGzO6w/DgT7tlnwtDwhgfhuMRyZ6sFHU0PN+DHCnp S3e+rX5vyZgVX/0XY0uR7+XT/ogie0BAOMyyEU4ExuS8QcUazPm3x/W/aHg66xx+AyB+ Gtamo6JosB5z+2UKsegO+D4kUCcyXucd5DmQtI7lzseBvnjImsQm+Xuie5EeMae3oHji 6OpKBou6Wwqo2Erg6wGgKJOAGjUQtCbbAHAGPhf/ucHHyn6B5i2Kveb7cy0Ql06HGwqa 9C5C4+/UNGNm5SL0MEYNtMUlz9IamobP8/NiRHMCkr+h1CDHGvSKBqiprsxGS4VtLgXj mxeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u22si4422035ejt.406.2020.12.18.02.00.22; Fri, 18 Dec 2020 02:00:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732884AbgLRJ6o (ORCPT + 99 others); Fri, 18 Dec 2020 04:58:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732804AbgLRJ6o (ORCPT ); Fri, 18 Dec 2020 04:58:44 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C72C0617A7; Fri, 18 Dec 2020 01:58:03 -0800 (PST) Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id DED361F4614A; Fri, 18 Dec 2020 09:58:01 +0000 (GMT) Date: Fri, 18 Dec 2020 10:57:59 +0100 From: Boris Brezillon To: Pratyush Yadav Cc: Sowjanya Komatineni , , , , , , , , , , , Subject: Re: [PATCH v4 5/9] spi: spi-mem: Mark dummy transfers by setting dummy_data bit Message-ID: <20201218105759.43789ccf@collabora.com> In-Reply-To: <20201218092106.skwej2g6bk3oksbb@ti.com> References: <1608236927-28701-1-git-send-email-skomatineni@nvidia.com> <1608236927-28701-6-git-send-email-skomatineni@nvidia.com> <20201218092106.skwej2g6bk3oksbb@ti.com> Organization: Collabora X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 18 Dec 2020 14:51:08 +0530 Pratyush Yadav wrote: > Hi Sowjanya, > > On 17/12/20 12:28PM, Sowjanya Komatineni wrote: > > This patch marks dummy transfer by setting dummy_data bit to 1. > > > > Controllers supporting dummy transfer by hardware use this bit field > > to skip software transfer of dummy bytes and use hardware dummy bytes > > transfer. > > What is the benefit you get from this change? You add complexity in > spi-mem and the controller driver, so that must come with some benefits. > Here I don't see any. The transfer will certainly take the same amount > of time because the number or period of the dummy cycles has not > changed. So why is this needed? Well, you don't have to queue TX bytes if you use HW-based dummy cycles, but I agree, I'd expect the overhead to be negligible, especially since we're talking about emitting a few bytes, not hundreds. This being said, the complexity added to the core is reasonable IMHO, so if it really helps reducing the CPU overhead (we might need some numbers to prove that), I guess it's okay. > > > Signed-off-by: Sowjanya Komatineni > > --- > > drivers/spi/spi-mem.c | 1 + > > include/linux/spi/spi.h | 2 ++ > > 2 files changed, 3 insertions(+) > > > > diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c > > index f3a3f19..c64371c 100644 > > --- a/drivers/spi/spi-mem.c > > +++ b/drivers/spi/spi-mem.c > > @@ -354,6 +354,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) > > xfers[xferpos].tx_buf = tmpbuf + op->addr.nbytes + 1; > > xfers[xferpos].len = op->dummy.nbytes; > > xfers[xferpos].tx_nbits = op->dummy.buswidth; > > + xfers[xferpos].dummy_data = 1; > > spi_message_add_tail(&xfers[xferpos], &msg); > > xferpos++; > > totalxferlen += op->dummy.nbytes; > > diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h > > index aa09fdc..708f2f5 100644 > > --- a/include/linux/spi/spi.h > > +++ b/include/linux/spi/spi.h > > @@ -827,6 +827,7 @@ extern void spi_res_release(struct spi_controller *ctlr, > > * transfer. If 0 the default (from @spi_device) is used. > > * @bits_per_word: select a bits_per_word other than the device default > > * for this transfer. If 0 the default (from @spi_device) is used. > > + * @dummy_data: indicates transfer is dummy bytes transfer. > > * @cs_change: affects chipselect after this transfer completes > > * @cs_change_delay: delay between cs deassert and assert when > > * @cs_change is set and @spi_transfer is not the last in @spi_message > > @@ -939,6 +940,7 @@ struct spi_transfer { > > struct sg_table tx_sg; > > struct sg_table rx_sg; > > > > + unsigned dummy_data:1; > > unsigned cs_change:1; > > unsigned tx_nbits:3; > > unsigned rx_nbits:3; > > -- > > 2.7.4 > > >