From patchwork Mon Jun 5 17:31:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 771373 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3whMPZ3BtLz9s3w for ; Tue, 6 Jun 2017 03:34:10 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752042AbdFEReI (ORCPT ); Mon, 5 Jun 2017 13:34:08 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:24850 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752036AbdFEReH (ORCPT ); Mon, 5 Jun 2017 13:34:07 -0400 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 6F34E1C980C2B; Mon, 5 Jun 2017 18:33:51 +0100 (IST) Received: from localhost (10.20.1.33) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Mon, 5 Jun 2017 18:33:55 +0100 From: Paul Burton To: CC: "David S . Miller" , , Eric Dumazet , Jarod Wilson , Tobias Klauser , Paul Burton Subject: [PATCH v4 6/7] net: pch_gbe: Allow longer for resets Date: Mon, 5 Jun 2017 10:31:35 -0700 Message-ID: <20170605173136.10795-7-paul.burton@imgtec.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170605173136.10795-1-paul.burton@imgtec.com> References: <20170602234042.22782-1-paul.burton@imgtec.com> <20170605173136.10795-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.33] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Resets of the EG20T MAC on the MIPS Boston development board take longer than the 1000 loops that pch_gbe_wait_clr_bit was performing. Rather than simply increasing the number of loops, switch to using readl_poll_timeout_atomic() from linux/iopoll.h in order to provide some independence from the speed of the CPU. Signed-off-by: Paul Burton Cc: David S. Miller Cc: Eric Dumazet Cc: Jarod Wilson Cc: Tobias Klauser Cc: linux-mips@linux-mips.org Cc: netdev@vger.kernel.org --- Changes in v4: None Changes in v3: - Switch to using readl_poll_timeout_atomic(). Changes in v2: None drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index c8554d3adf1c..c109646803a4 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #define DRV_VERSION "1.01" @@ -318,13 +319,11 @@ s32 pch_gbe_mac_read_mac_addr(struct pch_gbe_hw *hw) */ static void pch_gbe_wait_clr_bit(void *reg, u32 bit) { + int err; u32 tmp; - /* wait busy */ - tmp = 1000; - while ((ioread32(reg) & bit) && --tmp) - cpu_relax(); - if (!tmp) + err = readl_poll_timeout_atomic(reg, tmp, !(tmp & bit), 10, 500); + if (err) pr_err("Error: busy bit is not cleared\n"); }