msp_usb.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /******************************************************************
  2. * Copyright (c) 2000-2007 PMC-Sierra INC.
  3. *
  4. * This program is free software; you can redistribute it
  5. * and/or modify it under the terms of the GNU General
  6. * Public License as published by the Free Software
  7. * Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be
  11. * useful, but WITHOUT ANY WARRANTY; without even the implied
  12. * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. * PURPOSE. See the GNU General Public License for more
  14. * details.
  15. *
  16. * You should have received a copy of the GNU General Public
  17. * License along with this program; if not, write to the Free
  18. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
  19. * 02139, USA.
  20. *
  21. * PMC-SIERRA INC. DISCLAIMS ANY LIABILITY OF ANY KIND
  22. * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS
  23. * SOFTWARE.
  24. */
  25. #ifndef MSP_USB_H_
  26. #define MSP_USB_H_
  27. #define NUM_USB_DEVS 1
  28. /* Register spaces for USB host 0 */
  29. #define MSP_USB0_MAB_START (MSP_USB0_BASE + 0x0)
  30. #define MSP_USB0_MAB_END (MSP_USB0_BASE + 0x17)
  31. #define MSP_USB0_ID_START (MSP_USB0_BASE + 0x40000)
  32. #define MSP_USB0_ID_END (MSP_USB0_BASE + 0x4008f)
  33. #define MSP_USB0_HS_START (MSP_USB0_BASE + 0x40100)
  34. #define MSP_USB0_HS_END (MSP_USB0_BASE + 0x401FF)
  35. /* Register spaces for USB host 1 */
  36. #define MSP_USB1_MAB_START (MSP_USB1_BASE + 0x0)
  37. #define MSP_USB1_MAB_END (MSP_USB1_BASE + 0x17)
  38. #define MSP_USB1_ID_START (MSP_USB1_BASE + 0x40000)
  39. #define MSP_USB1_ID_END (MSP_USB1_BASE + 0x4008f)
  40. #define MSP_USB1_HS_START (MSP_USB1_BASE + 0x40100)
  41. #define MSP_USB1_HS_END (MSP_USB1_BASE + 0x401ff)
  42. /* USB Identification registers */
  43. struct msp_usbid_regs {
  44. u32 id; /* 0x0: Identification register */
  45. u32 hwgen; /* 0x4: General HW params */
  46. u32 hwhost; /* 0x8: Host HW params */
  47. u32 hwdev; /* 0xc: Device HW params */
  48. u32 hwtxbuf; /* 0x10: Tx buffer HW params */
  49. u32 hwrxbuf; /* 0x14: Rx buffer HW params */
  50. u32 reserved[26];
  51. u32 timer0_load; /* 0x80: General-purpose timer 0 load*/
  52. u32 timer0_ctrl; /* 0x84: General-purpose timer 0 control */
  53. u32 timer1_load; /* 0x88: General-purpose timer 1 load*/
  54. u32 timer1_ctrl; /* 0x8c: General-purpose timer 1 control */
  55. };
  56. /* MSBus to AMBA registers */
  57. struct msp_mab_regs {
  58. u32 isr; /* 0x0: Interrupt status */
  59. u32 imr; /* 0x4: Interrupt mask */
  60. u32 thcr0; /* 0x8: Transaction header capture 0 */
  61. u32 thcr1; /* 0xc: Transaction header capture 1 */
  62. u32 int_stat; /* 0x10: Interrupt status summary */
  63. u32 phy_cfg; /* 0x14: USB phy config */
  64. };
  65. /* EHCI registers */
  66. struct msp_usbhs_regs {
  67. u32 hciver; /* 0x0: Version and offset to operational regs */
  68. u32 hcsparams; /* 0x4: Host control structural parameters */
  69. u32 hccparams; /* 0x8: Host control capability parameters */
  70. u32 reserved0[5];
  71. u32 dciver; /* 0x20: Device interface version */
  72. u32 dccparams; /* 0x24: Device control capability parameters */
  73. u32 reserved1[6];
  74. u32 cmd; /* 0x40: USB command */
  75. u32 sts; /* 0x44: USB status */
  76. u32 int_ena; /* 0x48: USB interrupt enable */
  77. u32 frindex; /* 0x4c: Frame index */
  78. u32 reserved3;
  79. union {
  80. struct {
  81. u32 flb_addr; /* 0x54: Frame list base address */
  82. u32 next_async_addr; /* 0x58: next asynchronous addr */
  83. u32 ttctrl; /* 0x5c: embedded transaction translator
  84. async buffer status */
  85. u32 burst_size; /* 0x60: Controller burst size */
  86. u32 tx_fifo_ctrl; /* 0x64: Tx latency FIFO tuning */
  87. u32 reserved0[4];
  88. u32 endpt_nak; /* 0x78: Endpoint NAK */
  89. u32 endpt_nak_ena; /* 0x7c: Endpoint NAK enable */
  90. u32 cfg_flag; /* 0x80: Config flag */
  91. u32 port_sc1; /* 0x84: Port status & control 1 */
  92. u32 reserved1[7];
  93. u32 otgsc; /* 0xa4: OTG status & control */
  94. u32 mode; /* 0xa8: USB controller mode */
  95. } host;
  96. struct {
  97. u32 dev_addr; /* 0x54: Device address */
  98. u32 endpt_list_addr; /* 0x58: Endpoint list address */
  99. u32 reserved0[7];
  100. u32 endpt_nak; /* 0x74 */
  101. u32 endpt_nak_ctrl; /* 0x78 */
  102. u32 cfg_flag; /* 0x80 */
  103. u32 port_sc1; /* 0x84: Port status & control 1 */
  104. u32 reserved[7];
  105. u32 otgsc; /* 0xa4: OTG status & control */
  106. u32 mode; /* 0xa8: USB controller mode */
  107. u32 endpt_setup_stat; /* 0xac */
  108. u32 endpt_prime; /* 0xb0 */
  109. u32 endpt_flush; /* 0xb4 */
  110. u32 endpt_stat; /* 0xb8 */
  111. u32 endpt_complete; /* 0xbc */
  112. u32 endpt_ctrl0; /* 0xc0 */
  113. u32 endpt_ctrl1; /* 0xc4 */
  114. u32 endpt_ctrl2; /* 0xc8 */
  115. u32 endpt_ctrl3; /* 0xcc */
  116. } device;
  117. } u;
  118. };
  119. /*
  120. * Container for the more-generic platform_device.
  121. * This exists mainly as a way to map the non-standard register
  122. * spaces and make them accessible to the USB ISR.
  123. */
  124. struct mspusb_device {
  125. struct msp_mab_regs __iomem *mab_regs;
  126. struct msp_usbid_regs __iomem *usbid_regs;
  127. struct msp_usbhs_regs __iomem *usbhs_regs;
  128. struct platform_device dev;
  129. };
  130. #define to_mspusb_device(x) container_of((x), struct mspusb_device, dev)
  131. #define TO_HOST_ID(x) ((x) & 0x3)
  132. #endif /*MSP_USB_H_*/