From patchwork Fri Oct 24 10:37:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 5145581 Return-Path: X-Original-To: patchwork-linux-fbdev@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 DD6E8C11AC for ; Fri, 24 Oct 2014 10:39:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0CC012021B for ; Fri, 24 Oct 2014 10:39:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C6EC200D9 for ; Fri, 24 Oct 2014 10:39:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756376AbaJXKjR (ORCPT ); Fri, 24 Oct 2014 06:39:17 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:52570 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756250AbaJXKiO (ORCPT ); Fri, 24 Oct 2014 06:38:14 -0400 Received: by mail-pd0-f175.google.com with SMTP id y13so1246935pdi.6 for ; Fri, 24 Oct 2014 03:38:13 -0700 (PDT) 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=/Hbhv9ufjuZKk3L7NYM05YbbvcbcqmQc0NybCRwibOo=; b=c77WnPpgYra8qI1BH5AGdpfN453i5wTPfg2s10gSNdMPZX25U7/71Tx7z5NvNkl2b0 qaFqdP5LG36T/QgfFLq5JexTvcUFIQ/exxGED8CUkyLnuTYjcS1Aq2HcNO+1m01uagGh sPMy6tALT3hMTvy6/Y7gLIWKVosK5rRAyabTOSVOYUx6jV8ALfSNipyEfBh52ZV/gAAd hPujQuAHxVXd8GyGpb1xC5IponxOMHjLKVLG/OIURQxjdn+JglFHRGTq+8Zmvkr3D/XG /z5N3FZBm0PYajDu5VAgxSLYkpiE7Lt79rMiUscAbTsPs77PGWD6CzHupBZudcndIGyD VzDA== X-Received: by 10.70.42.15 with SMTP id j15mr3741864pdl.17.1414147093908; Fri, 24 Oct 2014 03:38:13 -0700 (PDT) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id jc3sm3590019pbb.49.2014.10.24.03.38.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Oct 2014 03:38:13 -0700 (PDT) From: Dmitry Eremin-Solenikov To: linux-arm-kernel@lists.infradead.org, linux-pcmcia@lists.infradead.org, linux-fbdev@vger.kernel.org Cc: Russell King , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Linus Walleij , Andrea Adami Subject: [PATCH 4/5] pcmcia: sa1100: make use of device clock Date: Fri, 24 Oct 2014 14:37:26 +0400 Message-Id: <1414147047-12892-5-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1414147047-12892-1-git-send-email-dbaryshkov@gmail.com> References: <1414147047-12892-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=-8.2 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 54d3089..6dd94bb 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c @@ -135,14 +135,16 @@ 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; @@ -218,6 +220,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); @@ -226,12 +233,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); @@ -242,6 +251,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);