From patchwork Tue Jul 16 08:45:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerhard Sittig X-Patchwork-Id: 2828014 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CAE289F967 for ; Tue, 16 Jul 2013 08:48:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD59520165 for ; Tue, 16 Jul 2013 08:48:35 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 489C920154 for ; Tue, 16 Jul 2013 08:48:34 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uz0uW-0004Js-9k; Tue, 16 Jul 2013 08:47:04 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uz0uB-0005Ct-60; Tue, 16 Jul 2013 08:46:43 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uz0tz-00058r-4t for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2013 08:46:33 +0000 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3bvZvL1xzTz4KK2k; Tue, 16 Jul 2013 10:45:50 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3bvZvL14fMzbbhr; Tue, 16 Jul 2013 10:45:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id DiVG8cSPv5KS; Tue, 16 Jul 2013 10:45:48 +0200 (CEST) X-Auth-Info: HoA9OFMgckmaWm61TkJPkXeN2tv8zx3wnbf1s3U9DDg= Received: from localhost (host-82-135-33-74.customer.m-online.net [82.135.33.74]) by mail.mnet-online.de (Postfix) with ESMTPA; Tue, 16 Jul 2013 10:45:48 +0200 (CEST) From: Gerhard Sittig To: linuxppc-dev@lists.ozlabs.org, Anatolij Gustschin , Mike Turquette , linux-arm-kernel@lists.infradead.org, devicetree-discuss@lists.ozlabs.org Subject: [PATCH v1 22/24] powerpc/fsl-pci: OF clock lookup, prepare before enable Date: Tue, 16 Jul 2013 10:45:38 +0200 Message-Id: <1373964341-25228-2-git-send-email-gsi@denx.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1373914074-20889-1-git-send-email-gsi@denx.de> References: <1373914074-20889-1-git-send-email-gsi@denx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130716_044631_429390_51BC343B X-CRM114-Status: GOOD ( 11.55 ) X-Spam-Score: -1.9 (-) Cc: Detlev Zundel , Wolfram Sang , Greg Kroah-Hartman , Gerhard Sittig , Rob Herring , Mark Brown , Marc Kleine-Budde , Pantelis Antoniou , David Woodhouse , Wolfgang Grandegger , Mauro Carvalho Chehab X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP device tree based clock lookup, must prepare clocks before enabling them, error check in the clock setup this change implements non-fatal clock lookup for compatibility with platforms that don't provide OF clock specs, but failure to enable a specified clock is considered fatal Signed-off-by: Gerhard Sittig --- arch/powerpc/sysdev/fsl_pci.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 46ac1dd..cb2ed92 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c @@ -17,6 +17,8 @@ * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ + +#include #include #include #include @@ -741,6 +743,7 @@ err0: int __init mpc83xx_add_bridge(struct device_node *dev) { + struct clk *clk; int ret; int len; struct pci_controller *hose; @@ -758,6 +761,18 @@ int __init mpc83xx_add_bridge(struct device_node *dev) } pr_debug("Adding PCI host bridge %s\n", dev->full_name); + /* non-fatal OF clock lookup, but fatal when a clock + * was specified yet could not get enabled */ + clk = of_clk_get_by_name(dev, "per"); + if (!IS_ERR(clk)) { + ret = clk_prepare_enable(clk); + clk_put(clk); + if (ret) { + pr_err("Could not enable peripheral clock\n"); + return ret; + } + } + /* Fetch host bridge registers address */ if (of_address_to_resource(dev, 0, &rsrc_reg)) { printk(KERN_WARNING "Can't get pci register base!\n");