From patchwork Tue Mar 8 08:42:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 8530861 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 BB7AEC0553 for ; Tue, 8 Mar 2016 08:57:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD11E2015E for ; Tue, 8 Mar 2016 08:57:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E4FA4200EC for ; Tue, 8 Mar 2016 08:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753677AbcCHI5S (ORCPT ); Tue, 8 Mar 2016 03:57:18 -0500 Received: from mail-bl2nam02on0056.outbound.protection.outlook.com ([104.47.38.56]:37632 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753525AbcCHI5R (ORCPT ); Tue, 8 Mar 2016 03:57:17 -0500 X-Greylist: delayed 900 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Mar 2016 03:57:17 EST Received: from CY1NAM02FT049.eop-nam02.prod.protection.outlook.com (10.152.74.55) by CY1NAM02HT253.eop-nam02.prod.protection.outlook.com (10.152.75.94) with Microsoft SMTP Server (TLS) id 15.1.427.7; Tue, 8 Mar 2016 08:42:14 +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 CY1NAM02FT049.mail.protection.outlook.com (10.152.75.83) with Microsoft SMTP Server (TLS) id 15.1.427.7 via Frontend Transport; Tue, 8 Mar 2016 08:42:14 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:34786 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1adDDa-00071i-49; Tue, 08 Mar 2016 00:42:14 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1adDDa-0005LS-0D; Tue, 08 Mar 2016 00:42:14 -0800 Received: from xsj-pvapsmtp01 (smtp3.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id u288gAJs014760; Tue, 8 Mar 2016 00:42:11 -0800 Received: from [172.23.146.171] (helo=xhdl3763.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1adDDW-0005L8-LX; Tue, 08 Mar 2016 00:42:10 -0800 Received: by xhdl3763.xilinx.com (Postfix, from userid 9049) id C7C092CE0556; Tue, 8 Mar 2016 14:12:09 +0530 (IST) From: Shubhrajyoti Datta To: CC: , , , Shubhrajyoti Datta Subject: [PATCH] spi/spi-xilinx: Add clock support Date: Tue, 8 Mar 2016 14:12:08 +0530 Message-ID: <1457426528-15247-1-git-send-email-shubhraj@xilinx.com> X-Mailer: git-send-email 2.1.2 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22178.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)(189002)(199003)(6806005)(5008740100001)(87936001)(42186005)(63266004)(45336002)(90966002)(86362001)(48376002)(189998001)(81166005)(92566002)(50466002)(11100500001)(50986999)(33646002)(1096002)(52956003)(47776003)(5003940100001)(107886002)(4326007)(110136002)(103686003)(4001430100002)(2906002)(106466001)(36756003)(36386004)(229853001)(2351001)(586003)(19580395003)(50226001)(46386002)(19580405001)(1220700001)(107986001)(5001870100001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1NAM02HT253; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; MLV:nov; MX:1; A:1; PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com; LANG:en; MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: b42daafd-d4bd-4f37-6928-08d3472d8c75 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:CY1NAM02HT253; X-Microsoft-Antispam-PRVS: <309c0d8caeb04aa3b56dbb2dbedd22f9@CY1NAM02HT253.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)(13023025)(13024025)(8121501046)(5005006)(13017025)(13018025)(13015025)(10201501046)(3002001); SRVR:CY1NAM02HT253; BCL:0; PCL:0; RULEID:; SRVR:CY1NAM02HT253; X-Forefront-PRVS: 08756AC3C8 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2016 08:42:14.3570 (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: CY1NAM02HT253 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. Signed-off-by: Shubhrajyoti Datta Acked-by: Sören Brinkmann --- 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; }