Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2120119ybf; Mon, 2 Mar 2020 02:20:39 -0800 (PST) X-Google-Smtp-Source: APXvYqyhgxcaZAy14QxGGpNvVJKphr8AvfacXWM+cqsKjK724Yawr1tmhK+tadAf/sGqqrg91ZhP X-Received: by 2002:aca:e084:: with SMTP id x126mr10697798oig.97.1583144439161; Mon, 02 Mar 2020 02:20:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583144439; cv=none; d=google.com; s=arc-20160816; b=sPfPTpqMixkqWPn+2iOLJsgrZC6htJUkcnOQNC8FpilK9spSAblk2CKoIAbMd09nVM igAklTU2sInZJ7zTrw9mpOjzIVJCv81QU/yISmLYQu6dCbL60ZkhzEzh9KZIRWHgDuY8 BNFh6YfcWsPeP3yPtZDWnI1rVDt1kxdOmXmFO6io4VRcCdgUMylDQ4k4zef2Yb2kk3P4 APxOE2eS814+yECLurnA631lLO9IxPHk0Vko4VTQXvdPSzEhf++3rpUzbkx+YXjB9HjV x0SN8uv1N9Z8kL6uUZZje6/nDQfg/y2MzKCT6pNYG12vSntBhSchmY3wilrC523NvDQO 3aAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=LaHNXmteSOXZaAOGmGG5kFVzEEtqr6/Oi45X0k+2R0Q=; b=bgqOm3S2CuXFaEsHNJeIeVmS/Xu/zJ1fE06GXpgyZF+lq7FaFZPksLYAKSFsma9Z1u +RsJ6zZHpi4SaFpP2VqYAcR2T02D3uX+liBDbqVlulz342wcPGQowimxGuoqL7QDlstB Y9VZ9rZBi55zfHAqoVqcV1JC9OtTxx7YG1cbBbqcyhIAtHSpWAlbIHrKxakhhpjpcQ6z vIjjvpfODW558LZxtuMIiSv5kcmZm5ygSD/+cmGo0e6EW53enz/cVWl7PCWVt3Omdt47 rQ1MO4WK2uXTzlo5IoWW1gVy7pK43vyJy+32Mn/RgHv5euURnsFJ00ZCa2ZhDfukNoqu J0Eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id c20si1800991oic.99.2020.03.02.02.20.27; Mon, 02 Mar 2020 02:20:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727124AbgCBKUK (ORCPT + 99 others); Mon, 2 Mar 2020 05:20:10 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:43340 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726654AbgCBKUK (ORCPT ); Mon, 2 Mar 2020 05:20:10 -0500 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 F239229480B; Mon, 2 Mar 2020 10:20:07 +0000 (GMT) Date: Mon, 2 Mar 2020 11:20:02 +0100 From: Boris Brezillon To: Pratyush Yadav Cc: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Mark Brown , Rob Herring , Mark Rutland , , Sekhar Nori , , , Subject: Re: [PATCH v2 02/11] spi: set mode bits for "spi-rx-dtr" and "spi-tx-dtr" Message-ID: <20200302112002.4e3aaffd@collabora.com> In-Reply-To: <20200302094829.opazalwldrdn4s7y@ti.com> References: <20200226093703.19765-1-p.yadav@ti.com> <20200226093703.19765-3-p.yadav@ti.com> <20200227172247.0e8ec459@collabora.com> <20200302094829.opazalwldrdn4s7y@ti.com> Organization: Collabora X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2 Mar 2020 15:18:31 +0530 Pratyush Yadav wrote: > > > diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c > > > index 38b4c78df506..25c8ed9343f9 100644 > > > --- a/drivers/spi/spi.c > > > +++ b/drivers/spi/spi.c > > > @@ -1927,6 +1927,13 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, > > > } > > > } > > > > > > + /* Device DTR mode. */ > > > + if (of_property_read_bool(nc, "spi-tx-dtr")) > > > + spi->mode |= SPI_TX_DTR; > > > + > > > + if (of_property_read_bool(nc, "spi-rx-dtr")) > > > + spi->mode |= SPI_RX_DTR; > > > + > > > > If this DTR mode is only used in spi-mem, maybe we shouldn't add those > > flags. SPI mem devices are usually smart enough to advertise what they > > support, and the subsystem in charge of those devices (in this specific > > case, spi-nor) will check what the controller supports > > using spi_mem_supports_op(). The only case we might have to deal with > > at some point is board level limitations (disabling DTR because the > > routing prevents using this mode). > > Yes, being able to handle board-level limitations is the main reason > behind this change. There should be a way to over-ride the use of DTR > for a given board. And IIUC, SPI allows doing the same for Rx and Tx > buswidth. So I don't see why we should deviate from that model. My point is, maybe it should be expressed as a limitation, rather than made mandatory for the non-limited case (default to supported, unless stated otherwise). I think we already had this discussion with Rob and Mark regarding the QUAD/DUAL flags, which made conversion from spi-nor to spi-mem non-backward compatible for some controllers (some spi-nor controller drivers were considering the absence of spi-{tx,rx}-width as 'use the max supported by the controller if the device supports it' while the spi subsystem goes for the more conservative 'use single SPI if spi-{tx,rx}-width is missing'). If we introduce a new property, maybe it'd be a good thing to think twice before taking this decision. FWIW, I'd vote for a 'spi-no-dtr' property to express board-level limitations. Orthogonal to this is the question of where we should put those flags, and I'm still not convinced we need that at the spi level (at least not yet).