Module Name:    src
Committed By:   matt
Date:           Wed Sep  5 00:19:59 UTC 2012

Modified Files:
        src/sys/arch/arm/omap: files.omap2 obio_ohci.c obio_wdt.c omap2_obio.c
            omap2_obiovar.h omap2_reg.h omap3_ehci.c omap_wdt.c

Log Message:
Get USB closer to working on OMAP3 and OMAP4.
Get OMAP4430 closer to working.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/omap/files.omap2
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/omap/obio_ohci.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/obio_wdt.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/omap/omap2_obio.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/omap2_obiovar.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/omap/omap2_reg.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/omap3_ehci.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/omap_wdt.c

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/arm/omap/files.omap2
diff -u src/sys/arch/arm/omap/files.omap2:1.14 src/sys/arch/arm/omap/files.omap2:1.15
--- src/sys/arch/arm/omap/files.omap2:1.14	Wed Aug 29 17:48:17 2012
+++ src/sys/arch/arm/omap/files.omap2	Wed Sep  5 00:19:59 2012
@@ -1,10 +1,11 @@
-#	$NetBSD: files.omap2,v 1.14 2012/08/29 17:48:17 matt Exp $
+#	$NetBSD: files.omap2,v 1.15 2012/09/05 00:19:59 matt Exp $
 #
 # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support
 # Based on xscale/files.pxa2x0
 #
 
 include "arch/arm/pic/files.pic"
+include "arch/arm/cortex/files.cortex"
 
 file	arch/arm/arm32/irq_dispatch.S
 file	arch/arm/omap/omap_dma.c
@@ -98,7 +99,6 @@ attach	prcm at obio
 file	arch/arm/omap/omap2_prcm.c		prcm needs-flag
 
 # OHCI USB controller
-##attach	ohci at obio with obioohci:		omapgpio
 attach	ohci at obio with obioohci
 file	arch/arm/omap/obio_ohci.c		obioohci
 

Index: src/sys/arch/arm/omap/obio_ohci.c
diff -u src/sys/arch/arm/omap/obio_ohci.c:1.6 src/sys/arch/arm/omap/obio_ohci.c:1.7
--- src/sys/arch/arm/omap/obio_ohci.c:1.6	Mon Feb 13 17:34:21 2012
+++ src/sys/arch/arm/omap/obio_ohci.c	Wed Sep  5 00:19:59 2012
@@ -1,7 +1,7 @@
-/*	$Id: obio_ohci.c,v 1.6 2012/02/13 17:34:21 matt Exp $	*/
+/*	$Id: obio_ohci.c,v 1.7 2012/09/05 00:19:59 matt Exp $	*/
 
 /* adapted from: */
-/*	$NetBSD: obio_ohci.c,v 1.6 2012/02/13 17:34:21 matt Exp $	*/
+/*	$NetBSD: obio_ohci.c,v 1.7 2012/09/05 00:19:59 matt Exp $	*/
 /*	$OpenBSD: pxa2x0_ohci.c,v 1.19 2005/04/08 02:32:54 dlg Exp $ */
 
 /*
@@ -21,9 +21,10 @@
  */
 
 #include "opt_omap.h"
+#include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obio_ohci.c,v 1.6 2012/02/13 17:34:21 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obio_ohci.c,v 1.7 2012/09/05 00:19:59 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -52,7 +53,6 @@ struct obioohci_softc {
 	void		*sc_ih;
 	bus_addr_t	sc_addr;
 	bus_addr_t	sc_size;
-	void		*sc_powerhook;
 };
 
 static int	obioohci_match(struct device *, struct cfdata *, void *);
