Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1544154yba; Thu, 25 Apr 2019 01:23:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8bKtsr2KgH14Cp0L+4PgIxnYYagY358HK2FEFLDqoaa8Dqe/Prhv7LdV4DY0pS0bpBUmK X-Received: by 2002:a17:902:1003:: with SMTP id b3mr38060014pla.306.1556180581656; Thu, 25 Apr 2019 01:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556180581; cv=none; d=google.com; s=arc-20160816; b=t4QyFdzkLeQPmefc+0HDDHtqAuNpNfLPSbJsU+y1caf6Nd+AldKlVQWs+a5gc2kDOB Z+xxAIFQSfp1WUnd2HrbV9sdWB2j0skp9Hd0R+Ah7q4pH3wpKCa9Ypr+fqyLZ8Vf9weW uB/EFgHpC2eeIQci0xfFWAgqmT5khWmjROvtyh7wY4PoDe6WG/YJsGRRrAl+rjMG6Rjs P35yAezK0o2MN7sQGo8HXCjA0T/noUjnFYHhUwtQND+5uarXP02dmVt8XXayjHBEyxPP flYlD2DHEB4Ih22danfq/rLstdF7rUvjnB3EbiwmkT8D5lCxsrnRVxRMFIX93Zf8wZqs yXTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date; bh=8B0aweg3ekEceLI7zeMFUc4wvNcGthjh56ue9eUY3wQ=; b=xLd2c9cL7alHQ5S9m75WkiCW2Q7rkXpOaeQrg2Jhdy7tp9aW49l/kO4XtEAGHdQp09 VDAiv2k6DBTXDt4H4Ta0ufSj1/IrLf8DbTH39DgIcKsPfdRC2KhzYkE9UMwjYIUqK6DU qxEZd3eInfILrHt1/di2sRFZ5s6FQCuuT69cnWyI9j7w7q5jSXhahc7eSm7I2XjgPqpu Lp2E9BguOFba0FOPA4dB30pm888qz7BuQrlDVM4CgTmAFDECn4tahGDZcUeHcuTEeHE7 ISiJmNsTxDpv3h7LKo+BheklF2bC2ncM97xonnPS3ilcf8Gqkfn9BYskkzKNxSCii64h q1AA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 74si20359887pgb.203.2019.04.25.01.22.46; Thu, 25 Apr 2019 01:23:01 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729699AbfDYGes (ORCPT + 99 others); Thu, 25 Apr 2019 02:34:48 -0400 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:64034 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726229AbfDYGer (ORCPT ); Thu, 25 Apr 2019 02:34:47 -0400 X-IronPort-AV: E=Sophos;i="5.60,392,1549954800"; d="scan'208";a="30632859" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 24 Apr 2019 23:34:46 -0700 Received: from localhost (10.10.76.4) by chn-sv-exch04.mchp-main.com (10.10.76.105) with Microsoft SMTP Server id 14.3.352.0; Wed, 24 Apr 2019 23:34:46 -0700 Date: Thu, 25 Apr 2019 08:34:16 +0200 From: Ludovic Desroches To: CC: , , , , , Subject: Re: [PATCH RESEND] can: m_can: implement errata "Needless activation of MRAF irq" Message-ID: <20190425063416.iuwbtqdhffuidaju@M43218.corp.atmel.com> Mail-Followup-To: Eugen.Hristev@microchip.com, wg@grandegger.com, mkl@pengutronix.de, linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <1554209445-19879-1-git-send-email-eugen.hristev@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1554209445-19879-1-git-send-email-eugen.hristev@microchip.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 02, 2019 at 12:56:18PM +0000, Eugen.Hristev@microchip.com wrote: > > From: Eugen Hristev > > During frame reception while the MCAN is in Error Passive state > and the Receive Error Counter has thevalue MCAN_ECR.REC = 127, it may happen > that MCAN_IR.MRAF is set although there was no Message RAM access failure. > If MCAN_IR.MRAF is enabled, an interrupt to the Host CPU is generated. > Work around: > The Message RAM Access Failure interrupt routine needs to check whether > MCAN_ECR.RP = '1' and MCAN_ECR.REC = '127'. > In this case, reset MCAN_IR.MRAF. No further action is required. > This affects versions older than 3.2.0 > > Errata explained on Sama5d2 SoC which includes this hardware block: > http://ww1.microchip.com/downloads/en/DeviceDoc/SAMA5D2-Family-Silicon-Errata-and-Data-Sheet-Clarification-DS80000803B.pdf chapter 6.2 > > Reproducibility: If 2 devices with m_can are connected back to back, > configuring different bitrate on them will lead to interrupt storm on the > receiving side, with error "Message RAM access failure occurred". > Another way is to have a bad hardware connection. Bad wire connection can lead > to this issue as well. > > This patch fixes the issue according to provided workaround. > > Signed-off-by: Eugen Hristev Sounds good. Reviewed-by: Ludovic Desroches > --- > drivers/net/can/m_can/m_can.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c > index 9b44940..deb274a 100644 > --- a/drivers/net/can/m_can/m_can.c > +++ b/drivers/net/can/m_can/m_can.c > @@ -822,6 +822,27 @@ static int m_can_poll(struct napi_struct *napi, int quota) > if (!irqstatus) > goto end; > > + /* Errata workaround for issue "Needless activation of MRAF irq" > + * During frame reception while the MCAN is in Error Passive state > + * and the Receive Error Counter has the value MCAN_ECR.REC = 127, > + * it may happen that MCAN_IR.MRAF is set although there was no > + * Message RAM access failure. > + * If MCAN_IR.MRAF is enabled, an interrupt to the Host CPU is generated > + * The Message RAM Access Failure interrupt routine needs to check > + * whether MCAN_ECR.RP = ’1’ and MCAN_ECR.REC = 127. > + * In this case, reset MCAN_IR.MRAF. No further action is required. > + */ > + if ((priv->version <= 31) && (irqstatus & IR_MRAF) && > + (m_can_read(priv, M_CAN_ECR) & ECR_RP)) { > + struct can_berr_counter bec; > + > + __m_can_get_berr_counter(dev, &bec); > + if (bec.rxerr == 127) { > + m_can_write(priv, M_CAN_IR, IR_MRAF); > + irqstatus &= ~IR_MRAF; > + } > + } > + > psr = m_can_read(priv, M_CAN_PSR); > if (irqstatus & IR_ERR_STATE) > work_done += m_can_handle_state_errors(dev, psr); > -- > 2.7.4 > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel