From patchwork Sat Nov 16 22:07:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 3193201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1AF00C045B for ; Sat, 16 Nov 2013 22:10:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4231920812 for ; Sat, 16 Nov 2013 22:09:59 +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 58C2920811 for ; Sat, 16 Nov 2013 22:09:58 +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 1Vho36-0005RU-Kf; Sat, 16 Nov 2013 22:09:05 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vho2u-0000kY-3M; Sat, 16 Nov 2013 22:08:52 +0000 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vho2b-0000iA-7d for linux-arm-kernel@lists.infradead.org; Sat, 16 Nov 2013 22:08:34 +0000 Received: by mail-wi0-f182.google.com with SMTP id en1so547472wid.3 for ; Sat, 16 Nov 2013 14:08:11 -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=r2BF4gHQyU2pUTr6rnICwiQoqPpY3wwgzzNy4SOvMa/jAsmRUxJewWn9e/ZPe/Y4bv xZ1dBawaT6Xp9JQO8jXaVKGs+TYhLNe9oyEFZ48c6CNF0Y4vNoib7cpEN/umljdU5GW7 Fj5z0TvlJXSG5R5RbDbxWFgs2YTaNRhv0BZ1xuAYwtdBIJHx55NgFdCuyuuQZxkicFHA +tlIqIXZjT1IffYU2bQvacfngjZYAG9FEuVZPpE7YNL5zmMF/HaqfYuhGvZg34eVFM3l VgcjB0Vb6bsPEd/H6Y8GOLh4XLNJxiAQ9UKURcIegQ0XpJ2wxZR0mi6brAX4KtyGH4ha k59g== X-Received: by 10.180.84.101 with SMTP id x5mr11646931wiy.58.1384639691235; Sat, 16 Nov 2013 14:08:11 -0800 (PST) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id je17sm8706021wic.4.2013.11.16.14.08.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Nov 2013 14:08:10 -0800 (PST) From: Dmitry Eremin-Solenikov To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/5] pcmcia: sa1100: make use of device clock Date: Sun, 17 Nov 2013 02:07:28 +0400 Message-Id: <1384639650-3919-4-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1384639650-3919-1-git-send-email-dbaryshkov@gmail.com> References: <1384639650-3919-1-git-send-email-dbaryshkov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131116_170833_482343_69864D89 X-CRM114-Status: GOOD ( 14.72 ) X-Spam-Score: -2.0 (--) Cc: Russell King , Dmitry Artamonow 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.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, 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);