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: 24120 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 87C72202FA for ; Tue, 4 Feb 2014 15:59:56 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id oz11sf24469047veb.4 for ; Tue, 04 Feb 2014 07:59:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=ifos7MnM2H3poAB3SZ6p5lgZX/kOT8hrn1l+aKpdVL4=; b=mBBynj1VQfRFu5qCN6w8yQpaAf4mnMELrKxxE1+Ejg64hJuz55hmZoEWSw0M3ebfUd /vadffYQBluSHHBAB5kYvLYSc8aPmi2O2sGsvdY/5GNhvRZ5IDHz8Sm1ADy+6NpbkWR1 bwpTDTGvHfaAxlaWV8gX8nYdQnoJyTAmiJOHL1BrzD42prdtkgtkna8YO/zol0jelSCd qracLVMGDpYmRmIA89R8sJaBzB2QF147FATtzb2k/OcS7ITVVl6JDqkKvchjxnyrFzsb wOf1v0X3zd3s7vnM+RB+LxyDkt+AgPvTpG65l7dLSaIldXCZUwlmeshTAx5KfHCaFO3d fntA== X-Gm-Message-State: ALoCoQn6BD2lSK6CBDjgkGRuIndozVy/ZfZ97qv3+mwlFohhmDqyqsoSlVKnLyytkvmDe5JN5eCI X-Received: by 10.58.253.33 with SMTP id zx1mr15778836vec.10.1391529595728; Tue, 04 Feb 2014 07:59:55 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.107.199 with SMTP id h65ls2233853qgf.76.gmail; Tue, 04 Feb 2014 07:59:55 -0800 (PST) X-Received: by 10.221.66.73 with SMTP id xp9mr1682671vcb.27.1391529595587; Tue, 04 Feb 2014 07:59:55 -0800 (PST) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id sq4si8338162vdc.2.2014.02.04.07.59.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 07:59:55 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.46; Received: by mail-vb0-f46.google.com with SMTP id o19so5771702vbm.19 for ; Tue, 04 Feb 2014 07:59:55 -0800 (PST) X-Received: by 10.58.69.111 with SMTP id d15mr33169106veu.3.1391529595513; Tue, 04 Feb 2014 07:59:55 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp245387vcz; Tue, 4 Feb 2014 07:59:54 -0800 (PST) X-Received: by 10.112.200.201 with SMTP id ju9mr577973lbc.76.1391529593653; Tue, 04 Feb 2014 07:59:53 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) by mx.google.com with ESMTPS id e10si12949816laa.146.2014.02.04.07.59.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 07:59:53 -0800 (PST) Received-SPF: neutral (google.com: 209.85.217.181 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id z5so6445485lbh.26 for ; Tue, 04 Feb 2014 07:59:53 -0800 (PST) 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 Cc: Alessandro Rubini , Linus Walleij , Wolfram Sang , Chris Ball , Mark Brown , linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-spi@vger.kernel.org, linux-mmc@vger.kernel.org, Ulf Hansson 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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));