Module Name:    src
Committed By:   matt
Date:           Sun Jul 10 06:26:02 UTC 2011

Modified Files:
        src/sys/arch/mips/atheros: ar9344.c ar_conf.c ar_console.c arbus.c
        src/sys/arch/mips/atheros/include: arbusvar.h platform.h
Added Files:
        src/sys/arch/mips/atheros: arbusle.c
        src/sys/arch/mips/atheros/dev: ehci_arbus.c

Log Message:
Add athers_get_uart_freq() (since AR7240 uses the ref_clk, not the bus_clk).
Add little endian bus_space_tag for arbus.
Add EHCI attachment for arbus.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/atheros/ar9344.c \
    src/sys/arch/mips/atheros/ar_conf.c \
    src/sys/arch/mips/atheros/ar_console.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/mips/atheros/arbus.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/mips/atheros/arbusle.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/mips/atheros/dev/ehci_arbus.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/atheros/include/arbusvar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/atheros/include/platform.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/mips/atheros/ar9344.c
diff -u src/sys/arch/mips/atheros/ar9344.c:1.1 src/sys/arch/mips/atheros/ar9344.c:1.2
--- src/sys/arch/mips/atheros/ar9344.c:1.1	Thu Jul  7 05:06:44 2011
+++ src/sys/arch/mips/atheros/ar9344.c	Sun Jul 10 06:26:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ar9344.c,v 1.1 2011/07/07 05:06:44 matt Exp $ */
+/* $NetBSD: ar9344.c,v 1.2 2011/07/10 06:26:02 matt Exp $ */
 
 /*
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -48,7 +48,7 @@
  * family.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ar9344.c,v 1.1 2011/07/07 05:06:44 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ar9344.c,v 1.2 2011/07/10 06:26:02 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -183,6 +183,11 @@
 	} else {
 		freqs->freq_mem = cpu_pll_freq / (post_div + 1);
 	}
+
+	/*
+	 * Console is off the reference clock, not the bus clock.
+	 */
+	freqs->freq_uart = freqs->freq_ref;
 }
 
 #if 0
@@ -285,26 +290,22 @@
 static int
 ar9344_enable_device(const struct atheros_device *adv)
 {
-#if 0
-	if (adv->adv_addr == AR9344_WLAN_BASE) {
-		/* enable arbitration for wlan */
-		PUTRESET(AR9344_RESET_AHB_ARB_CTL,
-		    GETRESET(AR9344_RESET_AHB_ARB_CTL) | AR9344_ARB_WLAN);
-
-		/* set WLAN for big endian */
-		PUTRESET(AR9344_RESET_ENDIAN,
-		    GETRESET(AR9344_RESET_ENDIAN) | AR9344_ENDIAN_WLAN);
-
-		/* wake up the mac */
-		PUTPCIREG(AR9344_PCI_MAC_SCR,
-		    (GETPCIREG(AR9344_PCI_MAC_SCR) & ~PCI_MAC_SCR_SLM_MASK) |
-		    PCI_MAC_SCR_SLM_FWAKE);
-
-		/* wait for it to wake up */
-		while (GETPCIREG(AR9344_PCI_MAC_PCICFG) &
-		    PCI_MAC_PCICFG_SPWR_DN);
+	if (adv->adv_reset) {
+		/* put device into reset */
+		PUTRESETREG(AR9344_RESET_RESETCTL,
+		    GETRESETREG(AR9344_RESET_RESETCTL) | adv->adv_reset);
+
+		delay(15000);	/* XXX: tsleep? */
+
+		/* take it out of reset */
+		PUTRESETREG(AR9344_RESET_RESETCTL,
+		    GETRESETREG(AR9344_RESET_RESETCTL) & ~adv->adv_reset);
+
+		delay(25);
 	}
-#endif
+	if (adv->adv_enable)
+		panic("%s: %s: enable not supported!", __func__, adv->adv_name);
+
 	return 0;
 }
 
@@ -392,10 +393,13 @@
 		.adv_mirq = AR9344_MISC_IRQ_UART0,
 	}, {
 		.adv_name = "ehci",
-		.adv_addr = AR9344_USB_BASE,
+		.adv_addr = AR9344_USB_BASE + 0x100,
 		.adv_size = 0x1000,
 		.adv_cirq = ARCHIP_CPU_IRQ_USB,
 		.adv_mirq = -1,
+		.adv_reset = AR9344_RESETCTL_USB_PHY_SUSPEND_OVERRIDE
+		    | ARCHIP_RESETCTL_USB_PHY_RESET
+		    | ARCHIP_RESETCTL_USB_HOST_RESET,
 	}, {
 		.adv_name = "age",
 		.adv_addr = AR9344_GMAC0_BASE,
Index: src/sys/arch/mips/atheros/ar_conf.c
diff -u src/sys/arch/mips/atheros/ar_conf.c:1.1 src/sys/arch/mips/atheros/ar_conf.c:1.2
--- src/sys/arch/mips/atheros/ar_conf.c:1.1	Thu Jul  7 05:06:44 2011
+++ src/sys/arch/mips/atheros/ar_conf.c	Sun Jul 10 06:26:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ar_conf.c,v 1.1 2011/07/07 05:06:44 matt Exp $	*/
+/*	$NetBSD: ar_conf.c,v 1.2 2011/07/10 06:26:02 matt Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: ar_conf.c,v 1.1 2011/07/07 05:06:44 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ar_conf.c,v 1.2 2011/07/10 06:26:02 matt Exp $");
 
 #include <sys/param.h>
 
@@ -102,6 +102,13 @@
 #ifdef WISOC_AR9344
 	{
 		.ac_platformsw =	&ar9344_platformsw,
+		.ac_chipid =		0x20,	/* 7240? */
+		.ac_chipmask =		0xff,
+		.ac_cid =		MIPS_PRID_CID_MTI,
+		.ac_pid =		MIPS_74K,
+		.ac_name =		"AR7240"
+	}, {
+		.ac_platformsw =	&ar9344_platformsw,
 		.ac_chipid =		ARCHIP_AR9344,
 		.ac_chipmask =		0xff,
 		.ac_cid =		MIPS_PRID_CID_MTI,
@@ -132,6 +139,15 @@
 }
 
 uint32_t
