From patchwork Wed Nov 8 09:19:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10048053 X-Patchwork-Delegate: horms@verge.net.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A8FAB6032D for ; Wed, 8 Nov 2017 09:20:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1E692A4AF for ; Wed, 8 Nov 2017 09:20:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 950F92A4D3; Wed, 8 Nov 2017 09:20:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15E132A4AF for ; Wed, 8 Nov 2017 09:20:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750817AbdKHJUF (ORCPT ); Wed, 8 Nov 2017 04:20:05 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:57310 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750777AbdKHJUD (ORCPT ); Wed, 8 Nov 2017 04:20:03 -0500 Received: by mail-wr0-f194.google.com with SMTP id q66so1743674wrb.13; Wed, 08 Nov 2017 01:20:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ABFbLqqRVZNsbx+/aBshlGoOvSI89yQQfG1g3EK4z/Y=; b=cvA1J6XTHPyWuRAHudNG7pUFPaOCskw9jTI3uxvnmHic6O5fUfxYlHNgFtlSola4dg F12kY7UxwhG0zXF+lv/pOmyWHalNZ7BzP70bbLFDQVbPfgbnr0MOxrG3jm7aiDJwWjUT NU4fVdgL+Z7ii4Yif6wijBgD2AeT0g4xcLgDuGoyXQP7BhtbEjgIgtxZVHiiQCTfopbi WyxdIf4anVvvHEuefmeI53nfYfBfcWKCanFiQgWWLD/aAYgPYgCDN4r0wBcu3JwwyPGf 2QCbTE293ul2U4aFRm+BrkfmLiqLRCvmJKX+RtNN7sRJZQKqUmLvBJ4opDqJ/ybelwT7 W5BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ABFbLqqRVZNsbx+/aBshlGoOvSI89yQQfG1g3EK4z/Y=; b=HhFhCbAuMcD4NfVImCj/NWC8XTEj+lNLaGShVGn0fE8xMXJldjbM28evk/MPAOf9T8 IgZ0raSkGQuvsDwK4Fi6ILxL6TdtyH1b0QWIIzqVn/MWBkGJYc22ES2ez564NQjCnKh0 iW2tjboc3Gg8X7+sVt/BjD6AZSkJopNLpQ7P3m5J9BOWBv5OsTKDXF65uS2eqIHFueUw 93sPmwgkqY7VgDM9Z80gClhlni8jr4/oijiQksboFmPShUq1QTOu49FbFgfgwNCOyYAX OZxbcoWRdf0JFLUUQYdlF1/m3R1Weuy8IC1aQpj9vB7t7XdS8sdt4D4/o7tFzTFLWKhr OWYA== X-Gm-Message-State: AJaThX5/lp6E4FWpK+Wy/kSXxYJN8h9fx8mqvyYn/XlrxddHpwqM8VcZ pFul4mlKX6DyDSGotH5ye3Let+FG X-Google-Smtp-Source: ABhQp+RVv9HoIIP6VYXfwJkvxmucfm2VN+/IYJcYUBKv72xn4UZ5reIHuBuZdZ6dZSV/eyt09putVg== X-Received: by 10.223.135.121 with SMTP id 54mr1326969wrz.160.1510132801441; Wed, 08 Nov 2017 01:20:01 -0800 (PST) Received: from kurokawa.lan (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id o80sm3649891wmg.6.2017.11.08.01.20.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Nov 2017 01:20:00 -0800 (PST) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-pci@vger.kernel.org Cc: Dien Pham , Hien Dang , Marek Vasut , Geert Uytterhoeven , Simon Horman , Wolfram Sang , linux-renesas-soc@vger.kernel.org Subject: [PATCH] PCI: rcar: Use runtime PM to control controller clock Date: Wed, 8 Nov 2017 10:19:56 +0100 Message-Id: <20171108091956.8537-1-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dien Pham The controller clock can be switched off during suspend/resume, let runtime PM take care of that. Signed-off-by: Dien Pham Signed-off-by: Hien Dang Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Simon Horman Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org --- drivers/pci/host/pcie-rcar.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 8b51208875fc..889603783f01 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -145,7 +145,6 @@ struct rcar_pcie { void __iomem *base; struct list_head resources; int root_bus_nr; - struct clk *clk; struct clk *bus_clk; struct rcar_msi msi; }; @@ -917,15 +916,6 @@ static int rcar_pcie_get_resources(struct rcar_pcie *pcie) if (IS_ERR(pcie->base)) return PTR_ERR(pcie->base); - pcie->clk = devm_clk_get(dev, "pcie"); - if (IS_ERR(pcie->clk)) { - dev_err(dev, "cannot get platform clock\n"); - return PTR_ERR(pcie->clk); - } - err = clk_prepare_enable(pcie->clk); - if (err) - return err; - pcie->bus_clk = devm_clk_get(dev, "pcie_bus"); if (IS_ERR(pcie->bus_clk)) { dev_err(dev, "cannot get pcie bus clock\n"); @@ -957,7 +947,6 @@ static int rcar_pcie_get_resources(struct rcar_pcie *pcie) err_map_reg: clk_disable_unprepare(pcie->bus_clk); fail_clk: - clk_disable_unprepare(pcie->clk); return err; } @@ -1126,6 +1115,13 @@ static int rcar_pcie_probe(struct platform_device *pdev) rcar_pcie_parse_request_of_pci_ranges(pcie); + pm_runtime_enable(pcie->dev); + err = pm_runtime_get_sync(pcie->dev); + if (err < 0) { + dev_err(pcie->dev, "pm_runtime_get_sync failed\n"); + goto err_pm_disable; + } + err = rcar_pcie_get_resources(pcie); if (err < 0) { dev_err(dev, "failed to request resources: %d\n", err); @@ -1136,13 +1132,6 @@ static int rcar_pcie_probe(struct platform_device *pdev) if (err) goto err_free_bridge; - pm_runtime_enable(dev); - err = pm_runtime_get_sync(dev); - if (err < 0) { - dev_err(dev, "pm_runtime_get_sync failed\n"); - goto err_pm_disable; - } - /* Failure to get a link might just be that no cards are inserted */ hw_init_fn = of_device_get_match_data(dev); err = hw_init_fn(pcie);