Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch DHT Walnut: Fix failure to attach on-board pdcide(4...
details: https://anonhg.NetBSD.org/src/rev/2472cf5b2740
branches: trunk
changeset: 371845:2472cf5b2740
user: rin <rin%NetBSD.org@localhost>
date: Sat Oct 15 04:47:37 2022 +0000
description:
DHT Walnut: Fix failure to attach on-board pdcide(4) for cold boot.
U-Boot seems to initialize pdcide(4) to compatible mode. Therefore, we
need to reinitialize it to native-PCI mode in pci_conf_hook(). Otherwise,
we will fail to configure IO registers for native-PCI mode during
PCI_NETBSD_CONFIGURE.
diffstat:
sys/arch/evbppc/conf/DHT | 5 +++--
sys/arch/powerpc/ibm4xx/pci/pci_machdep.c | 28 ++++++++++++++++++++++++++--
2 files changed, 29 insertions(+), 4 deletions(-)
diffs (81 lines):
diff -r bc0f73338c5c -r 2472cf5b2740 sys/arch/evbppc/conf/DHT
--- a/sys/arch/evbppc/conf/DHT Fri Oct 14 22:10:15 2022 +0000
+++ b/sys/arch/evbppc/conf/DHT Sat Oct 15 04:47:37 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: DHT,v 1.3 2022/08/07 02:52:25 simonb Exp $
+# $NetBSD: DHT,v 1.4 2022/10/15 04:47:37 rin Exp $
#
# DHT --- DHT Walnut 405GP Evaluation Board
# (Digital Home Technologies PCB 01070201 Rev. 1.1)
@@ -8,7 +8,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "DHT-$Revision: 1.3 $"
+#ident "DHT-$Revision: 1.4 $"
maxusers 32
@@ -160,6 +160,7 @@
#options PCI_CONFIGURE_VERBOSE # Show PCI config information
pdcide* at pci? dev ? function ? # Promise IDE controllers
+options DHT_FIXUP_PDCIDE # Initialize pdcide to native-PCI mode
# ATA (IDE) bus support
atabus* at ata?
diff -r bc0f73338c5c -r 2472cf5b2740 sys/arch/powerpc/ibm4xx/pci/pci_machdep.c
--- a/sys/arch/powerpc/ibm4xx/pci/pci_machdep.c Fri Oct 14 22:10:15 2022 +0000
+++ b/sys/arch/powerpc/ibm4xx/pci/pci_machdep.c Sat Oct 15 04:47:37 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.12 2020/07/06 10:49:41 rin Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.13 2022/10/15 04:47:37 rin Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.12 2020/07/06 10:49:41 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.13 2022/10/15 04:47:37 rin Exp $");
#ifdef _KERNEL_OPT
#include "opt_pci.h"
@@ -70,6 +70,10 @@
#include <powerpc/ibm4xx/pci_machdep.h>
#include <powerpc/ibm4xx/dev/pcicreg.h>
+#ifdef DHT_FIXUP_PDCIDE
+#include <dev/pci/pciidereg.h>
+#endif
+
static struct powerpc_bus_space pci_iot = {
_BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE,
0x00000000,
@@ -182,5 +186,25 @@
/* Don't configure the bridge and PCI probe. */
return 0;
}
+
+#ifdef DHT_FIXUP_PDCIDE
+ /*
+ * Initialize PDC20265 to native-PCI mode. This should be done
+ * *before* pci_do_device_query(). Otherwise, we will fail to
+ * configure native-PCI IO registers.
+ */
+ if (PCI_VENDOR(id) == PCI_VENDOR_PROMISE &&
+ PCI_PRODUCT(id) == PCI_PRODUCT_PROMISE_PDC20265) {
+ pcitag_t tag;
+ pcireg_t csr;
+
+ tag = ibm4xx_pci_make_tag(v, bus, dev, func);
+ csr = ibm4xx_pci_conf_read(v, tag, PCI_CLASS_REG);
+ csr |= (PCIIDE_INTERFACE_PCI(0) | PCIIDE_INTERFACE_PCI(1))
+ << PCI_INTERFACE_SHIFT;
+ ibm4xx_pci_conf_write(v, tag, PCI_CLASS_REG, csr);
+ }
+#endif
+
return PCI_CONF_DEFAULT;
}
Home |
Main Index |
Thread Index |
Old Index