From patchwork Mon Nov 24 23:05:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 5370741 Return-Path: X-Original-To: patchwork-linux-fbdev@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 6CE969F2F5 for ; Mon, 24 Nov 2014 23:05:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AFC9920172 for ; Mon, 24 Nov 2014 23:05:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EAEAB20154 for ; Mon, 24 Nov 2014 23:05:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750881AbaKXXFy (ORCPT ); Mon, 24 Nov 2014 18:05:54 -0500 Received: from mail-wg0-f53.google.com ([74.125.82.53]:56257 "EHLO mail-wg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751970AbaKXXFx (ORCPT ); Mon, 24 Nov 2014 18:05:53 -0500 Received: by mail-wg0-f53.google.com with SMTP id l18so13548066wgh.40 for ; Mon, 24 Nov 2014 15:05:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eELBKr8TgxXUlknE6Atx+kuT6b9hZ27ZiU0MvD8OOmQ=; b=MvONspYGA6lVzIlVEtaD4Ohl1QOld3MSTfMQptczPtxpzei80ttJp1zbfnXZgyRw8X Jd8yAzLH0oX+ZGD1CeLtQhe38yCIVeN8XzGeDych2Kcw7mimsgdsfiAcs2PQVcnBpzbk dIv0klHxT+EOYPcT/pg2iDAS5jCMfQ+r9LFt9JbqtATOxMzNG7pZQZ7AfpyHUAZR3yjU K5DsZg3n7nsKQ0ByvWdgfPC0oskxaIC9wK8t2ZLuC8FGu77mBKQ2mDFkyBVHUMK70k4C BDE5g131KLqQ+3FP6Il6xR98GxMFCC8EmhWqAMNl5ta2NVZcdqBy2aaFJn6HMDI2ba03 TWmw== X-Received: by 10.180.104.170 with SMTP id gf10mr19126319wib.43.1416870352915; Mon, 24 Nov 2014 15:05:52 -0800 (PST) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id u5sm326051wiz.9.2014.11.24.15.05.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Nov 2014 15:05:52 -0800 (PST) From: Dmitry Eremin-Solenikov To: Russell King , linux-arm-kernel@lists.infradead.org Cc: linux-pcmcia@lists.infradead.org, linux-fbdev@vger.kernel.org Subject: [PATCH V2 4/6] pcmcia: soc-common: enable/disable socket clocks Date: Tue, 25 Nov 2014 02:05:34 +0300 Message-Id: <1416870336-30114-5-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1416870336-30114-1-git-send-email-dbaryshkov@gmail.com> References: <1416870336-30114-1-git-send-email-dbaryshkov@gmail.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Call clk_prepare_enable() during hw_init() and clk_disable_unprepare() during hw_shutdown() to ensure that the clock rates returned by clk_get_rate() are correct. It is safe to call enable/disable functions even on NULL clock, so this patch will not break cases when the socket clock is not set. Signed-off-by: Dmitry Eremin-Solenikov --- drivers/pcmcia/soc_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index a2bc6ee..933f465 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c @@ -120,6 +120,8 @@ static void __soc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt, if (skt->ops->hw_shutdown) skt->ops->hw_shutdown(skt); + + clk_disable_unprepare(skt->clk); } static void soc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) @@ -131,6 +133,8 @@ static int soc_pcmcia_hw_init(struct soc_pcmcia_socket *skt) { int ret = 0, i; + clk_prepare_enable(skt->clk); + if (skt->ops->hw_init) { ret = skt->ops->hw_init(skt); if (ret)