From patchwork Sat Apr 5 03:29:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Jiang X-Patchwork-Id: 3935781 Return-Path: X-Original-To: patchwork-linux-spi@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 E81A19F357 for ; Fri, 4 Apr 2014 03:32:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E10F52037E for ; Fri, 4 Apr 2014 03:32:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB11920379 for ; Fri, 4 Apr 2014 03:32:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751738AbaDDDc5 (ORCPT ); Thu, 3 Apr 2014 23:32:57 -0400 Received: from am1ehsobe004.messaging.microsoft.com ([213.199.154.207]:48145 "EHLO am1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751557AbaDDDc4 (ORCPT ); Thu, 3 Apr 2014 23:32:56 -0400 Received: from mail68-am1-R.bigfish.com (10.3.201.253) by AM1EHSOBE005.bigfish.com (10.3.204.25) with Microsoft SMTP Server id 14.1.225.22; Fri, 4 Apr 2014 03:32:54 +0000 Received: from mail68-am1 (localhost [127.0.0.1]) by mail68-am1-R.bigfish.com (Postfix) with ESMTP id E8D0D260216; Fri, 4 Apr 2014 03:32:53 +0000 (UTC) X-Forefront-Antispam-Report: CIP:137.71.25.55; KIP:(null); UIP:(null); IPV:NLI; H:nwd2mta1.analog.com; RD:nwd2mail10.analog.com; EFVD:NLI X-SpamScore: 6 X-BigFish: VS6(zzzz1f42h2148h1ee6h1ce5h1fdah201ch2073h2146h1202h1fd0h1e76h2189h1d1ah1cabh1d2ah21bch1fc6hzz1de098h8275bh1de097hz31h87h2a8h839hd24he5bh1288h12a5h12a9h12bdh12e5h1354h137ah139eh13b6h13eah1441h1504h1537h15a8h162dh1631h1758h17eeh1898h18e1h1946h19b5h1b0ah224fh1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e23h1fe8h1ff5h2218h2216h226dh22d0h24afh2327h2336h2438h2461h2487h24d7h2516h2545h255eh25f6h2605h268bh26d3h1355m129fi1155h) Received-SPF: softfail (mail68-am1: transitioning domain of gmail.com does not designate 137.71.25.55 as permitted sender) client-ip=137.71.25.55; envelope-from=scott.jiang.linux@gmail.com; helo=nwd2mta1.analog.com ; 1.analog.com ; X-FB-DOMAIN-IP-MATCH: fail Received: from mail68-am1 (localhost.localdomain [127.0.0.1]) by mail68-am1 (MessageSwitch) id 1396582372888647_10042; Fri, 4 Apr 2014 03:32:52 +0000 (UTC) Received: from AM1EHSMHS001.bigfish.com (unknown [10.3.201.252]) by mail68-am1.bigfish.com (Postfix) with ESMTP id C49AD4008E; Fri, 4 Apr 2014 03:32:52 +0000 (UTC) Received: from nwd2mta1.analog.com (137.71.25.55) by AM1EHSMHS001.bigfish.com (10.3.207.101) with Microsoft SMTP Server (TLS) id 14.16.227.3; Fri, 4 Apr 2014 03:32:53 +0000 Received: from NWD2HUBCAS5.ad.analog.com (nwd2hubcas5.ad.analog.com [10.64.72.161]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id s343WCfn008648 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 3 Apr 2014 20:32:12 -0700 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS5.ad.analog.com (10.64.72.161) with Microsoft SMTP Server id 14.3.158.1; Thu, 3 Apr 2014 23:31:33 -0400 Received: from linux.site ([10.99.22.20]) by zeus.spd.analog.com (8.14.6/8.14.6) with ESMTP id s343VWdt029646; Thu, 3 Apr 2014 23:31:33 -0400 Received: from localhost.localdomain (unknown [10.99.24.124]) by linux.site (Postfix) with ESMTP id 8BF4D3AEA2A2; Thu, 3 Apr 2014 12:26:35 -0700 (MST) From: Scott Jiang To: Mark Brown CC: , , Scott Jiang Subject: [PATCH] spi: spi-adi-v3: convert to use common clk framework Date: Sat, 5 Apr 2014 11:29:09 +0800 Message-ID: <1396668549-20052-1-git-send-email-scott.jiang.linux@gmail.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_12_24, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 Use common clk api to get spi clock. Signed-off-by: Scott Jiang --- arch/blackfin/mach-bf609/clock.c | 7 +++++++ drivers/spi/spi-adi-v3.c | 13 +++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/arch/blackfin/mach-bf609/clock.c b/arch/blackfin/mach-bf609/clock.c index 13644ed..2bd82b1 100644 --- a/arch/blackfin/mach-bf609/clock.c +++ b/arch/blackfin/mach-bf609/clock.c @@ -381,6 +381,12 @@ static struct clk ethclk = { .ops = &dummy_clk_ops, }; +static struct clk spiclk = { + .name = "spi", + .parent = &sclk1, + .ops = &dummy_clk_ops, +}; + static struct clk_lookup bf609_clks[] = { CLK(sys_clkin, NULL, "SYS_CLKIN"), CLK(pll_clk, NULL, "PLLCLK"), @@ -393,6 +399,7 @@ static struct clk_lookup bf609_clks[] = { CLK(dclk, NULL, "DCLK"), CLK(oclk, NULL, "OCLK"), CLK(ethclk, NULL, "stmmaceth"), + CLK(spiclk, NULL, "spi"), }; int __init clk_init(void) diff --git a/drivers/spi/spi-adi-v3.c b/drivers/spi/spi-adi-v3.c index 0c2914c..dcb2287 100644 --- a/drivers/spi/spi-adi-v3.c +++ b/drivers/spi/spi-adi-v3.c @@ -13,6 +13,7 @@ * GNU General Public License for more details. */ +#include #include #include #include @@ -800,7 +801,7 @@ static int adi_spi_probe(struct platform_device *pdev) struct adi_spi_master *drv_data; struct resource *mem, *res; unsigned int tx_dma, rx_dma; - unsigned long sclk; + struct clk *sclk; int ret; if (!info) { @@ -808,10 +809,10 @@ static int adi_spi_probe(struct platform_device *pdev) return -ENODEV; } - sclk = get_sclk1(); - if (!sclk) { - dev_err(dev, "can not get sclk1\n"); - return -ENXIO; + sclk = devm_clk_get(dev, "spi"); + if (IS_ERR(sclk)) { + dev_err(dev, "can not get spi clock\n"); + return PTR_ERR(sclk); } res = platform_get_resource(pdev, IORESOURCE_DMA, 0); @@ -852,7 +853,7 @@ static int adi_spi_probe(struct platform_device *pdev) drv_data->tx_dma = tx_dma; drv_data->rx_dma = rx_dma; drv_data->pin_req = info->pin_req; - drv_data->sclk = sclk; + drv_data->sclk = clk_get_rate(sclk); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); drv_data->regs = devm_ioremap_resource(dev, mem);