From patchwork Tue Feb 4 15:58:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 3577601 Return-Path: X-Original-To: patchwork-linux-arm@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 D741CC02DC for ; Tue, 4 Feb 2014 16:05:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C7B62017D for ; Tue, 4 Feb 2014 16:05:06 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 10CC920170 for ; Tue, 4 Feb 2014 16:05:05 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAiSj-0002bQ-FW; Tue, 04 Feb 2014 16:03:03 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAiRi-0006NP-0n; Tue, 04 Feb 2014 16:01:58 +0000 Received: from mail-la0-f51.google.com ([209.85.215.51]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAiQ3-00067k-GI for linux-arm-kernel@lists.infradead.org; Tue, 04 Feb 2014 16:00:24 +0000 Received: by mail-la0-f51.google.com with SMTP id c6so6511696lan.24 for ; Tue, 04 Feb 2014 07:59:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ifos7MnM2H3poAB3SZ6p5lgZX/kOT8hrn1l+aKpdVL4=; b=UIkID2W3SgZsbL2FZhWxL5rs9hU7+eN3EGmsRTbIRHJrHWwhhaYK87e9er3yUCX4r9 N4XniqeU9ZgVcBxBFL8Ft0/4haf5HDAA/rjSo/HeO64abofs3zw8w9bbCAbO4S/vLkrn oCI3r6zpEDA6np328aLChIRcR9C2132QlKCAopY8skkIjzGPqeuou7B/9TLXWlDVoBwl 2c7R1S1fhPZ75mperWMyOy0Ll5CS/MzGDCnL0CLgR9SLlExRto25a55nzJjS5C+dUL+I OQdrXU74Hr1myWWe3Jdk7o2Hs955sRIL5C954Ps3I96pXbBnTRzbq30tQ0HSYplkZXXC gAKQ== X-Gm-Message-State: ALoCoQmwtHOfO2Z8pE+a+vZjGo6poHmll1t9MbPtfDcpMRmcIdxzLtfmozh9COjGpHwctCnnIe0f X-Received: by 10.112.164.35 with SMTP id yn3mr2146086lbb.45.1391529592965; Tue, 04 Feb 2014 07:59:52 -0800 (PST) Received: from localhost.localdomain (host-95-199-220-119.mobileonline.telia.com. [95.199.220.119]) by mx.google.com with ESMTPSA id dm8sm35906603lad.7.2014.02.04.07.59.50 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 07:59:52 -0800 (PST) From: Ulf Hansson To: Russell King , linux-arm-kernel@lists.infradead.org Subject: [PATCH 13/17] i2c: nomadik: Leave probe with the device in active state Date: Tue, 4 Feb 2014 16:58:54 +0100 Message-Id: <1391529538-21685-14-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1391529538-21685-1-git-send-email-ulf.hansson@linaro.org> References: <1391529538-21685-1-git-send-email-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140204_110015_841604_9975E52F X-CRM114-Status: GOOD ( 14.12 ) X-Spam-Score: -2.6 (--) Cc: Ulf Hansson , Wolfram Sang , Linus Walleij , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Ball , Mark Brown , linux-i2c@vger.kernel.org, linux-spi@vger.kernel.org, Alessandro Rubini X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Since the runtime PM state is expected to be active according to the amba bus, we must align our behaviour while probing to it. Moreover, this is needed to be able to have the driver fully functional without depending on CONFIG_RUNTIME_PM. Cc: Alessandro Rubini Cc: Linus Walleij Cc: Wolfram Sang Signed-off-by: Ulf Hansson --- drivers/i2c/busses/i2c-nomadik.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 42c9e51..0caa8ea 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -1026,11 +1026,6 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) dev->adev = adev; amba_set_drvdata(adev, dev); - /* Select default pin state */ - pinctrl_pm_select_default_state(&adev->dev); - /* If possible, let's go to idle until the first transfer */ - pinctrl_pm_select_idle_state(&adev->dev); - dev->virtbase = devm_ioremap(&adev->dev, adev->res.start, resource_size(&adev->res)); if (!dev->virtbase) { @@ -1055,6 +1050,14 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) goto err_no_mem; } + ret = clk_prepare_enable(dev->clk); + if (ret) { + dev_err(&adev->dev, "can't prepare_enable clock\n"); + goto err_no_mem; + } + + init_hw(dev); + adap = &dev->adap; adap->dev.of_node = np; adap->dev.parent = &adev->dev; @@ -1080,13 +1083,15 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) ret = i2c_add_adapter(adap); if (ret) { dev_err(&adev->dev, "failed to add adapter\n"); - goto err_no_mem; + goto err_no_adap; } pm_runtime_put(&adev->dev); return 0; + err_no_adap: + clk_disable_unprepare(dev->clk); err_no_mem: return ret; @@ -1103,6 +1108,7 @@ static int nmk_i2c_remove(struct amba_device *adev) clear_all_interrupts(dev); /* disable the controller */ i2c_clr_bit(dev->virtbase + I2C_CR, I2C_CR_PE); + clk_disable_unprepare(dev->clk); if (res) release_mem_region(res->start, resource_size(res));