+atheros_get_uart_freq(void)
+{
+	if (chip_freqs.freq_uart)
+		return chip_freqs.freq_uart;
+
+	return chip_freqs.freq_bus;
+}
+
+uint32_t
 atheros_get_bus_freq(void)
 {
 	return chip_freqs.freq_bus;
@@ -172,6 +188,12 @@
 			atheros_early_consinit();
 			printf("Early console started!\n");
 			(*apsw->apsw_get_freqs)(&chip_freqs);
+			printf("freqs: cpu=%u bus=%u mem=%u ref=%u pll=%u\n",
+			     chip_freqs.freq_cpu,
+			     chip_freqs.freq_bus,
+			     chip_freqs.freq_mem,
+			     chip_freqs.freq_ref,
+			     chip_freqs.freq_pll);
 			return;
 		}
 	}
Index: src/sys/arch/mips/atheros/ar_console.c
diff -u src/sys/arch/mips/atheros/ar_console.c:1.1 src/sys/arch/mips/atheros/ar_console.c:1.2
--- src/sys/arch/mips/atheros/ar_console.c:1.1	Thu Jul  7 05:06:44 2011
+++ src/sys/arch/mips/atheros/ar_console.c	Sun Jul 10 06:26:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ar_console.c,v 1.1 2011/07/07 05:06:44 matt Exp $ */
+/* $NetBSD: ar_console.c,v 1.2 2011/07/10 06:26:02 matt Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
  * This file implement an Atheros dependent early console.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ar_console.c,v 1.1 2011/07/07 05:06:44 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ar_console.c,v 1.2 2011/07/10 06:26:02 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -49,7 +49,7 @@
 #include <mips/atheros/include/platform.h>
 #include <mips/atheros/include/arbusvar.h>
 
-#include <machine/locore.h>
+#include <mips/locore.h>
 #include "com.h"
 
 #include <dev/ic/ns16450reg.h>
@@ -66,7 +66,8 @@
 #if NCOM > 0
 	/* Setup polled serial for early console I/O */
 	/* XXX: pass in CONSPEED? */
-	com_arbus_cnattach(platformsw->apsw_uart0_base, atheros_get_bus_freq());
+	com_arbus_cnattach(platformsw->apsw_uart0_base,
+	    atheros_get_uart_freq());
 #else
 	panic("Not configured to use serial console!\n");
 	/* not going to see that message now, are we? */

Index: src/sys/arch/mips/atheros/arbus.c
diff -u src/sys/arch/mips/atheros/arbus.c:1.14 src/sys/arch/mips/atheros/arbus.c:1.15
--- src/sys/arch/mips/atheros/arbus.c:1.14	Thu Jul  7 05:06:44 2011
+++ src/sys/arch/mips/atheros/arbus.c	Sun Jul 10 06:26:02 2011
@@ -1,4 +1,4 @@
-/* $Id: arbus.c,v 1.14 2011/07/07 05:06:44 matt Exp $ */
+/* $Id: arbus.c,v 1.15 2011/07/10 06:26:02 matt Exp $ */
 /*
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
  * Copyright (c) 2006 Garrett D'Amore.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arbus.c,v 1.14 2011/07/07 05:06:44 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arbus.c,v 1.15 2011/07/10 06:26:02 matt Exp $");
 
 #include "locators.h"
 #define	_MIPS_BUS_DMA_PRIVATE
@@ -70,6 +70,9 @@
 CFATTACH_DECL_NEW(arbus, 0, arbus_match, arbus_attach, NULL, NULL);
 
 struct mips_bus_space	arbus_mbst;
+#if _BYTE_ORDER == _BIG_ENDIAN
+struct mips_bus_space	arbus_mbst_le;
+#endif
 struct mips_bus_dma_tag	arbus_mdt = {
 	._dmamap_ops = _BUS_DMAMAP_OPS_INITIALIZER,
 	._dmamem_ops = _BUS_DMAMEM_OPS_INITIALIZER,
@@ -85,6 +88,9 @@
 	done = true;
 
 	arbus_bus_mem_init(&arbus_mbst, NULL);
+#if _BYTE_ORDER == _BIG_ENDIAN
+	arbusle_bus_mem_init(&arbus_mbst_le, NULL);
+#endif
 }
 
 /* this primarily exists so we can get to the console... */
