svn commit: r266244 - in head/sys: dev/usb/controller modules/usb/saf1761

Hans Petter Selasky hselasky at FreeBSD.org
Fri May 16 15:50:22 UTC 2014


Author: hselasky
Date: Fri May 16 15:50:21 2014
New Revision: 266244
URL: http://svnweb.freebsd.org/changeset/base/266244

Log:
  Rename "saf1761_dci_xxx" into "saf1761_otg_xxx" to reflect that this
  driver supports both host and device side mode.
  
  Sponsored by:	DARPA, AFRL

Added:
  head/sys/dev/usb/controller/saf1761_otg.c
     - copied, changed from r266241, head/sys/dev/usb/controller/saf1761_dci.c
  head/sys/dev/usb/controller/saf1761_otg.h
     - copied, changed from r266241, head/sys/dev/usb/controller/saf1761_dci.h
  head/sys/dev/usb/controller/saf1761_otg_fdt.c
     - copied, changed from r266215, head/sys/dev/usb/controller/saf1761_dci_fdt.c
  head/sys/dev/usb/controller/saf1761_otg_reg.h
     - copied, changed from r266241, head/sys/dev/usb/controller/saf1761_dci_reg.h
Modified:
  head/sys/modules/usb/saf1761/Makefile

Copied and modified: head/sys/dev/usb/controller/saf1761_otg.c (from r266241, head/sys/dev/usb/controller/saf1761_dci.c)
==============================================================================
--- head/sys/dev/usb/controller/saf1761_dci.c	Fri May 16 15:41:55 2014	(r266241, copy source)
+++ head/sys/dev/usb/controller/saf1761_otg.c	Fri May 16 15:50:21 2014	(r266244)
@@ -62,7 +62,7 @@
 #include <dev/usb/usb.h>
 #include <dev/usb/usbdi.h>
 
-#define	USB_DEBUG_VAR saf1761_dci_debug
+#define	USB_DEBUG_VAR saf1761_otg_debug
 
 #include <dev/usb/usb_core.h>
 #include <dev/usb/usb_debug.h>
@@ -77,58 +77,58 @@
 #include <dev/usb/usb_bus.h>
 #endif					/* USB_GLOBAL_INCLUDE_FILE */
 
-#include <dev/usb/controller/saf1761_dci.h>
-#include <dev/usb/controller/saf1761_dci_reg.h>
+#include <dev/usb/controller/saf1761_otg.h>
+#include <dev/usb/controller/saf1761_otg_reg.h>
 
-#define	SAF1761_DCI_BUS2SC(bus) \
-   ((struct saf1761_dci_softc *)(((uint8_t *)(bus)) - \
-    ((uint8_t *)&(((struct saf1761_dci_softc *)0)->sc_bus))))
+#define	SAF1761_OTG_BUS2SC(bus) \
+   ((struct saf1761_otg_softc *)(((uint8_t *)(bus)) - \
+    ((uint8_t *)&(((struct saf1761_otg_softc *)0)->sc_bus))))
 
 #ifdef USB_DEBUG
-static int saf1761_dci_debug = 0;
-static int saf1761_dci_forcefs = 0;
+static int saf1761_otg_debug = 0;
+static int saf1761_otg_forcefs = 0;
 
 static 
