^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) ================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) Driver for EP93xx LCD controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) The EP93xx LCD controller can drive both standard desktop monitors and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) embedded LCD displays. If you have a standard desktop monitor then you
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) can use the standard Linux video mode database. In your board file::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) static struct ep93xxfb_mach_info some_board_fb_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) .num_modes = EP93XXFB_USE_MODEDB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) .bpp = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) If you have an embedded LCD display then you need to define a video
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) mode for it as follows::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) static struct fb_videomode some_board_video_modes[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) .name = "some_lcd_name",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) /* Pixel clock, porches, etc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) Note that the pixel clock value is in pico-seconds. You can use the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) KHZ2PICOS macro to convert the pixel clock value. Most other values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) are in pixel clocks. See Documentation/fb/framebuffer.rst for further
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) The ep93xxfb_mach_info structure for your board should look like the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) following::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static struct ep93xxfb_mach_info some_board_fb_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) .num_modes = ARRAY_SIZE(some_board_video_modes),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) .modes = some_board_video_modes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) .default_mode = &some_board_video_modes[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) .bpp = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) The framebuffer device can be registered by adding the following to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) your board initialisation function::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) ep93xx_register_fb(&some_board_fb_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) =====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) Video Attribute Flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) =====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) The ep93xxfb_mach_info structure has a flags field which can be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) to configure the controller. The video attributes flags are fully
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) documented in section 7 of the EP93xx users' guide. The following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) flags are available:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) =============================== ==========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) EP93XXFB_PCLK_FALLING Clock data on the falling edge of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) pixel clock. The default is to clock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) data on the rising edge.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) EP93XXFB_SYNC_BLANK_HIGH Blank signal is active high. By
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) default the blank signal is active low.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) EP93XXFB_SYNC_HORIZ_HIGH Horizontal sync is active high. By
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) default the horizontal sync is active low.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) EP93XXFB_SYNC_VERT_HIGH Vertical sync is active high. By
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) default the vertical sync is active high.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) =============================== ==========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) The physical address of the framebuffer can be controlled using the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) following flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) =============================== ======================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) EP93XXFB_USE_SDCSN0 Use SDCSn[0] for the framebuffer. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) is the default setting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) EP93XXFB_USE_SDCSN1 Use SDCSn[1] for the framebuffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) EP93XXFB_USE_SDCSN2 Use SDCSn[2] for the framebuffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) EP93XXFB_USE_SDCSN3 Use SDCSn[3] for the framebuffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) =============================== ======================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) ==================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) Platform callbacks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) ==================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) The EP93xx framebuffer driver supports three optional platform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) callbacks: setup, teardown and blank. The setup and teardown functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) are called when the framebuffer driver is installed and removed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) respectively. The blank function is called whenever the display is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) blanked or unblanked.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) The setup and teardown devices pass the platform_device structure as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) an argument. The fb_info and ep93xxfb_mach_info structures can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) obtained as follows::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) static int some_board_fb_setup(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) struct ep93xxfb_mach_info *mach_info = pdev->dev.platform_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) struct fb_info *fb_info = platform_get_drvdata(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /* Board specific framebuffer setup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) ======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) Setting the video mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) ======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) The video mode is set using the following syntax::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) video=XRESxYRES[-BPP][@REFRESH]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) If the EP93xx video driver is built-in then the video mode is set on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) the Linux kernel command line, for example::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) video=ep93xx-fb:800x600-16@60
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) If the EP93xx video driver is built as a module then the video mode is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) set when the module is installed::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) modprobe ep93xx-fb video=320x240
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) ==============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) Screenpage bug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) ==============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) At least on the EP9315 there is a silicon bug which causes bit 27 of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) the VIDSCRNPAGE (framebuffer physical offset) to be tied low. There is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) an unofficial errata for this bug at::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) https://marc.info/?l=linux-arm-kernel&m=110061245502000&w=2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) By default the EP93xx framebuffer driver checks if the allocated physical
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) address has bit 27 set. If it does, then the memory is freed and an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) error is returned. The check can be disabled by adding the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) option when loading the driver::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) ep93xx-fb.check_screenpage_bug=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) In some cases it may be possible to reconfigure your SDRAM layout to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) avoid this bug. See section 13 of the EP93xx users' guide for details.