dw100_regs.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * DW100 Hardware dewarper
  4. *
  5. * Copyright 2022 NXP
  6. * Author: Xavier Roumegue (xavier.roumegue@oss.nxp.com)
  7. */
  8. #ifndef _DW100_REGS_H_
  9. #define _DW100_REGS_H_
  10. /* AHB register offset */
  11. #define DW100_DEWARP_ID 0x00
  12. #define DW100_DEWARP_CTRL 0x04
  13. #define DW100_DEWARP_CTRL_ENABLE BIT(0)
  14. #define DW100_DEWARP_CTRL_START BIT(1)
  15. #define DW100_DEWARP_CTRL_SOFT_RESET BIT(2)
  16. #define DW100_DEWARP_CTRL_FORMAT_YUV422_SP 0UL
  17. #define DW100_DEWARP_CTRL_FORMAT_YUV422_PACKED 1UL
  18. #define DW100_DEWARP_CTRL_FORMAT_YUV420_SP 2UL
  19. #define DW100_DEWARP_CTRL_INPUT_FORMAT_MASK GENMASK(5, 4)
  20. #define DW100_DEWARP_CTRL_INPUT_FORMAT(x) ((x) << 4)
  21. #define DW100_DEWARP_CTRL_OUTPUT_FORMAT(x) ((x) << 6)
  22. #define DW100_DEWARP_CTRL_OUTPUT_FORMAT_MASK GENMASK(7, 6)
  23. #define DW100_DEWARP_CTRL_SRC_AUTO_SHADOW BIT(8)
  24. #define DW100_DEWARP_CTRL_HW_HANDSHAKE BIT(9)
  25. #define DW100_DEWARP_CTRL_DST_AUTO_SHADOW BIT(10)
  26. #define DW100_DEWARP_CTRL_SPLIT_LINE BIT(11)
  27. #define DW100_DEWARP_CTRL_PREFETCH_MODE_MASK GENMASK(17, 16)
  28. #define DW100_DEWARP_CTRL_PREFETCH_MODE_TRAVERSAL (0UL << 16)
  29. #define DW100_DEWARP_CTRL_PREFETCH_MODE_CALCULATION (1UL << 16)
  30. #define DW100_DEWARP_CTRL_PREFETCH_MODE_AUTO (2UL << 16)
  31. #define DW100_DEWARP_CTRL_PREFETCH_THRESHOLD_MASK GENMASK(24, 18)
  32. #define DW100_DEWARP_CTRL_PREFETCH_THRESHOLD(x) ((x) << 18)
  33. #define DW100_MAP_LUT_ADDR 0x08
  34. #define DW100_MAP_LUT_ADDR_ADDR(addr) (((addr) >> 4) & GENMASK(29, 0))
  35. #define DW100_MAP_LUT_SIZE 0x0c
  36. #define DW100_MAP_LUT_SIZE_WIDTH(w) (((w) & GENMASK(10, 0)) << 0)
  37. #define DW100_MAP_LUT_SIZE_HEIGHT(h) (((h) & GENMASK(10, 0)) << 16)
  38. #define DW100_SRC_IMG_Y_BASE 0x10
  39. #define DW100_IMG_Y_BASE(base) (((base) >> 4) & GENMASK(29, 0))
  40. #define DW100_SRC_IMG_UV_BASE 0x14
  41. #define DW100_IMG_UV_BASE(base) (((base) >> 4) & GENMASK(29, 0))
  42. #define DW100_SRC_IMG_SIZE 0x18
  43. #define DW100_IMG_SIZE_WIDTH(w) (((w) & GENMASK(12, 0)) << 0)
  44. #define DW100_IMG_SIZE_HEIGHT(h) (((h) & GENMASK(12, 0)) << 16)
  45. #define DW100_SRC_IMG_STRIDE 0x1c
  46. #define DW100_MAP_LUT_ADDR2 0x20
  47. #define DW100_MAP_LUT_SIZE2 0x24
  48. #define DW100_SRC_IMG_Y_BASE2 0x28
  49. #define DW100_SRC_IMG_UV_BASE2 0x2c
  50. #define DW100_SRC_IMG_SIZE2 0x30
  51. #define DW100_SRC_IMG_STRIDE2 0x34
  52. #define DW100_DST_IMG_Y_BASE 0x38
  53. #define DW100_DST_IMG_UV_BASE 0x3c
  54. #define DW100_DST_IMG_SIZE 0x40
  55. #define DW100_DST_IMG_STRIDE 0x44
  56. #define DW100_DST_IMG_Y_BASE2 0x48
  57. #define DW100_DST_IMG_UV_BASE2 0x4c
  58. #define DW100_DST_IMG_SIZE2 0x50
  59. #define DW100_DST_IMG_STRIDE2 0x54
  60. #define DW100_SWAP_CONTROL 0x58
  61. #define DW100_SWAP_CONTROL_BYTE BIT(0)
  62. #define DW100_SWAP_CONTROL_SHORT BIT(1)
  63. #define DW100_SWAP_CONTROL_WORD BIT(2)
  64. #define DW100_SWAP_CONTROL_LONG BIT(3)
  65. #define DW100_SWAP_CONTROL_Y(x) (((x) & GENMASK(3, 0)) << 0)
  66. #define DW100_SWAP_CONTROL_UV(x) (((x) & GENMASK(3, 0)) << 4)
  67. #define DW100_SWAP_CONTROL_SRC(x) (((x) & GENMASK(7, 0)) << 0)
  68. #define DW100_SWAP_CONTROL_DST(x) (((x) & GENMASK(7, 0)) << 8)
  69. #define DW100_SWAP_CONTROL_SRC2(x) (((x) & GENMASK(7, 0)) << 16)
  70. #define DW100_SWAP_CONTROL_DST2(x) (((x) & GENMASK(7, 0)) << 24)
  71. #define DW100_SWAP_CONTROL_SRC_MASK GENMASK(7, 0)
  72. #define DW100_SWAP_CONTROL_DST_MASK GENMASK(15, 8)
  73. #define DW100_SWAP_CONTROL_SRC2_MASK GENMASK(23, 16)
  74. #define DW100_SWAP_CONTROL_DST2_MASK GENMASK(31, 24)
  75. #define DW100_VERTICAL_SPLIT_LINE 0x5c
  76. #define DW100_HORIZON_SPLIT_LINE 0x60
  77. #define DW100_SCALE_FACTOR 0x64
  78. #define DW100_ROI_START 0x68
  79. #define DW100_ROI_START_X(x) (((x) & GENMASK(12, 0)) << 0)
  80. #define DW100_ROI_START_Y(y) (((y) & GENMASK(12, 0)) << 16)
  81. #define DW100_BOUNDARY_PIXEL 0x6c
  82. #define DW100_BOUNDARY_PIXEL_V(v) (((v) & GENMASK(7, 0)) << 0)
  83. #define DW100_BOUNDARY_PIXEL_U(u) (((u) & GENMASK(7, 0)) << 8)
  84. #define DW100_BOUNDARY_PIXEL_Y(y) (((y) & GENMASK(7, 0)) << 16)
  85. #define DW100_INTERRUPT_STATUS 0x70
  86. #define DW100_INTERRUPT_STATUS_INT_FRAME_DONE BIT(0)
  87. #define DW100_INTERRUPT_STATUS_INT_ERR_TIME_OUT BIT(1)
  88. #define DW100_INTERRUPT_STATUS_INT_ERR_AXI_RESP BIT(2)
  89. #define DW100_INTERRUPT_STATUS_INT_ERR_X BIT(3)
  90. #define DW100_INTERRUPT_STATUS_INT_ERR_MB_FETCH BIT(4)
  91. #define DW100_INTERRUPT_STATUS_INT_ERR_FRAME2 BIT(5)
  92. #define DW100_INTERRUPT_STATUS_INT_ERR_FRAME3 BIT(6)
  93. #define DW100_INTERRUPT_STATUS_INT_ERR_FRAME_DONE BIT(7)
  94. #define DW100_INTERRUPT_STATUS_INT_ERR_STATUS(x) (((x) >> 1) & 0x7f)
  95. #define DW100_INTERRUPT_STATUS_INT_STATUS(x) ((x) & 0xff)
  96. #define DW100_INTERRUPT_STATUS_INT_ENABLE_MASK GENMASK(15, 8)
  97. #define DW100_INTERRUPT_STATUS_INT_ENABLE(x) (((x) & GENMASK(7, 0)) << 8)
  98. #define DW100_INTERRUPT_STATUS_FRAME_BUSY BIT(16)
  99. #define DW100_INTERRUPT_STATUS_INT_CLEAR(x) (((x) & GENMASK(7, 0)) << 24)
  100. #define DW100_BUS_CTRL 0x74
  101. #define DW100_BUS_CTRL_AXI_MASTER_ENABLE BIT(31)
  102. #define DW100_BUS_CTRL1 0x78
  103. #define DW100_BUS_TIME_OUT_CYCLE 0x7c
  104. #define DW100_DST_IMG_Y_SIZE1 0x80
  105. #define DW100_DST_IMG_Y_SIZE(sz) (((sz) >> 4) & GENMASK(29, 0))
  106. #define DW100_DST_IMG_UV_SIZE(sz) (((sz) >> 4) & GENMASK(29, 0))
  107. #define DW100_DST_IMG_UV_SIZE1 0x84
  108. #define DW100_DST_IMG_Y_SIZE2 0x88
  109. #define DW100_DST_IMG_UV_SIZE2 0x8c
  110. #endif /* _DW100_REGS_H_ */