ar71xx: use the tp-link parser on the tp-link boards
[openwrt.git] / target / linux / ar71xx / files / arch / mips / ar71xx / dev-usb.c
index 8e61c0e862e22b3c5642219f0263c27bcc00b938..57c7ef292c23a397f664e25be9f88cc557a91a84 100644 (file)
@@ -165,6 +165,47 @@ static void __init ar91xx_usb_setup(void)
        platform_device_register(&ar71xx_ehci_device);
 }
 
+static void __init ar933x_usb_setup(void)
+{
+       ar71xx_device_reset_rmw(0, AR933X_RESET_USBSUS_OVERRIDE);
+       mdelay(10);
+
+       ar71xx_device_reset_rmw(AR933X_RESET_USB_HOST,
+                               AR933X_RESET_USBSUS_OVERRIDE);
+       mdelay(10);
+
+       ar71xx_device_reset_rmw(AR933X_RESET_USB_PHY,
+                               AR933X_RESET_USBSUS_OVERRIDE);
+       mdelay(10);
+
+       ar71xx_ehci_data.is_ar91xx = 1;
+       platform_device_register(&ar71xx_ehci_device);
+}
+
+static void __init ar934x_usb_setup(void)
+{
+       u32 bootstrap;
+
+       bootstrap = ar71xx_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
+       if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE)
+               return;
+
+       ar71xx_device_stop(AR934X_RESET_USBSUS_OVERRIDE);
+       udelay(1000);
+
+       ar71xx_device_start(AR934X_RESET_USB_PHY);
+       udelay(1000);
+
+       ar71xx_device_start(AR934X_RESET_USB_PHY_ANALOG);
+       udelay(1000);
+
+       ar71xx_device_start(AR934X_RESET_USB_HOST);
+       udelay(1000);
+
+       ar71xx_ehci_data.is_ar91xx = 1;
+       platform_device_register(&ar71xx_ehci_device);
+}
+
 void __init ar71xx_add_device_usb(void)
 {
        switch (ar71xx_soc) {
@@ -185,10 +226,18 @@ void __init ar71xx_add_device_usb(void)
 
        case AR71XX_SOC_AR9130:
        case AR71XX_SOC_AR9132:
+               ar91xx_usb_setup();
+               break;
+
+       case AR71XX_SOC_AR9330:
+       case AR71XX_SOC_AR9331:
+               ar933x_usb_setup();
+               break;
+
        case AR71XX_SOC_AR9341:
        case AR71XX_SOC_AR9342:
        case AR71XX_SOC_AR9344:
-               ar91xx_usb_setup();
+               ar934x_usb_setup();
                break;
 
        default: