]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - drivers/usb/musb/musb_hcd.c
Merge branch 'master' of git://git.denx.de/u-boot-nand-flash
[karo-tx-uboot.git] / drivers / usb / musb / musb_hcd.c
index 3dc5d6a5583bd0ab5ff574224ec888a82697656b..708fa124a21489f4b9ed46a24fc2dce0ffc4970e 100644 (file)
@@ -267,7 +267,7 @@ static int wait_until_ep0_ready(struct usb_device *dev, u32 bit_mask)
 /*
  * waits until tx ep is ready. Returns 1 when ep is ready and 0 on error.
  */
-static u8 wait_until_txep_ready(struct usb_device *dev, u8 ep)
+static int wait_until_txep_ready(struct usb_device *dev, u8 ep)
 {
        u16 csr;
        int timeout = CONFIG_MUSB_TIMEOUT;
@@ -299,7 +299,7 @@ static u8 wait_until_txep_ready(struct usb_device *dev, u8 ep)
 /*
  * waits until rx ep is ready. Returns 1 when ep is ready and 0 on error.
  */
-static u8 wait_until_rxep_ready(struct usb_device *dev, u8 ep)
+static int wait_until_rxep_ready(struct usb_device *dev, u8 ep)
 {
        u16 csr;
        int timeout = CONFIG_MUSB_TIMEOUT;
@@ -417,8 +417,12 @@ static int ctrlreq_out_data_phase(struct usb_device *dev, u32 len, void *buffer)
 
                /* Set TXPKTRDY bit */
                csr = readw(&musbr->txcsr);
-               writew(csr | MUSB_CSR0_H_DIS_PING | MUSB_CSR0_TXPKTRDY,
-                                       &musbr->txcsr);
+                       
+               csr |= MUSB_CSR0_TXPKTRDY;
+#if !defined(CONFIG_SOC_DM365)
+               csr |= MUSB_CSR0_H_DIS_PING;
+#endif
+               writew(csr, &musbr->txcsr);
                result = wait_until_ep0_ready(dev, MUSB_CSR0_TXPKTRDY);
                if (result < 0)
                        break;
@@ -439,8 +443,10 @@ static int ctrlreq_out_status_phase(struct usb_device *dev)
 
        /* Set the StatusPkt bit */
        csr = readw(&musbr->txcsr);
-       csr |= (MUSB_CSR0_H_DIS_PING | MUSB_CSR0_TXPKTRDY |
-                       MUSB_CSR0_H_STATUSPKT);
+       csr |= (MUSB_CSR0_TXPKTRDY | MUSB_CSR0_H_STATUSPKT);
+#if !defined(CONFIG_SOC_DM365)
+       csr |= MUSB_CSR0_H_DIS_PING;
+#endif
        writew(csr, &musbr->txcsr);
 
        /* Wait until TXPKTRDY bit is cleared */
@@ -457,7 +463,10 @@ static int ctrlreq_in_status_phase(struct usb_device *dev)
        int result;
 
        /* Set the StatusPkt bit and ReqPkt bit */
-       csr = MUSB_CSR0_H_DIS_PING | MUSB_CSR0_H_REQPKT | MUSB_CSR0_H_STATUSPKT;
+       csr = MUSB_CSR0_H_REQPKT | MUSB_CSR0_H_STATUSPKT;
+#if !defined(CONFIG_SOC_DM365)
+       csr |= MUSB_CSR0_H_DIS_PING;
+#endif
        writew(csr, &musbr->txcsr);
        result = wait_until_ep0_ready(dev, MUSB_CSR0_H_REQPKT);
 
@@ -1009,7 +1018,7 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
                        writew(csr | MUSB_TXCSR_TXPKTRDY, &musbr->txcsr);
 
                        /* Wait until the TxPktRdy bit is cleared */
-                       if (!wait_until_txep_ready(dev, MUSB_BULK_EP)) {
+                       if (wait_until_txep_ready(dev, MUSB_BULK_EP) != 1) {
                                readw(&musbr->txcsr);
                                usb_settoggle(dev, ep, dir_out,
                                (csr >> MUSB_TXCSR_H_DATATOGGLE_SHIFT) & 1);
@@ -1044,7 +1053,7 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
                        writew(csr | MUSB_RXCSR_H_REQPKT, &musbr->rxcsr);
 
                        /* Wait until the RxPktRdy bit is set */
-                       if (!wait_until_rxep_ready(dev, MUSB_BULK_EP)) {
+                       if (wait_until_rxep_ready(dev, MUSB_BULK_EP) != 1) {
                                csr = readw(&musbr->rxcsr);
                                usb_settoggle(dev, ep, dir_out,
                                (csr >> MUSB_S_RXCSR_H_DATATOGGLE) & 1);
@@ -1217,7 +1226,7 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe,
                        writew(csr | MUSB_RXCSR_H_REQPKT, &musbr->rxcsr);
 
                        /* Wait until the RxPktRdy bit is set */
-                       if (!wait_until_rxep_ready(dev, MUSB_INTR_EP)) {
+                       if (wait_until_rxep_ready(dev, MUSB_INTR_EP) != 1) {
                                csr = readw(&musbr->rxcsr);
                                usb_settoggle(dev, ep, dir_out,
                                (csr >> MUSB_S_RXCSR_H_DATATOGGLE) & 1);