Date: Mon, 13 Jul 2009 15:12:43 GMT From: Sylvestre Gallon <syl@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 166011 for review Message-ID: <200907131512.n6DFChfr008111@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=166011 Change 166011 by syl@syl_pablo on 2009/07/13 15:11:43 Implement xfer_setup. Add s3c24dci_tc in s3c24xxdci.h. Affected files ... .. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.c#7 edit .. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.h#5 edit Differences ... ==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.c#7 (text+ko) ==== @@ -96,7 +96,6 @@ .max_in_frame_size = 64, .max_out_frame_size = 64, .is_simplex = 1, - .support_multi_buffer = 1, .support_bulk = 1, .support_interrupt = 1, .support_in = 1, @@ -106,7 +105,6 @@ .max_in_frame_size = 64, .max_out_frame_size = 64, .is_simplex = 1, - .support_multi_buffer = 1, .support_bulk = 1, .support_interrupt = 1, .support_in = 1, @@ -116,7 +114,6 @@ .max_in_frame_size = 64, .max_out_frame_size = 64, .is_simplex = 1, - .support_multi_buffer = 1, .support_bulk = 1, .support_interrupt = 1, .support_in = 1, @@ -126,7 +123,6 @@ .max_in_frame_size = 64, .max_out_frame_size = 64, .is_simplex = 1, - .support_multi_buffer = 1, .support_bulk = 1, .support_interrupt = 1, .support_in = 1, @@ -444,7 +440,80 @@ static void s3c24dci_xfer_setup(struct usb_setup_params *parm) { - return ; + const struct usb_hw_ep_profile *pf; + struct s3c24dci_softc *sc; + struct usb_xfer *xfer; + void *last_obj; + uint32_t ntd; + uint32_t n; + uint8_t ep_no; + + sc = S3C24_DCI_BUS2SC(parm->udev->bus); + xfer = parm->curr_xfer; + + /* + * NOTE: This driver does not use any of the parameters that + * are computed from the following values. Just set some + * reasonable dummies: + */ + parm->hc_max_packet_size = 0x500; + parm->hc_max_packet_count = 1; + parm->hc_max_frame_size = 0x500; + + usbd_transfer_setup_sub(parm); + + if (parm->methods == &s3c24dci_device_ctrl_methods) { + ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + + 1 /* SYNC 2 */; + } else if (parm->methods == &s3c24dci_device_bulk_methods) { + ntd = xfer->nframes + 1 /* SYNC */; + } else if (parm->methods == &s3c24dci_device_intr_methods) { + ntd = xfer->nframes + 1 /* SYNC */; + } else { + ntd = 0; + } + + /* + * check if "usbd_transfer_setup_sub" set an error + */ + if (parm->err) { + return ; + } + + if (ntd) { + ep_no = xfer->endpointno & UE_ADDR; + s3c24dci_get_hw_ep_profile(parm->udev, &pf, ep_no); + + if (pf == NULL) { + parm->err = USB_ERR_INVAL; + return ; + } + } else { + ep_no = 0; + pf = NULL; + } + + parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); + + for (n = 0 ; n != ntd ; n++) { + struct s3c24dci_td *td; + + if (parm->buf) { + td = USB_ADD_BYTES(parm->buf, parm->size[0]); + + /* init TD */ + td->io_tag = sc->sc_io_tag; + td->io_hdl = sc->sc_io_hdl; + td->max_packet_size = xfer->max_packet_size; + td->ep_no = ep_no; + td->obj_next = last_obj; + + last_obj = td; + } + parm->size[0] += sizeof(*td); + } + + xfer->td_start[0] = last_obj; } static void ==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.h#5 (text+ko) ==== @@ -175,6 +175,26 @@ #define S3C24XX_DCI_WRITE_4(sc, reg, (sc)->sc_io_hdl, reg, data) \ bus_space_write_4((sc)->sc_io_tag, (sc)->sc_io_hdl, reg, data) +struct s3cdci_td; + +typedef uint8_t (s3c24dci_cmd_t)(struct s3c24dci_td *td); + +struct uint8_t s3c24dci_td { + bus_space_tag_t io_tag; + bus_space_handle_t io_hdl; + struct s3c24dci_td *obj_next; + s3c24dci_cmd_t *func; + struct usb_page_cache *pc; + uint32_t offset; + uint32_t remainder; + uint16_t max_packet_size; + uint8_t ep_no; + uint8_t error:1; + uint8_t alt_next:1; + uint8_t short_pkt:1; + uint8_t did_stall:1; +}; + struct s3c24dci_softc { struct usb_bus sc_bus;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907131512.n6DFChfr008111>