[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3] intel/pinctrl: check REVID register value for device presence


  • To: <linux-kernel@xxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Thu, 25 Mar 2021 10:09:47 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Gy90LQX86leF6ZR1WNAfhPrItTPQigLCB93lZMNhTss=; b=CAVRFwMPNbhlJB4fb9GQE/TbbFQ7+GoKOEMhJcT4qQHdMayEtby/Wvtqril7AE3NW7Eh1FsWxAThH2T6ctKPLYcK+NGnLLWcVvVuE5nDcvwQcG3xOsq7RdxUavGVdbP23n10YRdUaQjmjGvOiKwQzSEQncF34Yk6uFnVH2kx68YvX+IMtsvG2Wi76qalB7xLumwc8goPo577PiosEnOSAPHjHr1dOstLHeY2beMf2jsS3F95EaoB0RxoB8cWQidZPpo4PZs/O/cUPBAxpnXCqz629AtPjMQISMvL4L9sKmGntHAZ4Inp0LIAV+8aM/UtD39WMMZ41ZMisizYAVU+Ww==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X5HS7lg12ay8wSsRtufc2sjiW4UeF2Id344NhnhJGvFea0MCy2u88xNVUmGc1YWF28UUX8NgCJhcNDmlZIXN+rBc4E8dTb8YesxH2pqpmL+hIdeVGqIq/0I78EBtK5SJ2sC16jeuNOmbpYnW1f84lEFgv1dIhTUiNs1XpdYFe3gAMxIIZVbybxIKhBS1qplRHRWgO52Boa06iepE3XXBj2GcGp85iHIDidfXQ3mTe281S2VhHIv+K1Uc5lgYXsU4MAYZr6LP0ImOMHgamrUGpt+nIQJvrru8hzjCuohpyDZnJ2Z9qsjOA5YZ8+agEftenRCb5VF/E3ehzcPn1Sj09Q==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>, Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>, Andy Shevchenko <andy@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>, <linux-gpio@xxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 25 Mar 2021 09:10:17 +0000
  • Ironport-hdrordr: A9a23:9Xg9j6v3ZFUnxs8yh7OWpIAB7skCkoYji2hD6mlwRA09T+WxrO rrtOgH1BPylTYaUGwhn9fFA6WbXXbA7/dOjrU5FYyJGC3ronGhIo0n14vtxDX8Bzbzn9Qw6Y 5JSII7MtH5CDFB4PrSyBWkEtom3dmM+L2pg+Cb9Ht2UQR2cchbjjtRICzzKDwTeCBtA50lGJ 2Aovddrz27dngNKui9DH8JX+/Mzue77q7OSxgAGhIh9U2ynSqlgYSKaCSw8zU/d3d0wbkk+X XYiACR3Muemtyy1xO07R600714g93ko+EzZvCkrugwBnHShh2zZIJnMofywgwdhO208l4lnJ 3tjn4bTr1OwkjcdG20vhfhsjOIuF1Fiw6AuC+lqEDuvNDjQ3YCA9dB7LgpDSfx0VYqv913zc twrgWknqdQZCmw+RjV1pzjUhFnkVeMunwykeIfpGw3a/pjVJZh6aMY509bC5EGAWbT750mCv BnCIXm6O9Rak7yVQGSgkBfhPiXGlgjFBaPRUYP/uSTzjhthXh8i28V3tYWkHss/I80IqM0qt jsA+BNrvVjX8UWZaVyCKMqWs2sEFHARhrKLSa7PUnnPLtvAQOCl7fHpJEOoM26cp0By5U/3L 7bVklDiGI0c0XyTeWTwZxw9AzXSmnVZ0Wj9uhuo7xC/pH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LDbg79GXPcawDBgRAotXUCIlV2KaUmPXqn3RfHimrZSYved7P2jo1Rgc6eTOzdHiajfkC YWSgRqcF+YUMnkrH3+lwACK1vNRoFeIe+EBkX/DhgEHN3Ka78Aqz2Grblw1U+rlApiGM3bNKtz IgSvvxn1inGRG9jURV8ttjR3LisxTQs5q/hV+1OWnHzpc/hfr26qJ3ntCgIpwBM9wXbNycKQoC EoE=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

91d898e51e60 ('pinctrl: intel: Convert capability list to features')
Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Changes since v2:
 - Return ENODEV.
 - Adjust code comment.

Changes since v1:
 - New in this version.
---
Cc: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
Cc: Andy Shevchenko <andy@xxxxxxxxxx>
Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
Cc: linux-gpio@xxxxxxxxxxxxxxx
---
 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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.