@@ -65,7 +65,6 @@ CFATTACH_DECL_NEW(obioohci, sizeof(struc
     obioohci_match, obioohci_attach, obioohci_detach, ohci_activate);
 
 static void	obioohci_clkinit(struct obio_attach_args *);
-static void	obioohci_power(int, void *);
 static void	obioohci_enable(struct obioohci_softc *);
 static void	obioohci_disable(struct obioohci_softc *);
 
@@ -75,30 +74,52 @@ static void	obioohci_disable(struct obio
 static int
 obioohci_match(device_t parent, cfdata_t cf, void *aux)
 {
-
 	struct obio_attach_args *obio = aux;
 
-	if ((obio->obio_addr == -1)
-	|| (obio->obio_size == 0)
-	|| (obio->obio_intr == -1))
-		panic("obioohci must have addr, size and intr"
-			" specified in config.");
+	if (obio->obio_addr == OBIOCF_ADDR_DEFAULT
+	    || obio->obio_size == OBIOCF_SIZE_DEFAULT
+	    || obio->obio_intr == OBIOCF_INTR_DEFAULT)
+		return 0;
+
+#if defined(OMAP_2430) || defined(OMAP_2420)
+	if (obio->obio_addr != OHCI1_BASE_2430)
+		return 0;
+#endif
+#if defined(OMAP_3530)
+	if (obio->obio_addr != OHCI1_BASE_3530)
+		return 0;
+#endif
+#if defined(OMAP_4430)
+	if (obio->obio_addr != OHCI1_BASE_4430)
+		return 0;
+#endif
 
 	obioohci_clkinit(obio);
 
-	return 1;	/* XXX */
+	return 1;
 }
 
 static void
 obioohci_attach(device_t parent, device_t self, void *aux)
 {
+	struct obio_softc *psc = device_private(parent);
 	struct obioohci_softc *sc = device_private(self);
 	struct obio_attach_args *obio = aux;
 	usbd_status r;
 
-	sc->sc.sc_size = 0;
-	sc->sc_ih = NULL;
-	sc->sc.sc_bus.dmatag = 0;
+	KASSERT(psc->sc_obio_dev == NULL);
+	psc->sc_obio_dev = self;
+
+	aprint_naive(": USB Controller\n");
+	aprint_normal(": USB Controller\n");
+
+	sc->sc_addr = obio->obio_addr;
+
+	sc->sc.iot = obio->obio_iot;
+	sc->sc.sc_dev = self;
+	sc->sc.sc_size = obio->obio_size;
+	sc->sc.sc_bus.dmatag = obio->obio_dmat;
+	sc->sc.sc_bus.hci_private = &sc->sc;
 
 	/* Map I/O space */
 	if (bus_space_map(obio->obio_iot, obio->obio_addr, obio->obio_size, 0,
@@ -106,10 +127,6 @@ obioohci_attach(device_t parent, device_
 		aprint_error(": couldn't map memory space\n");
 		return;
 	}
-	sc->sc.iot = obio->obio_iot;
-	sc->sc_addr = obio->obio_addr;
-	sc->sc.sc_size = obio->obio_size;
-	sc->sc.sc_bus.dmatag = obio->obio_dmat;
 
 	/* XXX copied from ohci_pci.c. needed? */
 	bus_space_barrier(sc->sc.iot, sc->sc.ioh, 0, sc->sc.sc_size,
@@ -123,40 +140,26 @@ obioohci_attach(device_t parent, device_
 
 	/* Disable interrupts, so we don't get any spurious ones. */
 	bus_space_write_4(sc->sc.iot, sc->sc.ioh, OHCI_INTERRUPT_DISABLE,
-	    OHCI_MIE);
+	    OHCI_ALL_INTRS);
 
-#if 1
 	sc->sc_ih = intr_establish(obio->obio_intr, IPL_USB, IST_LEVEL,
 		ohci_intr, &sc->sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error(": unable to establish interrupt\n");
 		goto free_map;
 	}
-#else
-	sc->sc_ih = obioohci_fake_intr_establish(ohci_intr, &sc->sc);
-#endif
 
-	strlcpy(sc->sc.sc_vendor, "OMAP2", sizeof(sc->sc.sc_vendor));
+	strlcpy(sc->sc.sc_vendor, "OMAP", sizeof(sc->sc.sc_vendor));
 	r = ohci_init(&sc->sc);
 	if (r != USBD_NORMAL_COMPLETION) {
 		aprint_error_dev(self, "init failed, error=%d\n", r);
 		goto free_intr;
 	}
 
-	sc->sc_powerhook = powerhook_establish(device_xname(self),
-	    obioohci_power, sc);
-	if (sc->sc_powerhook == NULL) {
-		aprint_error_dev(self, "cannot establish powerhook\n");
-	}
-
-	sc->sc.sc_child = config_found((void *)sc, &sc->sc.sc_bus, usbctlprint);
-
+	sc->sc.sc_child = config_found(self, &sc->sc.sc_bus, usbctlprint);
 	return;
 
 free_intr:
-#ifdef NOTYET
-	obio_gpio_intr_disestablish(sc->sc_ih);
-#endif
 	sc->sc_ih = NULL;
 free_map:
 	obioohci_disable(sc);
@@ -177,14 +180,9 @@ obioohci_detach(device_t self, int flags
 	if (error)
 		return error;
 
-	if (sc->sc_powerhook) {
-		powerhook_disestablish(sc->sc_powerhook);
-		sc->sc_powerhook = NULL;
-	}
-
 	if (sc->sc_ih) {
 #ifdef NOTYET
-		obio_gpio_intr_disestablish(sc->sc_ih);
+		intr_disestablish(sc->sc_ih);
 #endif
 		sc->sc_ih = NULL;
 	}
@@ -207,42 +205,11 @@ obioohci_detach(device_t self, int flags
 }
 
 static void
-obioohci_power(int why, void *arg)
-{
-	struct obioohci_softc *sc = (struct obioohci_softc *)arg;
-	int s;
-
-	s = splhardusb();
-	sc->sc.sc_bus.use_polling++;
-	switch (why) {
-	case PWR_STANDBY:
-	case PWR_SUSPEND:
-#if 0
-		ohci_power(why, &sc->sc);
-#endif
-#ifdef NOTYET
-		pxa2x0_clkman_config(CKEN_USBHC, 0);
-#endif
-		break;
-
-	case PWR_RESUME:
-#ifdef NOTYET
-		pxa2x0_clkman_config(CKEN_USBHC, 1);
-#endif
-		obioohci_enable(sc);
-#if 0
-		ohci_power(why, &sc->sc);
-#endif
-		break;
-	}
-	sc->sc.sc_bus.use_polling--;
-	splx(s);
-}
-
-static void
 obioohci_enable(struct obioohci_softc *sc)
 {
+#ifdef NOTYET
 	printf("%s: TBD\n", __func__);
+#endif
 }
 
 static void
@@ -265,7 +232,7 @@ obioohci_disable(struct obioohci_softc *
 static void
 obioohci_clkinit(struct obio_attach_args *obio)
 {
-	
+#if defined(OMAP_2430) || defined(OMAP_2420)
 	bus_space_handle_t ioh;
 	uint32_t r;
 	int err;
@@ -286,23 +253,5 @@ obioohci_clkinit(struct obio_attach_args
 	bus_space_write_4(obio->obio_iot, ioh, OMAP2_CM_ICLKEN2_CORE, r);
 
 	bus_space_unmap(obio->obio_iot, ioh, OMAP2_CM_SIZE);
-}
-
-#if 0
-int (*obioohci_fake_intr_func)(void *);
-void *obioohci_fake_intr_arg;
-
-void *
-obioohci_fake_intr_establish(int (*func)(void *), void *arg)
-{
-	obioohci_fake_intr_func = func;
-	obioohci_fake_intr_arg = arg;
-	return (void *)1;
-}
-
-void
-obioohci_fake_intr(void)
-{
-	(void)(*obioohci_fake_intr_func)(obioohci_fake_intr_arg);
-}
 #endif
+}

Index: src/sys/arch/arm/omap/obio_wdt.c
diff -u src/sys/arch/arm/omap/obio_wdt.c:1.5 src/sys/arch/arm/omap/obio_wdt.c:1.6
--- src/sys/arch/arm/omap/obio_wdt.c:1.5	Fri Jul  1 20:30:21 2011
+++ src/sys/arch/arm/omap/obio_wdt.c	Wed Sep  5 00:19:59 2012
@@ -33,7 +33,7 @@
 #include "opt_omap.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obio_wdt.c,v 1.5 2011/07/01 20:30:21 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obio_wdt.c,v 1.6 2012/09/05 00:19:59 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/callout.h>
@@ -79,8 +79,8 @@ obiowdt32k_attach(device_t parent, devic
 	sc->sc_smw.smw_period = OMAPWDT32K_DEFAULT_PERIOD;
 	sc->sc_iot = obio->obio_iot;
 
-	if (bus_space_map(sc->sc_iot, obio->obio_addr, obio->obio_size,
-			  0, &sc->sc_ioh))
+	if (bus_space_map(sc->sc_iot, obio->obio_addr, obio->obio_size, 0,
+		&sc->sc_ioh))
 		panic("%s: Cannot map registers", device_xname(self));
 
 	val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, WIDR);

Index: src/sys/arch/arm/omap/omap2_obio.c
diff -u src/sys/arch/arm/omap/omap2_obio.c:1.13 src/sys/arch/arm/omap/omap2_obio.c:1.14
--- src/sys/arch/arm/omap/omap2_obio.c:1.13	Mon Aug 20 12:38:28 2012
+++ src/sys/arch/arm/omap/omap2_obio.c	Wed Sep  5 00:19:59 2012
@@ -1,7 +1,7 @@
-/*	$Id: omap2_obio.c,v 1.13 2012/08/20 12:38:28 matt Exp $	*/
+/*	$Id: omap2_obio.c,v 1.14 2012/09/05 00:19:59 matt Exp $	*/
 
 /* adapted from: */
-/*	$NetBSD: omap2_obio.c,v 1.13 2012/08/20 12:38:28 matt Exp $ */
+/*	$NetBSD: omap2_obio.c,v 1.14 2012/09/05 00:19:59 matt Exp $ */
 
 
 /*
@@ -103,7 +103,7 @@
 
 #include "opt_omap.h"
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: omap2_obio.c,v 1.13 2012/08/20 12:38:28 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap2_obio.c,v 1.14 2012/09/05 00:19:59 matt Exp $");
 
 #include "locators.h"
 #include "obio.h"
@@ -130,16 +130,6 @@ typedef struct {
 	ulong		cs_size;
 } obio_csconfig_t;
 
-struct obio_softc {
-	device_t		sc_dev;
-	bus_dma_tag_t		sc_dmat;
-	bus_space_tag_t		sc_iot;
-	bus_space_handle_t	sc_ioh;
-	bus_addr_t		sc_base;
-	bus_size_t		sc_size;
-};
-
-
 /* prototypes */
 static int	obio_match(device_t, cfdata_t, void *);
 static void	obio_attach(device_t, device_t, void *);
@@ -227,6 +217,7 @@ obio_attach(device_t parent, device_t se
 	 * Attach critical devices first.
 	 */
 	obio_attach_critical(sc);
+
 	/*
 	 * Then attach the rest of our devices
 	 */
@@ -348,11 +339,12 @@ static const struct {
 	bus_addr_t addr;
 	bool required;
 } critical_devs[] = {
-#ifdef OMAP3
-	{ .name = "avic", .addr = INTC_BASE_3530, .required = true },
-#else
+#if defined(OMAP_2430) || defined(OMAP_2420)
 	{ .name = "avic", .addr = INTC_BASE, .required = true },
 #endif
+#if defined(OMAP_3530)
+	{ .name = "avic", .addr = INTC_BASE_3530, .required = true },
+#endif
 	{ .name = "gpio1", .addr = GPIO1_BASE, .required = false },
 	{ .name = "gpio2", .addr = GPIO2_BASE, .required = false },
 	{ .name = "gpio3", .addr = GPIO3_BASE, .required = false },

Index: src/sys/arch/arm/omap/omap2_obiovar.h
diff -u src/sys/arch/arm/omap/omap2_obiovar.h:1.1 src/sys/arch/arm/omap/omap2_obiovar.h:1.2
--- src/sys/arch/arm/omap/omap2_obiovar.h:1.1	Wed Aug 27 11:03:10 2008
+++ src/sys/arch/arm/omap/omap2_obiovar.h	Wed Sep  5 00:19:59 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: omap2_obiovar.h,v 1.1 2008/08/27 11:03:10 matt Exp $ */
+/* $NetBSD: omap2_obiovar.h,v 1.2 2012/09/05 00:19:59 matt Exp $ */
 
 /*
  * Copyright (c) 2007 Microsoft
@@ -32,6 +32,7 @@
 #define _ARM_OMAP_OMAP2_OBIOVAR_H_
 
 struct obio_attach_args {
+	const char *obio_name;
 	bus_space_tag_t	obio_iot;
 	bus_addr_t	obio_addr;
 	bus_size_t	obio_size;
@@ -41,4 +42,14 @@ struct obio_attach_args {
 	unsigned int	obio_intrbase;
 };
 
+struct obio_softc {
+	device_t		sc_dev;
+	bus_dma_tag_t		sc_dmat;
+	bus_space_tag_t		sc_iot;
+	bus_space_handle_t	sc_ioh;
+	bus_addr_t		sc_base;
+	bus_size_t		sc_size;
+	device_t		sc_obio_dev;
+};
+
 #endif /* _ARM_OMAP_OMAP2_OBIOVAR_H_ */

Index: src/sys/arch/arm/omap/omap2_reg.h
diff -u src/sys/arch/arm/omap/omap2_reg.h:1.10 src/sys/arch/arm/omap/omap2_reg.h:1.11
--- src/sys/arch/arm/omap/omap2_reg.h:1.10	Wed Aug 29 17:48:17 2012
+++ src/sys/arch/arm/omap/omap2_reg.h	Wed Sep  5 00:19:59 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: omap2_reg.h,v 1.10 2012/08/29 17:48:17 matt Exp $ */
+/* $NetBSD: omap2_reg.h,v 1.11 2012/09/05 00:19:59 matt Exp $ */
 
 /*
  * Copyright (c) 2007 Microsoft
@@ -67,10 +67,10 @@
 #define OMAP4430_L4_WAKEUP_BASE		0x4A300000
 #define OMAP4430_L4_WAKEUP_SIZE		0x00040000	/* 256KB */
 
-#define OMAP4430_L4_PERIPHERAL_BASE	0x49000000
+#define OMAP4430_L4_PERIPHERAL_BASE	0x48000000
 #define OMAP4430_L4_PERIPHERAL_SIZE	0x01000000	/* 16MB */
 
-#define OMAP4430_L4_ABE_BASE		0x40000000	/* Actually L3 */
+#define OMAP4430_L4_ABE_BASE		0x49000000	/* Actually L3 */
 #define OMAP4430_L4_ABE_SIZE		0x01000000	/* 16MB */
 
 /* TI Sitara AM335x (OMAP like) */
@@ -366,6 +366,10 @@
 #define OMAP3_PRM_CLKSEL_FREQS	{ 12000, 13000, 19200, 26000, 38400, 16800, 0, 0 }
 #define	OMAP3_PRM_CLKSEL_MULT	1000
 
+#define	OMAP4_PRM_RSTCTRL	0x1b00
+#define	OMAP4_PRM_RSTCTRL_WARM	0x0001
+#define	OMAP4_PRM_RSTCTRL_COLD	0x0002
+
 /*
  * L3 Interconnect Target Agent Common Registers
  */
@@ -658,12 +662,12 @@
 /*
  * USB Host
  */
+#define	OHCI1_BASE_2430			0x4805e000
+
 #define	OHCI1_BASE_3530			0x48064400
 #define	EHCI1_BASE_3530			0x48064800
 
-#define	OHCI1_BASE_4430			OHCI1_BASE_3530
-#define	EHCI1_BASE_4430			EHCI1_BASE_3530
-
-#define	OHCI2_BASE_4430			0x4A0A9000
+#define	OHCI1_BASE_4430			0x4A064800
+#define	EHCI1_BASE_4430			0x4A064C00
 
 #endif	/* _ARM_OMAP_OMAP2_REG_H_ */

Index: src/sys/arch/arm/omap/omap3_ehci.c
diff -u src/sys/arch/arm/omap/omap3_ehci.c:1.2 src/sys/arch/arm/omap/omap3_ehci.c:1.3
--- src/sys/arch/arm/omap/omap3_ehci.c:1.2	Fri Jul 20 02:14:01 2012
+++ src/sys/arch/arm/omap/omap3_ehci.c	Wed Sep  5 00:19:59 2012
@@ -1,7 +1,7 @@
-/*	$Id: omap3_ehci.c,v 1.2 2012/07/20 02:14:01 matt Exp $	*/
+/*	$Id: omap3_ehci.c,v 1.3 2012/09/05 00:19:59 matt Exp $	*/
 
 /* adapted from: */
-/*	$NetBSD: omap3_ehci.c,v 1.2 2012/07/20 02:14:01 matt Exp $	*/
+/*	$NetBSD: omap3_ehci.c,v 1.3 2012/09/05 00:19:59 matt Exp $	*/
 /*	$OpenBSD: pxa2x0_ehci.c,v 1.19 2005/04/08 02:32:54 dlg Exp $ */
 
 /*
@@ -23,7 +23,7 @@
 #include "opt_omap.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: omap3_ehci.c,v 1.2 2012/07/20 02:14:01 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap3_ehci.c,v 1.3 2012/09/05 00:19:59 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -53,20 +53,16 @@ struct obioehci_softc {
 	void		*sc_ih;
 	bus_addr_t	sc_addr;
 	bus_size_t	sc_size;
-	void		*sc_powerhook;
 };
 
 static int	obioehci_match(struct device *, struct cfdata *, void *);
 static void	obioehci_attach(struct device *, struct device *, void *);
 static int	obioehci_detach(struct device *, int);
-void *		obioehci_fake_intr_establish(int (*)(void *), void *);
-void		obioehci_fake_intr(void);
 
 CFATTACH_DECL_NEW(obioehci, sizeof(struct obioehci_softc),
     obioehci_match, obioehci_attach, obioehci_detach, ehci_activate);
 
 static void	obioehci_clkinit(struct obio_attach_args *);
-static void	obioehci_power(int, void *);
 static void	obioehci_enable(struct obioehci_softc *);
 static void	obioehci_disable(struct obioehci_softc *);
 
@@ -82,45 +78,51 @@ obioehci_match(device_t parent, cfdata_t
 	if (obio->obio_addr == OBIOCF_ADDR_DEFAULT
 	    || obio->obio_size == OBIOCF_SIZE_DEFAULT
 	    || obio->obio_intr == OBIOCF_INTR_DEFAULT)
-		panic("obioehci must have addr, size and intr"
-			" specified in config.");
+		return 0;
 
 #ifdef OMAP_3530
+	if (obio->obio_addr != EHCI1_BASE_3530)
+		return 0;
 #endif
 
 #ifdef OMAP_4430
+	if (obio->obio_addr != EHCI1_BASE_4430)
+		return 0;
 #endif
 
 	obioehci_clkinit(obio);
 
-	return 0;	/* XXX */
+	return 1;
 }
 
 static void
 obioehci_attach(device_t parent, device_t self, void *aux)
 {
-	struct obioehci_softc *sc = device_private(self);
-	struct obio_attach_args *obio = aux;
+	struct obio_softc * const psc = device_private(parent);
+	struct obioehci_softc * const sc = device_private(self);
+	struct obio_attach_args * const obio = aux;
 	usbd_status r;
 
-	sc->sc.sc_size = 0;
-	sc->sc_ih = NULL;
-	sc->sc.sc_bus.dmatag = 0;
-
 	/* Map I/O space */
 	if (bus_space_map(obio->obio_iot, obio->obio_addr, obio->obio_size, 0,
 	    &sc->sc.ioh)) {
 		aprint_error(": couldn't map memory space\n");
 		return;
 	}
+
 	sc->sc.iot = obio->obio_iot;
 	sc->sc_addr = obio->obio_addr;
+
+	aprint_naive(": USB Controller\n");
+	aprint_normal(": USB Controller\n");
+
 	sc->sc.sc_dev = self;
 	sc->sc.sc_size = obio->obio_size;
 	sc->sc.sc_bus.dmatag = obio->obio_dmat;
 	sc->sc.sc_bus.usbrev = USBREV_2_0;
-	sc->sc.sc_bus.hci_private = sc;
-	sc->sc.sc_ncomp = 0;
+	sc->sc.sc_bus.hci_private = &sc->sc;
+	if (psc->sc_obio_dev)
+		sc->sc.sc_comps[sc->sc.sc_ncomp++] = psc->sc_obio_dev;
 
 	/* XXX copied from ehci_pci.c. needed? */
 	bus_space_barrier(sc->sc.iot, sc->sc.ioh, 0, sc->sc.sc_size,
@@ -138,16 +140,12 @@ obioehci_attach(device_t parent, device_
 	/* Disable interrupts, so we don't get any spurious ones. */
 	EOWRITE4(&sc->sc, EHCI_USBINTR, 0);
 
-#if 1
 	sc->sc_ih = intr_establish(obio->obio_intr, IPL_USB, IST_LEVEL,
 		ehci_intr, &sc->sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error(": unable to establish interrupt\n");
 		goto free_map;
 	}
-#else
-	sc->sc_ih = obioehci_fake_intr_establish(ehci_intr, &sc->sc);
-#endif
 
 	r = ehci_init(&sc->sc);
 	if (r != USBD_NORMAL_COMPLETION) {
@@ -155,19 +153,10 @@ obioehci_attach(device_t parent, device_
 		goto free_intr;
 	}
 
-	sc->sc_powerhook = powerhook_establish(device_xname(self),
-	    obioehci_power, sc);
-	if (sc->sc_powerhook == NULL) {
-		aprint_error_dev(self, "cannot establish powerhook\n");
-	}
-
 	sc->sc.sc_child = config_found(self, &sc->sc.sc_bus, usbctlprint);
 	return;
 
 free_intr:
-#ifdef NOTYET
-	obio_gpio_intr_disestablish(sc->sc_ih);
-#endif
 	sc->sc_ih = NULL;
 free_map:
 	obioehci_disable(sc);
@@ -188,11 +177,6 @@ obioehci_detach(device_t self, int flags
 	if (error)
 		return error;
 
-	if (sc->sc_powerhook) {
-		powerhook_disestablish(sc->sc_powerhook);
-		sc->sc_powerhook = NULL;
-	}
-
 	if (sc->sc_ih) {
 #ifdef NOTYET
 		obio_gpio_intr_disestablish(sc->sc_ih);
@@ -218,42 +202,11 @@ obioehci_detach(device_t self, int flags
 }
 
 static void
-obioehci_power(int why, void *arg)
-{
-	struct obioehci_softc *sc = (struct obioehci_softc *)arg;
-	int s;
-
-	s = splhardusb();
-	sc->sc.sc_bus.use_polling++;
-	switch (why) {
-	case PWR_STANDBY:
-	case PWR_SUSPEND:
-#if 0
-		ehci_power(why, &sc->sc);
-#endif
-#ifdef NOTYET
-		pxa2x0_clkman_config(CKEN_USBHC, 0);
-#endif
-		break;
-
-	case PWR_RESUME:
-#ifdef NOTYET
-		pxa2x0_clkman_config(CKEN_USBHC, 1);
-#endif
-		obioehci_enable(sc);
-#if 0
-		ehci_power(why, &sc->sc);
-#endif
-		break;
-	}
-	sc->sc.sc_bus.use_polling--;
-	splx(s);
-}
-
-static void
 obioehci_enable(struct obioehci_softc *sc)
 {
+#if 0
 	printf("%s: TBD\n", __func__);
+#endif
 }
 
 static void
@@ -276,7 +229,7 @@ obioehci_disable(struct obioehci_softc *
 static void
 obioehci_clkinit(struct obio_attach_args *obio)
 {
-	
+#ifdef OMAP2
 	bus_space_handle_t ioh;
 	uint32_t r;
 	int err;
@@ -297,23 +250,5 @@ obioehci_clkinit(struct obio_attach_args
 	bus_space_write_4(obio->obio_iot, ioh, OMAP2_CM_ICLKEN2_CORE, r);
 
 	bus_space_unmap(obio->obio_iot, ioh, OMAP2_CM_SIZE);
-}
-
-#if 0
-int (*obioehci_fake_intr_func)(void *);
-void *obioehci_fake_intr_arg;
-
-void *
-obioehci_fake_intr_establish(int (*func)(void *), void *arg)
-{
-	obioehci_fake_intr_func = func;
-	obioehci_fake_intr_arg = arg;
-	return (void *)1;
-}
-
-void
-obioehci_fake_intr(void)
-{
-	(void)(*obioehci_fake_intr_func)(obioehci_fake_intr_arg);
-}
 #endif
+}

Index: src/sys/arch/arm/omap/omap_wdt.c
diff -u src/sys/arch/arm/omap/omap_wdt.c:1.4 src/sys/arch/arm/omap/omap_wdt.c:1.5
--- src/sys/arch/arm/omap/omap_wdt.c:1.4	Fri Aug 24 15:25:11 2012
+++ src/sys/arch/arm/omap/omap_wdt.c	Wed Sep  5 00:19:59 2012
@@ -231,7 +231,10 @@ omapwdt32k_tickle(struct sysmon_wdog *sm
 void
 omapwdt32k_reboot(void)
 {
-	int s = splhigh();
+	if (omapwdt32k_sc == NULL)
+		return;
+
+	const int s = splhigh();
 
 	omapwdt32k_set_timeout(0);
 	omapwdt32k_start();

Reply via email to