]> rtime.felk.cvut.cz Git - vajnamar/linux-xlnx.git/blobdiff - drivers/usb/host/ehci-hcd.c
Merge tag 'v3.10' into master-next
[vajnamar/linux-xlnx.git] / drivers / usb / host / ehci-hcd.c
index 246e124e6ac55c3dc66ba822a9b3f8ba5bebdd6a..4a120d7ea173e4ec4dc59225b3d85e62f4a4a508 100644 (file)
@@ -335,11 +335,21 @@ static void ehci_turn_off_all_ports(struct ehci_hcd *ehci)
  */
 static void ehci_silence_controller(struct ehci_hcd *ehci)
 {
+#ifdef CONFIG_USB_ZYNQ_PHY
+       struct usb_hcd *hcd = ehci_to_hcd(ehci);
+#endif
+
        ehci_halt(ehci);
 
        spin_lock_irq(&ehci->lock);
        ehci->rh_state = EHCI_RH_HALTED;
+#ifdef CONFIG_USB_ZYNQ_PHY
+       /* turn off for non-otg port */
+       if(!hcd->phy)
+               ehci_turn_off_all_ports(ehci);
+#else
        ehci_turn_off_all_ports(ehci);
+#endif
 
        /* make BIOS/etc use companion controller during reboot */
        ehci_writel(ehci, 0, &ehci->regs->configured_flag);
@@ -422,7 +432,12 @@ static void ehci_stop (struct usb_hcd *hcd)
 
        ehci_quiesce(ehci);
        ehci_silence_controller(ehci);
+#ifdef CONFIG_USB_ZYNQ_PHY
+       if(!hcd->phy)
+               ehci_reset (ehci);
+#else
        ehci_reset (ehci);
+#endif
 
        hrtimer_cancel(&ehci->hrtimer);
        remove_sysfs_files(ehci);
@@ -569,6 +584,9 @@ static int ehci_run (struct usb_hcd *hcd)
        struct ehci_hcd         *ehci = hcd_to_ehci (hcd);
        u32                     temp;
        u32                     hcc_params;
+#if defined(CONFIG_ARCH_ZYNQ)
+       void __iomem *non_ehci = hcd->regs;
+#endif
 
        hcd->uses_new_polling = 1;
 
@@ -638,7 +656,11 @@ static int ehci_run (struct usb_hcd *hcd)
 
        ehci_writel(ehci, INTR_MASK,
                    &ehci->regs->intr_enable); /* Turn On Interrupts */
-
+#if defined(CONFIG_ARCH_ZYNQ)
+       /* Modifying FIFO Burst Threshold value from 2 to 8 */
+       temp = readl(non_ehci + 0x164);
+       ehci_writel(ehci, 0x00080000, non_ehci + 0x164);
+#endif
        /* GRR this is run-once init(), being done every time the HC starts.
         * So long as they're part of class devices, we can't do it init()
         * since the class device isn't created that early.
@@ -686,11 +708,35 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
        struct ehci_hcd         *ehci = hcd_to_ehci (hcd);
        u32                     status, masked_status, pcd_status = 0, cmd;
        int                     bh;
+       u32                     intr_en;
 
        spin_lock (&ehci->lock);
 
        status = ehci_readl(ehci, &ehci->regs->status);
-
+       intr_en = ehci_readl(ehci, &ehci->regs->intr_enable);
+
+#ifdef CONFIG_USB_ZYNQ_PHY
+       if(hcd->phy) {
+               /* A device */
+               if (hcd->phy->otg->default_a &&
+                       (hcd->phy->state == OTG_STATE_A_PERIPHERAL)) {
+                       spin_unlock(&ehci->lock);
+                       return IRQ_NONE;
+               }
+               /* B device */
+               if (!hcd->phy->otg->default_a &&
+                       ((hcd->phy->state != OTG_STATE_B_WAIT_ACON) &&
+                       (hcd->phy->state != OTG_STATE_B_HOST))) {
+                       spin_unlock(&ehci->lock);
+                       return IRQ_NONE;
+               }
+               /* If HABA is set and B-disconnect occurs, don't process that interrupt */
+               if (ehci_is_TDI(ehci) && tdi_in_host_mode(ehci) == 0) {
+                       spin_unlock(&ehci->lock);
+                       return IRQ_NONE;
+               }
+       }
+#endif
        /* e.g. cardbus physical eject */
        if (status == ~(u32) 0) {
                ehci_dbg (ehci, "device removed\n");
@@ -1246,6 +1292,11 @@ MODULE_LICENSE ("GPL");
 #define XILINX_OF_PLATFORM_DRIVER      ehci_hcd_xilinx_of_driver
 #endif
 
+#ifdef CONFIG_USB_EHCI_XUSBPS
+#include "ehci-xilinx-usbps.c"
+#define PLATFORM_DRIVER                ehci_xusbps_driver
+#endif
+
 #ifdef CONFIG_USB_W90X900_EHCI
 #include "ehci-w90x900.c"
 #define        PLATFORM_DRIVER         ehci_hcd_w90x900_driver