From patchwork Thu May 28 13:32:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 49116 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1066F202A3 for ; Thu, 28 May 2015 13:35:32 +0000 (UTC) Received: by wgla2 with SMTP id a2sf10268919wgl.1 for ; Thu, 28 May 2015 06:35:31 -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=PEiiLTh0F3mPYD+q5rRJHGmxZs5dNJnVYIVaqnv7GPA0tVEvl7k1sl8lZdxWiE/B5B qKo20y3QcsO8Wpv5nXqQo2Orw64bScAF5/hVi2CW3qzm7bEwXaF1JeLL8uwDaePmlSua pcvUHkMqRze6mmEjdHkd4ALcTrJvyBqnKz9zp+RtO8pBGYwHhQ2u+VaFW5+Abp61GEmG qctY2TvTzP+q2JAj+1ub6mCu1ithCVR0TsT/6+v4EGugszTJITvGV4l/jNSPL4/fe0gI F0rOjl5pJ7FzJH1a2c40i6m4cHscdZUc8SSOWrCXj+EIJwJ97+rSOcIxOeFrMrxEWmpA 0QFg== X-Gm-Message-State: ALoCoQkyt05IdLov+UZjxgIgHCGlTVqh/zOBcaidP9GY+bJqg3Se9bGtZtzQNjDw6NuBSvHLOfUZ X-Received: by 10.194.143.98 with SMTP id sd2mr2728954wjb.6.1432820131417; Thu, 28 May 2015 06:35:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.41 with SMTP id bd9ls20053lab.109.gmail; Thu, 28 May 2015 06:35:31 -0700 (PDT) X-Received: by 10.152.27.1 with SMTP id p1mr2802111lag.112.1432820131256; Thu, 28 May 2015 06:35:31 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id t2si1948225lbj.163.2015.05.28.06.35.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 06:35:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbcmx3 with SMTP id mx3so28396353lbc.1 for ; Thu, 28 May 2015 06:35:31 -0700 (PDT) X-Received: by 10.112.204.72 with SMTP id kw8mr2873566lbc.88.1432820131147; Thu, 28 May 2015 06:35:31 -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 hn6csp1165401lbb; Thu, 28 May 2015 06:35:30 -0700 (PDT) X-Received: by 10.68.180.131 with SMTP id do3mr5609572pbc.42.1432820126407; Thu, 28 May 2015 06:35:26 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8si3682249pas.64.2015.05.28.06.35.25; Thu, 28 May 2015 06:35:26 -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 S1754014AbbE1NfS (ORCPT + 1 other); Thu, 28 May 2015 09:35:18 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:36574 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753684AbbE1NfR (ORCPT ); Thu, 28 May 2015 09:35:17 -0400 Received: by paza2 with SMTP id a2so23857227paz.3 for ; Thu, 28 May 2015 06:35:17 -0700 (PDT) X-Received: by 10.70.90.100 with SMTP id bv4mr5565397pdb.53.1432820116926; Thu, 28 May 2015 06:35:16 -0700 (PDT) Received: from localhost.localdomain ([202.62.77.106]) by mx.google.com with ESMTPSA id f1sm2473461pds.62.2015.05.28.06.35.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 May 2015 06:35:15 -0700 (PDT) From: Vaibhav Hiremath To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , linux-arm-kernel@lists.infradead.org, Vaibhav Hiremath , Shouming Wang , Haojian Zhuang Subject: [PATCH 3/3] i2c: pxa: Add pin ctrl support for CP core access Date: Thu, 28 May 2015 19:02:48 +0530 Message-Id: <1432819968-17515-4-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432819968-17515-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1432819968-17515-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.217.170 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;