Module Name: src
Committed By: macallan
Date: Tue Dec 23 15:13:30 UTC 2014
Modified Files:
src/sys/arch/mips/ingenic: ingenic_dwctwo.c
Log Message:
establish interrupt
do some PHY setup, now the hardware actually responds
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/ingenic/ingenic_dwctwo.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/mips/ingenic/ingenic_dwctwo.c
diff -u src/sys/arch/mips/ingenic/ingenic_dwctwo.c:1.1 src/sys/arch/mips/ingenic/ingenic_dwctwo.c:1.2
--- src/sys/arch/mips/ingenic/ingenic_dwctwo.c:1.1 Sat Dec 6 14:35:47 2014
+++ src/sys/arch/mips/ingenic/ingenic_dwctwo.c Tue Dec 23 15:13:30 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ingenic_dwctwo.c,v 1.1 2014/12/06 14:35:47 macallan Exp $ */
+/* $NetBSD: ingenic_dwctwo.c,v 1.2 2014/12/23 15:13:30 macallan Exp $ */
/*-
* Copyright (c) 2014 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ingenic_dwctwo.c,v 1.1 2014/12/06 14:35:47 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ingenic_dwctwo.c,v 1.2 2014/12/23 15:13:30 macallan Exp $");
/*
* adapted from bcm2835_dwctwo.c
@@ -112,6 +112,7 @@ ingenic_dwc2_attach(device_t parent, dev
{
struct ingenic_dwc2_softc *sc = device_private(self);
struct apbus_attach_args *aa = aux;
+ uint32_t reg;
int error;
sc->sc_dwc2.sc_dev = self;
@@ -134,27 +135,41 @@ ingenic_dwc2_attach(device_t parent, dev
aprint_naive(": USB controller\n");
aprint_normal(": USB controller\n");
-#if notyet
- sc->sc_ih = bcm2835_intr_establish(aaa->aaa_intr, IPL_SCHED,
- dwc2_intr, &sc->sc_dwc2);
+ reg = readreg(JZ_USBPCR);
+ reg |= VBUSVLDEXTSEL;
+ reg |= VBUSVLDEXT;
+ reg |= USB_MODE;
+ reg |= COMMONONN;
+ reg &= ~OTG_DISABLE;
+ writereg(JZ_USBPCR, reg);
+
+ reg = readreg(JZ_USBPCR1);
+ reg |= PCR_SYNOPSYS;
+ reg |= PCR_REFCLK_CORE;
+ reg &= ~PCR_CLK_M;
+ reg |= PCR_CLK_48;
+ reg |= PCR_WORD_I_F0;
+ writereg(JZ_USBPCR1, reg);
+
+ delay(10000);
+
+ sc->sc_ih = evbmips_intr_establish(21, dwc2_intr, &sc->sc_dwc2);
if (sc->sc_ih == NULL) {
aprint_error_dev(self, "failed to establish interrupt %d\n",
- aaa->aaa_intr);
+ 21);
goto fail;
}
-#endif
+
config_defer(self, ingenic_dwc2_deferred);
return;
-#if notyet
fail:
if (sc->sc_ih) {
- intr_disestablish(sc->sc_ih);
+ evbmips_intr_disestablish(sc->sc_ih);
sc->sc_ih = NULL;
}
-#endif
bus_space_unmap(sc->sc_dwc2.sc_iot, sc->sc_dwc2.sc_ioh, 0x20000);
}