PERFORCE change 166540 for review

Sylvestre Gallon syl at FreeBSD.org
Sat Jul 25 10:25:30 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=166540

Change 166540 by syl at syl_atuin on 2009/07/25 10:25:07

	Implements dci_clock_on.
	Implements dci_clock_off.
	Implements dci_pull_up.
	Implements dci_pull_down.
	Implements dci_wakeup_peer.

Affected files ...

.. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.c#14 edit
.. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.h#10 edit

Differences ...

==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.c#14 (text+ko) ====

@@ -151,31 +151,68 @@
 static void
 s3c24dci_clocks_on(struct s3c24dci_softc *sc)
 {
+	if (sc->sc_flags.clocks_off &&
+	    sc->sc_flags.port_powered) {
 
+		DPRINTFN(5, "\n");
+
+		if (sc->sc_clocks_on) {
+			(sc->sc_clocks_on) (sc->sc_clocks_arg);
+		}
+		sc->sc_flags.clocks_off = 0;
+	}
 }
 
 static void
 s3c24dci_clocks_off(struct s3c24dci_softc *sc)
 {
+	if (!sc->sc_flags.clocks_off) {
 
+		DPRINTFN(5, "\n");
+
+		if (sc->sc_clocks_off) {
+			(sc->sc_clocks_off) (sc->sc_clocks_arg);
+		}
+		sc->sc_flags.clocks_off = 1;
+	}
 }
 
 static void
 s3c24dci_pull_up(struct s3c24dci_softc *sc)
 {
+	/* pullup D+, if possible */
 
+	if (!sc->sc_flags.d_pulled_up &&
+	    sc->sc_flags.port_powered) {
+		sc->sc_flags.d_pulled_up = 1;
+		(sc->sc_pull_up) (sc->sc_pull_arg);
+	}
 }
 
 static void
 s3c24dci_pull_down(struct s3c24dci_softc *sc)
 {
+	/* pulldown D+, if possible */
 
+	if (sc->sc_flags.d_pulled_up) {
+		sc->sc_flags.d_pulled_up = 0;
+		(sc->sc_pull_down) (sc->sc_pull_arg);
+	}
 }
 
 static void
 s3c24dci_wakeup_peer(struct s3c24dci_softc *sc)
 {
+	if (!(sc->sc_flags.status_suspend)) {
+		return;
+	}
 
+	S3C24XX_DCI_WRITE_4(sc, S3C24_DCI_PWR, S3C24_DCI_MCU_RESUME);
+	/* wait 8 milliseconds */
+	/* Wait for reset to complete. */
+	usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 125);
+
+	S3C24XX_DCI_WRITE_4(sc, S3C24_DCI_FUNC_ADDR, 0);
 }
 
 

==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.h#10 (text+ko) ====

@@ -245,6 +245,14 @@
 	bus_space_tag_t sc_io_tag;
 	bus_space_handle_t sc_io_hdl;
 
+	void    (*sc_clocks_on) (void *arg);
+	void    (*sc_clocks_off) (void *arg);
+	void   *sc_clocks_arg;
+
+	void    (*sc_pull_up) (void *arg);
+	void    (*sc_pull_down) (void *arg);
+	void   *sc_pull_arg;
+
 	uint8_t	sc_rt_addr;		/* root HUB address */
 	uint8_t	sc_dv_addr;		/* device address */
 	uint8_t	sc_conf;		/* root HUB config */


More information about the p4-projects mailing list