Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp520328ybh; Tue, 21 Jul 2020 00:49:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyaG/t/7keRf2Ph0wwB8VerQMJ0DijDdMicAQ1hq4Wra6RcydTljjUxVYrG12sYMVfo6H7 X-Received: by 2002:a17:906:3ac4:: with SMTP id z4mr22704916ejd.65.1595317779904; Tue, 21 Jul 2020 00:49:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595317779; cv=none; d=google.com; s=arc-20160816; b=cieLMOlzJPnG7Qtfvb1Iy07B2h1HlRA1bkj+dCSg+nv+77W2l5vok9bIOdhW3vOEpf bTj7QeDm9fhSkDMKsmUDlEzC6gBC3qCfuB9w5IqHuzgZdKMGRboGlWeLVAOfFKbst0+u t4+PYYm10QJGmSHm32BM/i0nr83iZZTGmU7X6yOrisCu+z5qA2BIr+j9LJ0cC2BYVdXe SCQaPyJMyy/6KQQ44Ecm1lqI2diE5D2bkoJRLZbDSkvBNlrTfZPbF4l2oxXeNBqI2D8o mZCXh76jh0SS8hsSRFRn8Knbpy0ZcRUyeD6iRjQY0XVv0eCVXd/e5B9htSaxKMbqAgp7 /Ebg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=sHgOtcI+I7IqZGYojmKRKqv4dbxvLcsIZeC1lizeTfM=; b=xkinXBoVofIyy92V+0LldeGwCJREUhNLKe7MpqzDoZbXJLPsGGIJnK6WdNtp8rLUza HF3/cdPQDMnfRQpxqGSlu0LyViuNyAns0lUIn3y6VA5dzKtD11LjuUezYUr6qm/TWXre 31R2VxPIYbL8S3m5egnixgKW4xdCHamoe4Ud8vqi0wmTnxE1DF5/0mlN6br3L3AYb+of 11wnoWIQWPeCMRKU86AoHKywmnmV+rFMvLO1UD837LIZKs8se15udOMp//UKcny7wew4 Lnlmg7YY4/geD7dSpjivjyTWYjZ2ICK8xK9Yhv8lBXkM9NUDp9win49kKwbkLFSpshyt Egqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si11549621eds.407.2020.07.21.00.49.16; Tue, 21 Jul 2020 00:49:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728345AbgGUHs1 (ORCPT + 99 others); Tue, 21 Jul 2020 03:48:27 -0400 Received: from inva021.nxp.com ([92.121.34.21]:48158 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726803AbgGUHs0 (ORCPT ); Tue, 21 Jul 2020 03:48:26 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 7784320154A; Tue, 21 Jul 2020 09:48:24 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 33B892003FA; Tue, 21 Jul 2020 09:48:20 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id C720040305; Tue, 21 Jul 2020 15:29:38 +0800 (SGT) From: Richard Zhu To: l.stach@pengutronix.de, bhelgaas@google.com, shawnguo@kernel.org, festevam@gmail.com Cc: linux-pci@vger.kernel.org, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Richard Zhu Subject: [PATCH 2/2] PCI: imx: add another regulator for imx pcie Date: Tue, 21 Jul 2020 15:44:30 +0800 Message-Id: <1595317470-9394-2-git-send-email-hongxing.zhu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595317470-9394-1-git-send-email-hongxing.zhu@nxp.com> References: <1595317470-9394-1-git-send-email-hongxing.zhu@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org One more regulator is required to turn on the external oscillator populated on the iMX6QP SABRESD board. Add another regulator to enable PCIe on iMX6QP SABRESD board. Signed-off-by: Richard Zhu --- drivers/pci/controller/dwc/pci-imx6.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 8f08ae53f53e..9e1563601835 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -81,6 +81,7 @@ struct imx6_pcie { u32 tx_swing_low; int link_gen; struct regulator *vpcie; + struct regulator *vepdev; void __iomem *phy_base; /* power domain for pcie */ @@ -507,6 +508,14 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) return; } } + if (imx6_pcie->vepdev && !regulator_is_enabled(imx6_pcie->vepdev)) { + ret = regulator_enable(imx6_pcie->vepdev); + if (ret) { + dev_err(dev, "failed to enable vepdev regulator: %d\n", + ret); + goto err_pcie_vepdev; + } + } ret = clk_prepare_enable(imx6_pcie->pcie_phy); if (ret) { @@ -595,6 +604,13 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) err_pcie_bus: clk_disable_unprepare(imx6_pcie->pcie_phy); err_pcie_phy: + if (imx6_pcie->vepdev && regulator_is_enabled(imx6_pcie->vepdev) > 0) { + ret = regulator_disable(imx6_pcie->vepdev); + if (ret) + dev_err(dev, "failed to disable vepdev regulator: %d\n", + ret); + } +err_pcie_vepdev: if (imx6_pcie->vpcie && regulator_is_enabled(imx6_pcie->vpcie) > 0) { ret = regulator_disable(imx6_pcie->vpcie); if (ret) @@ -1178,6 +1194,12 @@ static int imx6_pcie_probe(struct platform_device *pdev) return PTR_ERR(imx6_pcie->vpcie); imx6_pcie->vpcie = NULL; } + imx6_pcie->vepdev = devm_regulator_get_optional(&pdev->dev, "vepdev"); + if (IS_ERR(imx6_pcie->vepdev)) { + if (PTR_ERR(imx6_pcie->vepdev) != -ENODEV) + return PTR_ERR(imx6_pcie->vepdev); + imx6_pcie->vepdev = NULL; + } platform_set_drvdata(pdev, imx6_pcie); -- 2.17.1