From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F38FAC433C1 for ; Thu, 25 Mar 2021 12:55:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF9D361A11 for ; Thu, 25 Mar 2021 12:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230352AbhCYMyf (ORCPT ); Thu, 25 Mar 2021 08:54:35 -0400 Received: from mga17.intel.com ([192.55.52.151]:32934 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbhCYMyR (ORCPT ); Thu, 25 Mar 2021 08:54:17 -0400 IronPort-SDR: Sx7xwz8KGMAlYuDKOd+DCtUxEW6VtALRBJ24th0Absde/zChsQzCRTIEknvtrjK31Qz0uWQ4PO teDr40wZrytQ== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="170899352" X-IronPort-AV: E=Sophos;i="5.81,277,1610438400"; d="scan'208";a="170899352" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2021 05:54:17 -0700 IronPort-SDR: 0UZcZSDDN+4EZ6NdZE6wdeQVxlVSZPThBvSUsY1Z0jpTq41Ef7NW/naabCdg2U6qVoUzWm2rBJ jJr85sXM+nUA== X-IronPort-AV: E=Sophos;i="5.81,277,1610438400"; d="scan'208";a="375057264" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2021 05:54:15 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lPPV6-00G2tJ-5t; Thu, 25 Mar 2021 14:54:12 +0200 Date: Thu, 25 Mar 2021 14:54:12 +0200 From: Andy Shevchenko To: Roger Pau Monne Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Mika Westerberg , Andy Shevchenko , Linus Walleij , linux-gpio@vger.kernel.org Subject: Re: [PATCH v3] intel/pinctrl: check REVID register value for device presence Message-ID: References: <20210325090947.73729-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210325090947.73729-1-roger.pau@citrix.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 25, 2021 at 10:09:47AM +0100, Roger Pau Monne wrote: > Use the value read from the REVID register in order to check for the > presence of the device. A read of all ones is treated as if the device > is not present, and hence probing is ended. > > This fixes an issue when running as a Xen PVH dom0, where the ACPI > DSDT table is provided unmodified to dom0 and hence contains the > pinctrl devices, but the MMIO region(s) containing the device > registers might not be mapped in the guest physical memory map if such > region(s) are not exposed on a PCI device BAR or marked as reserved in > the host memory map. Applied for fixes, thanks! > 91d898e51e60 ('pinctrl: intel: Convert capability list to features') > Suggested-by: Andy Shevchenko > Signed-off-by: Roger Pau Monné > --- > Changes since v2: > - Return ENODEV. > - Adjust code comment. > > Changes since v1: > - New in this version. > --- > Cc: Mika Westerberg > Cc: Andy Shevchenko > Cc: Linus Walleij > Cc: linux-gpio@vger.kernel.org > --- > drivers/pinctrl/intel/pinctrl-intel.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c > index 8085782cd8f9..9fc5bba514ea 100644 > --- a/drivers/pinctrl/intel/pinctrl-intel.c > +++ b/drivers/pinctrl/intel/pinctrl-intel.c > @@ -1491,8 +1491,13 @@ static int intel_pinctrl_probe(struct platform_device *pdev, > if (IS_ERR(regs)) > return PTR_ERR(regs); > > - /* Determine community features based on the revision */ > + /* > + * Determine community features based on the revision. > + * A value of all ones means the device is not present. > + */ > value = readl(regs + REVID); > + if (value == ~0u) > + return -ENODEV; > if (((value & REVID_MASK) >> REVID_SHIFT) >= 0x94) { > community->features |= PINCTRL_FEATURE_DEBOUNCE; > community->features |= PINCTRL_FEATURE_1K_PD; > -- > 2.30.1 > -- With Best Regards, Andy Shevchenko