Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5923516iob; Tue, 10 May 2022 06:49:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzo9izqVETQHJhNANOy8AEF6QoqvOIeAf5IjVaUJAbJ+2BMyqr2UfIiC4U+nAC+t2KBbfIy X-Received: by 2002:a17:906:478c:b0:6f4:e6c6:526f with SMTP id cw12-20020a170906478c00b006f4e6c6526fmr20109703ejc.41.1652190563668; Tue, 10 May 2022 06:49:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652190563; cv=none; d=google.com; s=arc-20160816; b=HJsRBVnAXtlW3GDNGR9JEnf4RP3GMTF6QYysa/FXt3YaDxQQApdwGljcEeBIu7zCvb TuxZhqVjCzrIaknrEt+YDuQdO0tuizuOEbdMXR8KwoG7rfBpegtoILG0H7w3ptQrbROL egTlxIUfmHmb4Emmqzv5mrELHzSGz+CZ4sv2DOQ6IXno8M/r96V5W62IUyCuhAi/FyDn mCsUmhAogDzPQHil9ctostelZFkwDZOjp2lG+GkPFMCadcWL6ObQqmZ9HsyLBrl9N/jV 3dy3+wS10GkSSDlH4izZ7Zv32XCmr8yEScjczDmW/JHhiLvmcnU/3Y3b/k3KONHqDMDx 7QSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=r6gGY8uJPWMsNx9NrGNhIO7hqQt9WvcgpGoPJDHS/+Q=; b=kO49AAjq2I23PRlgZiKmXDPU1anlNX7L4MtQdyV5kktzwtbEw3o27Ynfgi/LURcxg9 DE+jTUsmNRgLdc1OmCZFtMep/YSJ16Lqr/0V51o8DxBm25nqCJbi7+BOLBxbwa03HVHm l4Iqe6rxI4zk0eoTjY0+BV5908j1EZsYmL7WxtmKi7smPXwKNIyPEPwsBeOTA0kB9g5R JYOKgIAXh0T0sMVJ/MNsSxpz/axc77HhVjC1P/poerPsBH+ziTHbnN0aOgrQ+EEbVgqe mEs/o06ZX5eyw9g4VOih7jBbIeQ/Hu0UYDQZLrZOiaU06sDRfwJLGJNPBinQJnlEbHJB fkvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kDGssBIh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z12-20020a50e68c000000b00425bc76ecddsi18844256edm.337.2022.05.10.06.48.59; Tue, 10 May 2022 06:49:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kDGssBIh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239666AbiEJKTI (ORCPT + 99 others); Tue, 10 May 2022 06:19:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239649AbiEJKTG (ORCPT ); Tue, 10 May 2022 06:19:06 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB3AB2AC0D0; Tue, 10 May 2022 03:15:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652177710; x=1683713710; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=mm3Wzebclb3e6JX7+dRypp1DwInebPhxa0hyqQTCYhk=; b=kDGssBIhxnWy2DXf8j0c2X8wVfKkSXxXqZ7yYTzBcqD2P0Tg9txmiNMz VqNxgErH5B2HXSK0zFOgoq4539PYN6R8UM2OTLM2W3NjUHYlTVn1qm0Ud jE9zG/DMPLpppZHy/oOiknyZFUUy956EyEQ4fKaeYkL+XlJ0fTpGuRNxG oF1d2/2WNkkY5j7xuwzArZbWKV54G333bWTMD9ubt9B+5M1oywgvnAhd0 8VVPN3aSykZssT5DvLiOaB2W5MT1KWRjBSC78M7bo9pBN83K8QBnshfo8 qsxre1K6aUbtZ3QqC9QQ61kzxi07fze+IFYBvB9Hd2if5WsGLTnFV6c0f A==; X-IronPort-AV: E=McAfee;i="6400,9594,10342"; a="256865436" X-IronPort-AV: E=Sophos;i="5.91,214,1647327600"; d="scan'208";a="256865436" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 03:15:09 -0700 X-IronPort-AV: E=Sophos;i="5.91,214,1647327600"; d="scan'208";a="635878530" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 03:15:02 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1noMtO-00EIEX-Bb; Tue, 10 May 2022 13:14:58 +0300 Date: Tue, 10 May 2022 13:14:57 +0300 From: Andy Shevchenko To: Tyrone Ting Cc: avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, robh+dt@kernel.org, krzysztof.kozlowski@canonical.com, wsa@kernel.org, jarkko.nikula@linux.intel.com, semen.protsenko@linaro.org, sven@svenpeter.dev, jie.deng@intel.com, jsd@semihalf.com, lukas.bulwahn@gmail.com, olof@lixom.net, arnd@arndb.de, tali.perry@nuvoton.com, Avi.Fishman@nuvoton.com, tomer.maimon@nuvoton.com, KWLIU@nuvoton.com, JJLIU0@nuvoton.com, kfting@nuvoton.com, openbmc@lists.ozlabs.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 7/9] i2c: npcm: Handle spurious interrupts Message-ID: References: <20220510091654.8498-1-warp5tw@gmail.com> <20220510091654.8498-8-warp5tw@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220510091654.8498-8-warp5tw@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 10, 2022 at 05:16:52PM +0800, Tyrone Ting wrote: > From: Tali Perry > > On some platforms in rare cases (1 to 100,000 transactions), > the i2c gets a spurious interrupt which means that we enter an interrupt > but in the interrupt handler we don't find any status bit that points to > the reason we got this interrupt. > > This may be a case of a rare HW issue or signal integrity issue that is > still under investigation. > > In order to overcome this we are doing the following: > 1. Disable incoming interrupts in master mode only when slave mode is not > enabled. > 2. Clear end of busy (EOB) after every interrupt. > 3. Clear other status bits (just in case since we found them cleared) > 4. Return correct status during the interrupt that will finish the > transaction. > > On next xmit transaction if the bus is still busy the master will issue a > recovery process before issuing the new transaction. ... > + /* clear status bits for spurious interrupts */ Clear ... > + /* > + * if irq is not one of the above, make sure EOB is disabled and all If > + * status bits are cleared. > + */ ... > + /* verify no status bits are still set after bus is released */ Verify ... > + /* check HW is OK: SDA and SCL should be high at this point. */ Check ... > + if ((npcm_i2c_get_SDA(&bus->adap) == 0) || > + (npcm_i2c_get_SCL(&bus->adap) == 0)) { This fits one line > + dev_err(bus->dev, "I2C%d init fail: lines are low", bus->num); > + dev_err(bus->dev, "SDA=%d SCL=%d", npcm_i2c_get_SDA(&bus->adap), > + npcm_i2c_get_SCL(&bus->adap)); No '\n' at the end of each?! > + return -ENXIO; > + } ... > + /* clear status bits for spurious interrupts */ Clear ... > + /* after any xfer, successful or not, stall and EOB must be disabled */ After ... Maybe you chose the small letter for one-liner comments, but I see even in the original code the inconsistent style. Please, add an explanation to the cover letter and follow it, assuming you add the patch at the end of the series that makes comment style consistent (for the one-liners, for the multi-line comments we have a clear understanding about the style). -- With Best Regards, Andy Shevchenko