Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic revert "make ahcisata(4) work on rk3399 (rockpro6...



details:   https://anonhg.NetBSD.org/src/rev/4c9c055e4526
branches:  trunk
changeset: 985650:4c9c055e4526
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Sep 03 01:23:33 2021 +0000

description:
revert "make ahcisata(4) work on rk3399 (rockpro64)" from 23-06-2021.

this problem is known to affect more than AHCI, and a more general
solution has been commited now.

diffstat:

 sys/arch/arm/rockchip/rk_platform.c |  16 ++--------------
 sys/dev/ic/ahcisata_core.c          |  24 ++++++------------------
 2 files changed, 8 insertions(+), 32 deletions(-)

diffs (98 lines):

diff -r 40e2d6d03d7f -r 4c9c055e4526 sys/arch/arm/rockchip/rk_platform.c
--- a/sys/arch/arm/rockchip/rk_platform.c       Fri Sep 03 01:21:48 2021 +0000
+++ b/sys/arch/arm/rockchip/rk_platform.c       Fri Sep 03 01:23:33 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_platform.c,v 1.13 2021/06/23 00:56:41 mrg Exp $ */
+/* $NetBSD: rk_platform.c,v 1.14 2021/09/03 01:23:33 mrg Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
 #include "opt_console.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rk_platform.c,v 1.13 2021/06/23 00:56:41 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_platform.c,v 1.14 2021/09/03 01:23:33 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -39,7 +39,6 @@
 #include <sys/device.h>
 #include <sys/termios.h>
 
-#include <prop/proplib.h>
 
 #include <dev/fdt/fdtvar.h>
 #include <arm/fdt/arm_fdtvar.h>
@@ -72,17 +71,6 @@
 static void
 rk_platform_device_register(device_t self, void *aux)
 {
-       prop_dictionary_t dict = device_properties(self);
-
-       if (device_is_a(self, "ahcisata")) {
-               /*
-                * Marvel 9230 AHCI SATA controllers take between 1213 and 1216
-                * milliseconds to reset, exceeding the AHCI spec of 1000.
-                */
-               if (!prop_dictionary_set_uint32(dict, "ahci-reset-ms", 2000))
-                       printf("%s: Failed to set \"ahci-reset-ms\" property"
-                              " on ahcisata\n", __func__);
-       }
 }
 
 static void
diff -r 40e2d6d03d7f -r 4c9c055e4526 sys/dev/ic/ahcisata_core.c
--- a/sys/dev/ic/ahcisata_core.c        Fri Sep 03 01:21:48 2021 +0000
+++ b/sys/dev/ic/ahcisata_core.c        Fri Sep 03 01:23:33 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ahcisata_core.c,v 1.100 2021/08/07 16:19:11 thorpej Exp $      */
+/*     $NetBSD: ahcisata_core.c,v 1.101 2021/09/03 01:23:33 mrg Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.100 2021/08/07 16:19:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.101 2021/09/03 01:23:33 mrg Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -144,31 +144,19 @@
 ahci_reset(struct ahci_softc *sc)
 {
        int i;
-       uint32_t timeout_ms = 1000;     /* default to 1s timeout */
-       prop_dictionary_t dict;
 
        /* reset controller */
        AHCI_WRITE(sc, AHCI_GHC, AHCI_GHC_HR);
-
-       /* some systems (rockchip rk3399) need extra reset time for ahcisata. */
-       dict = device_properties(sc->sc_atac.atac_dev);
-       if (dict)
-               prop_dictionary_get_uint32(dict, "ahci-reset-ms", &timeout_ms);
-
-       /* wait for reset to complete */
-       for (i = 0; i < timeout_ms; i++) {
+       /* wait up to 1s for reset to complete */
+       for (i = 0; i < 1000; i++) {
                delay(1000);
                if ((AHCI_READ(sc, AHCI_GHC) & AHCI_GHC_HR) == 0)
                        break;
        }
-       if ((AHCI_READ(sc, AHCI_GHC) & AHCI_GHC_HR) != 0) {
-               aprint_error_dev(sc->sc_atac.atac_dev, "reset failed\n");
+       if ((AHCI_READ(sc, AHCI_GHC) & AHCI_GHC_HR)) {
+               aprint_error("%s: reset failed\n", AHCINAME(sc));
                return -1;
        }
-       if (i > 1000) {
-               aprint_normal_dev(sc->sc_atac.atac_dev,
-                   "reset took %d milliseconds\n", i);
-       }
        /* enable ahci mode */
        ahci_enable(sc);
 



Home | Main Index | Thread Index | Old Index