@@ -125,6 +131,11 @@
 		aa.aa_size = adv->adv_size;
 		aa.aa_dmat = &arbus_mdt;
 		aa.aa_bst = &arbus_mbst;
+#if _BYTE_ORDER == _BIG_ENDIAN
+		aa.aa_bst_le = &arbus_mbst_le;
+#else
+		aa.aa_bst_le = &arbus_mbst;
+#endif
 		aa.aa_cirq = adv->adv_cirq;
 		aa.aa_mirq = adv->adv_mirq;
 

Index: src/sys/arch/mips/atheros/include/arbusvar.h
diff -u src/sys/arch/mips/atheros/include/arbusvar.h:1.3 src/sys/arch/mips/atheros/include/arbusvar.h:1.4
--- src/sys/arch/mips/atheros/include/arbusvar.h:1.3	Fri Jul  1 18:40:01 2011
+++ src/sys/arch/mips/atheros/include/arbusvar.h	Sun Jul 10 06:26:02 2011
@@ -1,4 +1,4 @@
-/* $Id: arbusvar.h,v 1.3 2011/07/01 18:40:01 dyoung Exp $ */
+/* $Id: arbusvar.h,v 1.4 2011/07/10 06:26:02 matt Exp $ */
 /*
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
  * Copyright (c) 2006 Garrett D'Amore.
@@ -48,6 +48,7 @@
 struct arbus_attach_args {
 	const char	*aa_name;
 	bus_space_tag_t	aa_bst;
+	bus_space_tag_t	aa_bst_le;
 	bus_dma_tag_t	aa_dmat;
 
 	bus_addr_t	aa_addr;
@@ -57,6 +58,7 @@
 };
 
 void arbus_init(void);
+void arbusle_bus_mem_init(bus_space_tag_t, void *);
 bus_space_tag_t arbus_get_bus_space_tag(void);
 bus_dma_tag_t arbus_get_bus_dma_tag(void);
 

Index: src/sys/arch/mips/atheros/include/platform.h
diff -u src/sys/arch/mips/atheros/include/platform.h:1.1 src/sys/arch/mips/atheros/include/platform.h:1.2
--- src/sys/arch/mips/atheros/include/platform.h:1.1	Thu Jul  7 05:06:44 2011
+++ src/sys/arch/mips/atheros/include/platform.h	Sun Jul 10 06:26:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: platform.h,v 1.1 2011/07/07 05:06:44 matt Exp $ */
+/* $NetBSD: platform.h,v 1.2 2011/07/10 06:26:02 matt Exp $ */
 /*
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
  * Copyright (c) 2006 Garrett D'Amore.
@@ -79,6 +79,7 @@
 	uint32_t freq_mem;
 	uint32_t freq_pll;
 	uint32_t freq_ref;
+	uint32_t freq_uart;
 };
 
 struct atheros_platformsw {
@@ -134,6 +135,7 @@
 	atheros_get_cpuname(void);
 u_int	atheros_get_chipid(void);
 
+uint32_t atheros_get_uart_freq(void);
 uint32_t atheros_get_bus_freq(void);
 uint32_t atheros_get_cpu_freq(void);
 uint32_t atheros_get_mem_freq(void);

Added files:

Index: src/sys/arch/mips/atheros/arbusle.c
diff -u /dev/null src/sys/arch/mips/atheros/arbusle.c:1.1
--- /dev/null	Sun Jul 10 06:26:02 2011
+++ src/sys/arch/mips/atheros/arbusle.c	Sun Jul 10 06:26:02 2011
@@ -0,0 +1,54 @@
+/* $NetBSD: arbusle.c,v 1.1 2011/07/10 06:26:02 matt Exp $ */
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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: arbusle.c,v 1.1 2011/07/10 06:26:02 matt Exp $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/endian.h>
+
+#if _BYTE_ORDER == _BIG_ENDIAN
+
+#include <mips/atheros/include/arbusvar.h>
+
+#define CHIP                    arbusle
+#define CHIP_MEM                /* defined */
+#define	CHIP_LITTLE_ENDIAN	/* defined */
+#define CHIP_W1_BUS_START(v)    0x00000000UL
+#define CHIP_W1_BUS_END(v)      0x1fffffffUL
+#define CHIP_W1_SYS_START(v)    CHIP_W1_BUS_START(v)
+#define CHIP_W1_SYS_END(v)      CHIP_W1_BUS_END(v)
+//#define	CHIP_ACCESS_SIZE	4
+
+#include <mips/mips/bus_space_alignstride_chipdep.c>
+#endif /* _BYTE_ORDER == _BIG_ENDIAN */

