Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp306175ybi; Fri, 24 May 2019 04:13:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxuDWkNU28u1ch+egVEiy7q0P3i6KDUQaD7Zp75UjUk2TlV79BGq2+y0d5bbuVF/S6Nv8i X-Received: by 2002:a17:902:8e8a:: with SMTP id bg10mr50201674plb.247.1558696402376; Fri, 24 May 2019 04:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558696402; cv=none; d=google.com; s=arc-20160816; b=gHzKUclsglAuyOuU/HKvYUEisFuc+FbouCiyCVe9QpvloEoWc6WQ3rW2fCD3qRNRq+ RCtmWtkBrGOkKGMvCDRytZMFRQGkPRBELBVACGSb85qbSXGUvJqwhFwS9VOW0PkfuG4h 1pd0g/3LAvhUKIKxCWkNWUvMcZD8bsv34TCVrdzt5qGB11h1zyBf0jRaLGxZrWZx3B0r Hk+8jDilc79ZfGSB2GVgFCqAB+9OYPgEew4eGh5lvopDg4L+5Eanjul/eH4AdMSpnB9q KQ4G82hfUCJNfQikqxXUWyGDH0d5PfGf7hGoFzXE/jNgOxAiVjUZy8fKZx1DQrrcd319 peDw== 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=+7J3y/fRv6XMK7gAKFuZ39eh40Af0wWeNJ4E0Zu6iH0=; b=y+pjAm51kKydoy1DylJsZj/fv1fZ6hrrycf2MFbX5xZJOTWGfNS7+VWprdmFbK7/CN CCnfR+z+cN0yUyFbt41lsD+44UsDLZLodpb7Wv4mLJsEWlAj9EV3D3Kwm8DV6G8TBUQL EzdM6Cv/uaB+lIAC69wRbewGSK/h52d5IvRnaeRirfeY1dTjVR+VEFSSyMCO+RcisuEL tMpy8N5A1Bu8CIQZaaIYAtoV1+Z1S/v1rXNyYar0ze7iqUsAfyTE97MJ+sepgZ+4tTxp Z3dnz15c3rapr+tx8CyZfEesk/cbPIS8omZ2Kc7KSwasvxmuRtW6OME1PeJiQc5++UH+ CtqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HYoUYWIh; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si3873793pgi.278.2019.05.24.04.13.05; Fri, 24 May 2019 04:13:22 -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=@gmail.com header.s=20161025 header.b=HYoUYWIh; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390908AbfEXLLR (ORCPT + 99 others); Fri, 24 May 2019 07:11:17 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46536 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390865AbfEXLLP (ORCPT ); Fri, 24 May 2019 07:11:15 -0400 Received: by mail-pg1-f194.google.com with SMTP id o11so274309pgm.13; Fri, 24 May 2019 04:11:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+7J3y/fRv6XMK7gAKFuZ39eh40Af0wWeNJ4E0Zu6iH0=; b=HYoUYWIh3uxH3NcvCusp33T+XJZGa3fl3oPvO7fB2blpt4QwpbEZ766Q6PdGDR/jo0 6aSBiNvJpU5mDgahFRvLB9LBIE2cUeHXTyFTHszceQw8jfChjmoT29ycbO6G4mLcjkFM pHmIEiwTY7vIw5+kqnuhBDwVnP5a0U+mlm3P/Z74RJ6ALUTXP6fXK8OpIH9JE+0F4oEp UMbXXoMwNDDjUD4OvuQVRdpp07ivomZNl79TGq401M3SdkdgZKlsxtTzM6YfVwppXTC0 aPua41Z1j5GWqWXGUY7VMsobwPUDzDvp/uzkRzVojgE11zv26SIUT8a71z36yQBTprjB U8hA== 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=+7J3y/fRv6XMK7gAKFuZ39eh40Af0wWeNJ4E0Zu6iH0=; b=mHLV9fA11ZNU+paXL2N30QMK3/hfDBpooKjUHTBPhu02JGkkB7CjVD1nRWHwnYxnE7 8h7AgAe4NKECFlMHYG6krBPXSXLEYcieL5cPCU3h/FzCh3a65Ivpp/wIiCsaRpkJgFTk 6cE60Me17zMlVjCnmiO1WNL9LFa5LaPq6b52IlQpStD22AW0njU5OzCEVPpGDvwOSpdw 33HE01UcwSIgN3AUggo5yKKj5woRvitZKQmnqiZMkzmqVMxwhsV9aExkAnSqo925mkd/ JSglaXmVNILGextcuQtX0PhubGIw2cttWB3ERjQaqNB9YCfp06Ho5OlPKTk3VY3RVV6r 5NtQ== X-Gm-Message-State: APjAAAVVa+HM5hyMJmTqWoXnyKG4G2Fy9Py6JQsIcUxXaNo+dWy7PZKu rz5kUJYSapQGvMaYCNrjpt3SfKcuiiVzMROISW1yfVttl5s= X-Received: by 2002:a63:4d0b:: with SMTP id a11mr16877570pgb.74.1558696275115; Fri, 24 May 2019 04:11:15 -0700 (PDT) MIME-Version: 1.0 References: <20190524094825.16151-1-sr@denx.de> <20190524102002.GT2781@lahna.fi.intel.com> In-Reply-To: <20190524102002.GT2781@lahna.fi.intel.com> From: Andy Shevchenko Date: Fri, 24 May 2019 14:11:04 +0300 Message-ID: Subject: Re: [PATCH 1/2 v2] serial: mctrl_gpio: Check if GPIO property exisits before requesting it To: Mika Westerberg Cc: Stefan Roese , "open list:SERIAL DRIVERS" , Linux Kernel Mailing List , Andy Shevchenko , Yegor Yefremov , 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, May 24, 2019 at 1:21 PM Mika Westerberg wrote: > > On Fri, May 24, 2019 at 11:48:24AM +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. > > We have a board where ASL provides _DSD for CTS and RxD pins. I'm afraid this won't work on it. Basically we need to understand the use of the GPIOs in UART. In our case it's an out-of-band wake up source for UART. Simply requiring GPIOs to be present is not enough. Perhaps property like 'modem-control-gpio-in-use' (this seems a bad name, given for sake of example). > > Signed-off-by: Stefan Roese > > Cc: Mika Westerberg > > Reviewed-by: Mika Westerberg -- With Best Regards, Andy Shevchenko