Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp745985ybi; Fri, 14 Jun 2019 02:39:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzt/bdpw3LUL0HyFLfTwdpjtSa8tR0qqj98dWJYDHuRloMVYbpzVcltdDbjVCO0Xvz4e68N X-Received: by 2002:a63:ec02:: with SMTP id j2mr36004403pgh.340.1560505161515; Fri, 14 Jun 2019 02:39:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560505161; cv=none; d=google.com; s=arc-20160816; b=oJwXpvX2FXE1OIiGgTBxk38RxUTs0+WJ00ZIFaa9vgrbUJfY5gYtD/S4/I4nEN+jA4 hEQrQ+Lk2xfUanx/OVDYnSc9UscSB5psEWXkpa59xD/VJIqFbHZCVCbbf8mZL6lyBgQX XLr5cJ0rIRY4mUdRDbjC7QMSEOuMS+seV6ENlXXi0NyOMJDMztJl7D9+kT7M4Zxl/SPT jjKKVfaV7h0gt+ikF8ewe6q1I2tJ8TbH5H0dh8IDHdyiOEqGzhfp2PJfgozeRBWVhAYl 1TF7x8nRhVC5vfTDAZ6TJi5f/OGF/gFYPY1USql0z+HG9SXR6E7pvrUrC+nqb21hsxTv X2ug== 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=Wpkxjv4XdUH50VTIe3/++vbOXy7Mm8zVzt0/ZIHrPWk=; b=Jl/AnOYnZJTowt7z6Z2oNeHPzhXip7p2U3LhQtFfjxvaqGDM3RROUy6oYCjGr6AkoP +dmd1DbR6Zjnqakpl08hbRXdC99U0sPHdsezHg9ogPPvPv3JxgCPSTc0WWhbgC/1gFtd MRorI1AP7Yc9KM8npW/OO1zM1Xl1SHNProRDUM8byXcrU1gz5M6B0pvFZinMuC4qVDO0 soOEUvj5GxCcYfR8OYRbyeG50NRivS3YDbUbvblKrv27/B59pSotn2EpcI39FkC/Kdpw ZhJFtsUA75T255JtDO9KyRCFqjsbVjd6Zcc7yob4dADQ7eZzxgDO9WRq2xblI6lbgcSM MAtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=Cjg9TXWK; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bc10si1783546plb.43.2019.06.14.02.39.05; Fri, 14 Jun 2019 02:39:21 -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=pass header.i=@googlemail.com header.s=20161025 header.b=Cjg9TXWK; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727082AbfFNJi4 (ORCPT + 99 others); Fri, 14 Jun 2019 05:38:56 -0400 Received: from mail-vs1-f68.google.com ([209.85.217.68]:42409 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726083AbfFNJi4 (ORCPT ); Fri, 14 Jun 2019 05:38:56 -0400 Received: by mail-vs1-f68.google.com with SMTP id 190so1354646vsf.9; Fri, 14 Jun 2019 02:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Wpkxjv4XdUH50VTIe3/++vbOXy7Mm8zVzt0/ZIHrPWk=; b=Cjg9TXWK0MXbh3dVZzjbaoawkxwalweheGkXBUUBWY0/RY1JpQHqQKFMRrnwv5Uc1R ycZrDGIKabqz9bsqun8Cf5rHEUJmrVxEKHGvLC1qmKWa/QqiwZGenOOaP5qGcfDiULiW 9wmzOzCwukfFdqmhTBvrOHNyZBYsSXZSwetDeeDb8EETXR0V0a7+THobGDO4UC/txrDy jBbenpX/Wi9wBtaMqQxy7qg9B0GMRIA78MbMSNhA/fT+GmC9D30axPUP5yKCN7DVqirk mlEKxLoVIdWBxL/Yf4IUITJMwIAI2i5MaMyD+jpwhyG3YvAmqEz0xmehnVUOdyBmnXLV wdlg== 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=Wpkxjv4XdUH50VTIe3/++vbOXy7Mm8zVzt0/ZIHrPWk=; b=T+r1rfV4VB9Qz4TBGFwhhEJXD5Ge7ks269cGbVDsswXwjccWmnNOwfCGVEscGYWJf5 oSlq5FH0vAOLhApPB4+2ydevmnqGZnuYWWFd2geqBZOG2B1kby2CZoQy5zsN+KLyx1lz hNobQQm4VEmV+jswvZX/2s+hiPoGv0xGwPN+snAAncOX1ZZ48kpdqQJVqacfY1oZDycZ UY2lgGZuiNnVzUc1DExi1CURb/ifluQT+DmtK0cYNTOO5dV7Oys6gX3yWJAqm/ekXpjV CsZxFFeZ/Ys+v0WbVFEmkRAsyWKm5I0zx+XOXJ/G8HLHWOo1bA00ZgQIIr8KCC4rGyyC 8GDw== X-Gm-Message-State: APjAAAW2srGGEfzNvFADKll2hqbvVAwIwglO7gTl5prgDDHX9kIVr85i 6uyKZYaf0uXKY6sc0WIExONLROqVls6QS+8LGbUiOA== X-Received: by 2002:a05:6102:382:: with SMTP id m2mr40706013vsq.134.1560505135124; Fri, 14 Jun 2019 02:38:55 -0700 (PDT) MIME-Version: 1.0 References: <20190613154542.32438-1-sr@denx.de> <20190613170802.GE9224@smile.fi.intel.com> <0bf6629c-cedf-e1dd-b42b-989c6711d390@denx.de> In-Reply-To: <0bf6629c-cedf-e1dd-b42b-989c6711d390@denx.de> From: Yegor Yefremov Date: Fri, 14 Jun 2019 11:38:31 +0200 Message-ID: Subject: Re: [PATCH 1/3 v6] serial: mctrl_gpio: Check if GPIO property exisits before requesting it To: Stefan Roese Cc: Andy Shevchenko , linux-serial@vger.kernel.org, kernel list , Mika Westerberg , Greg Kroah-Hartman , Giulio Benetti 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 Fri, Jun 14, 2019 at 11:29 AM Stefan Roese wrote: > > On 14.06.19 11:04, Yegor Yefremov wrote: > > On Thu, Jun 13, 2019 at 7:08 PM Andy Shevchenko > > wrote: > >> > >> On Thu, Jun 13, 2019 at 05:45:40PM +0200, Stefan Roese wrote: > >>> This patch adds a check for the GPIOs property existence, before the > >>> GPIO is requested. This fixes an issue seen when the 8250 mctrl_gpio > >>> support is added (2nd patch in this patch series) on x86 platforms using > >>> ACPI. > >>> > >>> Here Mika's comments from 2016-08-09: > >>> > >>> " > >>> I noticed that with v4.8-rc1 serial console of some of our Broxton > >>> systems does not work properly anymore. I'm able to see output but input > >>> does not work. > >>> > >>> I bisected it down to commit 4ef03d328769eddbfeca1f1c958fdb181a69c341 > >>> ("tty/serial/8250: use mctrl_gpio helpers"). > >>> > >>> The reason why it fails is that in ACPI we do not have names for GPIOs > >>> (except when _DSD is used) so we use the "idx" to index into _CRS GPIO > >>> resources. Now mctrl_gpio_init_noauto() goes through a list of GPIOs > >>> calling devm_gpiod_get_index_optional() passing "idx" of 0 for each. The > >>> UART device in Broxton has following (simplified) ACPI description: > >>> > >>> Device (URT4) > >>> { > >>> ... > >>> Name (_CRS, ResourceTemplate () { > >>> GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly, > >>> "\\_SB.GPO0", 0x00, ResourceConsumer) > >>> { > >>> 0x003A > >>> } > >>> GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly, > >>> "\\_SB.GPO0", 0x00, ResourceConsumer) > >>> { > >>> 0x003D > >>> } > >>> }) > >>> > >>> In this case it finds the first GPIO (0x003A which happens to be RX pin > >>> for that UART), turns it into GPIO which then breaks input for the UART > >>> device. This also breaks systems with bluetooth connected to UART (those > >>> typically have some GPIOs in their _CRS). > >>> > >>> Any ideas how to fix this? > >>> > >>> We cannot just drop the _CRS index lookup fallback because that would > >>> break many existing machines out there so maybe we can limit this to > >>> only DT enabled machines. Or alternatively probe if the property first > >>> exists before trying to acquire the GPIOs (using > >>> device_property_present()). > >>> " > >>> > >>> This patch implements the fix suggested by Mika in his statement above. > >>> > >> > >> Reviewed-by: Andy Shevchenko > > > > I cannot compile the driver without adding #include > > to drivers/tty/serial/serial_mctrl_gpio.c. > > > > My platform is AM335X (OMAP3). I've tried the patches both against the > > main repo and also tty-next. > > > > Other than that everything is working. > > Thanks for reporting. I'll wait a bit for other review comments and > tests (thanks Andy) and will then send v7 with this header included > (and compile tested on OMAP3) later next week. > > BTW: Could you please add a Tested-by-tag with the next version? Will do.