rpcd: iwinfo plugin fixes
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / patches-4.4 / 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 @@ -37,6 +37,8 @@ static struct usb_ehci_pdata ath79_ehci_
4 static struct usb_ehci_pdata ath79_ehci_pdata_v2 = {
5 .caps_offset = 0x100,
6 .has_tt = 1,
7 + .qca_force_host_mode = 1,
8 + .qca_force_16bit_ptw = 1,
9 };
10
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);
14 mdelay(10);
15
16 + ath79_ehci_pdata_v2.qca_force_host_mode = 0;
17 + ath79_ehci_pdata_v2.qca_force_16bit_ptw = 0;
18 +
19 ath79_usb_register("ehci-platform", -1,
20 AR913X_EHCI_BASE, AR913X_EHCI_SIZE,
21 ATH79_CPU_IRQ(3),
22 @@ -182,14 +187,34 @@ static void __init ar933x_usb_setup(void
23 &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
24 }
25
26 -static void __init ar934x_usb_setup(void)
27 +static void enable_tx_tx_idp_violation_fix(unsigned base)
28 {
29 - u32 bootstrap;
30 + void __iomem *phy_reg;
31 + u32 t;
32 +
33 + phy_reg = ioremap(base, 4);
34 + if (!phy_reg)
35 + return;
36 +
37 + t = ioread32(phy_reg);
38 + t &= ~0xff;
39 + t |= 0x58;
40 + iowrite32(t, phy_reg);
41 +
42 + iounmap(phy_reg);
43 +}
44
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)
48 +{
49 + if (pdev->id != -1)
50 return;
51
52 + enable_tx_tx_idp_violation_fix(0x18116c94);
53 + dev_info(&pdev->dev, "TX-TX IDP fix enabled\n");
54 +}
55 +
56 +static void __init ar934x_usb_setup(void)
57 +{
58 ath79_device_reset_set(AR934X_RESET_USBSUS_OVERRIDE);
59 udelay(1000);
60
61 @@ -202,14 +227,40 @@ static void __init ar934x_usb_setup(void
62 ath79_device_reset_clear(AR934X_RESET_USB_HOST);
63 udelay(1000);
64
65 + if (ath79_soc_rev >= 3)
66 + ath79_ehci_pdata_v2.reset_notifier = ar934x_usb_reset_notifier;
67 +
68 ath79_usb_register("ehci-platform", -1,
69 AR934X_EHCI_BASE, AR934X_EHCI_SIZE,
70 ATH79_CPU_IRQ(3),
71 &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
72 }
73
74 +static void qca955x_usb_reset_notifier(struct platform_device *pdev)
75 +{
76 + u32 base;
77 +
78 + switch (pdev->id) {
79 + case 0:
80 + base = 0x18116c94;
81 + break;
82 +
83 + case 1:
84 + base = 0x18116e54;
85 + break;
86 +
87 + default:
88 + return;
89 + }
90 +
91 + enable_tx_tx_idp_violation_fix(base);
92 + dev_info(&pdev->dev, "TX-TX IDP fix enabled\n");
93 +}
94 +
95 static void __init qca955x_usb_setup(void)
96 {
97 + ath79_ehci_pdata_v2.reset_notifier = qca955x_usb_reset_notifier;
98 +
99 ath79_usb_register("ehci-platform", 0,
100 QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE,
101 ATH79_IP3_IRQ(0),