sh7760fb.txt 4.4 KB

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