summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorKevin Lo <kevlo@cvs.openbsd.org>2021-08-26 07:11:10 +0000
committerKevin Lo <kevlo@cvs.openbsd.org>2021-08-26 07:11:10 +0000
commit21f10fdf8f98167ed06fd56e50691c2c46507888 (patch)
tree2f180bb1d5a5e1caccc37407d84f882af3a18bb4 /sys/dev
parentcc8cb57037948f0ec8c227a622d238fda748bc42 (diff)
There are some races in the hardware which thus require a few more tries
to get ownership. See Linux commit 501fd9895c1d7d8161ed56698ae2fccb10ef14f5 ok stsp@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_iwm.c25
-rw-r--r--sys/dev/pci/if_iwx.c27
2 files changed, 29 insertions, 23 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index 7d06d1a0ca4..a4aef73e7ce 100644
--- a/sys/dev/pci/if_iwm.c
+++ b/sys/dev/pci/if_iwm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwm.c,v 1.361 2021/08/20 01:33:44 kevlo Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.362 2021/08/26 07:11:09 kevlo Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -1686,6 +1686,7 @@ int
iwm_prepare_card_hw(struct iwm_softc *sc)
{
int t = 0;
+ int ntries;
if (iwm_set_hw_ready(sc))
return 0;
@@ -1694,17 +1695,19 @@ iwm_prepare_card_hw(struct iwm_softc *sc)
IWM_CSR_RESET_LINK_PWR_MGMT_DISABLED);
DELAY(1000);
+ for (ntries = 0; ntries < 10; ntries++) {
+ /* If HW is not ready, prepare the conditions to check again */
+ IWM_SETBITS(sc, IWM_CSR_HW_IF_CONFIG_REG,
+ IWM_CSR_HW_IF_CONFIG_REG_PREPARE);
- /* If HW is not ready, prepare the conditions to check again */
- IWM_SETBITS(sc, IWM_CSR_HW_IF_CONFIG_REG,
- IWM_CSR_HW_IF_CONFIG_REG_PREPARE);
-
- do {
- if (iwm_set_hw_ready(sc))
- return 0;
- DELAY(200);
- t += 200;
- } while (t < 150000);
+ do {
+ if (iwm_set_hw_ready(sc))
+ return 0;
+ DELAY(200);
+ t += 200;
+ } while (t < 150000);
+ DELAY(25000);
+ }
return ETIMEDOUT;
}
diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c
index 1fc07f62f52..f2b4b48a4b7 100644
--- a/sys/dev/pci/if_iwx.c
+++ b/sys/dev/pci/if_iwx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwx.c,v 1.96 2021/08/23 08:59:31 stsp Exp $ */
+/* $OpenBSD: if_iwx.c,v 1.97 2021/08/26 07:11:09 kevlo Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -2044,6 +2044,7 @@ int
iwx_prepare_card_hw(struct iwx_softc *sc)
{
int t = 0;
+ int ntries;
if (iwx_set_hw_ready(sc))
return 0;
@@ -2052,17 +2053,19 @@ iwx_prepare_card_hw(struct iwx_softc *sc)
IWX_CSR_RESET_LINK_PWR_MGMT_DISABLED);
DELAY(1000);
-
- /* If HW is not ready, prepare the conditions to check again */
- IWX_SETBITS(sc, IWX_CSR_HW_IF_CONFIG_REG,
- IWX_CSR_HW_IF_CONFIG_REG_PREPARE);
-
- do {
- if (iwx_set_hw_ready(sc))
- return 0;
- DELAY(200);
- t += 200;
- } while (t < 150000);
+ for (ntries = 0; ntries < 10; ntries++) {
+ /* If HW is not ready, prepare the conditions to check again */
+ IWX_SETBITS(sc, IWX_CSR_HW_IF_CONFIG_REG,
+ IWX_CSR_HW_IF_CONFIG_REG_PREPARE);
+
+ do {
+ if (iwx_set_hw_ready(sc))
+ return 0;
+ DELAY(200);
+ t += 200;
+ } while (t < 150000);
+ DELAY(25000);
+ }
return ETIMEDOUT;
}