Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbmips Improved alchemy board support, including b...



details:   https://anonhg.NetBSD.org/src/rev/0ef2244718e1
branches:  trunk
changeset: 588106:0ef2244718e1
user:      gdamore <gdamore%NetBSD.org@localhost>
date:      Wed Feb 08 09:04:01 2006 +0000

description:
Improved alchemy board support, including board differentiation required for
PCI idsel and irq routing (later).
Various cleanup/rototilling to remove hardcoded pb1000 references.
Reviewed by simonb@, and derived from changes reviewed by matt@ and tsutsui@

diffstat:

 sys/arch/evbmips/alchemy/board.h          |   61 ++++++
 sys/arch/evbmips/alchemy/dbau1500.c       |  127 ++++++++++++++
 sys/arch/evbmips/alchemy/dbau1500reg.h    |   20 ++
 sys/arch/evbmips/alchemy/dbau1550.c       |  134 +++++++++++++++
 sys/arch/evbmips/alchemy/dbau1550reg.h    |   28 +++
 sys/arch/evbmips/alchemy/genericbd.c      |   98 +++++++++++
 sys/arch/evbmips/alchemy/machdep.c        |   90 ++++++++--
 sys/arch/evbmips/alchemy/obio.c           |  121 +++++++++++++
 sys/arch/evbmips/alchemy/obiovar.h        |   54 ++++++
 sys/arch/evbmips/alchemy/pb1000_obio.c    |  132 --------------
 sys/arch/evbmips/alchemy/pb1000_obiovar.h |   50 -----
 sys/arch/evbmips/alchemy/pb1000var.h      |   47 -----
 sys/arch/evbmips/conf/ALCHEMY             |    9 +-
 sys/arch/evbmips/conf/DBAU1500            |  265 ++++++++++++++++++++++++++++++
 sys/arch/evbmips/conf/DBAU1550            |  265 ++++++++++++++++++++++++++++++
 sys/arch/evbmips/conf/files.alchemy       |   62 +++++++
 sys/arch/evbmips/conf/files.pb1000        |   53 ------
 sys/arch/evbmips/conf/std.alchemy         |   15 +
 sys/arch/evbmips/conf/std.pb1000          |   18 --
 19 files changed, 1328 insertions(+), 321 deletions(-)

diffs (truncated from 1828 to 300 lines):

