Module Name:    src
Committed By:   mrg
Date:           Fri Sep  3 01:23:33 UTC 2021

Modified Files:
        src/sys/arch/arm/rockchip: rk_platform.c
        src/sys/dev/ic: ahcisata_core.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/rockchip/rk_platform.c
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/ic/ahcisata_core.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/rockchip/rk_platform.c
diff -u src/sys/arch/arm/rockchip/rk_platform.c:1.13 src/sys/arch/arm/rockchip/rk_platform.c:1.14
--- src/sys/arch/arm/rockchip/rk_platform.c:1.13	Wed Jun 23 00:56:41 2021
+++ src/sys/arch/arm/rockchip/rk_platform.c	Fri Sep  3 01:23:33 2021
@@ -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 <jmcne...@invisible.ca>
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: rk_platform.
 #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 @@ rk_platform_init_attach_args(struct fdt_
 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

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.100 src/sys/dev/ic/ahcisata_core.c:1.101
--- src/sys/dev/ic/ahcisata_core.c:1.100	Sat Aug  7 16:19:11 2021
+++ src/sys/dev/ic/ahcisata_core.c	Fri Sep  3 01:23:33 2021
@@ -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 @@ static int
 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);
 

Reply via email to