Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/uebayasi-xip]: src/sys/arch/powerpc Implement 405GPr's "External Bus" as...
details: https://anonhg.NetBSD.org/src/rev/a7686c4efde6
branches: uebayasi-xip
changeset: 751766:a7686c4efde6
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Wed Aug 11 13:53:22 2010 +0000
description:
Implement 405GPr's "External Bus" as exb(4).
diffstat:
sys/arch/powerpc/conf/files.ibm4xx | 7 +-
sys/arch/powerpc/ibm4xx/dev/exb.c | 146 +++++++++++++++++++++++++++++++
sys/arch/powerpc/ibm4xx/dev/exbvar.h | 46 +++++++++
sys/arch/powerpc/ibm4xx/dev/plb.c | 5 +-
sys/arch/powerpc/include/ibm4xx/dcr4xx.h | 41 ++++++++-
5 files changed, 241 insertions(+), 4 deletions(-)
diffs (297 lines):
diff -r 843556ed352b -r a7686c4efde6 sys/arch/powerpc/conf/files.ibm4xx
--- a/sys/arch/powerpc/conf/files.ibm4xx Wed Aug 11 13:50:05 2010 +0000
+++ b/sys/arch/powerpc/conf/files.ibm4xx Wed Aug 11 13:53:22 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.ibm4xx,v 1.10.88.1 2010/04/30 14:39:41 uebayasi Exp $
+# $NetBSD: files.ibm4xx,v 1.10.88.2 2010/08/11 13:53:22 uebayasi Exp $
#
# IBM 4xx specific configuration info
@@ -69,3 +69,8 @@
device gpiic: i2cbus, i2c_bitbang
attach gpiic at opb
file arch/powerpc/ibm4xx/dev/gpiic_opb.c gpiic
+
+# External bus
+device exb {[addr = -1]}
+attach exb at plb
+file arch/powerpc/ibm4xx/dev/exb.c exb
diff -r 843556ed352b -r a7686c4efde6 sys/arch/powerpc/ibm4xx/dev/exb.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/exb.c Wed Aug 11 13:53:22 2010 +0000
@@ -0,0 +1,146 @@
+/* $Id: exb.c,v 1.1.2.1 2010/08/11 13:53:22 uebayasi Exp $ */
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software developed for The NetBSD Foundation
+ * by Masao Uebayashi.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 THE FOUNDATION OR CONTRIBUTORS
+ * 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: exb.c,v 1.1.2.1 2010/08/11 13:53:22 uebayasi Exp $");
+
+#include "locators.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/extent.h>
+#include <sys/bus.h>
+
+#include <powerpc/ibm4xx/dcr4xx.h>
+#include <powerpc/ibm4xx/dev/exbvar.h>
+
+/* XXX board specific */
+static const struct exb_conf exb_confs[] = {
+ { "flash", 0xff800000 + 0x00000000, 0x00010000 }, // 0xff800000
+ { "flash", 0xff800000 + 0x00010000, 0x007b0000 }, // 0xff810000
+#if 0 /* XXX extent(9) */
+ { "flash", 0xff800000 + 0x007c0000, 0x00040000 }, // 0xfffc0000
+#endif
+ { NULL }
+};
+
+struct exb_softc {
+};
+
+static int exb_match(device_t, struct cfdata *, void *);
+static void exb_attach(device_t, struct device *, void *);
+static int exb_print(void *, const char *);
+
+CFATTACH_DECL_NEW(exb, sizeof(struct exb_softc), exb_match, exb_attach,
+ NULL, NULL);
+
+static struct powerpc_bus_space exb_bus_space_tag =
+ { _BUS_SPACE_BIG_ENDIAN | _BUS_SPACE_MEM_TYPE, 0 };
+
+static int
+exb_match(device_t parent, struct cfdata *cf, void *aux)
+{
+
+ return 1;
+}
+
+static void
+exb_attach(device_t parent, device_t self, void *aux)
+{
+ const struct exb_conf *ec = exb_confs;
+ uint32_t ebc0_bNcr;
+ bus_addr_t base, size;
+ int locs[EXBCF_NLOCS];
+
+ printf("\n");
+
+ /* mtdcr needs a constant */
+ switch (device_unit(self)) {
+ case 0: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B0CR); break;
+ case 1: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B1CR); break;
+ case 2: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B2CR); break;
+ case 3: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B3CR); break;
+ case 4: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B4CR); break;
+ case 5: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B5CR); break;
+ case 6: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B6CR); break;
+ case 7: mtdcr(DCR_EBC0_CFGADDR, DCR_EBC0_B7CR); break;
+ }
+ ebc0_bNcr = mfdcr(DCR_EBC0_CFGDATA);
+ base = ebc0_bNcr & 0xfff00000;
+ size = 0x00100000 << ((ebc0_bNcr & 0x000e0000) >> 17);
+
+ exb_bus_space_tag.pbs_base = base;
+ exb_bus_space_tag.pbs_limit = base + size - 1;
+
+ while (ec->ec_name) {
+ struct exb_conf ec1;
+
+ locs[EXBCF_ADDR] = ec->ec_addr;
+
+ ec1 = *ec;
+ ec1.ec_bust = exb_get_bus_space_tag();
+
+ config_found_sm_loc(self, "exb", locs, &ec1, exb_print,
+ config_stdsubmatch);
+ ec++;
+ }
+}
+
+static int
+exb_print(void *aux, const char *bus)
+{
+ struct exb_conf *ec = aux;
+
+ if (bus)
+ return QUIET;
+
+ if (ec->ec_addr)
+ printf(" addr %"PRIxBUSADDR, ec->ec_addr);
+
+ return UNCONF;
+}
+
+bus_space_tag_t
+exb_get_bus_space_tag(void)
+{
+ static char ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)]
+ __attribute__((aligned(8)));
+ static int exb_bus_space_tag_inited;
+
+ if (exb_bus_space_tag_inited == 0) {
+ if (bus_space_init(&exb_bus_space_tag, "exbtag",
+ ex_storage, sizeof(ex_storage)))
+ panic("exb_attach: Failed to initialise exb_bus_space_tag");
+ exb_bus_space_tag_inited = 1;
+ }
+ return &exb_bus_space_tag;
+}
diff -r 843556ed352b -r a7686c4efde6 sys/arch/powerpc/ibm4xx/dev/exbvar.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/exbvar.h Wed Aug 11 13:53:22 2010 +0000
@@ -0,0 +1,46 @@
+/* $Id: exbvar.h,v 1.1.2.1 2010/08/11 13:53:22 uebayasi Exp $ */
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software developed for The NetBSD Foundation
+ * by Masao Uebayashi.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 THE FOUNDATION OR CONTRIBUTORS
+ * 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 _POWERPC_IBM4XX_DEV_EXBVAR_H_
+#define _POWERPC_IBM4XX_DEV_EXBVAR_H_
+
+struct exb_conf {
+ const char *ec_name;
+
+ bus_addr_t ec_addr;
+ bus_size_t ec_size;
+
+ bus_space_tag_t ec_bust;
+};
+
+bus_space_tag_t exb_get_bus_space_tag(void);
+
+#endif /* _POWERPC_IBM4XX_DEV_EXBVAR_H_ */
diff -r 843556ed352b -r a7686c4efde6 sys/arch/powerpc/ibm4xx/dev/plb.c
--- a/sys/arch/powerpc/ibm4xx/dev/plb.c Wed Aug 11 13:50:05 2010 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/plb.c Wed Aug 11 13:53:22 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: plb.c,v 1.14.98.1 2010/04/30 14:39:42 uebayasi Exp $ */
+/* $NetBSD: plb.c,v 1.14.98.2 2010/08/11 13:53:22 uebayasi Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plb.c,v 1.14.98.1 2010/04/30 14:39:42 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plb.c,v 1.14.98.2 2010/08/11 13:53:22 uebayasi Exp $");
#include "locators.h"
#include "emac.h"
@@ -100,6 +100,7 @@
{ IBM405GPR, "ecc", },
{ IBM405GPR, "opb", },
{ IBM405GPR, "pchb", },
+ { IBM405GPR, "exb", },
/* AMCC 405EX / EXR */
{ AMCC405EX, "cpu", },
diff -r 843556ed352b -r a7686c4efde6 sys/arch/powerpc/include/ibm4xx/dcr4xx.h
--- a/sys/arch/powerpc/include/ibm4xx/dcr4xx.h Wed Aug 11 13:50:05 2010 +0000
+++ b/sys/arch/powerpc/include/ibm4xx/dcr4xx.h Wed Aug 11 13:53:22 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dcr4xx.h,v 1.1.2.2 2010/04/30 14:39:43 uebayasi Exp $ */
+/* $NetBSD: dcr4xx.h,v 1.1.2.3 2010/08/11 13:53:23 uebayasi Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -272,4 +272,43 @@
#define SDRAM0_ECCESR_BKEN(n) (0x00008000 >> (n))
#define SDRAM0_ECCESR_CBEN(n) (0x00800000 >> (n))
+/* Indirectly accessed External Bus Controller (EBC) DCRs */
+
+#define DCR_EBC0_B0CR 0x00
+#define DCR_EBC0_B1CR 0x01
+#define DCR_EBC0_B2CR 0x02
+#define DCR_EBC0_B3CR 0x03
+#define DCR_EBC0_B4CR 0x04
+#define DCR_EBC0_B5CR 0x05
+#define DCR_EBC0_B6CR 0x06
+#define DCR_EBC0_B7CR 0x07
+#define DCR_EBC0_B0AP 0x10
+#define DCR_EBC0_B1AP 0x11
+#define DCR_EBC0_B2AP 0x12
+#define DCR_EBC0_B3AP 0x13
+#define DCR_EBC0_B4AP 0x14
+#define DCR_EBC0_B5AP 0x15
+#define DCR_EBC0_B6AP 0x16
+#define DCR_EBC0_B7AP 0x17
+#define DCR_EBC0_BEAR 0x20
+#define DCR_EBC0_BESR0 0x21
+#define DCR_EBC0_BESR1 0x22
+#define DCR_EBC0_CFG 0x23
+
+/* Indirectly accessed Decompression Controller DCRs */
+
+#define DCR_DCP0_ITOR0 0x00
+#define DCR_DCP0_ITOR1 0x01
+#define DCR_DCP0_ITOR2 0x02
+#define DCR_DCP0_ITOR3 0x03
+#define DCR_DCP0_ADDR0 0x04
+#define DCR_DCP0_ADDR1 0x05
+#define DCR_DCP0_CFG 0x40
+#define DCR_DCP0_ID 0x41
+#define DCR_DCP0_VER 0x42
+#define DCR_DCP0_PLBBEAR 0x50
+#define DCR_DCP0_MEMBEAR 0x51
+#define DCR_DCP0_ESR 0x52
+#define DCR_DCP0_RAM0 0x400
+
#endif /* _DCR405GP_H_ */
Home |
Main Index |
Thread Index |
Old Index