Module Name:    src
Committed By:   matt
Date:           Tue Aug  2 01:34:36 UTC 2011

Modified Files:
        src/sys/arch/evbppc/mpc85xx [matt-nb5-pq3]: autoconf.c machdep.c
        src/sys/arch/powerpc/booke/dev [matt-nb5-pq3]: pq3ehci.c
        src/sys/arch/powerpc/include/booke [matt-nb5-pq3]: cpuvar.h e500reg.h

Log Message:
Pull in changes from -current to get ehci at cpunode working.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/evbppc/mpc85xx/autoconf.c
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/evbppc/mpc85xx/machdep.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/powerpc/booke/dev/pq3ehci.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/powerpc/include/booke/cpuvar.h
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/powerpc/include/booke/e500reg.h

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/evbppc/mpc85xx/autoconf.c
diff -u src/sys/arch/evbppc/mpc85xx/autoconf.c:1.1.2.1 src/sys/arch/evbppc/mpc85xx/autoconf.c:1.1.2.2
--- src/sys/arch/evbppc/mpc85xx/autoconf.c:1.1.2.1	Fri Jan  7 01:40:36 2011
+++ src/sys/arch/evbppc/mpc85xx/autoconf.c	Tue Aug  2 01:34:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.1.2.1 2011/01/07 01:40:36 matt Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.1.2.2 2011/08/02 01:34:36 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1.2.1 2011/01/07 01:40:36 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1.2.2 2011/08/02 01:34:36 matt Exp $");
 
 #define __INTR_PRIVATE
 
@@ -121,6 +121,7 @@
 	ma.ma_name = "cpunode";
 	ma.ma_node = 0;
 	ma.ma_memt = curcpu()->ci_softc->cpu_bst;
+	ma.ma_le_memt = curcpu()->ci_softc->cpu_le_bst;
 	ma.ma_dmat = &booke_bus_dma_tag;
 
 	config_found_sm_loc(self, "mainbus", NULL, &ma, mainbus_print, NULL);

Index: src/sys/arch/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.1.2.3 src/sys/arch/evbppc/mpc85xx/machdep.c:1.1.2.4
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.1.2.3	Tue Jul 26 03:32:45 2011
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Tue Aug  2 01:34:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.1.2.3 2011/07/26 03:32:45 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.1.2.4 2011/08/02 01:34:36 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -131,6 +131,12 @@
 	.pbs_limit = GUR_SIZE,
 };
 
+struct powerpc_bus_space gur_le_bst = {
+	.pbs_flags = _BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
+	.pbs_offset = GUR_BASE,
+	.pbs_limit = GUR_SIZE,
+};
+
 const bus_space_handle_t gur_bsh = (bus_space_handle_t)(uintptr_t)(GUR_BASE);
 
 #ifdef CADMUS
@@ -614,7 +620,9 @@
 	CTASSERT(offsetof(struct tlb_md_ops, md_tlb_mapiodev) == 0);
 	cpu_md_ops.md_tlb_ops = (const void *)&early_tlb_mapiodev;
 	bus_space_init(&gur_bst, NULL, NULL, 0);
+	bus_space_init(&gur_le_bst, NULL, NULL, 0);
 	cpu->cpu_bst = &gur_bst;
+	cpu->cpu_le_bst = &gur_le_bst;
 	cpu->cpu_bsh = gur_bsh;
 
 	/*
@@ -653,6 +661,7 @@
 	 * Now find out how much memory is attached
 	 */
 	pmemsize = memprobe(endkernel);
+	cpu->cpu_highmem = pmemsize;
 		printf(" memprobe=%zuMB", (size_t) (pmemsize >> 20));
 
 	/*

Index: src/sys/arch/powerpc/booke/dev/pq3ehci.c
diff -u src/sys/arch/powerpc/booke/dev/pq3ehci.c:1.1.2.1 src/sys/arch/powerpc/booke/dev/pq3ehci.c:1.1.2.2
--- src/sys/arch/powerpc/booke/dev/pq3ehci.c:1.1.2.1	Fri Jan  7 01:26:19 2011
+++ src/sys/arch/powerpc/booke/dev/pq3ehci.c	Tue Aug  2 01:34:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3ehci.c,v 1.1.2.1 2011/01/07 01:26:19 matt Exp $	*/
+/*	$NetBSD: pq3ehci.c,v 1.1.2.2 2011/08/02 01:34:36 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pq3ehci.c,v 1.1.2.1 2011/01/07 01:26:19 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3ehci.c,v 1.1.2.2 2011/08/02 01:34:36 matt Exp $");
+
+#include "opt_usb.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -90,7 +92,7 @@
 	int error;
 
 	psc->sc_children |= cna->cna_childmask;
-	sc->sc.iot = cna->cna_memt;
+	sc->sc.iot = cna->cna_le_memt;	/* EHCI registers are little endian */
 	sc->sc.sc_dev = self;
 	sc->sc.sc_bus.dmatag = cna->cna_dmat;
 	sc->sc.sc_bus.hci_private = sc;
