sh7760fb.rst 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. ================================================
  2. SH7760/SH7763 integrated LCDC Framebuffer driver
  3. ================================================
  4. 0. Overview
  5. -----------
  6. The SH7760/SH7763 have an integrated LCD Display controller (LCDC) which
  7. supports (in theory) resolutions ranging from 1x1 to 1024x1024,
  8. with color depths ranging from 1 to 16 bits, on STN, DSTN and TFT Panels.
  9. Caveats:
  10. * Framebuffer memory must be a large chunk allocated at the top
  11. of Area3 (HW requirement). Because of this requirement you should NOT
  12. make the driver a module since at runtime it may become impossible to
  13. get a large enough contiguous chunk of memory.
  14. * The driver does not support changing resolution while loaded
  15. (displays aren't hotpluggable anyway)
  16. * Heavy flickering may be observed
  17. a) if you're using 15/16bit color modes at >= 640x480 px resolutions,
  18. b) during PCMCIA (or any other slow bus) activity.
  19. * Rotation works only 90degress clockwise, and only if horizontal
  20. resolution is <= 320 pixels.
  21. Files:
  22. - drivers/video/sh7760fb.c
  23. - include/asm-sh/sh7760fb.h
  24. - Documentation/fb/sh7760fb.rst
  25. 1. Platform setup
  26. -----------------
  27. SH7760:
  28. Video data is fetched via the DMABRG DMA engine, so you have to
  29. configure the SH DMAC for DMABRG mode (write 0x94808080 to the
  30. DMARSRA register somewhere at boot).
  31. PFC registers PCCR and PCDR must be set to peripheral mode.
  32. (write zeros to both).
  33. The driver does NOT do the above for you since board setup is, well, job
  34. of the board setup code.
  35. 2. Panel definitions
  36. --------------------
  37. The LCDC must explicitly be told about the type of LCD panel
  38. attached. Data must be wrapped in a "struct sh7760fb_platdata" and
  39. passed to the driver as platform_data.
  40. Suggest you take a closer look at the SH7760 Manual, Section 30.
  41. (http://documentation.renesas.com/eng/products/mpumcu/e602291_sh7760.pdf)
  42. The following code illustrates what needs to be done to
  43. get the framebuffer working on a 640x480 TFT::
  44. #include <linux/fb.h>
  45. #include <asm/sh7760fb.h>
  46. /*
  47. * NEC NL6440bc26-01 640x480 TFT
  48. * dotclock 25175 kHz
  49. * Xres 640 Yres 480
  50. * Htotal 800 Vtotal 525
  51. * HsynStart 656 VsynStart 490
  52. * HsynLenn 30 VsynLenn 2
  53. *
  54. * The linux framebuffer layer does not use the syncstart/synclen
  55. * values but right/left/upper/lower margin values. The comments
  56. * for the x_margin explain how to calculate those from given
  57. * panel sync timings.
  58. */
  59. static struct fb_videomode nl6448bc26 = {
  60. .name = "NL6448BC26",
  61. .refresh = 60,
  62. .xres = 640,
  63. .yres = 480,
  64. .pixclock = 39683, /* in picoseconds! */
  65. .hsync_len = 30,
  66. .vsync_len = 2,
  67. .left_margin = 114, /* HTOT - (HSYNSLEN + HSYNSTART) */
  68. .right_margin = 16, /* HSYNSTART - XRES */
  69. .upper_margin = 33, /* VTOT - (VSYNLEN + VSYNSTART) */
  70. .lower_margin = 10, /* VSYNSTART - YRES */
  71. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
  72. .vmode = FB_VMODE_NONINTERLACED,
  73. .flag = 0,
  74. };
  75. static struct sh7760fb_platdata sh7760fb_nl6448 = {
  76. .def_mode = &nl6448bc26,
  77. .ldmtr = LDMTR_TFT_COLOR_16, /* 16bit TFT panel */
  78. .lddfr = LDDFR_8BPP, /* we want 8bit output */
  79. .ldpmmr = 0x0070,
  80. .ldpspr = 0x0500,
  81. .ldaclnr = 0,
  82. .ldickr = LDICKR_CLKSRC(LCDC_CLKSRC_EXTERNAL) |
  83. LDICKR_CLKDIV(1),
  84. .rotate = 0,
  85. .novsync = 1,
  86. .blank = NULL,
  87. };
  88. /* SH7760:
  89. * 0xFE300800: 256 * 4byte xRGB palette ram
  90. * 0xFE300C00: 42 bytes ctrl registers
  91. */
  92. static struct resource sh7760_lcdc_res[] = {
  93. [0] = {
  94. .start = 0xFE300800,
  95. .end = 0xFE300CFF,
  96. .flags = IORESOURCE_MEM,
  97. },
  98. [1] = {
  99. .start = 65,
  100. .end = 65,
  101. .flags = IORESOURCE_IRQ,
  102. },
  103. };
  104. static struct platform_device sh7760_lcdc_dev = {
  105. .dev = {
  106. .platform_data = &sh7760fb_nl6448,
  107. },
  108. .name = "sh7760-lcdc",
  109. .id = -1,
  110. .resource = sh7760_lcdc_res,
  111. .num_resources = ARRAY_SIZE(sh7760_lcdc_res),
  112. };