130-usb-ehci-add-fot2g-driver.patch 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. --- a/drivers/usb/host/ehci-hcd.c
  2. +++ b/drivers/usb/host/ehci-hcd.c
  3. @@ -352,11 +352,13 @@ static void ehci_silence_controller(stru
  4. ehci->rh_state = EHCI_RH_HALTED;
  5. ehci_turn_off_all_ports(ehci);
  6. +#ifndef CONFIG_ARCH_GEMINI
  7. /* make BIOS/etc use companion controller during reboot */
  8. ehci_writel(ehci, 0, &ehci->regs->configured_flag);
  9. /* unblock posted writes */
  10. ehci_readl(ehci, &ehci->regs->configured_flag);
  11. +#endif
  12. spin_unlock_irq(&ehci->lock);
  13. }
  14. @@ -608,7 +610,9 @@ static int ehci_run (struct usb_hcd *hcd
  15. // Philips, Intel, and maybe others need CMD_RUN before the
  16. // root hub will detect new devices (why?); NEC doesn't
  17. ehci->command &= ~(CMD_LRESET|CMD_IAAD|CMD_PSE|CMD_ASE|CMD_RESET);
  18. +#ifndef CONFIG_ARCH_GEMINI
  19. ehci->command |= CMD_RUN;
  20. +#endif
  21. ehci_writel(ehci, ehci->command, &ehci->regs->command);
  22. dbg_cmd (ehci, "init", ehci->command);
  23. @@ -628,9 +632,11 @@ static int ehci_run (struct usb_hcd *hcd
  24. */
  25. down_write(&ehci_cf_port_reset_rwsem);
  26. ehci->rh_state = EHCI_RH_RUNNING;
  27. +#ifndef CONFIG_ARCH_GEMINI
  28. ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag);
  29. ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
  30. msleep(5);
  31. +#endif
  32. up_write(&ehci_cf_port_reset_rwsem);
  33. ehci->last_periodic_enable = ktime_get_real();
  34. @@ -768,9 +774,10 @@ static irqreturn_t ehci_irq (struct usb_
  35. pcd_status = status;
  36. /* resume root hub? */
  37. +#ifndef CONFIG_ARCH_GEMINI
  38. if (ehci->rh_state == EHCI_RH_SUSPENDED)
  39. usb_hcd_resume_root_hub(hcd);
  40. -
  41. +#endif
  42. /* get per-port change detect bits */
  43. if (ehci->has_ppcd)
  44. ppcd = status >> 16;
  45. @@ -1296,6 +1303,11 @@ MODULE_LICENSE ("GPL");
  46. #define PLATFORM_DRIVER ehci_hcd_sead3_driver
  47. #endif
  48. +#ifdef CONFIG_ARCH_GEMINI
  49. +#include "ehci-fotg2.c"
  50. +#define PLATFORM_DRIVER ehci_fotg2_driver
  51. +#endif
  52. +
  53. static int __init ehci_hcd_init(void)
  54. {
  55. int retval = 0;
  56. --- a/drivers/usb/host/ehci-timer.c
  57. +++ b/drivers/usb/host/ehci-timer.c
  58. @@ -208,7 +208,9 @@ static void ehci_handle_controller_death
  59. /* Clean up the mess */
  60. ehci->rh_state = EHCI_RH_HALTED;
  61. +#ifndef CONFIG_ARCH_GEMINI
  62. ehci_writel(ehci, 0, &ehci->regs->configured_flag);
  63. +#endif
  64. ehci_writel(ehci, 0, &ehci->regs->intr_enable);
  65. ehci_work(ehci);
  66. end_unlink_async(ehci);
  67. --- a/drivers/usb/host/ehci.h
  68. +++ b/drivers/usb/host/ehci.h
  69. @@ -657,7 +657,12 @@ static inline unsigned int
  70. ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc)
  71. {
  72. if (ehci_is_TDI(ehci)) {
  73. - switch ((portsc >> (ehci->has_hostpc ? 25 : 26)) & 3) {
  74. +#ifdef CONFIG_ARCH_GEMINI
  75. + portsc = readl(ehci_to_hcd(ehci)->regs + 0x80);
  76. + switch ((portsc>>22)&3) {
  77. +#else
  78. + switch ((portsc>>26)&3) {
  79. +#endif
  80. case 0:
  81. return 0;
  82. case 1:
  83. --- a/drivers/usb/host/ehci-hub.c
  84. +++ b/drivers/usb/host/ehci-hub.c
  85. @@ -1076,6 +1076,11 @@ int ehci_hub_control(
  86. /* see what we found out */
  87. temp = check_reset_complete (ehci, wIndex, status_reg,
  88. ehci_readl(ehci, status_reg));
  89. +#ifdef CONFIG_ARCH_GEMINI
  90. + /* restart schedule */
  91. + ehci->command |= CMD_RUN;
  92. + ehci_writel(ehci, ehci->command, &ehci->regs->command);
  93. +#endif
  94. }
  95. /* transfer dedicated ports to the companion hc */
  96. --- a/include/linux/usb/ehci_def.h
  97. +++ b/include/linux/usb/ehci_def.h
  98. @@ -112,8 +112,13 @@ struct ehci_regs {
  99. u32 frame_list; /* points to periodic list */
  100. /* ASYNCLISTADDR: offset 0x18 */
  101. u32 async_next; /* address of next async queue head */
  102. -
  103. +#ifndef CONFIG_ARCH_GEMINI
  104. u32 reserved1[2];
  105. +#else
  106. + u32 reserved1;
  107. + /* PORTSC: offset 0x20 for Faraday OTG */
  108. + u32 port_status[1];
  109. +#endif
  110. /* TXFILLTUNING: offset 0x24 */
  111. u32 txfill_tuning; /* TX FIFO Tuning register */
  112. @@ -125,8 +130,11 @@ struct ehci_regs {
  113. u32 configured_flag;
  114. #define FLAG_CF (1<<0) /* true: we'll support "high speed" */
  115. +#ifndef CONFIG_ARCH_GEMINI
  116. /* PORTSC: offset 0x44 */
  117. u32 port_status[0]; /* up to N_PORTS */
  118. +#endif
  119. +
  120. /* EHCI 1.1 addendum */
  121. #define PORTSC_SUSPEND_STS_ACK 0
  122. #define PORTSC_SUSPEND_STS_NYET 1