dw_ufs.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef DW_UFS_H
  7. #define DW_UFS_H
  8. #include <stdint.h>
  9. /* Bus Throtting */
  10. #define BUSTHRTL 0xC0
  11. /* Outstanding OCP Requests */
  12. #define OOCPR 0xC4
  13. /* Fatal Error Interrupt Enable */
  14. #define FEIE 0xC8
  15. /* C-Port Direct Access Configuration register */
  16. #define CDACFG 0xD0
  17. /* C-Port Direct Access Transmit 1 register */
  18. #define CDATX1 0xD4
  19. /* C-Port Direct Access Transmit 2 register */
  20. #define CDATX2 0xD8
  21. /* C-Port Direct Access Receive 1 register */
  22. #define CDARX1 0xDC
  23. /* C-Port Direct Access Receive 2 register */
  24. #define CDARX2 0xE0
  25. /* C-Port Direct Access Status register */
  26. #define CDASTA 0xE4
  27. /* UPIU Loopback Configuration register */
  28. #define LBMCFG 0xF0
  29. /* UPIU Loopback Status */
  30. #define LBMSTA 0xF4
  31. /* Debug register */
  32. #define DBG 0xF8
  33. /* HClk Divider register */
  34. #define HCLKDIV 0xFC
  35. #define TX_HIBERN8TIME_CAP_OFFSET 0x000F
  36. #define TX_FSM_STATE_OFFSET 0x0041
  37. #define TX_FSM_STATE_LINE_RESET 7
  38. #define TX_FSM_STATE_LINE_CFG 6
  39. #define TX_FSM_STATE_HS_BURST 5
  40. #define TX_FSM_STATE_LS_BURST 4
  41. #define TX_FSM_STATE_STALL 3
  42. #define TX_FSM_STATE_SLEEP 2
  43. #define TX_FSM_STATE_HIBERN8 1
  44. #define TX_FSM_STATE_DISABLE 0
  45. #define RX_MIN_ACTIVATETIME_CAP_OFFSET 0x008F
  46. #define RX_HS_G2_SYNC_LENGTH_CAP_OFFSET 0x0094
  47. #define RX_HS_G3_SYNC_LENGTH_CAP_OFFSET 0x0095
  48. #define PA_AVAIL_TX_DATA_LANES_OFFSET 0x1520
  49. #define PA_TX_SKIP_OFFSET 0x155C
  50. #define PA_TX_SKIP_PERIOD_OFFSET 0x155D
  51. #define PA_LOCAL_TX_LCC_ENABLE_OFFSET 0x155E
  52. #define PA_ACTIVE_TX_DATA_LANES_OFFSET 0x1560
  53. #define PA_CONNECTED_TX_DATA_LANES_OFFSET 0x1561
  54. #define PA_TX_TRAILING_CLOCKS_OFFSET 0x1564
  55. #define PA_TX_GEAR_OFFSET 0x1568
  56. #define PA_TX_TERMINATION_OFFSET 0x1569
  57. #define PA_HS_SERIES_OFFSET 0x156A
  58. #define PA_PWR_MODE_OFFSET 0x1571
  59. #define PA_ACTIVE_RX_DATA_LANES_OFFSET 0x1580
  60. #define PA_CONNECTED_RX_DATA_LANES_OFFSET 0x1581
  61. #define PA_RX_PWR_STATUS_OFFSET 0x1582
  62. #define PA_RX_GEAR_OFFSET 0x1583
  63. #define PA_RX_TERMINATION_OFFSET 0x1584
  64. #define PA_SCRAMBLING_OFFSET 0x1585
  65. #define PA_MAX_RX_PWM_GEAR_OFFSET 0x1586
  66. #define PA_MAX_RX_HS_GEAR_OFFSET 0x1587
  67. #define PA_PACP_REQ_TIMEOUT_OFFSET 0x1590
  68. #define PA_PACP_REQ_EOB_TIMEOUT_OFFSET 0x1591
  69. #define PA_REMOTE_VER_INFO_OFFSET 0x15A0
  70. #define PA_LOGICAL_LANE_MAP_OFFSET 0x15A1
  71. #define PA_TACTIVATE_OFFSET 0x15A8
  72. #define PA_PWR_MODE_USER_DATA0_OFFSET 0x15B0
  73. #define PA_PWR_MODE_USER_DATA1_OFFSET 0x15B1
  74. #define PA_PWR_MODE_USER_DATA2_OFFSET 0x15B2
  75. #define PA_PWR_MODE_USER_DATA3_OFFSET 0x15B3
  76. #define PA_PWR_MODE_USER_DATA4_OFFSET 0x15B4
  77. #define PA_PWR_MODE_USER_DATA5_OFFSET 0x15B5
  78. #define DL_TC0_TX_FC_THRESHOLD_OFFSET 0x2040
  79. #define DL_AFC0_CREDIT_THRESHOLD_OFFSET 0x2044
  80. #define DL_TC0_OUT_ACK_THRESHOLD_OFFSET 0x2045
  81. #define DME_FC0_PROTECTION_TIMEOUT_OFFSET 0xD041
  82. #define DME_TC0_REPLAY_TIMEOUT_OFFSET 0xD042
  83. #define DME_AFC0_REQ_TIMEOUT_OFFSET 0xD043
  84. #define DME_FC1_PROTECTION_TIMEOUT_OFFSET 0xD044
  85. #define DME_TC1_REPLAY_TIMEOUT_OFFSET 0xD045
  86. #define DME_AFC1_REQ_TIMEOUT_OFFSET 0xD046
  87. #define VS_MPHY_CFG_UPDT_OFFSET 0xD085
  88. #define VS_MK2_EXTN_SUPPORT_OFFSET 0xD0AB
  89. #define VS_MPHY_DISABLE_OFFSET 0xD0C1
  90. #define VS_MPHY_DISABLE_MPHYDIS (1 << 0)
  91. typedef struct dw_ufs_params {
  92. uintptr_t reg_base;
  93. uintptr_t desc_base;
  94. size_t desc_size;
  95. unsigned long flags;
  96. } dw_ufs_params_t;
  97. int dw_ufs_init(dw_ufs_params_t *params);
  98. #endif /* DW_UFS_H */