dwc_usb.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* Copyright (C) 2013 by John Cronin <jncronin@tysos.org>
  2. *
  3. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4. * of this software and associated documentation files (the "Software"), to deal
  5. * in the Software without restriction, including without limitation the rights
  6. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. * copies of the Software, and to permit persons to whom the Software is
  8. * furnished to do so, subject to the following conditions:
  9. * The above copyright notice and this permission notice shall be included in
  10. * all copies or substantial portions of the Software.
  11. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. * THE SOFTWARE.
  18. */
  19. #ifndef DWC_USB_H
  20. #define DWC_USB_H
  21. // The FIFOs - one page per FIFO
  22. #define DWC_USB_FIFO_SIZE 0x1000
  23. #define DWC_USB_FIFO_LEN (3 * DWC_USB_FIFO_SIZE)
  24. #define DWC_USB_FIFO_START (0x100000 - DWC_USB_FIFO_LEN)
  25. // Register addresses
  26. #define DWC_USB_BASE 0x20980000
  27. #define DWC_USB_OTG_CTRL 0
  28. #define DWC_USB_OTG_IRPT 4
  29. #define DWC_USB_AHB_CONF 8
  30. #define DWC_USB_CORE_CONF 0xC
  31. #define DWC_USB_CORE_RESET 0x10
  32. #define DWC_USB_CORE_IRPT 0x14
  33. #define DWC_USB_CORE_IRPT_MASK 0x18
  34. #define DWC_USB_RECV_STATUS_DBG 0x1C
  35. #define DWC_USB_STATUS_READ_POP 0x1C
  36. #define DWC_USB_DEVICE_STATUS_READ_POP 0x20
  37. #define DWC_USB_RECV_FIFO_SIZE 0x24
  38. #define DWC_USB_NON_PERIODIC_FIFO_SIZE 0x28
  39. #define DWC_USB_NON_PERIODIC_FIFO 0x2C
  40. #define DWC_USB_I2C_ACCESS 0x30
  41. #define DWC_USB_PHY_VENDOR_CONTROL 0x34
  42. #define DWC_USB_GPIO 0x38
  43. #define DWC_USB_USER_ID 0x3C
  44. #define DWC_USB_SYNOPSYS_ID 0x40
  45. #define DWC_USB_CONFIG_1 0x44
  46. #define DWC_USB_CONFIG_2 0x48
  47. #define DWC_USB_CONFIG_3 0x4C
  48. #define DWC_USB_CONFIG_4 0x50
  49. #define DWC_USB_PERIODIC_FIFO_SIZE 0x100
  50. #define DWC_USB_HOST_CONF 0x400
  51. #define DWC_USB_HOST_FRAME_INTERVAL 0x404
  52. #define DWC_USB_HOST_FRAME_NUMBER 0x408
  53. #define DWC_USB_HOST_PERIODIC_FIFO 0x410
  54. #define DWC_USB_HOST_ALL_CHAN_IRPT 0x414
  55. #define DWC_USB_HOST_IPRT_MASK 0x418
  56. #define DWC_USB_HOST_FRAME_LIST 0x41C
  57. #define DWC_USB_HOST_PORT_CTRL_STATUS 0x440
  58. #define DWC_USB_HOST_CHAN_CHAR 0x500
  59. #define DWC_USB_HOST_CHAN_SPLIT_CTRL 0x504
  60. #define DWC_USB_HOST_CHAN_IRPT 0x508
  61. #define DWC_USB_HOST_CHAN_IRPT_MASK 0x50C
  62. #define DWC_USB_HOST_CHAN_TFER_SIZE 0x510
  63. #define DWC_USB_HOST_CHAN_DMA_ADDR 0x514
  64. #define DWC_USB_POWER 0xE00
  65. // DWC_USB_HOST_PORT_CTRL_STATUS bits
  66. #define DWC_USB_HPCS_PRTCONNSTS (1 << 0)
  67. #define DWC_USB_HPCS_PRTCONNDET (1 << 1)
  68. #define DWC_USB_HPCS_PRTENA (1 << 2)
  69. #define DWC_USB_HPCS_PRTENCHNG (1 << 3)
  70. #define DWC_USB_HPCS_PRTOVRCURACT (1 << 4)
  71. #define DWC_USB_HPCS_PRTOVRCURCHNG (1 << 5)
  72. #define DWC_USB_HPCS_PRTRES (1 << 6)
  73. #define DWC_USB_HPCS_PRTSUSP (1 << 7)
  74. #define DWC_USB_HPCS_PRTRST (1 << 8)
  75. #define DWC_USB_HPCS_PRTLNSTS (3 << 10)
  76. #define DWC_USB_HPCS_PRTPWR (1 << 12)
  77. #define DWC_USB_HPCS_PRTTSTCTL (15 << 13)
  78. #define DWC_USB_HPCS_PRTSPD (3 << 17)
  79. #endif