PERFORCE change 166538 for review
Sylvestre Gallon
syl at FreeBSD.org
Sat Jul 25 09:59:01 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166538
Change 166538 by syl at syl_atuin on 2009/07/25 09:58:35
Follow at91dci function order to simplify the diff between the two drivers.
Add s3c24dci_do_poll.
Add s3c24dci_interrupt_poll.
Affected files ...
.. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.c#13 edit
.. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.h#9 edit
Differences ...
==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.c#13 (text+ko) ====
@@ -79,7 +79,8 @@
static s3c24dci_cmd_t s3c24dci_data_tx;
static s3c24dci_cmd_t s3c24dci_data_tx_sync;
static void s3c24dci_device_done(struct usb_xfer *, usb_error_t);
-static void s3c24dci_start_standard_chain(struct usb_xfer *xfer);
+static void s3c24dci_do_poll(struct usb_bus *);
+static void s3c24dci_standard_done(struct usb_xfer *xfer);
/*
* This driver dont support DMA for the mement. DMA seems to not be
@@ -137,173 +138,69 @@
},
};
-/*
- * Transfer stuff.
- */
-
-static uint8_t
-s3c24dci_setup_rx(struct s3c24dci_td *td)
+static void
+s3c24dci_get_hw_ep_profile(struct usb_device *udev,
+ const struct usb_hw_ep_profile **ppf, uint8_t ep_addr)
{
- return 0;
+ if (ep_addr < S3C24XX_DCI_EP_MAX)
+ *ppf = (s3c24dci_ep_profile + ep_addr);
+ else
+ *ppf = NULL;
}
-static uint8_t
-s3c24dci_data_rx(struct s3c24dci_td *td)
+static void
+s3c24dci_clocks_on(struct s3c24dci_softc *sc)
{
- return 0;
+
}
-static uint8_t
-s3c24dci_data_tx(struct s3c24dci_td *td)
+static void
+s3c24dci_clocks_off(struct s3c24dci_softc *sc)
{
- return 0;
+
}
-static uint8_t
-s3c24dci_data_tx_sync(struct s3c24dci_td *td)
+static void
+s3c24dci_pull_up(struct s3c24dci_softc *sc)
{
- return 0;
+
}
static void
-s3c24dci_device_done(struct usb_xfer *xfer, usb_error_t error)
+s3c24dci_pull_down(struct s3c24dci_softc *sc)
{
- struct s3c24dci_softc *sc = S3C24_DCI_BUS2SC(xfer->xroot->bus);
- uint32_t ittmp;
- uint8_t ep_no;
-
- USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
-
- DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n",
- xfer, xfer->endpoint, error);
-
- if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
- ep_no = (xfer->endpointno & UE_ADDR);
-
- /* disable endpoint interrupt */
- ittmp = S3C24XX_DCI_READ_4(sc, S3C24_DCI_EP_INT_EN);
- ittmp &= ~(1<<ep_no);
- S3C24XX_DCI_WRITE_4(sc, S3C24_DCI_EP_INT_EN, ittmp);
-
- DPRINTFN(15, "disable interrupts on endpoint %d\n", ep_no);
- }
- usbd_transfer_done(xfer, error);
}
static void
-s3c24dci_timeout(void *arg)
+s3c24dci_wakeup_peer(struct s3c24dci_softc *sc)
{
- struct usb_xfer *xfer = arg;
- DPRINTF("xfer=%p\n", xfer);
+}
- USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
- /* transfer is transferred */
- s3c24dci_device_done(xfer, USB_ERR_TIMEOUT);
+static uint8_t
+s3c24dci_setup_rx(struct s3c24dci_td *td)
+{
+ return 0;
}
-static usb_error_t
-s3c24dci_standard_done_sub(struct usb_xfer *xfer)
+static uint8_t
+s3c24dci_data_rx(struct s3c24dci_td *td)
{
- struct s3c24dci_td *td;
- uint32_t len;
- uint8_t error;
+ return 0;
+}
- DPRINTFN(9, "\n");
-
- td = xfer->td_transfer_cache;
-
- do {
- len = td->remainder;
-
- if (xfer->aframes != xfer->nframes) {
- /*
- * Verify the length and subtract
- * the remainder from "frlengths[]":
- */
- if (len > xfer->frlengths[xfer->aframes]) {
- td->error = 1;
- } else {
- xfer->frlengths[xfer->aframes] -= len;
- }
- }
- /* Check for transfer error */
- if (td->error) {
- /* the transfer is finished */
- error = 1;
- td = NULL;
- break;
- }
- /* Check for short transfer */
- if (len > 0) {
- if (xfer->flags_int.short_frames_ok) {
- /* follow alt next */
- if (td->alt_next) {
- td = td->obj_next;
- } else {
- td = NULL;
- }
- } else {
- /* the transfer is finished */
- td = NULL;
- }
- error = 0;
- break;
- }
- td = td->obj_next;
-
- /* this USB frame is complete */
- error = 0;
- break;
-
- } while (0);
-
- /* update transfer cache */
-
- xfer->td_transfer_cache = td;
-
- return (error ?
- USB_ERR_STALLED : USB_ERR_NORMAL_COMPLETION);
+static uint8_t
+s3c24dci_data_tx(struct s3c24dci_td *td)
+{
+ return 0;
}
-static void
-s3c24dci_standard_done(struct usb_xfer *xfer)
+static uint8_t
+s3c24dci_data_tx_sync(struct s3c24dci_td *td)
{
- usb_error_t err = 0;
-
- DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
- xfer, xfer->endpoint);
-
- /* reset scanner */
-
- xfer->td_transfer_cache = xfer->td_transfer_first;
-
- if (xfer->flags_int.control_xfr) {
- if (xfer->flags_int.control_hdr) {
- err = s3c24dci_standard_done_sub(xfer);
- }
- xfer->aframes = 1;
- if (xfer->td_transfer_cache == NULL) {
- goto done;
- }
- }
- while (xfer->aframes != xfer->nframes) {
- err = s3c24dci_standard_done_sub(xfer);
- xfer->aframes++;
-
- if (xfer->td_transfer_cache == NULL) {
- goto done;
- }
- }
-
- if (xfer->flags_int.control_xfr &&
- !xfer->flags_int.control_act) {
- err = s3c24dci_standard_done_sub(xfer);
- }
-done:
- s3c24dci_device_done(xfer, err);
+ return 0;
}
static uint8_t
@@ -347,34 +244,15 @@
}
static void
-s3c24dci_start_standard_chain(struct usb_xfer *xfer)
+s3c24dci_interrupt_poll(struct s3c24dci_softc *sc)
{
- DPRINTFN(9, "\n");
+ struct usb_xfer *xfer;
- /* poll one time */
- if (s3c24dci_xfer_do_fifo(xfer)) {
- struct s3c24dci_softc *sc = S3C24_DCI_BUS2SC(xfer->xroot->bus);
- uint8_t ep_no = xfer->endpointno & UE_ADDR;
- uint32_t ittmp;
-
- /*
- * Only enable the endpoint interrupt when we are actually
- * waiting for data, hence we are dealing with level
- * triggered interrupts !
- */
- ittmp = S3C24XX_DCI_READ_4(sc, S3C24_DCI_EP_INT_EN);
- ittmp |= (1<<ep_no);
- S3C24XX_DCI_WRITE_4(sc, S3C24_DCI_EP_INT_EN, ittmp);
-
- DPRINTFN(15, "enable interrupts on endpoint %d\n", ep_no);
-
- /* put transfer on interrupt queue */
- usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
-
- /* start timeout, if any */
- if (xfer->timeout != 0) {
- usbd_transfer_timeout_ms(xfer,
- &s3c24dci_timeout, xfer->timeout);
+repeat:
+ TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) {
+ if (!s3c24dci_xfer_do_fifo(xfer)) {
+ /* queue has been modified */
+ goto repeat;
}
}
}
@@ -549,162 +427,215 @@
xfer->td_transfer_last = td;
}
-/*
- * s3c24xxdci ctrl/bulk/intr support
- */
-
static void
-s3c24dci_device_dummy(struct usb_xfer *xfer)
+s3c24dci_timeout(void *arg)
{
- return ;
+ struct usb_xfer *xfer = arg;
+
+ DPRINTF("xfer=%p\n", xfer);
+
+ USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
+
+ /* transfer is transferred */
+ s3c24dci_device_done(xfer, USB_ERR_TIMEOUT);
}
static void
-s3c24dci_device_xxx_start(struct usb_xfer *xfer)
+s3c24dci_start_standard_chain(struct usb_xfer *xfer)
{
- s3c24dci_setup_standard_chain(xfer);
- s3c24dci_start_standard_chain(xfer);
- return ;
+ DPRINTFN(9, "\n");
+
+ /* poll one time */
+ if (s3c24dci_xfer_do_fifo(xfer)) {
+ struct s3c24dci_softc *sc = S3C24_DCI_BUS2SC(xfer->xroot->bus);
+ uint8_t ep_no = xfer->endpointno & UE_ADDR;
+ uint32_t ittmp;
+
+ /*
+ * Only enable the endpoint interrupt when we are actually
+ * waiting for data, hence we are dealing with level
+ * triggered interrupts !
+ */
+ ittmp = S3C24XX_DCI_READ_4(sc, S3C24_DCI_EP_INT_EN);
+ ittmp |= (1<<ep_no);
+ S3C24XX_DCI_WRITE_4(sc, S3C24_DCI_EP_INT_EN, ittmp);
+
+ DPRINTFN(15, "enable interrupts on endpoint %d\n", ep_no);
+
+ /* put transfer on interrupt queue */
+ usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
+
+ /* start timeout, if any */
+ if (xfer->timeout != 0) {
+ usbd_transfer_timeout_ms(xfer,
+ &s3c24dci_timeout, xfer->timeout);
+ }
+ }
}
-static void
-s3c24dci_device_xxx_close(struct usb_xfer *xfer)
+static usb_error_t
+s3c24dci_standard_done_sub(struct usb_xfer *xfer)
{
- s3c24dci_device_done(xfer, USB_ERR_CANCELLED);
- return ;
-}
+ struct s3c24dci_td *td;
+ uint32_t len;
+ uint8_t error;
+
+ DPRINTFN(9, "\n");
+
+ td = xfer->td_transfer_cache;
+
+ do {
+ len = td->remainder;
+
+ if (xfer->aframes != xfer->nframes) {
+ /*
+ * Verify the length and subtract
+ * the remainder from "frlengths[]":
+ */
+ if (len > xfer->frlengths[xfer->aframes]) {
+ td->error = 1;
+ } else {
+ xfer->frlengths[xfer->aframes] -= len;
+ }
+ }
+ /* Check for transfer error */
+ if (td->error) {
+ /* the transfer is finished */
+ error = 1;
+ td = NULL;
+ break;
+ }
+ /* Check for short transfer */
+ if (len > 0) {
+ if (xfer->flags_int.short_frames_ok) {
+ /* follow alt next */
+ if (td->alt_next) {
+ td = td->obj_next;
+ } else {
+ td = NULL;
+ }
+ } else {
+ /* the transfer is finished */
+ td = NULL;
+ }
+ error = 0;
+ break;
+ }
+ td = td->obj_next;
-struct usb_pipe_methods s3c24dci_device_ctrl_methods = {
- .open = s3c24dci_device_dummy,
- .enter = s3c24dci_device_dummy,
- .close = s3c24dci_device_xxx_close,
- .start = s3c24dci_device_xxx_start,
-};
+ /* this USB frame is complete */
+ error = 0;
+ break;
-struct usb_pipe_methods s3c24dci_device_bulk_methods = {
- .open = s3c24dci_device_dummy,
- .enter = s3c24dci_device_dummy,
- .close = s3c24dci_device_xxx_close,
- .start = s3c24dci_device_xxx_start,
-};
+ } while (0);
-struct usb_pipe_methods s3c24dci_device_intr_methods = {
- .open = s3c24dci_device_dummy,
- .enter = s3c24dci_device_dummy,
- .close = s3c24dci_device_xxx_close,
- .start = s3c24dci_device_xxx_start,
-};
+ /* update transfer cache */
-/*
- * s3c24dci root control support
- * Simulate a hardware HUB by handling all the necessary requests.
- */
+ xfer->td_transfer_cache = td;
-static const struct usb_device_descriptor s3c24dci_devd = {
- .bLength = sizeof(struct usb_device_descriptor),
- .bDescriptorType = UDESC_DEVICE,
- .bcdUSB = {0x00, 0x02},
- .bDeviceClass = UDCLASS_HUB,
- .bDeviceSubClass = UDSUBCLASS_HUB,
- .bDeviceProtocol = UDPROTO_HSHUBSTT,
- .bMaxPacketSize = 64,
- .bcdDevice = {0x00, 0x01},
- .iManufacturer = 1,
- .iProduct = 2,
- .bNumConfigurations = 1,
-};
+ return (error ?
+ USB_ERR_STALLED : USB_ERR_NORMAL_COMPLETION);
+}
-static const struct usb_device_qualifier s3c24dci_odevd = {
- .bLength = sizeof(struct usb_device_qualifier),
- .bDescriptorType = UDESC_DEVICE_QUALIFIER,
- .bcdUSB = {0x00, 0x02},
- .bDeviceClass = UDCLASS_HUB,
- .bDeviceSubClass = UDSUBCLASS_HUB,
- .bDeviceProtocol = UDPROTO_FSHUB,
- .bMaxPacketSize0 = 0,
- .bNumConfigurations = 0,
-
-};
+static void
+s3c24dci_standard_done(struct usb_xfer *xfer)
+{
+ usb_error_t err = 0;
-static const struct s3c24dci_config_desc s3c24dci_confd = {
- .confd = {
- .bLength = sizeof(struct usb_config_descriptor),
- .bDescriptorType = UDESC_CONFIG,
- .wTotalLength[0] = sizeof(s3c24dci_confd),
- .bNumInterface = 1,
- .bConfigurationValue = 1,
- .iConfiguration = 0,
- .bmAttributes = UC_SELF_POWERED,
- .bMaxPower = 0,
- },
- .ifcd = {
- .bLength = sizeof(struct usb_interface_descriptor),
- .bDescriptorType = UDESC_INTERFACE,
- .bNumEndpoints = 1,
- .bInterfaceClass = UICLASS_HUB,
- .bInterfaceSubClass = UISUBCLASS_HUB,
- .bInterfaceProtocol = UIPROTO_HSHUBSTT,
- },
- .endpd = {
- .bLength = sizeof(struct usb_endpoint_descriptor),
- .bDescriptorType = UDESC_ENDPOINT,
- .bEndpointAddress = (UE_DIR_IN | S3C24_DCI_INTR_ENDPT),
- .bmAttributes = UE_INTERRUPT,
- .wMaxPacketSize[0] = 8,
- .bInterval = 255,
- },
-};
+ DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
+ xfer, xfer->endpoint);
-static const struct usb_hub_descriptor_min s3c24dci_hubd = {
- .bDescLength = sizeof(s3c24dci_hubd),
- .bDescriptorType = UDESC_HUB,
- .bNbrPorts = 1,
- .wHubCharacteristics[0] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF,
- .wHubCharacteristics[1] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 8,
- .bPwrOn2PwrGood = 50,
- .bHubContrCurrent = 0,
- .DeviceRemovable = {0}, /* port is removable */
-};
+ /* reset scanner */
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
+ xfer->td_transfer_cache = xfer->td_transfer_first;
-#define STRING_VENDOR \
- 'S', 0, 'A', 0, 'M', 0, 'S', 0, 'U', 0, 'N', 0, 'G', 0
+ if (xfer->flags_int.control_xfr) {
+ if (xfer->flags_int.control_hdr) {
+ err = s3c24dci_standard_done_sub(xfer);
+ }
+ xfer->aframes = 1;
+ if (xfer->td_transfer_cache == NULL) {
+ goto done;
+ }
+ }
+ while (xfer->aframes != xfer->nframes) {
+ err = s3c24dci_standard_done_sub(xfer);
+ xfer->aframes++;
-#define STRING_PRODUCT \
- 'D', 0, 'C', 0, 'I', 0, ' ', 0, 'R', 0, \
- 'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \
- 'U', 0, 'B', 0,
+ if (xfer->td_transfer_cache == NULL) {
+ goto done;
+ }
+ }
-USB_MAKE_STRING_DESC(STRING_LANG, s3c24dci_langtab);
-USB_MAKE_STRING_DESC(STRING_VENDOR, s3c24dci_vendor);
-USB_MAKE_STRING_DESC(STRING_PRODUCT, s3c24dci_product);
+ if (xfer->flags_int.control_xfr &&
+ !xfer->flags_int.control_act) {
+ err = s3c24dci_standard_done_sub(xfer);
+ }
+done:
+ s3c24dci_device_done(xfer, err);
+}
/*
- * USB FN interface
+ * s3c24dci_device_done
+ * NOTE : This function can be called more than one time on
+ * the same USB transfer !
*/
+static void
+s3c24dci_device_done(struct usb_xfer *xfer, usb_error_t error)
+{
+ struct s3c24dci_softc *sc = S3C24_DCI_BUS2SC(xfer->xroot->bus);
+ uint32_t ittmp;
+ uint8_t ep_no;
+
+ USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
+
+ DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n",
+ xfer, xfer->endpoint, error);
-usb_error_t s3c24dci_init(struct s3c24dci_softc *sc)
-{
- return 0;
-}
+ if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
+ ep_no = (xfer->endpointno & UE_ADDR);
+
+ /* disable endpoint interrupt */
+ ittmp = S3C24XX_DCI_READ_4(sc, S3C24_DCI_EP_INT_EN);
+ ittmp &= ~(1<<ep_no);
+ S3C24XX_DCI_WRITE_4(sc, S3C24_DCI_EP_INT_EN, ittmp);
+
+ DPRINTFN(15, "disable interrupts on endpoint %d\n", ep_no);
+ }
-void s3c24dci_uninit(struct s3c24dci_softc *sc)
-{
- return ;
+ usbd_transfer_done(xfer, error);
}
static void
-s3c24dci_get_hw_ep_profile(struct usb_device *udev,
- const struct usb_hw_ep_profile **ppf, uint8_t ep_addr)
+s3c24dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
+ struct usb_endpoint *ep, uint8_t *did_stall)
{
- if (ep_addr < S3C24XX_DCI_EP_MAX)
- *ppf = (s3c24dci_ep_profile + ep_addr);
- else
- *ppf = NULL;
+ struct s3c24dci_softc *sc;
+ uint32_t csr;
+
+ USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
+
+ DPRINTFN(5, "endpoint=%p\n", ep);
+
+ if (xfer) {
+ /* cancel any ongoing transfers */
+ s3c24dci_device_done(xfer, USB_ERR_STALLED);
+ }
+
+ /* set STALL */
+ sc = S3C24_DCI_BUS2SC(udev->bus);
+ S3C24XX_DCI_WRITE_4(sc, S3C24_DCI_INDEX, (ep->edesc->bEndpointAddress & UE_ADDR));
+ if ((ep->edesc->bEndpointAddress & (UE_DIR_IN|UE_DIR_OUT)) == UE_DIR_IN) {
+ csr = S3C24XX_DCI_READ_4(sc, S3C24_DCI_IN_CSR1);
+ csr |= S3C24_DCI_IN_SEND_STALL;
+ S3C24XX_DCI_WRITE_4(sc, S3C24_DCI_IN_CSR1, csr);
+ } else {
+ csr = S3C24XX_DCI_READ_4(sc, S3C24_DCI_OUT_CSR1);
+ csr |= S3C24_DCI_OUT_SEND_STALL;
+ S3C24XX_DCI_WRITE_4(sc, S3C24_DCI_OUT_CSR1, csr);
+ }
+
+ return ;
}
static void
@@ -815,67 +746,162 @@
return ;
}
-static void
-s3c24dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
- struct usb_endpoint *ep, uint8_t *did_stall)
+usb_error_t
+s3c24dci_init(struct s3c24dci_softc *sc)
{
- struct s3c24dci_softc *sc;
- uint32_t csr;
+ s3c24dci_do_poll(&sc->sc_bus);
+ return 0;
+}
- USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
-
- DPRINTFN(5, "endpoint=%p\n", ep);
-
- if (xfer) {
- /* cancel any ongoing transfers */
- s3c24dci_device_done(xfer, USB_ERR_STALLED);
- }
-
- /* set STALL */
- sc = S3C24_DCI_BUS2SC(udev->bus);
- S3C24XX_DCI_WRITE_4(sc, S3C24_DCI_INDEX, (ep->edesc->bEndpointAddress & UE_ADDR));
- if ((ep->edesc->bEndpointAddress & (UE_DIR_IN|UE_DIR_OUT)) == UE_DIR_IN) {
- csr = S3C24XX_DCI_READ_4(sc, S3C24_DCI_IN_CSR1);
- csr |= S3C24_DCI_IN_SEND_STALL;
- S3C24XX_DCI_WRITE_4(sc, S3C24_DCI_IN_CSR1, csr);
- } else {
- csr = S3C24XX_DCI_READ_4(sc, S3C24_DCI_OUT_CSR1);
- csr |= S3C24_DCI_OUT_SEND_STALL;
- S3C24XX_DCI_WRITE_4(sc, S3C24_DCI_OUT_CSR1, csr);
- }
-
+void
+s3c24dci_uninit(struct s3c24dci_softc *sc)
+{
return ;
}
static void
-s3c24dci_clocks_on(struct s3c24dci_softc *sc)
+s3c24dci_do_poll(struct usb_bus *bus)
{
+ struct s3c24dci_softc *sc = S3C24_DCI_BUS2SC(bus);
+ USB_BUS_LOCK(&sc->sc_bus);
+ s3c24dci_interrupt_poll(sc);
+ USB_BUS_UNLOCK(&sc->sc_bus);
}
+/*
+ * s3c24xxdci ctrl/bulk/intr support
+ */
+
static void
-s3c24dci_clocks_off(struct s3c24dci_softc *sc)
+s3c24dci_device_dummy(struct usb_xfer *xfer)
{
-
+ return ;
}
static void
-s3c24dci_pull_up(struct s3c24dci_softc *sc)
+s3c24dci_device_xxx_start(struct usb_xfer *xfer)
{
-
+ s3c24dci_setup_standard_chain(xfer);
+ s3c24dci_start_standard_chain(xfer);
+ return ;
}
static void
-s3c24dci_pull_down(struct s3c24dci_softc *sc)
+s3c24dci_device_xxx_close(struct usb_xfer *xfer)
{
+ s3c24dci_device_done(xfer, USB_ERR_CANCELLED);
+ return ;
+}
+
+struct usb_pipe_methods s3c24dci_device_ctrl_methods = {
+ .open = s3c24dci_device_dummy,
+ .enter = s3c24dci_device_dummy,
+ .close = s3c24dci_device_xxx_close,
+ .start = s3c24dci_device_xxx_start,
+};
+
+struct usb_pipe_methods s3c24dci_device_bulk_methods = {
+ .open = s3c24dci_device_dummy,
+ .enter = s3c24dci_device_dummy,
+ .close = s3c24dci_device_xxx_close,
+ .start = s3c24dci_device_xxx_start,
+};
+
+struct usb_pipe_methods s3c24dci_device_intr_methods = {
+ .open = s3c24dci_device_dummy,
+ .enter = s3c24dci_device_dummy,
+ .close = s3c24dci_device_xxx_close,
+ .start = s3c24dci_device_xxx_start,
+};
+
+/*
+ * s3c24dci root control support
+ * Simulate a hardware HUB by handling all the necessary requests.
+ */
-}
+static const struct usb_device_descriptor s3c24dci_devd = {
+ .bLength = sizeof(struct usb_device_descriptor),
+ .bDescriptorType = UDESC_DEVICE,
+ .bcdUSB = {0x00, 0x02},
+ .bDeviceClass = UDCLASS_HUB,
+ .bDeviceSubClass = UDSUBCLASS_HUB,
+ .bDeviceProtocol = UDPROTO_HSHUBSTT,
+ .bMaxPacketSize = 64,
+ .bcdDevice = {0x00, 0x01},
+ .iManufacturer = 1,
+ .iProduct = 2,
+ .bNumConfigurations = 1,
+};
+
+static const struct usb_device_qualifier s3c24dci_odevd = {
+ .bLength = sizeof(struct usb_device_qualifier),
+ .bDescriptorType = UDESC_DEVICE_QUALIFIER,
+ .bcdUSB = {0x00, 0x02},
+ .bDeviceClass = UDCLASS_HUB,
+ .bDeviceSubClass = UDSUBCLASS_HUB,
+ .bDeviceProtocol = UDPROTO_FSHUB,
+ .bMaxPacketSize0 = 0,
+ .bNumConfigurations = 0,
+
+};
+
+static const struct s3c24dci_config_desc s3c24dci_confd = {
+ .confd = {
+ .bLength = sizeof(struct usb_config_descriptor),
+ .bDescriptorType = UDESC_CONFIG,
+ .wTotalLength[0] = sizeof(s3c24dci_confd),
+ .bNumInterface = 1,
+ .bConfigurationValue = 1,
+ .iConfiguration = 0,
+ .bmAttributes = UC_SELF_POWERED,
+ .bMaxPower = 0,
+ },
+ .ifcd = {
+ .bLength = sizeof(struct usb_interface_descriptor),
+ .bDescriptorType = UDESC_INTERFACE,
+ .bNumEndpoints = 1,
+ .bInterfaceClass = UICLASS_HUB,
+ .bInterfaceSubClass = UISUBCLASS_HUB,
+ .bInterfaceProtocol = UIPROTO_HSHUBSTT,
+ },
+ .endpd = {
+ .bLength = sizeof(struct usb_endpoint_descriptor),
+ .bDescriptorType = UDESC_ENDPOINT,
+ .bEndpointAddress = (UE_DIR_IN | S3C24_DCI_INTR_ENDPT),
+ .bmAttributes = UE_INTERRUPT,
+ .wMaxPacketSize[0] = 8,
+ .bInterval = 255,
+ },
+};
+
+static const struct usb_hub_descriptor_min s3c24dci_hubd = {
+ .bDescLength = sizeof(s3c24dci_hubd),
+ .bDescriptorType = UDESC_HUB,
+ .bNbrPorts = 1,
+ .wHubCharacteristics[0] =
+ (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF,
+ .wHubCharacteristics[1] =
+ (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 8,
+ .bPwrOn2PwrGood = 50,
+ .bHubContrCurrent = 0,
+ .DeviceRemovable = {0}, /* port is removable */
+};
+
+#define STRING_LANG \
+ 0x09, 0x04, /* American English */
+
+#define STRING_VENDOR \
+ 'S', 0, 'A', 0, 'M', 0, 'S', 0, 'U', 0, 'N', 0, 'G', 0
-static void
-s3c24dci_wakeup_peer(struct s3c24dci_softc *sc)
-{
+#define STRING_PRODUCT \
+ 'D', 0, 'C', 0, 'I', 0, ' ', 0, 'R', 0, \
+ 'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \
+ 'U', 0, 'B', 0,
-}
+USB_MAKE_STRING_DESC(STRING_LANG, s3c24dci_langtab);
+USB_MAKE_STRING_DESC(STRING_VENDOR, s3c24dci_vendor);
+USB_MAKE_STRING_DESC(STRING_PRODUCT, s3c24dci_product);
static usb_error_t
s3c24dci_roothub_exec(struct usb_device *udev,
==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.h#9 (text+ko) ====
More information about the p4-projects
mailing list