ar71xx: add missing tx gain table flag for buffalo wzr-hp-g450h
[openwrt.git] / target / linux / ar71xx / patches-3.10 / 525-MIPS-ath79-enable-qca-usb-quirks.patch
1 --- a/arch/mips/ath79/dev-usb.c
2 +++ b/arch/mips/ath79/dev-usb.c
3 @@ -182,14 +182,34 @@ static void __init ar933x_usb_setup(void
4                            &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
5  }
6  
7 -static void __init ar934x_usb_setup(void)
8 +static void enable_tx_tx_idp_violation_fix(unsigned base)
9  {
10 -       u32 bootstrap;
11 +       void __iomem *phy_reg;
12 +       u32 t;
13 +
14 +       phy_reg = ioremap(base, 4);
15 +       if (!phy_reg)
16 +               return;
17 +
18 +       t = ioread32(phy_reg);
19 +       t &= ~0xff;
20 +       t |= 0x58;
21 +       iowrite32(t, phy_reg);
22 +
23 +       iounmap(phy_reg);
24 +}
25  
26 -       bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
27 -       if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE)
28 +static void ar934x_usb_reset_notifier(struct platform_device *pdev)
29 +{
30 +       if (pdev->id != -1)
31                 return;
32  
33 +       enable_tx_tx_idp_violation_fix(0x18116c94);
34 +       dev_info(&pdev->dev, "TX-TX IDP fix enabled\n");
35 +}
36 +
37 +static void __init ar934x_usb_setup(void)
38 +{
39         ath79_device_reset_set(AR934X_RESET_USBSUS_OVERRIDE);
40         udelay(1000);
41  
42 @@ -202,14 +222,44 @@ static void __init ar934x_usb_setup(void
43         ath79_device_reset_clear(AR934X_RESET_USB_HOST);
44         udelay(1000);
45  
46 +       ath79_ehci_pdata_v2.qca_force_host_mode = 1;
47 +       ath79_ehci_pdata_v2.qca_force_16bit_ptw = 1;
48 +       if (ath79_soc_rev >= 3)
49 +               ath79_ehci_pdata_v2.reset_notifier = ar934x_usb_reset_notifier;
50 +
51         ath79_usb_register("ehci-platform", -1,
52                            AR934X_EHCI_BASE, AR934X_EHCI_SIZE,
53                            ATH79_CPU_IRQ(3),
54                            &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
55  }
56  
57 +static void qca955x_usb_reset_notifier(struct platform_device *pdev)
58 +{
59 +       u32 base;
60 +
61 +       switch (pdev->id) {
62 +       case 0:
63 +               base = 0x18116c94;
64 +               break;
65 +
66 +       case 1:
67 +               base = 0x18116e54;
68 +               break;
69 +
70 +       default:
71 +               return;
72 +       }
73 +
74 +       enable_tx_tx_idp_violation_fix(base);
75 +       dev_info(&pdev->dev, "TX-TX IDP fix enabled\n");
76 +}
77 +
78  static void __init qca955x_usb_setup(void)
79  {
80 +       ath79_ehci_pdata_v2.qca_force_host_mode = 1;
81 +       ath79_ehci_pdata_v2.qca_force_16bit_ptw = 1;
82 +       ath79_ehci_pdata_v2.reset_notifier = qca955x_usb_reset_notifier;
83 +
84         ath79_usb_register("ehci-platform", 0,
85                            QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE,
86                            ATH79_IP3_IRQ(0),