Driver for EP93xx LCD controller

The EP93xx LCD controller can drive both standard desktop monitors andembedded LCD displays. If you have a standard desktop monitor then youcan use the standard Linux video mode database. In your board file:

static struct ep93xxfb_mach_info some_board_fb_info = {        .num_modes      = EP93XXFB_USE_MODEDB,        .bpp            = 16,};

If you have an embedded LCD display then you need to define a videomode for it as follows:

static struct fb_videomode some_board_video_modes[] = {        {                .name           = "some_lcd_name",                /* Pixel clock, porches, etc */        },};

Note that the pixel clock value is in pico-seconds. You can use theKHZ2PICOS macro to convert the pixel clock value. Most other valuesare in pixel clocks. See Documentation/fb/framebuffer.rst for furtherdetails.

The ep93xxfb_mach_info structure for your board should look like thefollowing:

static struct ep93xxfb_mach_info some_board_fb_info = {        .num_modes      = ARRAY_SIZE(some_board_video_modes),        .modes          = some_board_video_modes,        .default_mode   = &some_board_video_modes[0],        .bpp            = 16,};

The framebuffer device can be registered by adding the following toyour board initialisation function:

ep93xx_register_fb(&some_board_fb_info);

Video Attribute Flags

The ep93xxfb_mach_info structure has a flags field which can be usedto configure the controller. The video attributes flags are fullydocumented in section 7 of the EP93xx users’ guide. The followingflags are available:

EP93XXFB_PCLK_FALLINGClock data on the falling edge of thepixel clock. The default is to clockdata on the rising edge.
EP93XXFB_SYNC_BLANK_HIGHBlank signal is active high. Bydefault the blank signal is active low.
EP93XXFB_SYNC_HORIZ_HIGHHorizontal sync is active high. Bydefault the horizontal sync is active low.
EP93XXFB_SYNC_VERT_HIGHVertical sync is active high. Bydefault the vertical sync is active high.

The physical address of the framebuffer can be controlled using thefollowing flags:

EP93XXFB_USE_SDCSN0Use SDCSn[0] for the framebuffer. Thisis the default setting.
EP93XXFB_USE_SDCSN1Use SDCSn[1] for the framebuffer.
EP93XXFB_USE_SDCSN2Use SDCSn[2] for the framebuffer.
EP93XXFB_USE_SDCSN3Use SDCSn[3] for the framebuffer.

Platform callbacks

The EP93xx framebuffer driver supports three optional platformcallbacks: setup, teardown and blank. The setup and teardown functionsare called when the framebuffer driver is installed and removedrespectively. The blank function is called whenever the display isblanked or unblanked.

The setup and teardown devices pass the platform_device structure asan argument. The fb_info and ep93xxfb_mach_info structures can beobtained as follows:

static int some_board_fb_setup(struct platform_device *pdev){        struct ep93xxfb_mach_info *mach_info = pdev->dev.platform_data;        struct fb_info *fb_info = platform_get_drvdata(pdev);        /* Board specific framebuffer setup */}

Setting the video mode

The video mode is set using the following syntax:

video=XRESxYRES[-BPP][@REFRESH]

If the EP93xx video driver is built-in then the video mode is set onthe Linux kernel command line, for example:

video=ep93xx-fb:800x600-16@60

If the EP93xx video driver is built as a module then the video mode isset when the module is installed:

modprobe ep93xx-fb video=320x240

Screenpage bug

At least on the EP9315 there is a silicon bug which causes bit 27 ofthe VIDSCRNPAGE (framebuffer physical offset) to be tied low. There isan unofficial errata for this bug at:

http://marc.info/?l=linux-arm-kernel&m=110061245502000&w=2

By default the EP93xx framebuffer driver checks if the allocated physicaladdress has bit 27 set. If it does, then the memory is freed and anerror is returned. The check can be disabled by adding the followingoption when loading the driver:

ep93xx-fb.check_screenpage_bug=0

In some cases it may be possible to reconfigure your SDRAM layout toavoid this bug. See section 13 of the EP93xx users’ guide for details.