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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B251C433FE for ; Thu, 28 Oct 2021 06:51:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36A1160296 for ; Thu, 28 Oct 2021 06:51:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbhJ1Gx2 (ORCPT ); Thu, 28 Oct 2021 02:53:28 -0400 Received: from mail-eopbgr40066.outbound.protection.outlook.com ([40.107.4.66]:11030 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229784AbhJ1Gx1 (ORCPT ); Thu, 28 Oct 2021 02:53:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ILknCp8ityMvDHlWx2lg8igBernJzwOY1jLY0atpE9hTpaHiDKHT7JbNYkK7VBjFeat7ODdqZHSjqgo0QBfKln01d7/Y+cYU6rgraLA0mhThu4lHChER0w/ZV0JL+BfOv0xTjnwQdbEtH1mdK6DAYDZenAryBwrwKg9QSuVyJby1EW67DRgodJyJqr7AbRkqMtOSOPpYUHxTcnp8jcvKxKKalJ98R8SsUjZ3xalQz3DxlACikQ1RoePRUxT4Xmplwr/ldkynGuD/ipX6LmJ38XhgJf01cSOBtPaiKflKsBY/KGqExFZ4ShnrJ5QIjdLjFbugDxJ90yzl7BwqBUFeXg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Y6fmau527/f3PG9X6FHgB0VpvmZKnPz6FODMSf+4KXg=; b=IX92Kvn2plU2/J2qK4WDcVXSkIhTnddH52I/JKCNbELI3dGjAsCIv/aGfQJRi4QxNeyiMRvh3izT1ywF7biJYD+GLoPVmLBNP5OX+wFEbmwy+5byO61pBSKilkKd+0ouB0Fd8Bxg9T/xYBeZXe6ANk4x5KELYFmvdu8/z+u0gQ6w1nP0mhL6Ar+ury32Mw+5qHTwlfAt4NHs7m0PNzChBMOJiwZxwciAjcAKlI2bElZb0CXgLFNKw6fJmemCZdz3tmwsgVasMbhV/g+1q5AsIGIbNlToRwtjYRBGKhkxK2lQkaWWIlZEiaxhOMdELwGc1dRFDtI8HT5rPup6ZtB6Cw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y6fmau527/f3PG9X6FHgB0VpvmZKnPz6FODMSf+4KXg=; b=UB6WQAOTCQRCijaZHGxN41Wu2EWZb5IOMRL1hMo+LzZvp9C2AUp20Ho/W0Noeu80nEyytiocgEnTSlfi5HnsLY3++7r3434Qb06pIN7HUhOPacBQSyltIPB4K+2+ukHf0YG993MjgavjKexg/JX6BgynkN25Pe522F8cLYPCHqE= Received: from AS8PR04MB8676.eurprd04.prod.outlook.com (2603:10a6:20b:42b::10) by AS8PR04MB8641.eurprd04.prod.outlook.com (2603:10a6:20b:428::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15; Thu, 28 Oct 2021 06:50:58 +0000 Received: from AS8PR04MB8676.eurprd04.prod.outlook.com ([fe80::b059:46c6:685b:e0fc]) by AS8PR04MB8676.eurprd04.prod.outlook.com ([fe80::b059:46c6:685b:e0fc%5]) with mapi id 15.20.4649.015; Thu, 28 Oct 2021 06:50:58 +0000 From: Richard Zhu To: Mark Brown CC: Francesco Dolcini , "l.stach@pengutronix.de" , "bhelgaas@google.com" , "lorenzo.pieralisi@arm.com" , "jingoohan1@gmail.com" , "linux-pci@vger.kernel.org" , dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "kernel@pengutronix.de" Subject: RE: [PATCH v3 3/7] PCI: imx6: Fix the regulator dump when link never came up Thread-Topic: [PATCH v3 3/7] PCI: imx6: Fix the regulator dump when link never came up Thread-Index: AQHXxxe5hpSrQkcPqkWGr8lEYEKQh6vjlGkAgAAC9gCAAPQyAIAAlv4AgAFuIxA= Date: Thu, 28 Oct 2021 06:50:58 +0000 Message-ID: References: <1634886750-13861-1-git-send-email-hongxing.zhu@nxp.com> <1634886750-13861-4-git-send-email-hongxing.zhu@nxp.com> <20211025111312.GA31419@francesco-nb.int.toradex.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fd4e38b1-cf87-4313-bc18-08d999df4c21 x-ms-traffictypediagnostic: AS8PR04MB8641: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ACvWo3uQbw4B+X2uoWpry7i+lyjU8CLSVX2BlyltWyJNX2a+ppnS3xVDsdxfYEBR8pRsttCQjgTp3NFQ5fIFC5YMF7vGK/67CdsGqsE/cmaihl2WC8crmMgYtFZpVk57L0PFQZu8YfFut/+0FwZ0v31DSsI9c9c9iTPNrSOiX6+Qzanop6eNOmaql38k5gP3TVV9l+G9TW9f1bnZl9BbS1zCtFm1HIiNyHlhv3tImWx/7QssXwVfcjtFMHQ0OsyMGBZdliUHgNMX7NUVemjeiOd4Cao4Yx2kHsCv0HoJztNDeHRHWKeFnYm5iWjoLCf2E1zn806eQmq9t+GGD+Um7QTBljMEZwnZ5TcEPsXzD1nOANL34pa6ULZJqle2emi43ocoVzhGZyj/u0DbnO4YQQCVQCecRG91lYBifnDT0IatQd5/9VPz2jCCWULNOOYQqHdy19R/KcWHHSEBOiJQS3DRyvWEsd3f/u8F9Jl1lb2Z74Sv5GSBYC/DJSXYLUpXDus9NpJB/8SXnHWoyt7wm9lD2g8R1Rf3pw3bsZIdAxT87Oq5CSWI03OM2WcXXf+QWYKkJbXFCifpmS5oz4wL7B4rvEOW1tS2Z57yg3raR5Dkh6h1pck9HGp3S5rkD0thMc5SX/gBEWxoLUsc1SkhdjaBtTKTa3RDlhYfSauz9XD/tEwbgEi5pu4bPJbJTUW7PfNgTszrCC/UDhOPpaTnog== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8676.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(316002)(7696005)(26005)(186003)(83380400001)(122000001)(38070700005)(54906003)(71200400001)(38100700002)(8676002)(8936002)(4326008)(86362001)(52536014)(66446008)(66476007)(66556008)(66946007)(76116006)(64756008)(7416002)(6916009)(6506007)(508600001)(9686003)(33656002)(55016002)(2906002)(5660300002)(53546011);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?npiNq2QDpHjij4XOCd/bd8erAW7ZSANCB4kkFa5m32Dtl/+ayOMNmrCs9gRR?= =?us-ascii?Q?gvb7JmIvNmSJeSA+iV4iXCrslqRmMph0gcvuWNBQGkDxYy/JvWbdbnSOkfPu?= =?us-ascii?Q?RV7fqFwCnv/pnOXWVtI3eabClWU6IWMeVVk/tH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wp2HHJHbglDrKg+TBpkDhneujsWgkNzCyJnWrfxojrnAcwvB2iN32i9?= =?us-ascii?Q?gpFo/GwxDUymOtt3c7M4mmivD5ua7yV9UGkyv22mUF8xex6zwW6Yf4TP45DU?= =?us-ascii?Q?/Ug5MqbqwomSWAzoUJ+0aGb78mVZVstC958f3kvpiLqLm17WLrl67OUCx7DV?= =?us-ascii?Q?ye3Uy3dEW84eYqBWnEvBTE9oRbcOuy7BI0gbzSHmLgsI8jge7+RvfO0tAzJo?= =?us-ascii?Q?THJcyGtMu78Vw+cp3pLCLaL/PtikQ4LK4yeBN2TI5N/W1120py2q1dwsosys?= =?us-ascii?Q?KcnLuo1r5RfGWyYqKS5/ideBkICXzt6XDb1C0dXwLTrHGM9zciYx1ULkZguX?= =?us-ascii?Q?8HBdYZ+/WQRU3yn5IFuSF75JzlKIHCV2UeUJRLUa9S6Ac7S0+WAeHJsvLKq8?= =?us-ascii?Q?tWSZG2gTl1+Te7+YLOPYILCZ36F2bIROibGQ5qGYlYHJI5RKhQY9PYPxVunq?= =?us-ascii?Q?DCsCgUiW9Q3NkB8VQflacWUs6FiG894CSuU+IBh+qrmrrxI4Bq1XZEOg1Xrq?= =?us-ascii?Q?dnn02Qyiy1v9cE/GeFY8wGhot7ooTzEhrCW3lGUpwV4YOhP6GFg/dZl26Xll?= =?us-ascii?Q?/w=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8676.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd4e38b1-cf87-4313-bc18-08d999df4c21 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Oct 2021 06:50:58.3273 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: sGegPMtWGx5Ge5whacxlJKvYk2RU+h45iBvSu7KFSPjNR2dxdpaVDHXNdayfRmJze78PZJ2Y8f7paEbp5Mh5nw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8641 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Mark Brown > Sent: Tuesday, October 26, 2021 6:58 PM > To: Richard Zhu > Cc: Francesco Dolcini ; > l.stach@pengutronix.de; bhelgaas@google.com; > lorenzo.pieralisi@arm.com; jingoohan1@gmail.com; > linux-pci@vger.kernel.org; dl-linux-imx ; > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > kernel@pengutronix.de > Subject: Re: [PATCH v3 3/7] PCI: imx6: Fix the regulator dump when link > never came up >=20 > On Tue, Oct 26, 2021 at 02:18:18AM +0000, Richard Zhu wrote: >=20 > > > I should probably also say that the check for the regulator looks > > > buggy as well, regulators should only be optional if they can be > > > physically absent which does not seem likely for PCI devices. If > > > the driver is not doing something to reconfigure the hardware to > > > account for a missing supply this is generally a big warning sign. > > > > > > I really don't understand why regulator support is so frequently > > > problematic for PCI controllers. :( >=20 > > [Richard Zhu] Hi Mark: > > The _enabled check is used because that this regulator is optional in t= he > HW design. > > To make the codes clean and aligned on different HW boards, the > _enabled check is added. >=20 > I would be really surprised to see PCI hardware that was able to support = a > supply being physically absent, and this use of _is_enabled() is quite > simply not how any of this is supposed to work in the regulator API even > for regulators that can be optional. [Richard Zhu] Actually, this regulator is one GPIO fixed regulator. Controlled by SW to turn on (GPIO high) or turn off (GPIO low) the supply. In some boards designs, this supply might be always on(GPIO high). So, in point of SW driver view, this regulator is optional. >=20 > > The root cause is that the error return is not handled properly by the > controller driver. > > I.MX PCIe controller doesn't support the Hot-Plug, and it would return > > -110 error when PCIe link never came up. Thus, the _probe would be > failed in the end. > > The clocks/regulator usage balance should be considered by i.MX PCIe > controller, that's all. > > It's not a general case, and the problem is not caused by the regulator > support. >=20 > Perhaps it's not causing problems in this design but if the supply is eve= r > shared with anything else then the software will run into trouble. > There will also be problems with the error handling on a system where > the regulator needs to be controlled. [Richard Zhu] This GPIO fixed regulator is only used by controller driver. It makes sense to disable the enabled regulator when driver probe is failed= . >=20 > Please fix your mail client to word wrap within paragraphs at something > substantially less than 80 columns. Doing this makes your messages > much easier to read and reply to. [Richard] Sorry about that. BR Richard 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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BED31C433F5 for ; Thu, 28 Oct 2021 06:52:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E80E6108F for ; Thu, 28 Oct 2021 06:52:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8E80E6108F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yWY3zXaIqkqiQOnWi7J/3A+yxbgT23JvZpGI5nxzWAE=; b=IzWlUMlnwUJR/4 TYMdreACHJOd21JTFv2dab2mZ2nF5I0snVpdflodQo3ZzKlA7ll1XhWGrUSTYOcHgi0tmuqXE++xR 4sYrlVS5MtGAj1xiAh5ZNUQRdBFXLlENnIt8nGTjGVjYksLT8Jl049vbTgNSHJ+nk+eIq+JI82Myl TDeAcoPD3Mb+mwrFtlsXoHiv+wdE5JfI84GnKBpKautbjxBdkGouSFBoJMfSI/h6+VDUojmgnlN+D EC1IMyfe6UQsBqD5zuG00mWzXnNhZ4LDMMg6rry3TOJKk6VJ4Uk+iJc0s9jt9IFz7Pof6xXNV8HUC 3BJveCN3aif0K6pgRRKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfzFi-0071kp-8b; Thu, 28 Oct 2021 06:51:06 +0000 Received: from mail-eopbgr40071.outbound.protection.outlook.com ([40.107.4.71] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfzFd-0071jT-RT for linux-arm-kernel@lists.infradead.org; Thu, 28 Oct 2021 06:51:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ILknCp8ityMvDHlWx2lg8igBernJzwOY1jLY0atpE9hTpaHiDKHT7JbNYkK7VBjFeat7ODdqZHSjqgo0QBfKln01d7/Y+cYU6rgraLA0mhThu4lHChER0w/ZV0JL+BfOv0xTjnwQdbEtH1mdK6DAYDZenAryBwrwKg9QSuVyJby1EW67DRgodJyJqr7AbRkqMtOSOPpYUHxTcnp8jcvKxKKalJ98R8SsUjZ3xalQz3DxlACikQ1RoePRUxT4Xmplwr/ldkynGuD/ipX6LmJ38XhgJf01cSOBtPaiKflKsBY/KGqExFZ4ShnrJ5QIjdLjFbugDxJ90yzl7BwqBUFeXg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Y6fmau527/f3PG9X6FHgB0VpvmZKnPz6FODMSf+4KXg=; b=IX92Kvn2plU2/J2qK4WDcVXSkIhTnddH52I/JKCNbELI3dGjAsCIv/aGfQJRi4QxNeyiMRvh3izT1ywF7biJYD+GLoPVmLBNP5OX+wFEbmwy+5byO61pBSKilkKd+0ouB0Fd8Bxg9T/xYBeZXe6ANk4x5KELYFmvdu8/z+u0gQ6w1nP0mhL6Ar+ury32Mw+5qHTwlfAt4NHs7m0PNzChBMOJiwZxwciAjcAKlI2bElZb0CXgLFNKw6fJmemCZdz3tmwsgVasMbhV/g+1q5AsIGIbNlToRwtjYRBGKhkxK2lQkaWWIlZEiaxhOMdELwGc1dRFDtI8HT5rPup6ZtB6Cw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y6fmau527/f3PG9X6FHgB0VpvmZKnPz6FODMSf+4KXg=; b=UB6WQAOTCQRCijaZHGxN41Wu2EWZb5IOMRL1hMo+LzZvp9C2AUp20Ho/W0Noeu80nEyytiocgEnTSlfi5HnsLY3++7r3434Qb06pIN7HUhOPacBQSyltIPB4K+2+ukHf0YG993MjgavjKexg/JX6BgynkN25Pe522F8cLYPCHqE= Received: from AS8PR04MB8676.eurprd04.prod.outlook.com (2603:10a6:20b:42b::10) by AS8PR04MB8641.eurprd04.prod.outlook.com (2603:10a6:20b:428::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15; Thu, 28 Oct 2021 06:50:58 +0000 Received: from AS8PR04MB8676.eurprd04.prod.outlook.com ([fe80::b059:46c6:685b:e0fc]) by AS8PR04MB8676.eurprd04.prod.outlook.com ([fe80::b059:46c6:685b:e0fc%5]) with mapi id 15.20.4649.015; Thu, 28 Oct 2021 06:50:58 +0000 From: Richard Zhu To: Mark Brown CC: Francesco Dolcini , "l.stach@pengutronix.de" , "bhelgaas@google.com" , "lorenzo.pieralisi@arm.com" , "jingoohan1@gmail.com" , "linux-pci@vger.kernel.org" , dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "kernel@pengutronix.de" Subject: RE: [PATCH v3 3/7] PCI: imx6: Fix the regulator dump when link never came up Thread-Topic: [PATCH v3 3/7] PCI: imx6: Fix the regulator dump when link never came up Thread-Index: AQHXxxe5hpSrQkcPqkWGr8lEYEKQh6vjlGkAgAAC9gCAAPQyAIAAlv4AgAFuIxA= Date: Thu, 28 Oct 2021 06:50:58 +0000 Message-ID: References: <1634886750-13861-1-git-send-email-hongxing.zhu@nxp.com> <1634886750-13861-4-git-send-email-hongxing.zhu@nxp.com> <20211025111312.GA31419@francesco-nb.int.toradex.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fd4e38b1-cf87-4313-bc18-08d999df4c21 x-ms-traffictypediagnostic: AS8PR04MB8641: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ACvWo3uQbw4B+X2uoWpry7i+lyjU8CLSVX2BlyltWyJNX2a+ppnS3xVDsdxfYEBR8pRsttCQjgTp3NFQ5fIFC5YMF7vGK/67CdsGqsE/cmaihl2WC8crmMgYtFZpVk57L0PFQZu8YfFut/+0FwZ0v31DSsI9c9c9iTPNrSOiX6+Qzanop6eNOmaql38k5gP3TVV9l+G9TW9f1bnZl9BbS1zCtFm1HIiNyHlhv3tImWx/7QssXwVfcjtFMHQ0OsyMGBZdliUHgNMX7NUVemjeiOd4Cao4Yx2kHsCv0HoJztNDeHRHWKeFnYm5iWjoLCf2E1zn806eQmq9t+GGD+Um7QTBljMEZwnZ5TcEPsXzD1nOANL34pa6ULZJqle2emi43ocoVzhGZyj/u0DbnO4YQQCVQCecRG91lYBifnDT0IatQd5/9VPz2jCCWULNOOYQqHdy19R/KcWHHSEBOiJQS3DRyvWEsd3f/u8F9Jl1lb2Z74Sv5GSBYC/DJSXYLUpXDus9NpJB/8SXnHWoyt7wm9lD2g8R1Rf3pw3bsZIdAxT87Oq5CSWI03OM2WcXXf+QWYKkJbXFCifpmS5oz4wL7B4rvEOW1tS2Z57yg3raR5Dkh6h1pck9HGp3S5rkD0thMc5SX/gBEWxoLUsc1SkhdjaBtTKTa3RDlhYfSauz9XD/tEwbgEi5pu4bPJbJTUW7PfNgTszrCC/UDhOPpaTnog== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8676.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(316002)(7696005)(26005)(186003)(83380400001)(122000001)(38070700005)(54906003)(71200400001)(38100700002)(8676002)(8936002)(4326008)(86362001)(52536014)(66446008)(66476007)(66556008)(66946007)(76116006)(64756008)(7416002)(6916009)(6506007)(508600001)(9686003)(33656002)(55016002)(2906002)(5660300002)(53546011); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?npiNq2QDpHjij4XOCd/bd8erAW7ZSANCB4kkFa5m32Dtl/+ayOMNmrCs9gRR?= =?us-ascii?Q?gvb7JmIvNmSJeSA+iV4iXCrslqRmMph0gcvuWNBQGkDxY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oePaggfrBUddkwanyzjiJmwyHATqH/vW/PclrEKpCdwFTpOaRJllE?= =?us-ascii?Q?NMgk4wp2HHJHbglDrKg+TBpkDhneujsWgkNzCyJnWrfxojrnAcwvB2iN32i9?= =?us-ascii?Q?gpFo/GwxDUymOtt3c7M4mmivD5ua7yV9UGkyv22mUF8xex6zwW6Yf4TP45DU?= =?us-ascii?Q?/Ug5MqbqwomSWAzoUJ+0aGb78mVZVstC958f3kvpiLqLm17WLrl67OUCx7DV?= =?us-ascii?Q?ye3Uy3dEW84eYqBWnEvBTE9oRbcOuy7BI0gbzSHmLgsI8jge7+RvfO0tAzJo?= =?us-ascii?Q?THJcyGtMu78Vw+cp3pLCLaL/PtikQ4LK4yeBN2TI5N/W1120py2q1dwsosys?= =?us-ascii?Q?KcnLuo1r5RfGWyYqKS5/ideBkICXzt6XDb1C0dXwLTrHGM9zciYx1ULkZguX?= =?us-ascii?Q?8HBdYZ+/WQRU3yn5IFuSF75JzlKIHCV2UeUJRLUa9S6Ac7S0+WAeHJsvLKq8?= =?us-ascii?Q?tWSZG2gTl1+Te7+YLOPYILCZ36F2bIROibGQ5qGYlYHJI5RKhQY9PYPxVunq?= =?us-ascii?Q?DCsCgUiW9Q3NkB8VQflacWUs6FiG894CSuU+IBh+qrmrrxI4Bq1XZEOg1Xrq?= =?us-ascii?Q?dnn02Qyiy1v9cE/GeFY8wGhot7ooTzEhrCW3lGUpwV4YOhP6GFg/dZl26Xll?= =?us-ascii?Q?/w=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8676.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd4e38b1-cf87-4313-bc18-08d999df4c21 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Oct 2021 06:50:58.3273 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: sGegPMtWGx5Ge5whacxlJKvYk2RU+h45iBvSu7KFSPjNR2dxdpaVDHXNdayfRmJze78PZJ2Y8f7paEbp5Mh5nw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8641 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211027_235101_918134_64D9EFD0 X-CRM114-Status: GOOD ( 33.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > -----Original Message----- > From: Mark Brown > Sent: Tuesday, October 26, 2021 6:58 PM > To: Richard Zhu > Cc: Francesco Dolcini ; > l.stach@pengutronix.de; bhelgaas@google.com; > lorenzo.pieralisi@arm.com; jingoohan1@gmail.com; > linux-pci@vger.kernel.org; dl-linux-imx ; > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > kernel@pengutronix.de > Subject: Re: [PATCH v3 3/7] PCI: imx6: Fix the regulator dump when link > never came up > > On Tue, Oct 26, 2021 at 02:18:18AM +0000, Richard Zhu wrote: > > > > I should probably also say that the check for the regulator looks > > > buggy as well, regulators should only be optional if they can be > > > physically absent which does not seem likely for PCI devices. If > > > the driver is not doing something to reconfigure the hardware to > > > account for a missing supply this is generally a big warning sign. > > > > > > I really don't understand why regulator support is so frequently > > > problematic for PCI controllers. :( > > > [Richard Zhu] Hi Mark: > > The _enabled check is used because that this regulator is optional in the > HW design. > > To make the codes clean and aligned on different HW boards, the > _enabled check is added. > > I would be really surprised to see PCI hardware that was able to support a > supply being physically absent, and this use of _is_enabled() is quite > simply not how any of this is supposed to work in the regulator API even > for regulators that can be optional. [Richard Zhu] Actually, this regulator is one GPIO fixed regulator. Controlled by SW to turn on (GPIO high) or turn off (GPIO low) the supply. In some boards designs, this supply might be always on(GPIO high). So, in point of SW driver view, this regulator is optional. > > > The root cause is that the error return is not handled properly by the > controller driver. > > I.MX PCIe controller doesn't support the Hot-Plug, and it would return > > -110 error when PCIe link never came up. Thus, the _probe would be > failed in the end. > > The clocks/regulator usage balance should be considered by i.MX PCIe > controller, that's all. > > It's not a general case, and the problem is not caused by the regulator > support. > > Perhaps it's not causing problems in this design but if the supply is ever > shared with anything else then the software will run into trouble. > There will also be problems with the error handling on a system where > the regulator needs to be controlled. [Richard Zhu] This GPIO fixed regulator is only used by controller driver. It makes sense to disable the enabled regulator when driver probe is failed. > > Please fix your mail client to word wrap within paragraphs at something > substantially less than 80 columns. Doing this makes your messages > much easier to read and reply to. [Richard] Sorry about that. BR Richard _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel