From patchwork Thu May 2 10:49:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 16582 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ia0-f198.google.com (mail-ia0-f198.google.com [209.85.210.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 54A8E238EC for ; Thu, 2 May 2013 10:50:19 +0000 (UTC) Received: by mail-ia0-f198.google.com with SMTP id f5sf1771421iac.9 for ; Thu, 02 May 2013 03:50:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=ovhZqvgRiER+cTjf+20WEEhJb5/FREyw1+HtE/TLGjg=; b=ZSEr0LZh4U93yXp18HSRHLIjeR0eaqycvJHY7MdIk/EFmO7F+aLNBx9dRkButvVYfY 8RG7tr+5qFSjqtaTacRcHCrTTTBLFnbEziYQFh6QNZ5lZgsgEHNCTpu36+xLaKZsL7sY +HhSsmVTGWbVrf/c5Kz+nXDbTzvk/zyNANAUTre1RFQ7NK/dMCJSYklFOEaKYbT/5NYr o3BIESLclMQj/kWjfK1sC3JkE+D0x406fxla3RqQH+MCCSnFRK44PH517+puFQeD79tP GpHLZgzo4R9HmkeFdjsv4fUuk6q8NmMH0s9whhrcMqZc6LtzGqoHXAm4Q+/On55rUUqX QbwA== X-Received: by 10.182.19.169 with SMTP id g9mr5237839obe.6.1367491811773; Thu, 02 May 2013 03:50:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.37.33 with SMTP id v1ls1110022qej.76.gmail; Thu, 02 May 2013 03:50:11 -0700 (PDT) X-Received: by 10.52.66.165 with SMTP id g5mr962517vdt.53.1367491811587; Thu, 02 May 2013 03:50:11 -0700 (PDT) Received: from mail-vb0-x235.google.com (mail-vb0-x235.google.com [2607:f8b0:400c:c02::235]) by mx.google.com with ESMTPS id ec8si2668375vdb.46.2013.05.02.03.50.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 03:50:11 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::235 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::235; Received: by mail-vb0-f53.google.com with SMTP id i3so320458vbh.26 for ; Thu, 02 May 2013 03:50:11 -0700 (PDT) X-Received: by 10.52.66.101 with SMTP id e5mr1669394vdt.57.1367491811449; Thu, 02 May 2013 03:50:11 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp195692veb; Thu, 2 May 2013 03:50:10 -0700 (PDT) X-Received: by 10.194.92.197 with SMTP id co5mr7091773wjb.41.1367491810547; Thu, 02 May 2013 03:50:10 -0700 (PDT) Received: from mail-wg0-x22c.google.com (mail-wg0-x22c.google.com [2a00:1450:400c:c00::22c]) by mx.google.com with ESMTPS id vf9si1812776wjc.42.2013.05.02.03.50.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 03:50:10 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::22c is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c00::22c; Received: by mail-wg0-f44.google.com with SMTP id z12so411743wgg.23 for ; Thu, 02 May 2013 03:50:10 -0700 (PDT) X-Received: by 10.181.12.1 with SMTP id em1mr25122894wid.4.1367491809996; Thu, 02 May 2013 03:50:09 -0700 (PDT) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPSA id x13sm9665546wib.3.2013.05.02.03.50.08 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 03:50:09 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, srinidhi.kasagar@stericsson.com, Lee Jones , Herbert Xu , "David S. Miller" , Andreas Westin , Ulf Hansson , linux-crypto@vger.kernel.org Subject: [PATCH 4/8] crypto: ux500/cryp - Prepare clock before enabling it Date: Thu, 2 May 2013 11:49:46 +0100 Message-Id: <1367491790-9727-5-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1367491790-9727-1-git-send-email-lee.jones@linaro.org> References: <1367491790-9727-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQmgu9KrgTTN7Y2KhknTLLI/ABM83qGL2jkkgbT8DomreXR0RxzV8MnXb24g0Cgh9DHXRuMe X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::235 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If we fail to prepare the ux500-cryp clock before enabling it the platform will fail to boot. Here we insure this happens. Cc: Herbert Xu Cc: David S. Miller Cc: Andreas Westin Cc: Ulf Hansson Cc: linux-crypto@vger.kernel.org Acked-by: Arnd Bergmann Signed-off-by: Lee Jones --- drivers/crypto/ux500/cryp/cryp_core.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index 22c9063..bf78d60 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c @@ -1459,11 +1459,17 @@ static int ux500_cryp_probe(struct platform_device *pdev) goto out_regulator; } + ret = clk_prepare(device_data->clk); + if (ret) { + dev_err(dev, "[%s]: clk_prepare() failed!", __func__); + goto out_clk; + } + /* Enable device power (and clock) */ ret = cryp_enable_power(device_data->dev, device_data, false); if (ret) { dev_err(dev, "[%s]: cryp_enable_power() failed!", __func__); - goto out_clk; + goto out_clk_unprepare; } cryp_error = cryp_check(device_data); @@ -1524,6 +1530,9 @@ static int ux500_cryp_probe(struct platform_device *pdev) out_power: cryp_disable_power(device_data->dev, device_data, false); +out_clk_unprepare: + clk_unprepare(device_data->clk); + out_clk: clk_put(device_data->clk); @@ -1594,6 +1603,7 @@ static int ux500_cryp_remove(struct platform_device *pdev) dev_err(&pdev->dev, "[%s]: cryp_disable_power() failed", __func__); + clk_unprepare(device_data->clk); clk_put(device_data->clk); regulator_put(device_data->pwr_regulator);