]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/video/mxc_ipuv3_fb.c
FPGA: Cyclon II: Correctly reset the FPGA before configuration
[karo-tx-uboot.git] / drivers / video / mxc_ipuv3_fb.c
index eafacef5306c1cda37f30c9542f6e1d5b7b86c84..47b336e7aa4fb7de28996b4921779162a42f3f27 100644 (file)
 #include "videomodes.h"
 #include "ipu.h"
 #include "mxcfb.h"
+#include "ipu_regs.h"
 
 static int mxcfb_map_video_memory(struct fb_info *fbi);
 static int mxcfb_unmap_video_memory(struct fb_info *fbi);
 
 /* graphics setup */
 static GraphicDevice panel;
-struct fb_videomode *gmode;
+static struct fb_videomode *gmode;
+static uint8_t gdisp;
+static uint32_t gpixfmt;
 
 void fb_videomode_to_var(struct fb_var_screeninfo *var,
                         const struct fb_videomode *mode)
@@ -499,7 +502,8 @@ static struct fb_info *mxcfb_init_fbinfo(void)
  *
  * @return      Appropriate error code to the kernel common code
  */
-static int mxcfb_probe(u32 interface_pix_fmt, struct fb_videomode *mode)
+static int mxcfb_probe(u32 interface_pix_fmt, uint8_t disp,
+                       struct fb_videomode *mode)
 {
        struct fb_info *fbi;
        struct mxcfb_info *mxcfbi;
@@ -523,7 +527,7 @@ static int mxcfb_probe(u32 interface_pix_fmt, struct fb_videomode *mode)
                mxcfbi->blank = FB_BLANK_POWERDOWN;
        }
 
-       mxcfbi->ipu_di = 0;
+       mxcfbi->ipu_di = disp;
 
        ipu_disp_set_global_alpha(mxcfbi->ipu_ch, 1, 0x80);
        ipu_disp_set_color_key(mxcfbi->ipu_ch, 0, 0);
@@ -573,6 +577,25 @@ err0:
        return ret;
 }
 
+void ipuv3_fb_shutdown(void)
+{
+       int i;
+       struct ipu_stat *stat = (struct ipu_stat *)IPU_STAT;
+
+       for (i = 0; i < ARRAY_SIZE(mxcfb_info); i++) {
+               struct fb_info *fbi = mxcfb_info[i];
+               if (fbi) {
+                       struct mxcfb_info *mxc_fbi = fbi->par;
+                       ipu_disable_channel(mxc_fbi->ipu_ch);
+                       ipu_uninit_channel(mxc_fbi->ipu_ch);
+               }
+       }
+       for (i = 0; i < ARRAY_SIZE(stat->int_stat); i++) {
+               __raw_writel(__raw_readl(&stat->int_stat[i]),
+                            &stat->int_stat[i]);
+       }
+}
+
 void *video_hw_init(void)
 {
        int ret;
@@ -581,7 +604,7 @@ void *video_hw_init(void)
        if (ret)
                puts("Error initializing IPU\n");
 
-       ret = mxcfb_probe(IPU_PIX_FMT_RGB666, gmode);
+       ret = mxcfb_probe(gpixfmt, gdisp, gmode);
        debug("Framebuffer at 0x%x\n", (unsigned int)panel.frameAdrs);
 
        return (void *)&panel;
@@ -596,9 +619,11 @@ void video_set_lut(unsigned int index, /* color number */
        return;
 }
 
-int mx51_fb_init(struct fb_videomode *mode)
+int ipuv3_fb_init(struct fb_videomode *mode, uint8_t disp, uint32_t pixfmt)
 {
        gmode = mode;
+       gdisp = disp;
+       gpixfmt = pixfmt;
 
        return 0;
 }