@@ -111,7 +113,17 @@
 	}
 	sc->sc.sc_size = cnl->cnl_size;
 
-	sc->sc_ih = intr_establish(cnl->cnl_intrs[0], IPL_VM, IST_ONCHIP,
+	/*
+	 * We need to tell the USB interface to snoop all off RAM starting
+	 * at 0.  Since it can do it by powers of 2, get the highest RAM
+	 * address and roughly round it to the next power of 2 and find
+	 * the number of leading zero bits.  
+	 */
+	cpu_write_4(cnl->cnl_addr + USB_SNOOP1,
+	    SNOOP_2GB - __builtin_clz(curcpu()->ci_softc->cpu_highmem * 2 - 1));
+	cpu_write_4(cnl->cnl_addr + USB_CONTROL, USB_EN);
+
+	sc->sc_ih = intr_establish(cnl->cnl_intrs[0], IPL_USB, IST_ONCHIP,
 	    ehci_intr, sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt %d\n",

Index: src/sys/arch/powerpc/include/booke/cpuvar.h
diff -u src/sys/arch/powerpc/include/booke/cpuvar.h:1.1.2.2 src/sys/arch/powerpc/include/booke/cpuvar.h:1.1.2.3
--- src/sys/arch/powerpc/include/booke/cpuvar.h:1.1.2.2	Mon Jan 17 07:46:00 2011
+++ src/sys/arch/powerpc/include/booke/cpuvar.h	Tue Aug  2 01:34:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuvar.h,v 1.1.2.2 2011/01/17 07:46:00 matt Exp $	*/
+/*	$NetBSD: cpuvar.h,v 1.1.2.3 2011/08/02 01:34:36 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -49,9 +49,12 @@
 	struct cpu_info *cpu_ci;
 	struct evcnt *cpu_evcnt_intrs;
 	bus_space_tag_t cpu_bst;
+	bus_space_tag_t cpu_le_bst;
 	bus_space_handle_t cpu_bsh;
 	bus_addr_t cpu_clock_gtbcr;
 
+	paddr_t cpu_highmem;     
+
 	u_int cpu_pcpls[5];
 	struct evcnt cpu_evcnt_spurious_intr;
 	struct lwp *cpu_softlwps[SOFTINT_COUNT];
@@ -74,6 +77,7 @@
 struct cpunode_attach_args {
 	const char *cna_busname;
 	bus_space_tag_t cna_memt;
+	bus_space_tag_t cna_le_memt;
 	bus_dma_tag_t cna_dmat;
 	struct cpunode_locators cna_locs;
 	u_int cna_childmask;
@@ -82,6 +86,7 @@
 struct mainbus_attach_args {
 	const char *ma_name;
 	bus_space_tag_t ma_memt;
+	bus_space_tag_t ma_le_memt;
 	bus_dma_tag_t ma_dmat;
 	int ma_node;
 };

Index: src/sys/arch/powerpc/include/booke/e500reg.h
diff -u src/sys/arch/powerpc/include/booke/e500reg.h:1.1.2.1 src/sys/arch/powerpc/include/booke/e500reg.h:1.1.2.2
--- src/sys/arch/powerpc/include/booke/e500reg.h:1.1.2.1	Fri Jan  7 01:26:20 2011
+++ src/sys/arch/powerpc/include/booke/e500reg.h	Tue Aug  2 01:34:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: e500reg.h,v 1.1.2.1 2011/01/07 01:26:20 matt Exp $	*/
+/*	$NetBSD: e500reg.h,v 1.1.2.2 2011/08/02 01:34:36 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -271,8 +271,15 @@
 #define	USB1_BASE	0x22100	/* MPC8536 */
 #define	USB2_BASE	0x23100	/* MPC8536 */
 #define	USB3_BASE	0x2b100	/* MPC8536 */
+#define	USB_SNOOP1	0x0300	/* DMA Snooping Register 1 */
+#define	USB_SNOOP2	0x0304	/* DMA Snooping Register 2 */
+#define	USB_CONTROL	0x0400	/* USB General Purpose Register */
+#define	USB_EN		__PPCBIT(29)
+#define	USB_ULPI_INT_EN	__PPCBIT(31)
 #define	USB_SIZE	0x00f00
 
+#define	SNOOP_2GB	0x1e
+
 #define	ETSEC1_BASE	0x24000
 #define	ETSEC2_BASE	0x25000
 #define	ETSEC3_BASE	0x26000

Reply via email to