Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp871478imj; Fri, 15 Feb 2019 08:10:11 -0800 (PST) X-Google-Smtp-Source: AHgI3IaeDJDE9bzfqGhu31F8Z18Cp9jPePCyhQNrBxiuOu+1VftdM5pu7kPuV2JexiXNwVDROANS X-Received: by 2002:a62:520b:: with SMTP id g11mr10648346pfb.53.1550247011699; Fri, 15 Feb 2019 08:10:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550247011; cv=none; d=google.com; s=arc-20160816; b=ny3pdyRV0oeZknT8BDSOhLOhFNlT73mGz3RHIGbhWDmmGv43C2SHT+AC/xswyXI8ds EWwAMsD30ehm+qKRsKQhc7qk0exLo6Vwx+83NlOGlegGI0rCslHG2Xv2GStfyH5eV7wE hFbLsmPptOFWoSViAdSvAvQI9lWmS7T44kpwAgmdvjJW8kHkfWJDThlkyPcWKXsKaf4g jo743gkeiNIrvIjSFI/msqskk5Y93D+zG63dZdYsLyqQQwKIc28tj22XMm8cebuPYnAP HrPoMYC6dow1UhkIhvTeNCt53QI++aoK7ottzt2bAD5zQ5dwDXP1A+4xB+rDZuN6lmoE 7AYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=DHreN7FmvfNjJM3uXrYhnaHzqQk+jmY9ofZPntDTasI=; b=jSTAx5czOtgBspGxk6XX4u2uSsYkvhP/GMexeXlfJq1RFsJVIvm7mOEdhX456hU/9y zWmt1og/pQvsYxbZJLwzNnJ2TnZuo68nZ7feGO+/+FQLbzpzzPseBDLkFao093OhWJdV 41xvhe/voN3bDwqxkvEbFETJEca5VebNFS5MZqlsl499V1YfihJKgBT6doQT0AaPBaWS UV6DB4LRxJJ9Ca3pMPM0tpq1cf8WeTLRHyk79trW7sCHnRC1MsloAdAE9M4MRuMCx8QN KdGhA/t1Fyx0zJLyU/3WWd83TsorH114lIr2NnFFAH6FpfpHhxecH/DBxpTKMfP/vclX pLag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mF96k0Ab; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si5510795plf.398.2019.02.15.08.09.55; Fri, 15 Feb 2019 08:10:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mF96k0Ab; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393988AbfBOLH7 (ORCPT + 99 others); Fri, 15 Feb 2019 06:07:59 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:37937 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393771AbfBOLH7 (ORCPT ); Fri, 15 Feb 2019 06:07:59 -0500 Received: by mail-wr1-f67.google.com with SMTP id v13so9889112wrw.5; Fri, 15 Feb 2019 03:07:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DHreN7FmvfNjJM3uXrYhnaHzqQk+jmY9ofZPntDTasI=; b=mF96k0AbTJhNZCfTcEsvKSncScD1ZXwuN6JBD8+SmL9l6B9W9wbYM/MNfWu9EVfvyK qsZ3SjgifMyROTc155lHthisuXMNbHX9hi8KeFmm1M51Tibk2pe9//OOOl/6zgtsALA6 QLf4rx8W+QCJ69hQBg10yi/mNvAKjeyE3iy8GxMshPtAyrbzTtvPvmrokqcR8mNEiPi5 yFQk0mv6IDS/v950tFSS+yjupdYiMaQGHg7UqNbzDotndW4Z5eob1DrcXZ/7CKAdsigd 0BgRcgzmKkn4qG+W2drHveKivVBz+kziQacK1KFAiE76889N2cdu7koKJ6z7XSNOzYdt iuEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DHreN7FmvfNjJM3uXrYhnaHzqQk+jmY9ofZPntDTasI=; b=HOF7Om4N8pfgDljVa5bXdVzOv6oQfT8J2CpCLt8PesjcR8f6CSWUM9rpymmK6P1Mom b3h4kjrX6U9aosZjd/X3ctxTOUZUrqy1443cRTEAN4RPDGwG8/3RPnh/3anTZ9guAbxE 4g4hgkpSaQZwpWx7XpfK5HVXZr7625+7ffnLi3lv724oOu8lcAFRoA40WyjdgMXkDaUR Oqw2vjwEtg9TdDBQiA9833RMf44g4LKqD5ZTyM6+E+dvJ/8vGKS5ztaV0jIgOkydl3Iw bPlQDA25Ifpb3FRFzz6Kk8NrAWGwYyu7p5pmu8Y4K8HczkZU1KkdczwEuRO6OLk/RuGH rHUQ== X-Gm-Message-State: AHQUAubYjvIMkgznvZDnVq4V/L0m+4fcmx0Tajxcetbm0yqA6KFHwz+8 1EToqucMNidZRf1ABRJIwvgKR3v8+7jim35Wiv4= X-Received: by 2002:a5d:5504:: with SMTP id b4mr3800825wrv.291.1550228877049; Fri, 15 Feb 2019 03:07:57 -0800 (PST) MIME-Version: 1.0 References: <20190129195214.30272-1-sxauwsk@163.com> In-Reply-To: <20190129195214.30272-1-sxauwsk@163.com> From: Shubhrajyoti Datta Date: Fri, 15 Feb 2019 16:37:46 +0530 Message-ID: Subject: Re: [PATCH] i2c: cadence: try reset when master receive error interrupts To: sxauwsk Cc: Michal Simek , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Shubhrajyoti Datta Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sxauwsk, On Wed, Jan 30, 2019 at 3:13 PM sxauwsk wrote: > > When the adapter receive error interrupts, such as NACK, arbitration lost, > cdns_i2c_master_xfer return to the caller directly instead of resuming > the adapter which resulted in the adapter being out of control. > > So when driver detect err_status then try to repair and fix it. > > Signed-off-by: sxauwsk > --- > drivers/i2c/busses/i2c-cadence.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c > index b13605718291..e10048d7524a 100644 > --- a/drivers/i2c/busses/i2c-cadence.c > +++ b/drivers/i2c/busses/i2c-cadence.c > @@ -548,10 +548,6 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg, > cdns_i2c_writereg(CDNS_I2C_IXR_ALL_INTR_MASK, > CDNS_I2C_IDR_OFFSET); > > - /* If it is bus arbitration error, try again */ > - if (id->err_status & CDNS_I2C_IXR_ARB_LOST) > - return -EAGAIN; > - > return 0; > } > > @@ -617,13 +613,19 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, > id->bus_hold_flag = 0; > > ret = cdns_i2c_process_msg(id, msgs, adap); > - if (ret) > + if (!ret) > goto out; > In case the Arbitration error happend the cdns_i2c_process_msg would return 0 and we will miss the check below. Am I missing something ? > /* Report the other error interrupts to application */ > if (id->err_status) { > cdns_i2c_master_reset(adap); > > + /* If it is bus arbitration error, try again */ > + if (id->err_status & CDNS_I2C_IXR_ARB_LOST) { > + ret = -EAGAIN; > + goto out; > + } > + > if (id->err_status & CDNS_I2C_IXR_NACK) { > ret = -ENXIO; > goto out; > -- > 2.19.2 > >