Merge remote-tracking branch 'u-boot-imx/master'
[oweals/u-boot.git] / drivers / usb / musb / musb_core.c
index 7766069bfcfdb25ca04551783c61f2f560df428a..545ebf4b502322cdecd71ddd2b5cc72ff24f209a 100644 (file)
@@ -34,6 +34,7 @@ void musb_start(void)
 {
 #if defined(CONFIG_MUSB_HCD)
        u8 devctl;
+       u8 busctl;
 #endif
 
        /* disable all interrupts */
@@ -45,6 +46,12 @@ void musb_start(void)
        /* put into basic highspeed mode and start session */
        writeb(MUSB_POWER_HSENAB, &musbr->power);
 #if defined(CONFIG_MUSB_HCD)
+       /* Program PHY to use EXT VBUS if required */
+       if (musb_cfg.extvbus == 1) {
+               busctl = musb_read_ulpi_buscontrol(musbr);
+               musb_write_ulpi_buscontrol(musbr, busctl | ULPI_USE_EXTVBUS);
+       }
+
        devctl = readb(&musbr->devctl);
        writeb(devctl | MUSB_DEVCTL_SESSION, &musbr->devctl);
 #endif
@@ -69,7 +76,7 @@ void musb_start(void)
  * epinfo      - Pointer to EP configuration table
  * cnt         - Number of entries in the EP conf table.
  */
-void musb_configure_ep(struct musb_epinfo *epinfo, u8 cnt)
+void musb_configure_ep(const struct musb_epinfo *epinfo, u8 cnt)
 {
        u16 csr;
        u16 fifoaddr = 64; /* First 64 bytes of FIFO reserved for EP0 */
@@ -134,6 +141,11 @@ void write_fifo(u8 ep, u32 length, void *fifo_data)
                writeb(*data++, &musbr->fifox[ep]);
 }
 
+/*
+ * AM35x supports only 32bit read operations so
+ * use seperate read_fifo() function for it.
+ */
+#ifndef CONFIG_USB_AM35X
 /*
  * This function reads data from endpoint fifo
  *
@@ -153,3 +165,4 @@ void read_fifo(u8 ep, u32 length, void *fifo_data)
        while (length--)
                *data++ = readb(&musbr->fifox[ep]);
 }
+#endif /* CONFIG_USB_AM35X */