From patchwork Mon Aug 7 13:47:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 9885403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CB19F603F2 for ; Mon, 7 Aug 2017 13:48:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB7EF28646 for ; Mon, 7 Aug 2017 13:48:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9F0C28684; Mon, 7 Aug 2017 13:48:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 51FF52868F for ; Mon, 7 Aug 2017 13:48:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hnq0rCWlb+nT+850BB8/5uo16W/xQ3Kgi9EJ0gv3dQA=; b=mYfv3Ls5yFQ88/VKhtXXkbhtys k4bqp34Y/HvidKdZDuK4Rlm4ukanK1VFdWKI2WWIe7mmRGNBAoQYtmIfC/9tiZBMadh5T1y5xElKE cKKjzhJvEI3Xf4AruysKA9AoIyGd74a28VClXNYO6g7hQb2a62PXTJaPuZhRFnoyM3S1wjiG2Hg6O wBfcUb5yKTqHpPUtevuxf6lslFLkSata221u9V8150U35P6pvEwh+FkgKZk4InHnuggiTKcWg6vu+ 5VFO5dwH9+scAlKkwJxeD/gfkpT017Lz+9lqftPT/10N/tSHEpMUWz0+wSgraP2drtg9rL3+73t68 Hx3Rw/gQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1deiOQ-0007C0-LQ; Mon, 07 Aug 2017 13:48:26 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1deiOM-00079K-7z for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2017 13:48:24 +0000 Received: by mail-wm0-x241.google.com with SMTP id t138so1092402wmt.4 for ; Mon, 07 Aug 2017 06:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=fOtIknMrHzDVA7+iMogRbG4UXK8FnPzs/e9KgiSjQvo=; b=KA+6ghykAEV+EvrTkuJb+Bh8W1A0UkVMm/X3BLEqMfwZf9nMdxEatAjAMjIoyWiCAl Jmrt6deE2wlY/vDO6ixkTbO+WR5ajEczJrdqI5g0fdaq6d53/p1Oxk25OXp2aBVciFes oly5s8NlJrr/f+tVJontLNGZ190rOPWEh+d5MsRWnn7uvxPG1lLqCNUJv7sXi0gOHQqG JHyWvu0wdaaIF2t9Vto1fZohQYXz080YG77vSA314n38UuWFPdciQ2AoE6HpJ6uPkOGa eo9sFDllSV34qqPTF3S8Vwunus+jgk93wOs2bp/gbeOXHcIWHHc3SKZOX3B6foCFB+bP LT/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=fOtIknMrHzDVA7+iMogRbG4UXK8FnPzs/e9KgiSjQvo=; b=AhmGRmG2bntq86HLWCk5UNfN2BlcJeUo/HYl2LLF2SeSNdJUDt4XccTSsUJZReDfeO LAQNvX2SO5nGex8k7PSoZSQAD/To8XcL9lm2noTn1BME2IBVllPvvRwZMRHP9s+E10eS ledd9prMj6isem2a477lSnZiTPzdsW2ozXcXUwIYryQkVysELgN2gvlm2vvmKUAtBbmG LFN5mBiRZrKNG3rrQ+HTPd2hL8i1kA32jvAtfyp+8/rSXEz+LtDBUvnTztVyJh4Qg8T/ PjnOhi+/mfRJ50yY6HPDLAk1sMVh9ecXR1cYB0ZVC1MPL+XLJqKedJfa78/cl3Um1r6v QHRQ== X-Gm-Message-State: AHYfb5gxmA16V0BBFlHDa20h7E+GBy4xg5isxZvvrwbjBA0A95/a41Cm CXd9MW/0p2h9Lq89 X-Received: by 10.28.55.69 with SMTP id e66mr810919wma.9.1502113680137; Mon, 07 Aug 2017 06:48:00 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id b195sm11133077wmf.38.2017.08.07.06.47.59 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 07 Aug 2017 06:47:59 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu Subject: [PATCH 2/2] can: xilinx: fix RX FIFO overflow error handling Date: Mon, 7 Aug 2017 15:47:57 +0200 Message-Id: <67efa4531bb8b83d5539c0bc0af32a9c9a523627.1502113674.git.michal.simek@xilinx.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <21850c76207942f5ae5c225f2627fb068d5234d0.1502113674.git.michal.simek@xilinx.com> References: <21850c76207942f5ae5c225f2627fb068d5234d0.1502113674.git.michal.simek@xilinx.com> In-Reply-To: <21850c76207942f5ae5c225f2627fb068d5234d0.1502113674.git.michal.simek@xilinx.com> References: <21850c76207942f5ae5c225f2627fb068d5234d0.1502113674.git.michal.simek@xilinx.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170807_064822_555101_DEF1D007 X-CRM114-Status: GOOD ( 10.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-can@vger.kernel.org, Marc Kleine-Budde , =?UTF-8?q?S=C3=B6ren=20Brinkmann?= , Andrea Scian , Wolfgang Grandegger MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andrea Scian Simply resetting the peripheral on RX FIFO overflow in not enough, because we also need to re-initialize the whole device. Also always enable RX FIFO overflow interrupt otherwise we may hang until another interrupt arrives (this happens if FIFO overrun and just read from CAN bus with candump) Signed-off-by: Andrea Scian Reviewed-by: Kedareswara rao Appana Signed-off-by: Michal Simek --- drivers/net/can/xilinx_can.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 05ea2820d27b..2c119d16861e 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -101,6 +101,7 @@ enum xcan_reg { #define XCAN_INTR_ALL (XCAN_IXR_TXOK_MASK | XCAN_IXR_BSOFF_MASK |\ XCAN_IXR_WKUP_MASK | XCAN_IXR_SLP_MASK | \ XCAN_IXR_RXNEMP_MASK | XCAN_IXR_ERROR_MASK | \ + XCAN_IXR_RXOFLW_MASK | \ XCAN_IXR_ARBLST_MASK) /* CAN register bit shift - XCAN___SHIFT */ @@ -529,6 +530,8 @@ static int xcan_rx(struct net_device *ndev) return 1; } +static void xcan_chip_stop(struct net_device *ndev); + /** * xcan_err_interrupt - error frame Isr * @ndev: net_device pointer @@ -600,7 +603,8 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr) if (isr & XCAN_IXR_RXOFLW_MASK) { stats->rx_over_errors++; stats->rx_errors++; - priv->write_reg(priv, XCAN_SRR_OFFSET, XCAN_SRR_RESET_MASK); + xcan_chip_stop(ndev); + xcan_chip_start(ndev); if (skb) { cf->can_id |= CAN_ERR_CRTL; cf->data[1] |= CAN_ERR_CRTL_RX_OVERFLOW;