From patchwork Wed Mar 9 08:47:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 8544061 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DD5FBC0553 for ; Wed, 9 Mar 2016 08:47:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F087F2021A for ; Wed, 9 Mar 2016 08:47:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 12FE520211 for ; Wed, 9 Mar 2016 08:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751638AbcCIIrd (ORCPT ); Wed, 9 Mar 2016 03:47:33 -0500 Received: from mail-bl2nam02on0088.outbound.protection.outlook.com ([104.47.38.88]:25438 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751533AbcCIIrc convert rfc822-to-8bit (ORCPT ); Wed, 9 Mar 2016 03:47:32 -0500 Received: from BL2NAM02FT045.eop-nam02.prod.protection.outlook.com (10.152.76.58) by BL2NAM02HT142.eop-nam02.prod.protection.outlook.com (10.152.76.97) with Microsoft SMTP Server (TLS) id 15.1.427.7; Wed, 9 Mar 2016 08:47:28 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by BL2NAM02FT045.mail.protection.outlook.com (10.152.77.16) with Microsoft SMTP Server (TLS) id 15.1.434.11 via Frontend Transport; Wed, 9 Mar 2016 08:47:28 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:44697 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1adZmB-0003nz-Md; Wed, 09 Mar 2016 00:47:27 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1adZmB-0006HI-Ig; Wed, 09 Mar 2016 00:47:27 -0800 Received: from xsj-pvapsmtp01 (mailman.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id u298lPUR013767; Wed, 9 Mar 2016 00:47:25 -0800 Received: from [172.23.146.171] (helo=xhdl3763.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1adZm9-0006GY-5n; Wed, 09 Mar 2016 00:47:25 -0800 Received: by xhdl3763.xilinx.com (Postfix, from userid 9049) id 61E7D2CE055B; Wed, 9 Mar 2016 14:17:24 +0530 (IST) From: Shubhrajyoti Datta To: CC: , , , , Shubhrajyoti Datta Subject: [PATCHv2 2/3] spi/spi-xilinx: Add clock support Date: Wed, 9 Mar 2016 14:17:21 +0530 Message-ID: <1457513242-11202-2-git-send-email-shubhraj@xilinx.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1457513242-11202-1-git-send-email-shubhraj@xilinx.com> References: <1457513242-11202-1-git-send-email-shubhraj@xilinx.com> MIME-Version: 1.0 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22180.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.100; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(106466001)(2906002)(2950100001)(36756003)(4001430100002)(110136002)(4326007)(103686003)(229853001)(5820100001)(2351001)(586003)(107886002)(19580405001)(1220700001)(50226001)(46386002)(19580395003)(90966002)(63266004)(45336002)(86362001)(87936001)(5008740100001)(6806005)(42186005)(11100500001)(47776003)(50986999)(1096002)(52956003)(33646002)(50466002)(23676002)(76176999)(189998001)(81166005)(92566002)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2NAM02HT142; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-MS-Office365-Filtering-Correlation-Id: 8fd2d215-772e-43ac-817d-08d347f77221 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:BL2NAM02HT142; X-Microsoft-Antispam-PRVS: <7612b44e8d464572857a6603e11ab0e3@BL2NAM02HT142.eop-nam02.prod.protection.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13017025)(13024025)(13023025)(13015025)(13018025)(5005006)(8121501046)(3002001)(10201501046); SRVR:BL2NAM02HT142; BCL:0; PCL:0; RULEID:; SRVR:BL2NAM02HT142; X-Forefront-PRVS: 0876988AF0 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2016 08:47:28.4789 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.100]; Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2NAM02HT142 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, 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 Add basic clock support. The clocks are requested at probe and released at remove. Acked-by: Sören Brinkmann Signed-off-by: Shubhrajyoti Datta --- v2 changes Add ack drivers/spi/spi-xilinx.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index 3009121..7e12338 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c @@ -21,6 +21,7 @@ #include #include #include +#include #define XILINX_SPI_MAX_CS 32 @@ -83,6 +84,7 @@ struct xilinx_spi { struct spi_bitbang bitbang; struct completion done; void __iomem *regs; /* virt. address of the control registers */ + struct clk *clk; int irq; @@ -428,6 +430,15 @@ static int xilinx_spi_probe(struct platform_device *pdev) goto put_master; } + xspi->clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(xspi->clk)) { + dev_err(&pdev->dev, "input clock not found.\n"); + return PTR_ERR(xspi->clk); + } + ret = clk_prepare_enable(xspi->clk); + if (ret) + dev_err(&pdev->dev, "Unable to enable clock.\n"); + master->bus_num = pdev->id; master->num_chipselect = num_cs; master->dev.of_node = pdev->dev.of_node; @@ -485,6 +496,7 @@ static int xilinx_spi_probe(struct platform_device *pdev) put_master: spi_master_put(master); + clk_disable_unprepare(xspi->clk); return ret; } @@ -503,6 +515,7 @@ static int xilinx_spi_remove(struct platform_device *pdev) xspi->write_fn(0, regs_base + XIPIF_V123B_DGIER_OFFSET); spi_master_put(xspi->bitbang.master); + clk_disable_unprepare(xspi->clk); return 0; }