2
0

525-MIPS-ath79-enable-qca-usb-quirks.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. static void __init ath79_usb_register(const char *name, int id,
  11. @@ -159,6 +161,9 @@ static void __init ar913x_usb_setup(void
  12. ath79_device_reset_clear(AR913X_RESET_USB_PHY);
  13. mdelay(10);
  14. + ath79_ehci_pdata_v2.qca_force_host_mode = 0;
  15. + ath79_ehci_pdata_v2.qca_force_16bit_ptw = 0;
  16. +
  17. ath79_usb_register("ehci-platform", -1,
  18. AR913X_EHCI_BASE, AR913X_EHCI_SIZE,
  19. ATH79_CPU_IRQ(3),
  20. @@ -182,14 +187,34 @@ static void __init ar933x_usb_setup(void
  21. &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  22. }
  23. -static void __init ar934x_usb_setup(void)
  24. +static void enable_tx_tx_idp_violation_fix(unsigned base)
  25. {
  26. - u32 bootstrap;
  27. + void __iomem *phy_reg;
  28. + u32 t;
  29. +
  30. + phy_reg = ioremap(base, 4);
  31. + if (!phy_reg)
  32. + return;
  33. +
  34. + t = ioread32(phy_reg);
  35. + t &= ~0xff;
  36. + t |= 0x58;
  37. + iowrite32(t, phy_reg);
  38. +
  39. + iounmap(phy_reg);
  40. +}
  41. - bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
  42. - if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE)
  43. +static void ar934x_usb_reset_notifier(struct platform_device *pdev)
  44. +{
  45. + if (pdev->id != -1)
  46. return;
  47. + enable_tx_tx_idp_violation_fix(0x18116c94);
  48. + dev_info(&pdev->dev, "TX-TX IDP fix enabled\n");
  49. +}
  50. +
  51. +static void __init ar934x_usb_setup(void)
  52. +{
  53. ath79_device_reset_set(AR934X_RESET_USBSUS_OVERRIDE);
  54. udelay(1000);
  55. @@ -202,14 +227,40 @@ static void __init ar934x_usb_setup(void
  56. ath79_device_reset_clear(AR934X_RESET_USB_HOST);
  57. udelay(1000);
  58. + if (ath79_soc_rev >= 3)
  59. + ath79_ehci_pdata_v2.reset_notifier = ar934x_usb_reset_notifier;
  60. +
  61. ath79_usb_register("ehci-platform", -1,
  62. AR934X_EHCI_BASE, AR934X_EHCI_SIZE,
  63. ATH79_CPU_IRQ(3),
  64. &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  65. }
  66. +static void qca955x_usb_reset_notifier(struct platform_device *pdev)
  67. +{
  68. + u32 base;
  69. +
  70. + switch (pdev->id) {
  71. + case 0:
  72. + base = 0x18116c94;
  73. + break;
  74. +
  75. + case 1:
  76. + base = 0x18116e54;
  77. + break;
  78. +
  79. + default:
  80. + return;
  81. + }
  82. +
  83. + enable_tx_tx_idp_violation_fix(base);
  84. + dev_info(&pdev->dev, "TX-TX IDP fix enabled\n");
  85. +}
  86. +
  87. static void __init qca955x_usb_setup(void)
  88. {
  89. + ath79_ehci_pdata_v2.reset_notifier = qca955x_usb_reset_notifier;
  90. +
  91. ath79_usb_register("ehci-platform", 0,
  92. QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE,
  93. ATH79_IP3_IRQ(0),