Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4659179pxb; Tue, 28 Sep 2021 00:39:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlqK2EfRP18Z7EtDSN9jRRJeEFiBLYlpB3NQcWvvhy/Sji1f55CWo3cYcm91pC4rcgvtp5 X-Received: by 2002:a17:906:31d7:: with SMTP id f23mr4910783ejf.190.1632814748760; Tue, 28 Sep 2021 00:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632814748; cv=none; d=google.com; s=arc-20160816; b=SJCEF81yCfSGlbaHqVukCZU6S3GIyeCLWUAEGR6cQ6yLI7nRnJaMcIXW2Lszdo2WEN +84zHnXepRtMuko1NP3vZPI7Kw8X6UeMqEURB0NX7r2oZ4O+pwWIjt6yktIBaN4BnX82 L0kH7xoFSQRXzUwDpR1YncdrGXXhyG8pvLdB2o6f0c6TMw2Ia9t+YLUZ6g/xyETjr9ME j+AAR/RdF8LC3Co2iWC1aplzH+ctjLlXWov0FfVEcIQ5+VNLlsyKWvd8ZtwqkpaJW5MD /vKMkdzEF7YBBGIaBG5mdncFnTj9evuanXo1AoaJ2wFBvd5tJWS7KpHeNGp4F9Lt0JTc VzQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gS2kTe2/BrD0IZYFqnwXGervqiujxCcdyYMFdUFA8/E=; b=motL88SOdBTr9RWpUu5sVfrTT3mzo/o5TktPt/dkG276erY/2hwHImXu0GBCCg7Ta+ aeLbep5UnDr7mTqy3izWJcucYpQuGIf/1wHrX1c5dLgU1ZaGAnJJI4YIr7uhnDul9YMI YvJECL25YZhrG7fzYK21u7bKKQ70xYvQ241tSNiJTnxROeoX7cnfyj99jHBkqG6EqDPA LJMqXBvtbEabHMdViLqRe8u1QQGULvYRbe1G8DEUdM8sQXb+XbfoiRcrKZJuCB+Z1Vpc JEf/v87staDsUJ/A1n8hVfFbAFQtNapkzwwbd0b0CtD2vLp3fE7oP6z9KT2TzjGwEJ35 dgGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V7QooksZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c14si2117173eds.145.2021.09.28.00.38.22; Tue, 28 Sep 2021 00:39:08 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V7QooksZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239496AbhI1HgW (ORCPT + 99 others); Tue, 28 Sep 2021 03:36:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:55934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239330AbhI1HgF (ORCPT ); Tue, 28 Sep 2021 03:36:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 66C776120C; Tue, 28 Sep 2021 07:34:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632814466; bh=axmn1RnvxQeX7oiXKGGbEvgu9vfWyq+RGPWvhaUey2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V7QooksZ9xbXAWiH9BwBfivTHzDafWYPMbMffrdqWorujFZjpXSWhlqGwPBGh3SoZ Lyz+QT2v6zxQSX2ZPqBpKX2pczkJPs9SXXgifPNIwsZfZTqFS9P+dBMC7VyPu0Prj3 0uAUa8yZ8z1+M/i19IH79NSSfwYN9/0U+7506JbzN4IzVd5WhyddVzY6p2hGSX8oZ/ YtLcO2tPPLmNOsCXQ3lt8NqUSVQCTfnloZr6zfVeI+jXra3WdIEWMRjAnGxgIiGEpn ytAIDo/JR/fNaQyIBIPvQdU5E0l54fUOLr8qQPcnO9uLrtC4f19i0oG4len2agpnCy Xr83CKcvcHIJA== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1mV7dA-000RQ7-Np; Tue, 28 Sep 2021 09:34:24 +0200 From: Mauro Carvalho Chehab To: Bjorn Helgaas Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Binghui Wang , Lorenzo Pieralisi , Rob Herring , Xiaowei Song , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v12 09/11] PCI: kirin: Add power_off support for Kirin 960 PHY Date: Tue, 28 Sep 2021 09:34:19 +0200 Message-Id: <81c6d2d0efca06a3a6bcd73033013365f22d8e0a.1632814194.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to prepare for module unload, add a power_off method for HiKey 960. Signed-off-by: Mauro Carvalho Chehab --- To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH v12 00/11] at: https://lore.kernel.org/all/cover.1632814194.git.mchehab+huawei@kernel.org/ drivers/pci/controller/dwc/pcie-kirin.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c index d5c29a266756..b17a194cf78d 100644 --- a/drivers/pci/controller/dwc/pcie-kirin.c +++ b/drivers/pci/controller/dwc/pcie-kirin.c @@ -343,6 +343,18 @@ static int hi3660_pcie_phy_init(struct platform_device *pdev, return hi3660_pcie_phy_get_resource(phy); } +static int hi3660_pcie_phy_power_off(struct kirin_pcie *pcie) +{ + struct hi3660_pcie_phy *phy = pcie->phy_priv; + + /* Drop power supply for Host */ + regmap_write(phy->sysctrl, SCTRL_PCIE_CMOS_OFFSET, 0x00); + + hi3660_pcie_phy_clk_ctrl(phy, false); + + return 0; +} + /* * The non-PHY part starts here */ @@ -560,7 +572,6 @@ static int kirin_pcie_add_bus(struct pci_bus *bus) return 0; } - static struct pci_ops kirin_pci_ops = { .read = kirin_pcie_rd_own_conf, .write = kirin_pcie_wr_own_conf, @@ -714,8 +725,12 @@ static int kirin_pcie_power_on(struct platform_device *pdev, return 0; err: - if (kirin_pcie->type != PCIE_KIRIN_INTERNAL_PHY) + if (kirin_pcie->type == PCIE_KIRIN_INTERNAL_PHY) { + hi3660_pcie_phy_power_off(kirin_pcie); + } else { + phy_power_off(kirin_pcie->phy); phy_exit(kirin_pcie->phy); + } return ret; } @@ -725,7 +740,7 @@ static int __exit kirin_pcie_remove(struct platform_device *pdev) struct kirin_pcie *kirin_pcie = platform_get_drvdata(pdev); if (kirin_pcie->type == PCIE_KIRIN_INTERNAL_PHY) - return 0; + return hi3660_pcie_phy_power_off(kirin_pcie); phy_power_off(kirin_pcie->phy); phy_exit(kirin_pcie->phy); -- 2.31.1