PERFORCE change 131630 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Tue Dec 25 14:47:48 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=131630
Change 131630 by hselasky at hselasky_laptop001 on 2007/12/25 22:46:45
Correct VBUS and PULLUP pin. Make sure that the clocks are
turned on and off in the correct order.
Affected files ...
.. //depot/projects/usb/src/sys/arm/at91/at91_udp.c#2 edit
Differences ...
==== //depot/projects/usb/src/sys/arm/at91/at91_udp.c#2 (text+ko) ====
@@ -51,11 +51,11 @@
/* Pin Definitions - do they belong here or somewhere else ? */
-#define VBUS_MASK AT91C_PIO_PD4
-#define VBUS_BASE AT91RM92_PIOD_BASE
+#define VBUS_MASK AT91C_PIO_PB24
+#define VBUS_BASE AT91RM92_PIOB_BASE
-#define PULLUP_MASK AT91C_PIO_PD5
-#define PULLUP_BASE AT91RM92_PIOD_BASE
+#define PULLUP_MASK AT91C_PIO_PB22
+#define PULLUP_BASE AT91RM92_PIOB_BASE
static device_probe_t at91_udp_probe;
static device_attach_t at91_udp_attach;
@@ -72,8 +72,13 @@
static void
at91_vbus_interrupt(struct at91_udp_softc *sc)
{
+ uint32_t temp;
uint8_t vbus_val;
+ /* XXX temporary clear interrupts here */
+
+ temp = at91_pio_gpio_clear_interrupt(VBUS_BASE);
+
/* just forward it */
vbus_val = at91_pio_gpio_get(VBUS_BASE, VBUS_MASK);
@@ -87,8 +92,8 @@
{
struct at91_udp_softc *sc = arg;
+ at91_pmc_clock_enable(sc->sc_iclk);
at91_pmc_clock_enable(sc->sc_fclk);
- at91_pmc_clock_enable(sc->sc_iclk);
return;
}
@@ -97,8 +102,8 @@
{
struct at91_udp_softc *sc = arg;
+ at91_pmc_clock_disable(sc->sc_fclk);
at91_pmc_clock_disable(sc->sc_iclk);
- at91_pmc_clock_disable(sc->sc_fclk);
return;
}
@@ -152,6 +157,7 @@
* configure VBUS input pin, enable deglitch and enable
* interrupt :
*/
+ at91_pio_use_gpio(VBUS_BASE, VBUS_MASK);
at91_pio_gpio_input(VBUS_BASE, VBUS_MASK);
at91_pio_gpio_set_deglitch(VBUS_BASE, VBUS_MASK, 1);
at91_pio_gpio_set_interrupt(VBUS_BASE, VBUS_MASK, 1);
@@ -159,10 +165,15 @@
/*
* configure PULLUP output pin :
*/
+ at91_pio_use_gpio(PULLUP_BASE, PULLUP_MASK);
at91_pio_gpio_output(PULLUP_BASE, PULLUP_MASK, 0);
at91_udp_pull_down(sc);
+ /* wait 10ms for pulldown to stabilise */
+
+ DELAY(10000);
+
sc->sc_iclk = at91_pmc_clock_ref("udc_clk");
sc->sc_fclk = at91_pmc_clock_ref("udpck");
@@ -225,19 +236,6 @@
sc->sc_vbus_intr_hdl = NULL;
goto error;
}
- /*
- * turn on the clocks from the AT91's point of view. Keep the unit
- * in reset.
- */
- at91_pmc_clock_enable(sc->sc_iclk);
- at91_pmc_clock_enable(sc->sc_fclk);
-
- /* disable Transceiver */
- AT91_UDP_WRITE_4(&(sc->sc_dci), AT91_UDP_TXVC, AT91_UDP_TXVC_DIS);
-
- /* disable and clear all interrupts */
- AT91_UDP_WRITE_4(&(sc->sc_dci), AT91_UDP_IDR, 0xFFFFFFFF);
- AT91_UDP_WRITE_4(&(sc->sc_dci), AT91_UDP_ICR, 0xFFFFFFFF);
err = at9100_dci_init(&(sc->sc_dci));
if (!err) {
More information about the p4-projects
mailing list