Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp317519pxb; Wed, 11 Nov 2020 04:36:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqTKOA6B35GXIAuKlOXdKzRuWlizRJk3KXcy+0cf23EbS8ZjdbZkKPzaEVYsiEeDMNwvsM X-Received: by 2002:a17:906:14d1:: with SMTP id y17mr25553239ejc.15.1605098202683; Wed, 11 Nov 2020 04:36:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605098202; cv=none; d=google.com; s=arc-20160816; b=wnKyFVBk792QSYgRQ0yanw+rqzC+OH3O0xUiaPOffz8X7EsMQ+/VjMKKVvwKbWq45A XIqDvBnJfXKz7vvqD+bp4hqePWHsRZN96XPQYOGKtWMXlG6pqkvFmEDLRa/b+gBeP3rM aGjTE72DgUMZzTI7zOtVKtDQWAsox7b9BkZVsOIwo6dQ0KQiqgW4BhPO0PuMjV++Ah6M TpbKxgT+Edb0+Kri+vUaeTHaYOXDDg0/wsRLyqeJQ06PoEcIu/9iews0Mavlvp3vcNEm N2KN0JPYx/xxAovR4da1inGyfoEp+BkqXZez2iLMFJNUbBBMQ2DP1m8uz/ubglp94NVJ n+Aw== 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=vGMKcgORO1J/Tw8FCaq5Pj9aSd3NNdXKC8s+Kkf9ZKE=; b=gWSsdMFWhG3uYhUOlrCt2w6yFbRYCyKwYkUL55A1KseS2xbIntSVFabXckk7Hk0AeI 1+AAB+hb2kKPf0EfIRj4B1mq7k+hnj6Z17BMQZK4bM2Z3oWNmwTJMbZb1khnsTWsJxrP ZKBi8tA8hI8H6EZOG583V7ASlRn1tRPV676E7O6Q+sATAuvx4CobrUbU+sAtArKUt/6X nk2/mlgj9qd2Qt8dHjC33TF5j5i2fOdyUccHX+BheF1SgDGFzLAdQaLIxxqedaqpyEUF WwBQJwEbUg4dEKIb1AkMVXCRBrOok6yMJl/c6teqAYZs/05ujrkGNhDaaD/NQ7PzR71+ xyzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fsnCrTS2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 3si1278584ejn.180.2020.11.11.04.36.17; Wed, 11 Nov 2020 04:36:42 -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; dkim=pass header.i=@kernel.org header.s=default header.b=fsnCrTS2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726220AbgKKMdo (ORCPT + 99 others); Wed, 11 Nov 2020 07:33:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:41658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbgKKMdo (ORCPT ); Wed, 11 Nov 2020 07:33:44 -0500 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B128D20709; Wed, 11 Nov 2020 12:33:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605098023; bh=ZYiBC0YrninJE98s5Zgaav4ZW54I6qKZUYUtc6gbFsE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fsnCrTS2BqQQc9PWMPmbtfDDirkacuqed7ivpqsXBk7QJBOChsvBxIDxn4mpmzTc8 ItNH1tAFYDFydDP/RO1cYyq2P3wzbtF/QF4rPwqkSPxVSGNUSnj1qxtzqGKGRFDMrq 6qh+y9ofPbC1yRguibnDZPm0Wr1908/ygDhqxRYo= Date: Wed, 11 Nov 2020 12:33:27 +0000 From: Mark Brown To: Linus Walleij Cc: Sven Van Asbroeck , Andy Shevchenko , Jonathan Cameron , Simon Han , Lukas Wunner , linux-spi , Linux Kernel Mailing List Subject: Re: [PATCH v1] spi: fix client driver breakages when using GPIO descriptors Message-ID: <20201111123327.GB4847@sirena.org.uk> References: <20201106150706.29089-1-TheSven73@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="R3G7APHDIzY6R/pk" Content-Disposition: inline In-Reply-To: X-Cookie: I'm not available for comment.. User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --R3G7APHDIzY6R/pk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Nov 11, 2020 at 02:05:19AM +0100, Linus Walleij wrote: > On Mon, Nov 9, 2020 at 3:41 PM Sven Van Asbroeck wrote: > > I don't disagree. Fact is that after the imx cspi bus driver was converted > > to gpio descriptors, most spi client drivers broke. It would be great if this > > could be fixed. Any method that the community can find a consensus on, > > would be great :) > I think your patch is the quick fix. > I would say that anything that has: > spi->mode = ... > is essentially broken. This is not clear to me, most of these settings are things that are constant for the device so it's not clear that they should be being set by the device tree in the first place. The idea that the chip select might be being inverted like it is by this whole gpiolib/DT/new binding thing is breaking expectations too. > The core sets up vital things in .mode from e.g. device tree in > of_spi_parse_dt(): > /* Mode (clock phase/polarity/etc.) */ > if (of_property_read_bool(nc, "spi-cpha")) > spi->mode |= SPI_CPHA; > if (of_property_read_bool(nc, "spi-cpol")) > spi->mode |= SPI_CPOL; > if (of_property_read_bool(nc, "spi-3wire")) > spi->mode |= SPI_3WIRE; > if (of_property_read_bool(nc, "spi-lsb-first")) > spi->mode |= SPI_LSB_FIRST; > if (of_property_read_bool(nc, "spi-cs-high")) > spi->mode |= SPI_CS_HIGH; > All this gets overwritten and ignored when a client just assigns mode > like that. Not just SPI_CS_HIGH. I doubt things are different > with ACPI. OTOH most of these are things the device driver should just get right without needing any input from DT, there's a few where there's plausible options (eg, you can imagine pin strap configuration for 3 wire mode) so generally it's not clear how many of these make sense for anything other than spidev. This binding all predates my involvement so I don't know the thought process here. --R3G7APHDIzY6R/pk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl+r2hYACgkQJNaLcl1U h9DTWgf+MQUdmL9lgsVd+Jaqdv+8dJmFHJArfbBVRKXrwDvdWXk4clNSEeuiL+7+ 0Tvp/X0/Z5Dsue2uKmfAqkrgluuXRd8vR3fkrKNRrwIPafh0ohWbQz/DheSw7h2A CfL5A5Hhn8lNH5RvcAKWQW52YWd9N4jWPqW9t8XAd/ENPtNBVNg2SLBD508KjCL3 vT8XF8/gr77mwrQzWzPEE/SSYcYov+49jPVuyQlqzYAt3Mt8NIoX4QdRYVj2/VSt SCg70Cq0xZPcM9JUsz5ZVQpkrhG66vK7qjAWbvzPZk/vp/DuR2uuY0hKzEflw+W+ aGPBzJTNTN31uQQ97MSlkeRpwJTeRg== =e49X -----END PGP SIGNATURE----- --R3G7APHDIzY6R/pk--