Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1620530img; Sat, 23 Mar 2019 07:41:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsn7KgueceFf0UVQUNDvpqPq+K+KZHPqX69xNa9vnB2KtWWGzd/55qvXWceJI+oLsy4+OE X-Received: by 2002:a17:902:bcc9:: with SMTP id o9mr1606343pls.65.1553352102598; Sat, 23 Mar 2019 07:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553352102; cv=none; d=google.com; s=arc-20160816; b=ePV5lTdvN6oO27E7abcykCT4nNQqva9/iVZDrEsgCAxe/9rptOPwUIL21ZlFpjMw2G UcvpANcWAKumNh9ElTh1b7BW593g5LgONNFXC+E6XqXTGs9Oom/kHQISPehkHZNRg7Hk kg//dkYreLjJHP0rDTBaa03vopr5wlVi3Ai7dnAyY4pE3yYVa/P9tSLSoxIOwpmNb+Fr n9fL5rM64Ydq2yCmAdniC9xH9GhF9sfR9rALHCJmiSb+8JLCKBtE3/3rKYJypYZ1kZxz LOHNbEMqx9Eqbs47NnIqdk7ZD6iSZCaaP+ri1TGS4bUhQVc0wwqDF8Evxj13XvNqKL7M wEBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=VS1ahpFuYFV4NmPn8Kph+6zm6Kx0r5ttBoH/tc36CQM=; b=gUS0nIOgDyeGxzJ8UZVQEX4DeELyDXN6JOdw9IC9+RGXx3Z5ZNBq1TYQGfWh5Ph+fP ISBm0jby7CJSDxCeJv1RHmfbvJK17pvZVpSx1SuOh87vDBwoLL+Gejcj4RDpKmDze9+6 O7IAekdYLrPw2nwpviVODmt2ztCgoHghXe/aQlKMe0jAuoFqhC7BZQMQPFGQsqlPsvga gU1ShKDQRtHJtzk3PDGUoABSiu3HrCC0eu8SB3zQNpoRr5fZqAYMgIG/JjgfO0mhmlms jmzRehm9dKiTyPgJKGTLY/UL+mSPdzx0Yv78zoEYJX7SFEKxyH1XEDSz060ocUMTHRNb kuew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@goldelico.com header.s=strato-dkim-0002 header.b=KEhpYwun; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d17si7615784pgk.479.2019.03.23.07.41.26; Sat, 23 Mar 2019 07:41:42 -0700 (PDT) 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=fail header.i=@goldelico.com header.s=strato-dkim-0002 header.b=KEhpYwun; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727544AbfCWOkv (ORCPT + 99 others); Sat, 23 Mar 2019 10:40:51 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.51]:10505 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbfCWOkv (ORCPT ); Sat, 23 Mar 2019 10:40:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1553352046; s=strato-dkim-0002; d=goldelico.com; h=To:References:Message-Id:Cc:Date:In-Reply-To:From:Subject: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=VS1ahpFuYFV4NmPn8Kph+6zm6Kx0r5ttBoH/tc36CQM=; b=KEhpYwunKwVqI9pnV9kL3V/ujlVRdQOo8+oSj4r3MSXqipYducelHbH0CRCThlCnWM b2on2ipl4M9zzlA7TVJuHbCjloO2R8b4+iA3IMxttLp3UKNI9DYEaOMZtkYa7l97PxrY foEZdFU1L5GUtBs66l5wN7ewbwmO/153J4g3WdQR7LatpVmiQ0y2jIzTtNcVhn++mAyN x5/hQA7jbHoM44YbwerMHbIqCGNGno7SMjQlFPqUdmZVFiRgQAxq7Np+WWm6NpAbdbyh nYMB530Sy20AWIPgPlejadWT0Nd1ZK8uTciB3dxgg0ConV0CiHGH1j0tYNt1RaLpGNAs lIgw== X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMgPgp8VKxflSZ1P34KBj5Qpw97WFDleUXA0Oqng=" X-RZG-CLASS-ID: mo00 Received: from imac.fritz.box by smtp.strato.de (RZmta 44.16 DYNA|AUTH) with ESMTPSA id h04075v2NEeTqTx (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sat, 23 Mar 2019 15:40:29 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: [BUG] gpiolib: spi chip select legacy support breaks modern chip select and whitens the GTA04 LCD panel From: "H. Nikolaus Schaller" In-Reply-To: <7509BFB6-36E4-441A-9F16-7A4FEE7F7CF3@goldelico.com> Date: Sat, 23 Mar 2019 15:40:29 +0100 Cc: LKML , Discussions about the Letux Kernel , kernel@pyra-handheld.com, "open list:GPIO SUBSYSTEM" , linux-spi@vger.kernel.org, devicetree , Rob Herring , Mark Brown Content-Transfer-Encoding: quoted-printable Message-Id: <5488EF42-08DB-4273-95FF-49ED31E27472@goldelico.com> References: <7509BFB6-36E4-441A-9F16-7A4FEE7F7CF3@goldelico.com> To: Linus Walleij X-Mailer: Apple Mail (2.3124) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, I am sorry to report that your patch (1) c1c04cea13dc gpio: of: Fix logic inversion together with the basic patch (2) 6953c57ab172 gpio: of: Handle SPI chipselect legacy bindings leads to a severe regression for our GTA04 board. The symptom was easy = to see but really difficult to understand: the LCD panel stopped working (did only show white = pixels) after upgrading from v5.0 to v5.1-rc1. In a long bisect session, I was able to identify patch (1) as the first = bad commit and started to analyse what the code is supposed to do and then found the older = patch (2). I learned that it tries to handle a legacy "spi-cs-high" property of SPI = slaves, but was stopped from doing so by a bug (1). So only with both patches, the legacy = handler becomes active which explains why it was not noticed earlier. Now, our GTA04 device tree from 2014 (v3.16-rc1) was already written = without any legacy spi properties in mind (3) c2e138bc8ed80 ARM: dts: omap3-gta04: Add display support So it has no spi-cs-high property and just defines constant 0 for the = flags (GPIO_ACTIVE_HIGH after some fix from 2015) assuming that this is sufficient. And it was until = before v5.1-rc1. This is now wrongly turned into an GPIO_ACTIVE_LOW by your legacy fix = which makes the panel stop feeling responsible to receive any initialization data over SPI. Yes, there is a new message in the boot log for this case, but to be = honest, nobody did see it before I found the code that does print it. A non-working LCD panel was = a too distracting indicator and could have been everything (most likely drm or the panel driver or = clock or regulator or dma setup or whatever)... So your assumption that this case is the exception as stated in commit = message of (2) seems not to be true. IMHO it should be standard (at least since 2015) that there = is GPIO_ACTIVE_HIGH and no spi-cs-high. So your patch (2) gives a legacy property a new priority = over modern style. BTW: the spi-cs-high is described as optional and indicative in the = bindings document. But it now appears to be required to get a cs-high. By the way, the detection of spi-cs-high still seems to be wrong as of = v5.1-rc1. Shouldn't it look at the child node for "spi-cs-high" and not the controller node = pointer? As far as I understand the current code, all such legacy flags are therefore ignored and should = break all boards that use spi-cs-high and GPIO_ACTIVE_HIGH. Of course, adding spi-cs-high; (at the controller node!) of our device = tree can make it work, but I do not like to be forced to introduce a legacy property to our DTS = file, just because gpio-lib tries to fix a legacy problem in the SPI subsystem (quite = mind-twisting cross-subsystem dependencies, aren't they?). The real problem seems to be that the legacy spi-cs-high property itself = still exists although it should not be needed for ca. 5 years. =46rom all this I conclude that = nobody really needs this legacy support or does test it. And if he/she does, they should better = fix the cs-gpios entries in the DTS and remove spi-cs-high completely. Therefore I would suggest: * revert both patches as soon as possible (v5.1-rc series) to remove the = unexpected spi legacy code handler from the gpio subsystem. * replace all uses of spi-cs-high by correct cs-gpios flags - unless = they already are there. fgrep spi-cs-high arch/*/boot/dts/*.dts* shows only a handful of DTS = candidates. * fix spi-bus.txt documentation to describe this potential pitfall. Then we can leave our GTA04 display and device tree untouched as from = v3.16-rc1 up to v5.0.x. BR and thanks, Nikolaus