diff -r 971ff62c386a -r 0ef2244718e1 sys/arch/evbmips/alchemy/board.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbmips/alchemy/board.h  Wed Feb 08 09:04:01 2006 +0000
@@ -0,0 +1,61 @@
+/*     $NetBSD: board.h,v 1.1 2006/02/08 09:04:01 gdamore Exp $        */
+
+/*-
+ * Copyright (c) 2006 Itronix Inc.
+ * All rights reserved.
+ *
+ * Written by Garrett D'Amore for Itronix Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of Itronix Inc. may not be used to endorse
+ *    or promote products derived from this software without specific
+ *    prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */ 
+
+#ifndef _EVBMIPS_ALCHEMY_BOARD_H
+#define        _EVBMIPS_ALCHEMY_BOARD_H
+
+#include <dev/pci/pcivar.h>
+
+struct alchemy_board {
+       const char              *ab_name;
+       const struct obiodev    *ab_devices;
+       void            (*ab_init)(void);
+       int             (*ab_pci_intr_map)(struct pci_attach_args *,
+                                          pci_intr_handle_t *);
+
+       /*
+        * XXX: csb250 (and perhaps others) will require pci_idsel
+        * entry point
+        *
+        * XXX: almost certainly some PCMCIA logic will have to be
+        * added
+        *
+        * XXX: some boards have hardware reset better than yamon, and
+        * power management interfaces -- maybe we should add hooks
+        * here
+        */
+};
+
+const struct alchemy_board *board_info(void);
+
+#endif /* _EVBMIPS_ALCHEMY_BOARD_H */
diff -r 971ff62c386a -r 0ef2244718e1 sys/arch/evbmips/alchemy/dbau1500.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbmips/alchemy/dbau1500.c       Wed Feb 08 09:04:01 2006 +0000
@@ -0,0 +1,127 @@
+/* $NetBSD: dbau1500.c,v 1.1 2006/02/08 09:04:01 gdamore Exp $ */
+
+/*-
+ * Copyright (c) 2006 Itronix Inc.
+ * All rights reserved.
+ *
+ * Written by Garrett D'Amore for Itronix Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of Itronix Inc. may not be used to endorse
+ *    or promote products derived from this software without specific
+ *    prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */ 
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: dbau1500.c,v 1.1 2006/02/08 09:04:01 gdamore Exp $");
+
+#include <sys/param.h>
+#include <machine/bus.h>
+#include <machine/locore.h>
+#include <evbmips/alchemy/obiovar.h>
+#include <evbmips/alchemy/board.h>
+#include <evbmips/alchemy/dbau1500reg.h>
+
+static void dbau1500_init(void);
+static int dbau1500_pci_intr_map(struct pci_attach_args *,
+                                pci_intr_handle_t *);
+
+static const struct obiodev dbau1500_devices[] = {
+#if 0
+       { "aupcmcia", -1, -1 },
+       { "auaudio", -1, -1 },
+#endif
+       { NULL },
+};
+
+static struct alchemy_board dbau1500_info = {
+       "AMD Alchemy DBAu1500",
+       dbau1500_devices,
+       dbau1500_init,
+       dbau1500_pci_intr_map,
+};
+
+const struct alchemy_board *
+board_info(void)
+{
+
+       return &dbau1500_info;
+}
+
+void
+dbau1500_init(void)
+{
+       uint32_t        whoami;
+
+       if (MIPS_PRID_COPTS(cpu_id) != MIPS_AU1500)
+               panic("dbau1500: CPU not an AU1500!");
+
+       /* check the whoami register for a match */
+       whoami = *((volatile uint32_t *)DBAU1500_WHOAMI);
+
+       if (DBAU1500_WHOAMI_BOARD(whoami) != DBAU1500_WHOAMI_DBAU1500)
+               panic("dbau1500: WHOAMI (%x) not DBAu1500!", whoami);
+
+       printf("DBAu1500 (zinfandel), CPLDv%d, ",
+           DBAU1500_WHOAMI_CPLD(whoami));
+
+       if (DBAU1500_WHOAMI_DAUGHTER(whoami) != 0xf)
+               printf("daughtercard 0x%x\n",
+                   DBAU1500_WHOAMI_DAUGHTER(whoami));
+       else
+               printf("no daughtercard\n");
+
+       /* leave console and clocks alone -- YAMON should have got it right! */
+
+}
+
+int
+dbau1500_pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
+{
+       /*
+        * This platform has PCI slot and IDE interrupts mapped
+        * identically.  So we just need to look at which of the four
+        * PCI interrupts it is.
+        */
+
+       switch (pa->pa_intrpin) {
+       case 0:
+               /* not used */
+               return 1;
+       case 1:
+               *ihp = 1;
+               break;
+       case 2:
+               *ihp = 2;
+               break;
+       case 3:
+               *ihp = 4;
+               break;
+       case 4:
+               *ihp = 5;
+               break;
+       default:
+               printf("pci: bad interrupt pin %d\n", pa->pa_intrpin);
+               return 1;
+       }
+       return 0;
+}
diff -r 971ff62c386a -r 0ef2244718e1 sys/arch/evbmips/alchemy/dbau1500reg.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbmips/alchemy/dbau1500reg.h    Wed Feb 08 09:04:01 2006 +0000
@@ -0,0 +1,20 @@
+/* $NetBSD: dbau1500reg.h,v 1.1 2006/02/08 09:04:01 gdamore Exp $ */
+
+/*
+ * Board-specific registers for DBAu1550.
+ */
+
+#define        DBAU1500_WHOAMI         0xAE000000
+#define        DBAU1500_WHOAMI_BOARD_MASK      0x00000f00
+#define        DBAU1500_WHOAMI_DBAU1500        0x6
+
+#define        DBAU1500_WHOAMI_BOARD(x)        (((x) >> 8) & 0x7)
+#define        DBAU1500_WHOAMI_CPLD(x)         (((x) >> 4) & 0xf)
+#define        DBAU1500_WHOAMI_DAUGHTER(x)     ((x) & 0xf)
+
+#define        DBAU1500_BCSR           0xAE000004
+#define        DBAU1500_BCSR_SWAPBOOT          0x20000000
+#define        DBAU1500_BCSR_PCMCIA1_INSERTED  0x00000020
+#define        DBAU1500_BCSR_PCMCIA0_INSERTED  0x00000010
+#define        DBAU1500_BCSR_PCMCIA1_VS        0x0000000c
+#define        DBAU1500_BCSR_PCMCIA0_VS        0x00000003
diff -r 971ff62c386a -r 0ef2244718e1 sys/arch/evbmips/alchemy/dbau1550.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbmips/alchemy/dbau1550.c       Wed Feb 08 09:04:01 2006 +0000
@@ -0,0 +1,134 @@
+/* $NetBSD: dbau1550.c,v 1.1 2006/02/08 09:04:01 gdamore Exp $ */
+
+/*-
+ * Copyright (c) 2006 Itronix Inc.
+ * All rights reserved.
+ *
+ * Written by Garrett D'Amore for Itronix Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of Itronix Inc. may not be used to endorse
+ *    or promote products derived from this software without specific
+ *    prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */ 
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: dbau1550.c,v 1.1 2006/02/08 09:04:01 gdamore Exp $");
+
+#include <sys/param.h>
+#include <machine/bus.h>
+#include <machine/locore.h>
+#include <evbmips/alchemy/obiovar.h>
+#include <evbmips/alchemy/board.h>
+#include <evbmips/alchemy/dbau1550reg.h>
+
+static void dbau1550_init(void);
+static int dbau1550_pci_intr_map(struct pci_attach_args *,
+                                pci_intr_handle_t *);
+
+static const struct obiodev dbau1550_devices[] = {
+#if 0
+       { "aupcmcia", -1, -1 },
+       { "aupsc", -1, -1 },
+       { "aupsc", -1, -1 },
+       { "aupsc", -1, -1 },
+#endif
+       { NULL },
+};
+
+static struct alchemy_board dbau1550_info = {
+       "AMD Alchemy DBAu1550",
+       dbau1550_devices,
+       dbau1550_init,
+       dbau1550_pci_intr_map,
+};
+
+const struct alchemy_board *
+board_info(void)
+{
+
+       return &dbau1550_info;
+}
+
+void
+dbau1550_init(void)
+{
+       uint32_t        whoami;
+



Home | Main Index | Thread Index | Old Index