1 --- a/arch/mips/ath79/dev-usb.c
2 +++ b/arch/mips/ath79/dev-usb.c
3 @@ -37,6 +37,8 @@ static struct usb_ehci_pdata ath79_ehci_
4 static struct usb_ehci_pdata ath79_ehci_pdata_v2 = {
7 + .qca_force_host_mode = 1,
8 + .qca_force_16bit_ptw = 1,
11 static void __init ath79_usb_register(const char *name, int id,
12 @@ -159,6 +161,9 @@ static void __init ar913x_usb_setup(void
13 ath79_device_reset_clear(AR913X_RESET_USB_PHY);
16 + ath79_ehci_pdata_v2.qca_force_host_mode = 0;
17 + ath79_ehci_pdata_v2.qca_force_16bit_ptw = 0;
19 ath79_usb_register("ehci-platform", -1,
20 AR913X_EHCI_BASE, AR913X_EHCI_SIZE,
22 @@ -182,14 +187,34 @@ static void __init ar933x_usb_setup(void
23 &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
26 -static void __init ar934x_usb_setup(void)
27 +static void enable_tx_tx_idp_violation_fix(unsigned base)
30 + void __iomem *phy_reg;
33 + phy_reg = ioremap(base, 4);
37 + t = ioread32(phy_reg);
40 + iowrite32(t, phy_reg);
45 - bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
46 - if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE)
47 +static void ar934x_usb_reset_notifier(struct platform_device *pdev)
52 + enable_tx_tx_idp_violation_fix(0x18116c94);
53 + dev_info(&pdev->dev, "TX-TX IDP fix enabled\n");
56 +static void __init ar934x_usb_setup(void)
58 ath79_device_reset_set(AR934X_RESET_USBSUS_OVERRIDE);
61 @@ -202,14 +227,40 @@ static void __init ar934x_usb_setup(void
62 ath79_device_reset_clear(AR934X_RESET_USB_HOST);
65 + if (ath79_soc_rev >= 3)
66 + ath79_ehci_pdata_v2.reset_notifier = ar934x_usb_reset_notifier;
68 ath79_usb_register("ehci-platform", -1,
69 AR934X_EHCI_BASE, AR934X_EHCI_SIZE,
71 &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
74 +static void qca955x_usb_reset_notifier(struct platform_device *pdev)
91 + enable_tx_tx_idp_violation_fix(base);
92 + dev_info(&pdev->dev, "TX-TX IDP fix enabled\n");
95 static void __init qca955x_usb_setup(void)
97 + ath79_ehci_pdata_v2.reset_notifier = qca955x_usb_reset_notifier;
99 ath79_usb_register("ehci-platform", 0,
100 QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE,