From patchwork Wed Aug 7 09:05:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingchang Lu X-Patchwork-Id: 265451 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6ADFE2C0219 for ; Wed, 7 Aug 2013 19:59:13 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757269Ab3HGJ7M (ORCPT ); Wed, 7 Aug 2013 05:59:12 -0400 Received: from mail-db9lp0249.outbound.messaging.microsoft.com ([213.199.154.249]:37492 "EHLO db9outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757225Ab3HGJ7L (ORCPT ); Wed, 7 Aug 2013 05:59:11 -0400 Received: from mail153-db9-R.bigfish.com (10.174.16.246) by DB9EHSOBE004.bigfish.com (10.174.14.67) with Microsoft SMTP Server id 14.1.225.22; Wed, 7 Aug 2013 09:59:09 +0000 Received: from mail153-db9 (localhost [127.0.0.1]) by mail153-db9-R.bigfish.com (Postfix) with ESMTP id 763AEE0279; Wed, 7 Aug 2013 09:59:09 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h208ch1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz1de098h8275bh1de097hz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh1fb3h1d0ch1d2eh1d3fh1dfeh1dffh1e23h1155h) Received: from mail153-db9 (localhost.localdomain [127.0.0.1]) by mail153-db9 (MessageSwitch) id 1375869547610818_32307; Wed, 7 Aug 2013 09:59:07 +0000 (UTC) Received: from DB9EHSMHS015.bigfish.com (unknown [10.174.16.228]) by mail153-db9.bigfish.com (Postfix) with ESMTP id 8E01A3E0046; Wed, 7 Aug 2013 09:59:07 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB9EHSMHS015.bigfish.com (10.174.14.25) with Microsoft SMTP Server (TLS) id 14.16.227.3; Wed, 7 Aug 2013 09:59:06 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.3.136.1; Wed, 7 Aug 2013 09:59:04 +0000 Received: from rock.am.freescale.net (rock.ap.freescale.net [10.193.20.106]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r779wqx4022506; Wed, 7 Aug 2013 02:59:01 -0700 From: Jingchang Lu To: CC: , , , , , Jingchang Lu Subject: [PATCH 2/8] i2c: imx: enable clk before write to registers Date: Wed, 7 Aug 2013 17:05:37 +0800 Message-ID: <1375866343-2074-2-git-send-email-b35083@freescale.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1375866343-2074-1-git-send-email-b35083@freescale.com> References: <1375866343-2074-1-git-send-email-b35083@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The module clk should be enabled before write to its register in probe(), and the clk can be disabled after. Signed-off-by: Jingchang Lu --- drivers/i2c/busses/i2c-imx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 9167d43..7adb351 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -543,6 +543,11 @@ static int __init i2c_imx_probe(struct platform_device *pdev) return PTR_ERR(i2c_imx->clk); } + ret = clk_prepare_enable(i2c_imx->clk); + if (ret) { + dev_err(&pdev->dev, "can't enable I2C clock\n"); + return ret; + } /* Request IRQ */ ret = devm_request_irq(&pdev->dev, irq, i2c_imx_isr, 0, pdev->name, i2c_imx); @@ -580,6 +585,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev) /* Set up platform driver data */ platform_set_drvdata(pdev, i2c_imx); + clk_disable_unprepare(i2c_imx->clk); dev_dbg(&i2c_imx->adapter.dev, "claimed irq %d\n", irq); dev_dbg(&i2c_imx->adapter.dev, "device resources from 0x%x to 0x%x\n",