From patchwork Wed Jun 21 08:32:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9801193 X-Patchwork-Delegate: bhelgaas@google.com 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 90AA960234 for ; Wed, 21 Jun 2017 08:32:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FFA025F3E for ; Wed, 21 Jun 2017 08:32:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 747032854F; Wed, 21 Jun 2017 08:32:48 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI 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 E42FD25F3E for ; Wed, 21 Jun 2017 08:32:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752534AbdFUIcl (ORCPT ); Wed, 21 Jun 2017 04:32:41 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:35747 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752528AbdFUIcj (ORCPT ); Wed, 21 Jun 2017 04:32:39 -0400 Received: by mail-lf0-f47.google.com with SMTP id p189so89395046lfe.2 for ; Wed, 21 Jun 2017 01:32:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=4Y7L9hsP+jSxUqIqUU0KrO0B9gZYA+9QRCRvU070BSo=; b=OAPjEMv7pu5etN9jy05sJZXzJtyvof4xDOeGhPh2JoODyoxrldDwQxUYZSyKn5Sujp CZswd6OJVt7pZgNSDcAuB0Hg/ajulSJAw/uRtt6x/aq+fAaDZmchzomJflm2Dfv8wKVP erPr3OHrru7l6NJir4Ra08IX/imcEOq9AQfwE= 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=4Y7L9hsP+jSxUqIqUU0KrO0B9gZYA+9QRCRvU070BSo=; b=kd8/flzF3VoAxHNBdXI+fUjyzpWEs6Sz3wbVPHVAaBLvYL1Hw0g6nJsiZO7fk7LRME 2hFiUSfMDegrC6tIgoFmmwjZ4/4rZwL4wOPKbRwppMfRoy+oLSsCGWSr7puXbUEcfu/0 Bxu4rdR/uKkJGwdm5j2TK0FPoznoz+urYlM0APzsm1K/MLLH0m3qpobdI8hKKo351UsU iU4Mglm6XpvZLUvbarEzgyRRMBHxRMK0nDYWidue1sujLsuOf98bKljE1XAX+cCvr5WX I/euaAdD/9fpVlwL75nak0ZiIs0+c+Rc8SRhH1Q4yirQpaHhF2GjrCsOslukIgTZE04P 1P0A== X-Gm-Message-State: AKS2vOzmHUtfu20mKcSbEu8jiqERuTTYwkBlGiVNUxfIBpmLrnpokiPL C1N6n2249zqKCert X-Received: by 10.46.87.9 with SMTP id l9mr2164257ljb.85.1498033952380; Wed, 21 Jun 2017 01:32:32 -0700 (PDT) Received: from fabina.bredbandsbolaget.se (c-2d0be055.014-348-6c756e10.cust.bredbandsbolaget.se. [85.224.11.45]) by smtp.gmail.com with ESMTPSA id h19sm3663102lji.59.2017.06.21.01.32.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jun 2017 01:32:31 -0700 (PDT) From: Linus Walleij To: Bjorn Helgaas , linux-pci@vger.kernel.org Cc: Hans Ulli Kroll , Florian Fainelli , Linus Walleij Subject: [PATCH] pci: ftpci100: Make clocks compulsory Date: Wed, 21 Jun 2017 10:32:28 +0200 Message-Id: <20170621083228.30631-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.4 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This fixes a regression on the FTPCI100 PCI driver. When the clock controller was augmented to probe clocks from the platform device except to the most basic clocks pertaining to timers, clocks may return an error pointer containing -EPROBE_DEFER. This hit the PCI driver which would try to continue without the clocks, but the actual clocks appeared later, so we did not pick them up properly, and in the end of the boot, these clocks get gated off if no users register, so the PCI host became numbed off and silently nonworking. The clocks for this PCI bus are defined properly for all platforms implementing it, so we should make them compulsory before new users arrive so we have our resources under control. This makes the driver bail out of probe with any error code from the clock, including -EPROBE_DEFER so that we again have a clean boot. Fixes: cea186ac1e45 ("pci: ftpci100: Add clock handling") Signed-off-by: Linus Walleij --- drivers/pci/host/pci-ftpci100.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/drivers/pci/host/pci-ftpci100.c b/drivers/pci/host/pci-ftpci100.c index d3bf153a2ab2..da62224e8e04 100644 --- a/drivers/pci/host/pci-ftpci100.c +++ b/drivers/pci/host/pci-ftpci100.c @@ -463,24 +463,20 @@ static int faraday_pci_probe(struct platform_device *pdev) /* Retrieve and enable optional clocks */ clk = devm_clk_get(dev, "PCLK"); - if (IS_ERR(clk)) { - dev_err(dev, "no PCLK available\n"); - } else { - ret = clk_prepare_enable(clk); - if (ret) { - dev_err(dev, "could not prepare PCLK\n"); - return ret; - } + if (IS_ERR(clk)) + return ERR_PTR(clk); + ret = clk_prepare_enable(clk); + if (ret) { + dev_err(dev, "could not prepare PCLK\n"); + return ret; } p->bus_clk = devm_clk_get(dev, "PCICLK"); - if (IS_ERR(p->bus_clk)) { - dev_err(dev, "no PCICLK available\n"); - } else { - ret = clk_prepare_enable(p->bus_clk); - if (ret) { - dev_err(dev, "could not prepare PCICLK\n"); - return ret; - } + if (IS_ERR(p->bus_clk)) + return ERR_PTR(clk); + ret = clk_prepare_enable(p->bus_clk); + if (ret) { + dev_err(dev, "could not prepare PCICLK\n"); + return ret; } regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);