Date: Mon, 13 Jul 2009 13:12:28 GMT From: Sylvestre Gallon <syl@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 166001 for review Message-ID: <200907131312.n6DDCSRK097081@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=166001 Change 166001 by syl@syl_pablo on 2009/07/13 13:11:35 Implement clear_stall. Update get_hw_ep_profile because this ip does not support isochronous transfers. Affected files ... .. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.c#3 edit .. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.h#4 edit Differences ... ==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.c#3 (text+ko) ==== @@ -73,6 +73,12 @@ #endif /* + * This driver dont support DMA for the mement. DMA seems to not be + * implemented on s3c2xxx cpus. + */ + + +/* * Here is a list of what the chip supports. */ @@ -91,7 +97,6 @@ .support_multi_buffer = 1, .support_bulk = 1, .support_interrupt = 1, - .support_isochronous = 1 , .support_in = 1, .support_out = 1 , }, @@ -102,7 +107,6 @@ .support_multi_buffer = 1, .support_bulk = 1, .support_interrupt = 1, - .support_isochronous = 1 , .support_in = 1, .support_out = 1 , }, @@ -113,7 +117,6 @@ .support_multi_buffer = 1, .support_bulk = 1, .support_interrupt = 1, - .support_isochronous = 1 , .support_in = 1, .support_out = 1 , }, @@ -124,7 +127,6 @@ .support_multi_buffer = 1, .support_bulk = 1, .support_interrupt = 1, - .support_isochronous = 1 , .support_in = 1, .support_out = 1 , }, @@ -284,9 +286,96 @@ return ; } +static void +s3c24dci_clear_stall_sub(struct s3c24dci_softc *sc, uint8_t ep_no, + uint8_t ep_type, uint8_t ep_dir) +{ + const struct usb_hw_ep_profile *pf; + uint32_t csr1; + uint32_t csr2; + uint32_t ittmp; + + if (ep_type == UE_CONTROL) { + /* clearing stall is not needed */ + } + + /* disable ep */ + + ittmp = S3C24XX_DCI_READ_4(S3C24_DCI_EP_INT_EN); + ittmp &= ~(1<<ep_no); + S3C24XX_DCI_WRITE_4(S3C24_DCI_EP_INT_EN, ittmp); + + /* get endpoint profile */ + s3c24dci_get_hw_ep_profile(NULL, &pf, ep_no); + + /* + * Need to update for clear rx flags for single buffer + * or eventual ping pong + */ + + + /* compute default CSR value */ + + S3C24XX_DCI_WRITE_4(S3C24_DCI_INDEX, ep_no); + S3C24XX_DCI_WRITE_4(S3C24_DCI_MAXP, S3C24_DCI_MAXP64); + + /* enable endpoint */ + if (ep_dir & UE_DIR_IN) { + csr1 = S3C24_DCI_IN_FIFO_FLUSH|S3C24_DCI_IN_CLR_DATA_TOGGLE; + csr2 = S3C24_DCI_IN_MODE_IN; + + S3C24XX_DCI_WRITE_4(S3C24_DCI_INDEX, ep_no); + S3C24XX_DCI_WRITE_4(S3C24_DCI_IN_CSR1, csr1); + S3C24XX_DCI_WRITE_4(S3C24_DCI_INDEX, ep_no); + S3C24XX_DCI_WRITE_4(S3C24_DCI_IN_CSR2, csr2); + + } else { + csr1 = S3C24_DCI_OUT_CLR_DATA_TOGGLE; + csr2 = 0; + + S3C24XX_DCI_WRITE_4(S3C24_DCI_INDEX, ep_no); + S3C24XX_DCI_WRITE_4(S3C24_DCI_OUT_CSR1, csr1); + S3C24XX_DCI_WRITE_4(S3C24_DCI_INDEX, ep_no); + S3C24XX_DCI_WRITE_4(S3C24_DCI_OUT_CSR2, csr2); + + csr1 = S3C24_DCI_OUT_FIFO_FLUSH | S3C24_DCI_OUT_CLR_DATA_TOGGLE; + csr2 = 0; + + S3C24XX_DCI_WRITE_4(S3C24_DCI_INDEX, ep_no); + S3C24XX_DCI_WRITE_4(S3C24_DCI_OUT_CSR1, csr1); + S3C24XX_DCI_WRITE_4(S3C24_DCI_INDEX, ep_no); + S3C24XX_DCI_WRITE_4(S3C24_DCI_OUT_CSR2, csr2); + } + + /* enable it on the ep */ + ittmp = S3C24XX_DCI_READ_4(S3C24_DCI_EP_INT_EN); + ittmp |= (1<<ep_no); + S3C24XX_DCI_WRITE_4(S3C24_DCI_EP_INT_EN, ittmp); +} + static void s3c24dci_clear_stall(struct usb_device *udev, struct usb_endpoint *ep) { + struct s3c24dci_softc *sc; + struct usb_endpoint_descriptor *ed; + + DPRINTF(5, "endpoint=%p\n", ep); + + /* check mode */ + if (udev->flags.usb_mode != USB_MODE_DEVICE) { + /* not supported */ + return ; + } + /* get softc */ + sc = S3C24_DCI_BUS2SC(udev->bus); + + /* get endpoint descriptors */ + ed = ep->edesc; + + s3c24dci_clear_stall_sub(sc, + (ed->bEndpointAddress & UE_ADDR), + (ed->bmAttributes & UE_XFERTYPE), + (ed->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT))); return ; } ==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.h#4 (text+ko) ==== @@ -169,6 +169,12 @@ #define S3C24XX_DCI_EP_MAX 5 +#define S3C24XX_DCI_READ_4(sc, reg) \ + bus_space_read_4((sc)->sc_io_tag, (sc)->sc_io_hdl, reg) + +#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 s3c24dci_softc { struct usb_bus sc_bus;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907131312.n6DDCSRK097081>
