rcar_lvds_regs.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * rcar_lvds_regs.h -- R-Car LVDS Interface Registers Definitions
  4. *
  5. * Copyright (C) 2013-2015 Renesas Electronics Corporation
  6. *
  7. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  8. */
  9. #ifndef __RCAR_LVDS_REGS_H__
  10. #define __RCAR_LVDS_REGS_H__
  11. #define LVDCR0 0x0000
  12. #define LVDCR0_DUSEL (1 << 15)
  13. #define LVDCR0_DMD (1 << 12) /* Gen2 only */
  14. #define LVDCR0_LVMD_MASK (0xf << 8)
  15. #define LVDCR0_LVMD_SHIFT 8
  16. #define LVDCR0_PLLON (1 << 4)
  17. #define LVDCR0_PWD (1 << 2) /* Gen3 only */
  18. #define LVDCR0_BEN (1 << 2) /* Gen2 only */
  19. #define LVDCR0_LVEN (1 << 1)
  20. #define LVDCR0_LVRES (1 << 0)
  21. #define LVDCR1 0x0004
  22. #define LVDCR1_CKSEL (1 << 15) /* Gen2 only */
  23. #define LVDCR1_CHSTBY(n) (3 << (2 + (n) * 2))
  24. #define LVDCR1_CLKSTBY (3 << 0)
  25. #define LVDPLLCR 0x0008
  26. /* Gen2 & V3M */
  27. #define LVDPLLCR_CEEN (1 << 14)
  28. #define LVDPLLCR_FBEN (1 << 13)
  29. #define LVDPLLCR_COSEL (1 << 12)
  30. #define LVDPLLCR_PLLDLYCNT_150M (0x1bf << 0)
  31. #define LVDPLLCR_PLLDLYCNT_121M (0x22c << 0)
  32. #define LVDPLLCR_PLLDLYCNT_60M (0x77b << 0)
  33. #define LVDPLLCR_PLLDLYCNT_38M (0x69a << 0)
  34. #define LVDPLLCR_PLLDLYCNT_MASK (0x7ff << 0)
  35. /* Gen3 but V3M,D3 and E3 */
  36. #define LVDPLLCR_PLLDIVCNT_42M (0x014cb << 0)
  37. #define LVDPLLCR_PLLDIVCNT_85M (0x00a45 << 0)
  38. #define LVDPLLCR_PLLDIVCNT_128M (0x006c3 << 0)
  39. #define LVDPLLCR_PLLDIVCNT_148M (0x046c1 << 0)
  40. #define LVDPLLCR_PLLDIVCNT_MASK (0x7ffff << 0)
  41. /* D3 and E3 */
  42. #define LVDPLLCR_PLLON (1 << 22)
  43. #define LVDPLLCR_PLLSEL_PLL0 (0 << 20)
  44. #define LVDPLLCR_PLLSEL_LVX (1 << 20)
  45. #define LVDPLLCR_PLLSEL_PLL1 (2 << 20)
  46. #define LVDPLLCR_CKSEL_LVX (1 << 17)
  47. #define LVDPLLCR_CKSEL_EXTAL (3 << 17)
  48. #define LVDPLLCR_CKSEL_DU_DOTCLKIN(n) ((5 + (n) * 2) << 17)
  49. #define LVDPLLCR_OCKSEL (1 << 16)
  50. #define LVDPLLCR_STP_CLKOUTE (1 << 14)
  51. #define LVDPLLCR_OUTCLKSEL (1 << 12)
  52. #define LVDPLLCR_CLKOUT (1 << 11)
  53. #define LVDPLLCR_PLLE(n) ((n) << 10)
  54. #define LVDPLLCR_PLLN(n) ((n) << 3)
  55. #define LVDPLLCR_PLLM(n) ((n) << 0)
  56. #define LVDCTRCR 0x000c
  57. #define LVDCTRCR_CTR3SEL_ZERO (0 << 12)
  58. #define LVDCTRCR_CTR3SEL_ODD (1 << 12)
  59. #define LVDCTRCR_CTR3SEL_CDE (2 << 12)
  60. #define LVDCTRCR_CTR3SEL_MASK (7 << 12)
  61. #define LVDCTRCR_CTR2SEL_DISP (0 << 8)
  62. #define LVDCTRCR_CTR2SEL_ODD (1 << 8)
  63. #define LVDCTRCR_CTR2SEL_CDE (2 << 8)
  64. #define LVDCTRCR_CTR2SEL_HSYNC (3 << 8)
  65. #define LVDCTRCR_CTR2SEL_VSYNC (4 << 8)
  66. #define LVDCTRCR_CTR2SEL_MASK (7 << 8)
  67. #define LVDCTRCR_CTR1SEL_VSYNC (0 << 4)
  68. #define LVDCTRCR_CTR1SEL_DISP (1 << 4)
  69. #define LVDCTRCR_CTR1SEL_ODD (2 << 4)
  70. #define LVDCTRCR_CTR1SEL_CDE (3 << 4)
  71. #define LVDCTRCR_CTR1SEL_HSYNC (4 << 4)
  72. #define LVDCTRCR_CTR1SEL_MASK (7 << 4)
  73. #define LVDCTRCR_CTR0SEL_HSYNC (0 << 0)
  74. #define LVDCTRCR_CTR0SEL_VSYNC (1 << 0)
  75. #define LVDCTRCR_CTR0SEL_DISP (2 << 0)
  76. #define LVDCTRCR_CTR0SEL_ODD (3 << 0)
  77. #define LVDCTRCR_CTR0SEL_CDE (4 << 0)
  78. #define LVDCTRCR_CTR0SEL_MASK (7 << 0)
  79. #define LVDCHCR 0x0010
  80. #define LVDCHCR_CHSEL_CH(n, c) ((((c) - (n)) & 3) << ((n) * 4))
  81. #define LVDCHCR_CHSEL_MASK(n) (3 << ((n) * 4))
  82. /* All registers below are specific to D3 and E3 */
  83. #define LVDSTRIPE 0x0014
  84. #define LVDSTRIPE_ST_TRGSEL_DISP (0 << 2)
  85. #define LVDSTRIPE_ST_TRGSEL_HSYNC_R (1 << 2)
  86. #define LVDSTRIPE_ST_TRGSEL_HSYNC_F (2 << 2)
  87. #define LVDSTRIPE_ST_SWAP (1 << 1)
  88. #define LVDSTRIPE_ST_ON (1 << 0)
  89. #define LVDSCR 0x0018
  90. #define LVDSCR_DEPTH(n) (((n) - 1) << 29)
  91. #define LVDSCR_BANDSET (1 << 28)
  92. #define LVDSCR_TWGCNT(n) ((((n) - 256) / 16) << 24)
  93. #define LVDSCR_SDIV(n) ((n) << 22)
  94. #define LVDSCR_MODE (1 << 21)
  95. #define LVDSCR_RSTN (1 << 20)
  96. #define LVDDIV 0x001c
  97. #define LVDDIV_DIVSEL (1 << 8)
  98. #define LVDDIV_DIVRESET (1 << 7)
  99. #define LVDDIV_DIVSTP (1 << 6)
  100. #define LVDDIV_DIV(n) ((n) << 0)
  101. #endif /* __RCAR_LVDS_REGS_H__ */