From patchwork Tue Nov 12 03:32:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 3170591 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 25A189F461 for ; Tue, 12 Nov 2013 03:32:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 700452037F for ; Tue, 12 Nov 2013 03:32:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D6782037A for ; Tue, 12 Nov 2013 03:32:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751959Ab3KLDcc (ORCPT ); Mon, 11 Nov 2013 22:32:32 -0500 Received: from mail-wi0-f171.google.com ([209.85.212.171]:33079 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751654Ab3KLDc2 (ORCPT ); Mon, 11 Nov 2013 22:32:28 -0500 Received: by mail-wi0-f171.google.com with SMTP id hn6so164506wib.10 for ; Mon, 11 Nov 2013 19:32:27 -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=5NFF2SgD/g0vpdU+usqggcd6WEXV9TFtCUM+nIgF2kM=; b=DJL9o2Cr3AWoGht+z6h/ENEahQCjmqdrelKZ3zW+IKr4Lgwe5Swhr/v9GzyzzlJa4a ahaFwQnuk/09XHuGfMLRCuHPJD3q7Y334m+oV+kIuJwnLkz6Q9cA9gwyn+l6J2Oodtzp yfIzmrvrKe0177QQvlW33x0BG0ljOfzVM+aZYwBfuBVCWprvirkmeyFTDyPgaOd59FBD BGcFsabo8BP9xU53r9rrGvfidGA1DASnSe1Vx7q9NyWUI24Ytaxgl/CIZ6MrkaYeC4uA AdpHQNd3SnG39+p4EumwU1A6K0STghew/9kj+nhANFlQNoam0EZp0kXkjuioRFtHs9P6 ZcYQ== X-Received: by 10.180.108.131 with SMTP id hk3mr14530944wib.10.1384227147618; Mon, 11 Nov 2013 19:32:27 -0800 (PST) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id i8sm40087381wiy.6.2013.11.11.19.32.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Nov 2013 19:32:27 -0800 (PST) From: Dmitry Eremin-Solenikov To: linux-arm-kernel@lists.infradead.org Cc: linux-pcmcia@lists.infradead.org, linux-fbdev@vger.kernel.org, Russell King Subject: [PATCH 3/5] pcmcia: sa1100: make use of device clock Date: Tue, 12 Nov 2013 07:32:10 +0400 Message-Id: <1384227132-10501-3-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1384227132-10501-1-git-send-email-dbaryshkov@gmail.com> References: <1384227132-10501-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, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Use per-device clock (instead of calling cpufreq_get(0), which can return 0 if no cpu frequency driver is selected) to program timings. Signed-off-by: Dmitry Eremin-Solenikov --- drivers/pcmcia/sa1100_generic.c | 1 + drivers/pcmcia/sa11xx_base.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index ff8a027..d2ab060 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c @@ -93,6 +93,7 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device *dev) for (i = 0; i < sinfo->nskt; i++) soc_pcmcia_remove_one(&sinfo->skt[i]); + clk_put(sinfo->clk); kfree(sinfo); return 0; } diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c index 6eecd7c..aef0e69 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -138,14 +139,15 @@ sa1100_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, static int sa1100_pcmcia_set_timing(struct soc_pcmcia_socket *skt) { - return sa1100_pcmcia_set_mecr(skt, cpufreq_get(0)); + unsigned long clk = clk_get_rate(skt->clk); + return sa1100_pcmcia_set_mecr(skt, clk / 1000); } static int sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf) { struct soc_pcmcia_timing timing; - unsigned int clock = cpufreq_get(0); + unsigned int clock = clk_get_rate(skt->clk); unsigned long mecr = MECR; char *p = buf; @@ -221,6 +223,11 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, struct skt_dev_info *sinfo; struct soc_pcmcia_socket *skt; int i, ret = 0; + struct clk *clk; + + clk = clk_get(dev, NULL); + if (IS_ERR(clk)) + return -ENODEV; sa11xx_drv_pcmcia_ops(ops); @@ -229,12 +236,14 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, return -ENOMEM; sinfo->nskt = nr; + sinfo->clk = clk; /* Initialize processor specific parameters */ for (i = 0; i < nr; i++) { skt = &sinfo->skt[i]; skt->nr = first + i; + skt->clk = clk; soc_pcmcia_init_one(skt, ops, dev); ret = sa11xx_drv_pcmcia_add_one(skt); @@ -245,6 +254,7 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, if (ret) { while (--i >= 0) soc_pcmcia_remove_one(&sinfo->skt[i]); + clk_put(clk); kfree(sinfo); } else { dev_set_drvdata(dev, sinfo);