-SYSCTL_NODE(_hw_usb, OID_AUTO, saf1761_dci, CTLFLAG_RW, 0,
+SYSCTL_NODE(_hw_usb, OID_AUTO, saf1761_otg, CTLFLAG_RW, 0,
     "USB SAF1761 DCI");
 
-SYSCTL_INT(_hw_usb_saf1761_dci, OID_AUTO, debug, CTLFLAG_RW,
-    &saf1761_dci_debug, 0, "SAF1761 DCI debug level");
-SYSCTL_INT(_hw_usb_saf1761_dci, OID_AUTO, forcefs, CTLFLAG_RW,
-    &saf1761_dci_forcefs, 0, "SAF1761 DCI force FULL speed");
+SYSCTL_INT(_hw_usb_saf1761_otg, OID_AUTO, debug, CTLFLAG_RW,
+    &saf1761_otg_debug, 0, "SAF1761 DCI debug level");
+SYSCTL_INT(_hw_usb_saf1761_otg, OID_AUTO, forcefs, CTLFLAG_RW,
+    &saf1761_otg_forcefs, 0, "SAF1761 DCI force FULL speed");
 #endif
 
-#define	SAF1761_DCI_INTR_ENDPT 1
+#define	SAF1761_OTG_INTR_ENDPT 1
 
 /* prototypes */
 
-static const struct usb_bus_methods saf1761_dci_bus_methods;
+static const struct usb_bus_methods saf1761_otg_bus_methods;
 static const struct usb_pipe_methods saf1761_otg_non_isoc_methods;
-static const struct usb_pipe_methods saf1761_dci_device_isoc_methods;
+static const struct usb_pipe_methods saf1761_otg_device_isoc_methods;
 
-static saf1761_dci_cmd_t saf1761_host_setup_tx;
-static saf1761_dci_cmd_t saf1761_host_bulk_data_rx;
-static saf1761_dci_cmd_t saf1761_host_bulk_data_tx;
-static saf1761_dci_cmd_t saf1761_host_intr_data_rx;
-static saf1761_dci_cmd_t saf1761_host_intr_data_tx;
-static saf1761_dci_cmd_t saf1761_host_isoc_data_rx;
-static saf1761_dci_cmd_t saf1761_host_isoc_data_tx;
-static saf1761_dci_cmd_t saf1761_device_setup_rx;
-static saf1761_dci_cmd_t saf1761_device_data_rx;
-static saf1761_dci_cmd_t saf1761_device_data_tx;
-static saf1761_dci_cmd_t saf1761_device_data_tx_sync;
-static void saf1761_dci_device_done(struct usb_xfer *, usb_error_t);
-static void saf1761_dci_do_poll(struct usb_bus *);
-static void saf1761_dci_standard_done(struct usb_xfer *);
-static void saf1761_dci_intr_set(struct usb_xfer *, uint8_t);
-static void saf1761_dci_root_intr(struct saf1761_dci_softc *);
+static saf1761_otg_cmd_t saf1761_host_setup_tx;
+static saf1761_otg_cmd_t saf1761_host_bulk_data_rx;
+static saf1761_otg_cmd_t saf1761_host_bulk_data_tx;
+static saf1761_otg_cmd_t saf1761_host_intr_data_rx;
+static saf1761_otg_cmd_t saf1761_host_intr_data_tx;
+static saf1761_otg_cmd_t saf1761_host_isoc_data_rx;
+static saf1761_otg_cmd_t saf1761_host_isoc_data_tx;
+static saf1761_otg_cmd_t saf1761_device_setup_rx;
+static saf1761_otg_cmd_t saf1761_device_data_rx;
+static saf1761_otg_cmd_t saf1761_device_data_tx;
+static saf1761_otg_cmd_t saf1761_device_data_tx_sync;
+static void saf1761_otg_device_done(struct usb_xfer *, usb_error_t);
+static void saf1761_otg_do_poll(struct usb_bus *);
+static void saf1761_otg_standard_done(struct usb_xfer *);
+static void saf1761_otg_intr_set(struct usb_xfer *, uint8_t);
+static void saf1761_otg_root_intr(struct saf1761_otg_softc *);
 
 /*
  * Here is a list of what the SAF1761 chip can support. The main
  * limitation is that the sum of the buffer sizes must be less than
  * 8192 bytes.
  */
-static const struct usb_hw_ep_profile saf1761_dci_ep_profile[] = {
+static const struct usb_hw_ep_profile saf1761_otg_ep_profile[] = {
 
 	[0] = {
 		.max_in_frame_size = 64,
@@ -149,20 +149,20 @@ static const struct usb_hw_ep_profile sa
 };
 
 static void
-saf1761_dci_get_hw_ep_profile(struct usb_device *udev,
+saf1761_otg_get_hw_ep_profile(struct usb_device *udev,
     const struct usb_hw_ep_profile **ppf, uint8_t ep_addr)
 {
 	if (ep_addr == 0) {
-		*ppf = saf1761_dci_ep_profile + 0;
+		*ppf = saf1761_otg_ep_profile + 0;
 	} else if (ep_addr < 8) {
-		*ppf = saf1761_dci_ep_profile + 1;
+		*ppf = saf1761_otg_ep_profile + 1;
 	} else {
 		*ppf = NULL;
 	}
 }
 
 static void
-saf1761_dci_pull_up(struct saf1761_dci_softc *sc)
+saf1761_otg_pull_up(struct saf1761_otg_softc *sc)
 {
 	/* activate pullup on D+, if possible */
 
@@ -174,7 +174,7 @@ saf1761_dci_pull_up(struct saf1761_dci_s
 }
 
 static void
-saf1761_dci_pull_down(struct saf1761_dci_softc *sc)
+saf1761_otg_pull_down(struct saf1761_otg_softc *sc)
 {
 	/* release pullup on D+, if possible */
 
@@ -186,7 +186,7 @@ saf1761_dci_pull_down(struct saf1761_dci
 }
 
 static void
-saf1761_dci_wakeup_peer(struct saf1761_dci_softc *sc)
+saf1761_otg_wakeup_peer(struct saf1761_otg_softc *sc)
 {
 	uint16_t temp;
 
@@ -205,7 +205,7 @@ saf1761_dci_wakeup_peer(struct saf1761_d
 }
 
 static uint8_t
-saf1761_host_channel_alloc(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_host_channel_alloc(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	uint32_t x;
 
@@ -245,7 +245,7 @@ saf1761_host_channel_alloc(struct saf176
 }
 
 static void
-saf1761_host_channel_free(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_host_channel_free(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	uint32_t x;
 
@@ -276,7 +276,7 @@ saf1761_host_channel_free(struct saf1761
 }
 
 static void
-saf1761_read_host_fifo_1(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td,
+saf1761_read_host_fifo_1(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td,
     void *buf, uint32_t len)
 {
 	bus_space_read_region_1((sc)->sc_io_tag, (sc)->sc_io_hdl,
@@ -284,7 +284,7 @@ saf1761_read_host_fifo_1(struct saf1761_
 }
 
 static void
-saf1761_write_host_fifo_1(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td,
+saf1761_write_host_fifo_1(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td,
     void *buf, uint32_t len)
 {
 	bus_space_write_region_1((sc)->sc_io_tag, (sc)->sc_io_hdl,
@@ -292,7 +292,7 @@ saf1761_write_host_fifo_1(struct saf1761
 }
 
 static uint8_t
-saf1761_host_setup_tx(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_host_setup_tx(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	struct usb_device_request req __aligned(4);
 	uint32_t status;
@@ -358,7 +358,7 @@ complete:
 }
 
 static uint8_t
-saf1761_host_bulk_data_rx(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_host_bulk_data_rx(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	if (td->channel < SOTG_HOST_CHANNEL_MAX) {
 		uint32_t status;
@@ -456,7 +456,7 @@ complete:
 }
 
 static uint8_t
-saf1761_host_bulk_data_tx(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_host_bulk_data_tx(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	uint32_t count;
 
@@ -532,31 +532,31 @@ complete:
 }
 
 static uint8_t
-saf1761_host_intr_data_rx(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_host_intr_data_rx(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	return (1);	/* busy */
 }
 
 static uint8_t
-saf1761_host_intr_data_tx(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_host_intr_data_tx(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	return (1);	/* busy */
 }
 
 static uint8_t
-saf1761_host_isoc_data_rx(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_host_isoc_data_rx(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	return (1);	/* busy */
 }
 
 static uint8_t
-saf1761_host_isoc_data_tx(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_host_isoc_data_tx(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	return (1);	/* busy */
 }
 
 static void
-saf1761_dci_set_address(struct saf1761_dci_softc *sc, uint8_t addr)
+saf1761_otg_set_address(struct saf1761_otg_softc *sc, uint8_t addr)
 {
 	DPRINTFN(5, "addr=%d\n", addr);
 
@@ -564,21 +564,21 @@ saf1761_dci_set_address(struct saf1761_d
 }
 
 static void
-saf1761_read_device_fifo_1(struct saf1761_dci_softc *sc, void *buf, uint32_t len)
+saf1761_read_device_fifo_1(struct saf1761_otg_softc *sc, void *buf, uint32_t len)
 {
 	bus_space_read_multi_1((sc)->sc_io_tag, (sc)->sc_io_hdl,
 	    SOTG_DATA_PORT, buf, len);
 }
 
 static void
-saf1761_write_device_fifo_1(struct saf1761_dci_softc *sc, void *buf, uint32_t len)
+saf1761_write_device_fifo_1(struct saf1761_otg_softc *sc, void *buf, uint32_t len)
 {
 	bus_space_write_multi_1((sc)->sc_io_tag, (sc)->sc_io_hdl,
 	    SOTG_DATA_PORT, buf, len);
 }
 
 static uint8_t
-saf1761_device_setup_rx(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_device_setup_rx(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	struct usb_device_request req;
 	uint16_t count;
@@ -646,7 +646,7 @@ busy:
 }
 
 static uint8_t
-saf1761_device_data_rx(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_device_data_rx(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	struct usb_page_search buf_res;
 	uint16_t count;
@@ -742,7 +742,7 @@ saf1761_device_data_rx(struct saf1761_dc
 }
 
 static uint8_t
-saf1761_device_data_tx(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_device_data_tx(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	struct usb_page_search buf_res;
 	uint16_t count;
@@ -830,7 +830,7 @@ saf1761_device_data_tx(struct saf1761_dc
 }
 
 static uint8_t
-saf1761_device_data_tx_sync(struct saf1761_dci_softc *sc, struct saf1761_dci_td *td)
+saf1761_device_data_tx_sync(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
 	if (td->ep_index == 0) {
 		/* select the correct endpoint */
@@ -855,15 +855,15 @@ saf1761_device_data_tx_sync(struct saf17
 
 	if (sc->sc_dv_addr != 0xFF) {
 		/* write function address */
-		saf1761_dci_set_address(sc, sc->sc_dv_addr);
+		saf1761_otg_set_address(sc, sc->sc_dv_addr);
 	}
 	return (0);			/* complete */
 }
 
 static uint8_t
-saf1761_dci_xfer_do_fifo(struct saf1761_dci_softc *sc, struct usb_xfer *xfer)
+saf1761_otg_xfer_do_fifo(struct saf1761_otg_softc *sc, struct usb_xfer *xfer)
 {
-	struct saf1761_dci_td *td;
+	struct saf1761_otg_td *td;
 	uint8_t toggle;
 
 	DPRINTFN(9, "\n");
@@ -901,19 +901,19 @@ saf1761_dci_xfer_do_fifo(struct saf1761_
 done:
 	/* compute all actual lengths */
 
-	saf1761_dci_standard_done(xfer);
+	saf1761_otg_standard_done(xfer);
 
 	return (0);			/* complete */
 }
 
 static void
-saf1761_dci_interrupt_poll(struct saf1761_dci_softc *sc)
+saf1761_otg_interrupt_poll(struct saf1761_otg_softc *sc)
 {
 	struct usb_xfer *xfer;
 
 repeat:
 	TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) {
-		if (!saf1761_dci_xfer_do_fifo(sc, xfer)) {
+		if (!saf1761_otg_xfer_do_fifo(sc, xfer)) {
 			/* queue has been modified */
 			goto repeat;
 		}
@@ -921,7 +921,7 @@ repeat:
 }
 
 static void
-saf1761_dci_wait_suspend(struct saf1761_dci_softc *sc, uint8_t on)
+saf1761_otg_wait_suspend(struct saf1761_otg_softc *sc, uint8_t on)
 {
 	if (on) {
 		sc->sc_intr_enable |= SOTG_DCINTERRUPT_IESUSP;
@@ -934,7 +934,7 @@ saf1761_dci_wait_suspend(struct saf1761_
 }
 
 static void
-saf1761_dci_update_vbus(struct saf1761_dci_softc *sc)
+saf1761_otg_update_vbus(struct saf1761_otg_softc *sc)
 {
 	uint16_t status;
 
@@ -950,7 +950,7 @@ saf1761_dci_update_vbus(struct saf1761_d
 			sc->sc_flags.status_vbus = 1;
 
 			/* complete root HUB interrupt endpoint */
-			saf1761_dci_root_intr(sc);
+			saf1761_otg_root_intr(sc);
 		}
 	} else {
 		/* VBUS not-present or host mode */
@@ -962,13 +962,13 @@ saf1761_dci_update_vbus(struct saf1761_d
 			sc->sc_flags.change_connect = 1;
 
 			/* complete root HUB interrupt endpoint */
-			saf1761_dci_root_intr(sc);
+			saf1761_otg_root_intr(sc);
 		}
 	}
 }
 
 void
-saf1761_dci_interrupt(struct saf1761_dci_softc *sc)
+saf1761_otg_interrupt(struct saf1761_otg_softc *sc)
 {
 	uint32_t status;
 
@@ -984,7 +984,7 @@ saf1761_dci_interrupt(struct saf1761_dci
 
 	/* update VBUS and ID bits, if any */
 	if (status & SOTG_DCINTERRUPT_IEVBUS) {
-		saf1761_dci_update_vbus(sc);
+		saf1761_otg_update_vbus(sc);
 	}
 
 	if (status & SOTG_DCINTERRUPT_IEBRST) {
@@ -1002,9 +1002,9 @@ saf1761_dci_interrupt(struct saf1761_dci
 		sc->sc_flags.change_connect = 1;
 
 		/* disable resume interrupt */
-		saf1761_dci_wait_suspend(sc, 1);
+		saf1761_otg_wait_suspend(sc, 1);
 		/* complete root HUB interrupt endpoint */
-		saf1761_dci_root_intr(sc);
+		saf1761_otg_root_intr(sc);
 	}
 	/*
 	 * If "RESUME" and "SUSPEND" is set at the same time we
@@ -1020,30 +1020,30 @@ saf1761_dci_interrupt(struct saf1761_dci
 			sc->sc_flags.status_suspend = 0;
 			sc->sc_flags.change_suspend = 1;
 			/* disable resume interrupt */
-			saf1761_dci_wait_suspend(sc, 1);
+			saf1761_otg_wait_suspend(sc, 1);
 			/* complete root HUB interrupt endpoint */
-			saf1761_dci_root_intr(sc);
+			saf1761_otg_root_intr(sc);
 		}
 	} else if (status & SOTG_DCINTERRUPT_IESUSP) {
 		if (!sc->sc_flags.status_suspend) {
 			sc->sc_flags.status_suspend = 1;
 			sc->sc_flags.change_suspend = 1;
 			/* enable resume interrupt */
-			saf1761_dci_wait_suspend(sc, 0);
+			saf1761_otg_wait_suspend(sc, 0);
 			/* complete root HUB interrupt endpoint */
-			saf1761_dci_root_intr(sc);
+			saf1761_otg_root_intr(sc);
 		}
 	}
 	/* poll all active transfers */
-	saf1761_dci_interrupt_poll(sc);
+	saf1761_otg_interrupt_poll(sc);
 
 	USB_BUS_UNLOCK(&sc->sc_bus);
 }
 
 static void
-saf1761_dci_setup_standard_chain_sub(struct saf1761_dci_std_temp *temp)
+saf1761_otg_setup_standard_chain_sub(struct saf1761_otg_std_temp *temp)
 {
-	struct saf1761_dci_td *td;
+	struct saf1761_otg_td *td;
 
 	/* get current Transfer Descriptor */
 	td = temp->td_next;
@@ -1067,11 +1067,11 @@ saf1761_dci_setup_standard_chain_sub(str
 }
 
 static void
-saf1761_dci_setup_standard_chain(struct usb_xfer *xfer)
+saf1761_otg_setup_standard_chain(struct usb_xfer *xfer)
 {
-	struct saf1761_dci_std_temp temp;
-	struct saf1761_dci_softc *sc;
-	struct saf1761_dci_td *td;
+	struct saf1761_otg_std_temp temp;
+	struct saf1761_otg_softc *sc;
+	struct saf1761_otg_td *td;
 	uint32_t x;
 	uint8_t ep_no;
 	uint8_t ep_type;
@@ -1099,7 +1099,7 @@ saf1761_dci_setup_standard_chain(struct 
 
 	is_host = (xfer->xroot->udev->flags.usb_mode == USB_MODE_HOST);
 
-	sc = SAF1761_DCI_BUS2SC(xfer->xroot->bus);
+	sc = SAF1761_OTG_BUS2SC(xfer->xroot->bus);
 	ep_no = (xfer->endpointno & UE_ADDR);
 	ep_type = (xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE);
 
@@ -1122,7 +1122,7 @@ saf1761_dci_setup_standard_chain(struct 
 				if (xfer->flags_int.control_act)
 					temp.setup_alt_next = 0;
 			}
-			saf1761_dci_setup_standard_chain_sub(&temp);
+			saf1761_otg_setup_standard_chain_sub(&temp);
 		}
 		x = 1;
 	} else {
@@ -1194,7 +1194,7 @@ saf1761_dci_setup_standard_chain(struct 
 			temp.short_pkt = (xfer->flags.force_short_xfer) ? 0 : 1;
 		}
 
-		saf1761_dci_setup_standard_chain_sub(&temp);
+		saf1761_otg_setup_standard_chain_sub(&temp);
 
 		if (xfer->flags_int.isochronous_xfr) {
 			temp.offset += temp.len;
@@ -1239,7 +1239,7 @@ saf1761_dci_setup_standard_chain(struct 
 			temp.len = 0;
 			temp.short_pkt = 0;
 
-			saf1761_dci_setup_standard_chain_sub(&temp);
+			saf1761_otg_setup_standard_chain_sub(&temp);
 
 			/* data toggle should be DATA1 */
 			td = temp.td;
@@ -1248,7 +1248,7 @@ saf1761_dci_setup_standard_chain(struct 
 			if (need_sync) {
 				/* we need a SYNC point after TX */
 				temp.func = &saf1761_device_data_tx_sync;
-				saf1761_dci_setup_standard_chain_sub(&temp);
+				saf1761_otg_setup_standard_chain_sub(&temp);
 			}
 		}
 	} else {
@@ -1260,7 +1260,7 @@ saf1761_dci_setup_standard_chain(struct 
 
 			/* we need a SYNC point after TX */
 			temp.func = &saf1761_device_data_tx_sync;
-			saf1761_dci_setup_standard_chain_sub(&temp);
+			saf1761_otg_setup_standard_chain_sub(&temp);
 		}
 	}
 
@@ -1276,7 +1276,7 @@ saf1761_dci_setup_standard_chain(struct 
 }
 
 static void
-saf1761_dci_timeout(void *arg)
+saf1761_otg_timeout(void *arg)
 {
 	struct usb_xfer *xfer = arg;
 
@@ -1285,13 +1285,13 @@ saf1761_dci_timeout(void *arg)
 	USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
 
 	/* transfer is transferred */
-	saf1761_dci_device_done(xfer, USB_ERR_TIMEOUT);
+	saf1761_otg_device_done(xfer, USB_ERR_TIMEOUT);
 }
 
 static void
-saf1761_dci_intr_set(struct usb_xfer *xfer, uint8_t set)
+saf1761_otg_intr_set(struct usb_xfer *xfer, uint8_t set)
 {
-	struct saf1761_dci_softc *sc = SAF1761_DCI_BUS2SC(xfer->xroot->bus);
+	struct saf1761_otg_softc *sc = SAF1761_OTG_BUS2SC(xfer->xroot->bus);
 	uint8_t ep_no = (xfer->endpointno & UE_ADDR);
 	uint32_t mask;
 
@@ -1316,21 +1316,21 @@ saf1761_dci_intr_set(struct usb_xfer *xf
 }
 
 static void
-saf1761_dci_start_standard_chain(struct usb_xfer *xfer)
+saf1761_otg_start_standard_chain(struct usb_xfer *xfer)
 {
-	struct saf1761_dci_softc *sc = SAF1761_DCI_BUS2SC(xfer->xroot->bus);
+	struct saf1761_otg_softc *sc = SAF1761_OTG_BUS2SC(xfer->xroot->bus);
 
 	DPRINTFN(9, "\n");
 
 	/* poll one time */
-	if (saf1761_dci_xfer_do_fifo(sc, xfer)) {
+	if (saf1761_otg_xfer_do_fifo(sc, xfer)) {
 
 		/*
 		 * Only enable the endpoint interrupt when we are
 		 * actually waiting for data, hence we are dealing
 		 * with level triggered interrupts !
 		 */
-		saf1761_dci_intr_set(xfer, 1);
+		saf1761_otg_intr_set(xfer, 1);
 
 		/* put transfer on interrupt queue */
 		usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
@@ -1338,13 +1338,13 @@ saf1761_dci_start_standard_chain(struct 
 		/* start timeout, if any */
 		if (xfer->timeout != 0) {
 			usbd_transfer_timeout_ms(xfer,
-			    &saf1761_dci_timeout, xfer->timeout);
+			    &saf1761_otg_timeout, xfer->timeout);
 		}
 	}
 }
 
 static void
-saf1761_dci_root_intr(struct saf1761_dci_softc *sc)
+saf1761_otg_root_intr(struct saf1761_otg_softc *sc)
 {
 	DPRINTFN(9, "\n");
 
@@ -1358,9 +1358,9 @@ saf1761_dci_root_intr(struct saf1761_dci
 }
 
 static usb_error_t
-saf1761_dci_standard_done_sub(struct usb_xfer *xfer)
+saf1761_otg_standard_done_sub(struct usb_xfer *xfer)
 {
-	struct saf1761_dci_td *td;
+	struct saf1761_otg_td *td;
 	uint32_t len;
 	usb_error_t error;
 
@@ -1425,7 +1425,7 @@ saf1761_dci_standard_done_sub(struct usb
 }
 
 static void
-saf1761_dci_standard_done(struct usb_xfer *xfer)
+saf1761_otg_standard_done(struct usb_xfer *xfer)
 {
 	usb_error_t err = 0;
 
@@ -1440,7 +1440,7 @@ saf1761_dci_standard_done(struct usb_xfe
 
 		if (xfer->flags_int.control_hdr) {
 
-			err = saf1761_dci_standard_done_sub(xfer);
+			err = saf1761_otg_standard_done_sub(xfer);
 		}
 		xfer->aframes = 1;
 
@@ -1450,7 +1450,7 @@ saf1761_dci_standard_done(struct usb_xfe
 	}
 	while (xfer->aframes != xfer->nframes) {
 
-		err = saf1761_dci_standard_done_sub(xfer);
+		err = saf1761_otg_standard_done_sub(xfer);
 		xfer->aframes++;
 
 		if (xfer->td_transfer_cache == NULL) {
@@ -1461,22 +1461,22 @@ saf1761_dci_standard_done(struct usb_xfe
 	if (xfer->flags_int.control_xfr &&
 	    !xfer->flags_int.control_act) {
 
-		err = saf1761_dci_standard_done_sub(xfer);
+		err = saf1761_otg_standard_done_sub(xfer);
 	}
 done:
-	saf1761_dci_device_done(xfer, err);
+	saf1761_otg_device_done(xfer, err);
 }
 
 /*------------------------------------------------------------------------*
- *	saf1761_dci_device_done
+ *	saf1761_otg_device_done
  *
  * NOTE: this function can be called more than one time on the
  * same USB transfer!
  *------------------------------------------------------------------------*/
 static void
-saf1761_dci_device_done(struct usb_xfer *xfer, usb_error_t error)
+saf1761_otg_device_done(struct usb_xfer *xfer, usb_error_t error)
 {
-	struct saf1761_dci_softc *sc = SAF1761_DCI_BUS2SC(xfer->xroot->bus);
+	struct saf1761_otg_softc *sc = SAF1761_OTG_BUS2SC(xfer->xroot->bus);
 
 	USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
 
@@ -1484,9 +1484,9 @@ saf1761_dci_device_done(struct usb_xfer 
 	    xfer, xfer->endpoint, error);
 
 	if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
-		saf1761_dci_intr_set(xfer, 0);
+		saf1761_otg_intr_set(xfer, 0);
 	} else {
-		struct saf1761_dci_td *td;
+		struct saf1761_otg_td *td;
 
 		td = xfer->td_transfer_first;
 
@@ -1499,16 +1499,16 @@ saf1761_dci_device_done(struct usb_xfer 
 }
 
 static void
-saf1761_dci_xfer_stall(struct usb_xfer *xfer)
+saf1761_otg_xfer_stall(struct usb_xfer *xfer)
 {
-	saf1761_dci_device_done(xfer, USB_ERR_STALLED);
+	saf1761_otg_device_done(xfer, USB_ERR_STALLED);
 }
 
 static void
-saf1761_dci_set_stall(struct usb_device *udev,
+saf1761_otg_set_stall(struct usb_device *udev,
     struct usb_endpoint *ep, uint8_t *did_stall)
 {
-	struct saf1761_dci_softc *sc;
+	struct saf1761_otg_softc *sc;
 	uint8_t ep_no;
 	uint8_t ep_type;
 	uint8_t ep_dir;
@@ -1524,7 +1524,7 @@ saf1761_dci_set_stall(struct usb_device 
 	DPRINTFN(5, "endpoint=%p\n", ep);
 
 	/* set FORCESTALL */
-	sc = SAF1761_DCI_BUS2SC(udev->bus);
+	sc = SAF1761_OTG_BUS2SC(udev->bus);
 	ep_no = (ep->edesc->bEndpointAddress & UE_ADDR);
 	ep_dir = (ep->edesc->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT));
 	ep_type = (ep->edesc->bmAttributes & UE_XFERTYPE);
@@ -1544,7 +1544,7 @@ saf1761_dci_set_stall(struct usb_device 
 }
 
 static void
-saf1761_dci_clear_stall_sub(struct saf1761_dci_softc *sc,
+saf1761_otg_clear_stall_sub(struct saf1761_otg_softc *sc,
     uint8_t ep_no, uint8_t ep_type, uint8_t ep_dir)
 {
 	if (ep_type == UE_CONTROL) {
@@ -1569,9 +1569,9 @@ saf1761_dci_clear_stall_sub(struct saf17
 }
 
 static void
-saf1761_dci_clear_stall(struct usb_device *udev, struct usb_endpoint *ep)
+saf1761_otg_clear_stall(struct usb_device *udev, struct usb_endpoint *ep)
 {
-	struct saf1761_dci_softc *sc;
+	struct saf1761_otg_softc *sc;
 	struct usb_endpoint_descriptor *ed;
 
 	USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
@@ -1584,20 +1584,20 @@ saf1761_dci_clear_stall(struct usb_devic
 		return;
 	}
 	/* get softc */
-	sc = SAF1761_DCI_BUS2SC(udev->bus);
+	sc = SAF1761_OTG_BUS2SC(udev->bus);
 
 	/* get endpoint descriptor */
 	ed = ep->edesc;
 
 	/* reset endpoint */
-	saf1761_dci_clear_stall_sub(sc,
+	saf1761_otg_clear_stall_sub(sc,
 	    (ed->bEndpointAddress & UE_ADDR),
 	    (ed->bmAttributes & UE_XFERTYPE),
 	    (ed->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT)));
 }
 
 usb_error_t
-saf1761_dci_init(struct saf1761_dci_softc *sc)
+saf1761_otg_init(struct saf1761_otg_softc *sc)
 {
 	const struct usb_hw_ep_profile *pf;
 	uint32_t x;
@@ -1606,7 +1606,7 @@ saf1761_dci_init(struct saf1761_dci_soft
 
 	/* set up the bus structure */
 	sc->sc_bus.usbrev = USB_REV_2_0;
-	sc->sc_bus.methods = &saf1761_dci_bus_methods;
+	sc->sc_bus.methods = &saf1761_otg_bus_methods;
 
 	USB_BUS_LOCK(&sc->sc_bus);
 
@@ -1644,14 +1644,14 @@ saf1761_dci_init(struct saf1761_dci_soft
 	DELAY(1000);
 
 	/* do a pulldown */
-	saf1761_dci_pull_down(sc);
+	saf1761_otg_pull_down(sc);
 
 	/* wait 10ms for pulldown to stabilise */
 	usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 100);
 
 	for (x = 1;; x++) {
 
-		saf1761_dci_get_hw_ep_profile(NULL, &pf, x);
+		saf1761_otg_get_hw_ep_profile(NULL, &pf, x);
 		if (pf == NULL)
 			break;
 
@@ -1717,19 +1717,19 @@ saf1761_dci_init(struct saf1761_dci_soft
 	SAF1761_WRITE_4(sc, SOTG_USBCMD, SOTG_USBCMD_RS);
 
 	/* poll initial VBUS status */
-	saf1761_dci_update_vbus(sc);
+	saf1761_otg_update_vbus(sc);
 
 	USB_BUS_UNLOCK(&sc->sc_bus);
 
 	/* catch any lost interrupts */
 
-	saf1761_dci_do_poll(&sc->sc_bus);
+	saf1761_otg_do_poll(&sc->sc_bus);
 
 	return (0);			/* success */
 }
 
 void
-saf1761_dci_uninit(struct saf1761_dci_softc *sc)
+saf1761_otg_uninit(struct saf1761_otg_softc *sc)
 {
 	USB_BUS_LOCK(&sc->sc_bus);
 
@@ -1743,90 +1743,90 @@ saf1761_dci_uninit(struct saf1761_dci_so
 	sc->sc_flags.change_suspend = 0;
 	sc->sc_flags.change_connect = 1;
 
-	saf1761_dci_pull_down(sc);
+	saf1761_otg_pull_down(sc);
 	USB_BUS_UNLOCK(&sc->sc_bus);
 }
 
 static void
-saf1761_dci_suspend(struct saf1761_dci_softc *sc)
+saf1761_otg_suspend(struct saf1761_otg_softc *sc)
 {
 	/* TODO */
 }
 
 static void
-saf1761_dci_resume(struct saf1761_dci_softc *sc)
+saf1761_otg_resume(struct saf1761_otg_softc *sc)
 {
 	/* TODO */
 }
 
 static void
-saf1761_dci_do_poll(struct usb_bus *bus)
+saf1761_otg_do_poll(struct usb_bus *bus)
 {
-	struct saf1761_dci_softc *sc = SAF1761_DCI_BUS2SC(bus);
+	struct saf1761_otg_softc *sc = SAF1761_OTG_BUS2SC(bus);
 
 	USB_BUS_LOCK(&sc->sc_bus);
-	saf1761_dci_interrupt_poll(sc);
+	saf1761_otg_interrupt_poll(sc);
 	USB_BUS_UNLOCK(&sc->sc_bus);
 }
 
 /*------------------------------------------------------------------------*
- * saf1761_dci control support
- * saf1761_dci interrupt support
- * saf1761_dci bulk support
+ * saf1761_otg control support
+ * saf1761_otg interrupt support
+ * saf1761_otg bulk support
  *------------------------------------------------------------------------*/
 static void
-saf1761_dci_device_non_isoc_open(struct usb_xfer *xfer)
+saf1761_otg_device_non_isoc_open(struct usb_xfer *xfer)
 {
 	return;
 }
 
 static void
-saf1761_dci_device_non_isoc_close(struct usb_xfer *xfer)
+saf1761_otg_device_non_isoc_close(struct usb_xfer *xfer)
 {
-	saf1761_dci_device_done(xfer, USB_ERR_CANCELLED);
+	saf1761_otg_device_done(xfer, USB_ERR_CANCELLED);
 }
 
 static void
-saf1761_dci_device_non_isoc_enter(struct usb_xfer *xfer)
+saf1761_otg_device_non_isoc_enter(struct usb_xfer *xfer)
 {
 	return;
 }
 
 static void
-saf1761_dci_device_non_isoc_start(struct usb_xfer *xfer)
+saf1761_otg_device_non_isoc_start(struct usb_xfer *xfer)
 {
 	/* setup TDs */
-	saf1761_dci_setup_standard_chain(xfer);
-	saf1761_dci_start_standard_chain(xfer);
+	saf1761_otg_setup_standard_chain(xfer);
+	saf1761_otg_start_standard_chain(xfer);
 }
 
 static const struct usb_pipe_methods saf1761_otg_non_isoc_methods =
 {
-	.open = saf1761_dci_device_non_isoc_open,
-	.close = saf1761_dci_device_non_isoc_close,
-	.enter = saf1761_dci_device_non_isoc_enter,
-	.start = saf1761_dci_device_non_isoc_start,
+	.open = saf1761_otg_device_non_isoc_open,
+	.close = saf1761_otg_device_non_isoc_close,
+	.enter = saf1761_otg_device_non_isoc_enter,
+	.start = saf1761_otg_device_non_isoc_start,
 };
 
 /*------------------------------------------------------------------------*
- * saf1761_dci isochronous support
+ * saf1761_otg isochronous support
  *------------------------------------------------------------------------*/
 static void
-saf1761_dci_device_isoc_open(struct usb_xfer *xfer)
+saf1761_otg_device_isoc_open(struct usb_xfer *xfer)
 {
 	return;
 }
 
 static void
-saf1761_dci_device_isoc_close(struct usb_xfer *xfer)
+saf1761_otg_device_isoc_close(struct usb_xfer *xfer)
 {
-	saf1761_dci_device_done(xfer, USB_ERR_CANCELLED);
+	saf1761_otg_device_done(xfer, USB_ERR_CANCELLED);
 }
 
 static void
-saf1761_dci_device_isoc_enter(struct usb_xfer *xfer)
+saf1761_otg_device_isoc_enter(struct usb_xfer *xfer)
 {
-	struct saf1761_dci_softc *sc = SAF1761_DCI_BUS2SC(xfer->xroot->bus);
+	struct saf1761_otg_softc *sc = SAF1761_OTG_BUS2SC(xfer->xroot->bus);
 	uint32_t temp;
 	uint32_t nframes;
 
@@ -1872,31 +1872,31 @@ saf1761_dci_device_isoc_enter(struct usb
 	xfer->endpoint->isoc_next += xfer->nframes;
 
 	/* setup TDs */
-	saf1761_dci_setup_standard_chain(xfer);
+	saf1761_otg_setup_standard_chain(xfer);
 }
 
 static void
-saf1761_dci_device_isoc_start(struct usb_xfer *xfer)
+saf1761_otg_device_isoc_start(struct usb_xfer *xfer)
 {
 	/* start TD chain */
-	saf1761_dci_start_standard_chain(xfer);
+	saf1761_otg_start_standard_chain(xfer);
 }
 
-static const struct usb_pipe_methods saf1761_dci_device_isoc_methods =
+static const struct usb_pipe_methods saf1761_otg_device_isoc_methods =
 {
-	.open = saf1761_dci_device_isoc_open,
-	.close = saf1761_dci_device_isoc_close,
-	.enter = saf1761_dci_device_isoc_enter,
-	.start = saf1761_dci_device_isoc_start,
+	.open = saf1761_otg_device_isoc_open,
+	.close = saf1761_otg_device_isoc_close,
+	.enter = saf1761_otg_device_isoc_enter,
+	.start = saf1761_otg_device_isoc_start,
 };
 
 /*------------------------------------------------------------------------*
- * saf1761_dci root control support
+ * saf1761_otg root control support
  *------------------------------------------------------------------------*
  * Simulate a hardware HUB by handling all the necessary requests.
  *------------------------------------------------------------------------*/
 
-static const struct usb_device_descriptor saf1761_dci_devd = {
+static const struct usb_device_descriptor saf1761_otg_devd = {
 	.bLength = sizeof(struct usb_device_descriptor),
 	.bDescriptorType = UDESC_DEVICE,
 	.bcdUSB = {0x00, 0x02},
@@ -1910,7 +1910,7 @@ static const struct usb_device_descripto
 	.bNumConfigurations = 1,
 };
 
-static const struct usb_device_qualifier saf1761_dci_odevd = {
+static const struct usb_device_qualifier saf1761_otg_odevd = {
 	.bLength = sizeof(struct usb_device_qualifier),
 	.bDescriptorType = UDESC_DEVICE_QUALIFIER,
 	.bcdUSB = {0x00, 0x02},
@@ -1921,11 +1921,11 @@ static const struct usb_device_qualifier
 	.bNumConfigurations = 0,
 };
 
-static const struct saf1761_dci_config_desc saf1761_dci_confd = {
+static const struct saf1761_otg_config_desc saf1761_otg_confd = {
 	.confd = {
 		.bLength = sizeof(struct usb_config_descriptor),
 		.bDescriptorType = UDESC_CONFIG,
-		.wTotalLength[0] = sizeof(saf1761_dci_confd),
+		.wTotalLength[0] = sizeof(saf1761_otg_confd),
 		.bNumInterface = 1,
 		.bConfigurationValue = 1,
 		.iConfiguration = 0,
@@ -1944,7 +1944,7 @@ static const struct saf1761_dci_config_d
 	.endpd = {
 		.bLength = sizeof(struct usb_endpoint_descriptor),
 		.bDescriptorType = UDESC_ENDPOINT,
-		.bEndpointAddress = (UE_DIR_IN | SAF1761_DCI_INTR_ENDPT),
+		.bEndpointAddress = (UE_DIR_IN | SAF1761_OTG_INTR_ENDPT),
 		.bmAttributes = UE_INTERRUPT,
 		.wMaxPacketSize[0] = 8,
 		.bInterval = 255,
@@ -1953,8 +1953,8 @@ static const struct saf1761_dci_config_d
 
 #define	HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) }
 
-static const struct usb_hub_descriptor_min saf1761_dci_hubd = {
-	.bDescLength = sizeof(saf1761_dci_hubd),
+static const struct usb_hub_descriptor_min saf1761_otg_hubd = {
+	.bDescLength = sizeof(saf1761_otg_hubd),
 	.bDescriptorType = UDESC_HUB,
 	.bNbrPorts = SOTG_NUM_PORTS,
 	HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)),
@@ -1969,14 +1969,14 @@ static const struct usb_hub_descriptor_m
 #define	STRING_PRODUCT \
   "D\0C\0I\0 \0R\0o\0o\0t\0 \0H\0U\0B"
 
-USB_MAKE_STRING_DESC(STRING_VENDOR, saf1761_dci_vendor);
-USB_MAKE_STRING_DESC(STRING_PRODUCT, saf1761_dci_product);
+USB_MAKE_STRING_DESC(STRING_VENDOR, saf1761_otg_vendor);
+USB_MAKE_STRING_DESC(STRING_PRODUCT, saf1761_otg_product);
 
 static usb_error_t
-saf1761_dci_roothub_exec(struct usb_device *udev,
+saf1761_otg_roothub_exec(struct usb_device *udev,
     struct usb_device_request *req, const void **pptr, uint16_t *plength)
 {
-	struct saf1761_dci_softc *sc = SAF1761_DCI_BUS2SC(udev->bus);
+	struct saf1761_otg_softc *sc = SAF1761_OTG_BUS2SC(udev->bus);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list