Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5429652ybc; Wed, 27 Nov 2019 04:01:08 -0800 (PST) X-Google-Smtp-Source: APXvYqxuiGWGXj+wIJW5ILgo5kUVP2BxQkwa6YuWhrlMspWZ0xFOKjNSK4cjI3elx8UFfYbAGohi X-Received: by 2002:a17:906:3107:: with SMTP id 7mr29546193ejx.125.1574856068399; Wed, 27 Nov 2019 04:01:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574856068; cv=none; d=google.com; s=arc-20160816; b=ghnjUJtBTy8p8gRad4oUahnaDu7ueAG09g4+KFECAJWhYkAzg92kec80bRruzVQyDe sP17dWeszotDejbl+PdsAje5fi95BpJyUuT+Kz1/zt1/1MHzaz1TdQRyRCtc/cnAWooq GKvTg1yCzZvKYbnEhHdHSyn49I8qSoJsUSSOJG9D06DZo8/pMjPXAdq04HoiECdWSYFL qEf1Vs08YqmJO5hEvlsGqBoQrInuOf9XfhZCzF/ZT4R5F9W6zYtcs4AlpVkqDebaij11 owwNbvLo2xbIy+RnVgK8jAGfsSqY0K45nJg5V+xZfRAjpKRQGTG1Lxntp8PvSH/lxEYv t8kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=dLCduunuHSXGNUTQhWaOufnCLY7lqNqBFiB4mZ4JNs8=; b=AhZW+TXwf+zQs6F6IZcJ7vgss3diyCJ5niKDSa+chAnsLNsXonzRo0IeYIBSK6B0LM QcoE8e9pB0sCZ6/kQH/qdoWV71E3z8YEgP+t4wq76TWggIJk/Fi8jkcFuSI3T2PDEe6U svs2T50ZLx1XKGU2M4AKjaKbwiv2o+yW84/dqhbhbd+fYN+XZB6cSYK/W1clvzjZVF16 t/dDGEKV0bPRGnqJlQv8JRxJkfSX6M4k1N2oOPB5yvphK4Vct96LUIEFwfzopwpF/vkF F3aPlu2FIO1nUqgIH26kVFcCW8ZWURGJjg3sdj0glOpx3xZC9f6kgTb9aqA0FWwQXjL+ NMDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="DoDl/MEa"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si10598701eda.429.2019.11.27.04.00.42; Wed, 27 Nov 2019 04:01:08 -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; dkim=pass header.i=@linaro.org header.s=google header.b="DoDl/MEa"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726560AbfK0L7s (ORCPT + 99 others); Wed, 27 Nov 2019 06:59:48 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:44259 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726320AbfK0L7s (ORCPT ); Wed, 27 Nov 2019 06:59:48 -0500 Received: by mail-lj1-f193.google.com with SMTP id g3so24126591ljl.11 for ; Wed, 27 Nov 2019 03:59:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dLCduunuHSXGNUTQhWaOufnCLY7lqNqBFiB4mZ4JNs8=; b=DoDl/MEaINjRQjtZnw6j+sllNqlFQ2Ud3V4/8nhZS9c9EyqJ/1xeIVHnSsCPsI4Dfi y88vKb4l6iyCaIltTH1vCXx5aYw7cYBEFc87bNdXFiQlMUeKz89sYEZPpwKVH0VYOQRY pVG4oIJEO8+l653O0drH+vT5RKIgL0SHyN5IrlbKSdcHSzfi2lITCO3IbvStUrx7m4fV uBrag4rRI5vMht+Biw8n76OXpYU7Bp4CyNtTrovEcwi06lgT3hy3oZ5RqCX0T4Dw4yx1 TYR7x7dysu/6aDOD3P+j3ttjsDI6mNLtixA9zA840AjdpOBA7l4pkqJxBgp6+XlwqcN5 Y0yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dLCduunuHSXGNUTQhWaOufnCLY7lqNqBFiB4mZ4JNs8=; b=BtPYIBVGFS5eAKLvKJugtpKjIxShBQFofqoiIT3339mbiEBOX2lmSApEgvYha1/LKH 2F5sLWtpHEN803V7sVJWhiOj/YSCloiAJff9kQcgcN7dZJauQcMFZSBLODkyjmjekxL5 Y/rXf0za5XJi2KwYl0k4SXpdeSYan1Skqy1QuuQhtRgR8/zNamgizxVALZzUXjn2I9+3 kBO1iXfcerlxHs/RMsJWo/ubE5imDqrr2bY4iYf2UnifhOMoa6WwZK2FdFzHmBf4dYE+ dxXmjkxpUOE9PA7/XXNwpWOxjwGWEhK3BlTgBGh7qd5b6E8FKAj7QSJUhEWg/C4UWhgH C/jg== X-Gm-Message-State: APjAAAXyziTmBlcKpzsDNxOYv1mpPCaP4KQ5umLZSrorm+P8kMkJVOgR US4YovE7m6xAkz9KYnR9obGajfTfDK1S6UeghsIuSA== X-Received: by 2002:a2e:b4f6:: with SMTP id s22mr18080062ljm.218.1574855986167; Wed, 27 Nov 2019 03:59:46 -0800 (PST) MIME-Version: 1.0 References: <20191126164140.6240-1-ckeepax@opensource.cirrus.com> <20191127115419.GA10451@ediswmail.ad.cirrus.com> In-Reply-To: <20191127115419.GA10451@ediswmail.ad.cirrus.com> From: Linus Walleij Date: Wed, 27 Nov 2019 12:59:34 +0100 Message-ID: Subject: Re: [PATCH] spi: cadence: Correct handling of native chipselect To: Charles Keepax Cc: Gregory Clement , Mark Brown , linux-spi , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 27, 2019 at 12:54 PM Charles Keepax wrote: > On Wed, Nov 27, 2019 at 11:42:47AM +0100, Linus Walleij wrote: > > On Tue, Nov 26, 2019 at 5:41 PM Charles Keepax > > wrote: > > The original patch > > f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs") > > came with the assumption that native chip select handler needed > > was to be converted to always expect a true (1) value to their > > ->set_cs() callbacks for asserting chip select, and this was one of > > the drivers augmented to expect that. > > > > Which is fine, I am not greatly invested in either symantics > of the set_cs callback although if we were changing that we > should have probably updated the kerneldoc comments for it. > > Although I do have a question if that is that case what is the > expected way to handle the polarity of the chip select? Because > it seems to me you would end up with each driver checking the > SPI_CS_HIGH flag in set_cs and doing the invert locally, whereas > with the pass the logic level system the core can centralise that > inversion. I guess I thought it was logical (hah!) that the core provide a signal that is true if a condition is asserted, and then the driver decides whether that drives the line low or high. But just saying that the callback sets the physical level out to the device works too, so the patch as-is: Acked-by: Linus Walleij > > As > > 3e5ec1db8bfe ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS") > > essentially undo that semantic change and switches back to > > the old semantic, all the drivers that were converted to expect > > a high input to their ->set_cs() callbacks for asserting CS need > > to be reverted back as well, but that didn't happen. > > > > So we need to fix not just cadence but also any other driver setting > > ->use_gpio_descriptors() and also supplying their own > > ->set_cs() callback and expecting this behaviour, or the fix > > will have fixed broken a bunch of drivers. > > > > But we are lucky: there aren't many of them. > > In addition to spi-cadence.c this seems to affect only spi-dw.c > > and I suppose that is what Gregory was using? Or > > something else? > > > > I will go do some digging and see what I can find. Thanks. Yours, Linus Walleij