Index: src/sys/arch/mips/atheros/dev/ehci_arbus.c
diff -u /dev/null src/sys/arch/mips/atheros/dev/ehci_arbus.c:1.1
--- /dev/null	Sun Jul 10 06:26:02 2011
+++ src/sys/arch/mips/atheros/dev/ehci_arbus.c	Sun Jul 10 06:26:02 2011
@@ -0,0 +1,138 @@
+/*	$NetBSD: ehci_arbus.c,v 1.1 2011/07/10 06:26:02 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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: ehci_arbus.c,v 1.1 2011/07/10 06:26:02 matt Exp $");
+
+#include "locators.h"
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+
+#include <mips/atheros/include/ar9344reg.h>
+#include <mips/atheros/include/arbusvar.h>
+
+#include <dev/usb/usb.h>   
+#include <dev/usb/usbdi.h>
+#include <dev/usb/usbdivar.h>
+#include <dev/usb/usb_mem.h>
+
+#include <dev/usb/ehcireg.h>
+#include <dev/usb/ehcivar.h>
+
+static int	ehci_arbus_match(device_t, cfdata_t, void *);
+static void	ehci_arbus_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(ehci_arbus, sizeof (ehci_softc_t),
+    ehci_arbus_match, ehci_arbus_attach, NULL, NULL);
+
+int
+ehci_arbus_match(device_t parent, cfdata_t cf, void *aux)
+{
+	struct arbus_attach_args *aa = aux;
+
+	if (strcmp(aa->aa_name, cf->cf_name) != 0)
+		return 0;
+
+	if (badaddr((void *)MIPS_PHYS_TO_KSEG1(aa->aa_addr), 4))
+		return 0;
+
+        return 1;	/* XXX */
+}
+
+void
+ehci_arbus_attach(device_t parent, device_t self, void *aux)
+{
+	ehci_softc_t *sc = device_private(self);
+	struct arbus_attach_args * const aa = aux;
+	void *ih = NULL;
+	int error;
+	int status;
+
+	sc->iot = aa->aa_bst_le;
+	sc->sc_size = aa->aa_size;
+	//sc->sc_bus.hci_private = sc;
+	sc->sc_bus.dmatag = aa->aa_dmat;
+	sc->sc_bus.usbrev = USBREV_1_0;
+	sc->sc_flags |= EHCIF_ETTF;
+
+	error = bus_space_map(aa->aa_bst, aa->aa_addr, aa->aa_size, 0,
+	    &sc->ioh);
+
+	if (error) {
+		aprint_error(": failed to map registers: %d\n", error);
+		return;
+	}
+
+	/* The recommended value is 0x20 for both ports and the host */
+	REGVAL(AR9344_USB_CONFIG_BASE) = 0x20c00;	/* magic */
+	DELAY(1000);
+
+	/* get offset to operational regs */
+	uint32_t r = bus_space_read_4(aa->aa_bst, sc->ioh, 0);
+	if (r != 0x40) {
+		aprint_error(": error: CAPLENGTH (%#x) != 0x40\n", sc->sc_offs);
+		return;
+	}
+
+	sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH);
+
+	aprint_normal("\n");
+
+	/* Disable EHCI interrupts */
+	EOWRITE2(sc, EHCI_USBINTR, 0);
+
+	/* establish interrupt */
+	ih = arbus_intr_establish(aa->aa_cirq, aa->aa_mirq, ehci_intr, sc);
+	if (ih == NULL)
+		panic("%s: couldn't establish interrupt",
+		    device_xname(self));
+
+	/*
+	 * There are no companion controllers
+	 */
+	sc->sc_ncomp = 0;
+
+	status = ehci_init(sc);
+	if (status != USBD_NORMAL_COMPLETION) {
+		aprint_error("%s: init failed, error=%d\n", device_xname(self),
+		    status);
+		if (ih != NULL)
+			arbus_intr_disestablish(ih);
+		return;
+	}
+
+	/* Attach USB device */
+	sc->sc_child = config_found(self, &sc->sc_bus, usbctlprint);
+}
+

Reply via email to