From patchwork Tue Jun 2 18:45:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 49435 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D40EF20BD1 for ; Tue, 2 Jun 2015 18:46:27 +0000 (UTC) Received: by wibut5 with SMTP id ut5sf16263861wib.0 for ; Tue, 02 Jun 2015 11:46:27 -0700 (PDT) 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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=9k8XhIDuJ3ph9FJyEBRF3s4I+aR6fyCcgBhQLZScrXs=; b=hAsknkZNyF7eh0RRPcx5GOFtCCVFWwOv8779JdoXPYJMd+nWXON0UELHawtHCyOriG MlSYqK6rd6v+RkMVGEGrpsP4kWVkfb75/jhecNYEJu57Bs2D1fmr9H22AGsuywwzOoCn DWJuPLn9KEt5NutLY0NR8kV9jsEJJH/Gvp56pIpq3rbOtBPhyYravHBL3aDuQVQGUKGm cV2uETF0npNupPXizDQFVlCU5t87C7mUj6zZyZrp7XA9Tz2YU7MKxCfOhVRXkXYjumHX WYEz/JYff6AbZeeOiJtRrTRG5uOZnimfDqsdDKqxrNZSsu5rujbY24veMT3OixzMs9Hz fVWw== X-Gm-Message-State: ALoCoQniMVAWlUmZNoYOCBrgMUVc8k+jYDTb2jtCbfmISJ07en1ctT25NOXot6e+vB7/6ecguZ4N X-Received: by 10.112.166.137 with SMTP id zg9mr26988256lbb.11.1433270787139; Tue, 02 Jun 2015 11:46:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.36 with SMTP id ll4ls233851lac.36.gmail; Tue, 02 Jun 2015 11:46:27 -0700 (PDT) X-Received: by 10.152.5.72 with SMTP id q8mr27634352laq.83.1433270786991; Tue, 02 Jun 2015 11:46:26 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id uo6si15824667lbc.21.2015.06.02.11.46.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jun 2015 11:46:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by labpy14 with SMTP id py14so120884439lab.0 for ; Tue, 02 Jun 2015 11:46:26 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr28488751lbc.32.1433270786375; Tue, 02 Jun 2015 11:46:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp3276827lbb; Tue, 2 Jun 2015 11:46:25 -0700 (PDT) X-Received: by 10.70.88.145 with SMTP id bg17mr52768840pdb.167.1433270784082; Tue, 02 Jun 2015 11:46:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qk1si27289912pbb.80.2015.06.02.11.46.23; Tue, 02 Jun 2015 11:46:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759311AbbFBSqW (ORCPT + 1 other); Tue, 2 Jun 2015 14:46:22 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:34516 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754366AbbFBSqV (ORCPT ); Tue, 2 Jun 2015 14:46:21 -0400 Received: by pdbki1 with SMTP id ki1so138697631pdb.1 for ; Tue, 02 Jun 2015 11:46:21 -0700 (PDT) X-Received: by 10.68.221.164 with SMTP id qf4mr14998309pbc.1.1433270781513; Tue, 02 Jun 2015 11:46:21 -0700 (PDT) Received: from localhost.localdomain ([223.190.86.187]) by mx.google.com with ESMTPSA id jx5sm18222527pbc.85.2015.06.02.11.46.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jun 2015 11:46:20 -0700 (PDT) From: Vaibhav Hiremath To: linux-i2c@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, wsa@the-dreams.de, Vaibhav Hiremath , Shouming Wang , Haojian Zhuang Subject: [PATCH-RESEND 3/3] i2c: pxa: Add pin ctrl support for CP core access Date: Wed, 3 Jun 2015 00:15:31 +0530 Message-Id: <1433270731-23790-4-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1433270731-23790-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1433270731-23790-1-git-send-email-vaibhav.hiremath@linaro.org> Sender: linux-i2c-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-i2c@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vaibhav.hiremath@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , PMIC TWSI pins configuration for AP and CP is different on eden, it need to be set to function 0 when AP get RIPC lock. When AP release RIPC lock, it also need configure twsi pins to other state, otherwise pinctrl will assume pins configration is not changed even if it is changed by CP, so it will not change twsi pins configuration to AP state when AP get RIPC next time. Signed-off-by: Shouming Wang Signed-off-by: Haojian Zhuang Signed-off-by: Vaibhav Hiremath --- drivers/i2c/busses/i2c-pxa.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index eb26eb1..1340de1 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -184,6 +184,7 @@ struct pxa_i2c { struct pinctrl *pinctrl; struct pinctrl_state *pin_i2c; struct pinctrl_state *pin_gpio; + struct pinctrl_state *pin_i2c_cp; }; #define _IBMR(i2c) ((i2c)->reg_ibmr) @@ -405,6 +406,10 @@ void mmp_hwlock_lock(struct i2c_adapter *adap) ripc_status = true; spin_unlock_irqrestore(&lock_for_ripc, flags); + + if (pinctrl_select_state(i2c->pinctrl, i2c->pin_i2c) < 0) + dev_err(&i2c->adap.dev, "could not set i2c AP pins\n"); + } void mmp_hwlock_unlock(struct i2c_adapter *adap) @@ -413,6 +418,9 @@ void mmp_hwlock_unlock(struct i2c_adapter *adap) struct pxa_i2c *i2c = adap->algo_data; + if (pinctrl_select_state(i2c->pinctrl, i2c->pin_i2c_cp) < 0) + dev_err(&i2c->adap.dev, "could not set i2c CP pins\n"); + spin_lock_irqsave(&lock_for_ripc, flags); __raw_writel(1, i2c->hwlock_addr); ripc_status = false; @@ -430,6 +438,9 @@ int mmp_hwlock_trylock(struct i2c_adapter *adap) ripc_status = !__raw_readl(i2c->hwlock_addr); spin_unlock_irqrestore(&lock_for_ripc, flags); + if (ripc_status && (pinctrl_select_state(i2c->pinctrl, i2c->pin_i2c) < 0)) + dev_err(&i2c->adap.dev, "could not set i2c AP pins\n"); + return ripc_status; } @@ -1497,8 +1508,14 @@ static int i2c_pxa_probe(struct platform_device *dev) ret = IS_ERR(i2c->pin_gpio); } + /* pin ctrl for CP - optional */ + i2c->pin_i2c_cp = pinctrl_lookup_state(i2c->pinctrl, "i2c_cp"); + if (IS_ERR(i2c->pin_i2c_cp)) + dev_err(&dev->dev, "could not get i2c_cp pinstate\n"); + if (ret) { i2c->pin_i2c = NULL; + i2c->pin_i2c_cp = NULL; i2c->pin_gpio = NULL; i2c->pinctrl = NULL; ret = 0;