]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/video/mxc_ipuv3_fb.c
video: ipu: initialize g_ipu_clk, g_ldb_clk statically
[karo-tx-uboot.git] / drivers / video / mxc_ipuv3_fb.c
index d4f12e931e491881da0b84357d6475ef8cd4cbcc..cd95abab837064a5616649a6b85c4e255062a27b 100644 (file)
@@ -14,6 +14,7 @@
 /* #define DEBUG */
 #include <common.h>
 #include <asm/errno.h>
+#include <asm/global_data.h>
 #include <linux/string.h>
 #include <linux/list.h>
 #include <linux/fb.h>
@@ -410,10 +411,13 @@ static int mxcfb_map_video_memory(struct fb_info *fbi)
                fbi->fix.smem_len = fbi->var.yres_virtual *
                                    fbi->fix.line_length;
        }
+
+       fbi->fix.smem_len = roundup(fbi->fix.smem_len, ARCH_DMA_MINALIGN);
        if (gd->fb_base)
                fbi->screen_base = (void *)gd->fb_base;
        else
-               fbi->screen_base = malloc(fbi->fix.smem_len);
+               fbi->screen_base = (char *)memalign(ARCH_DMA_MINALIGN,
+                                               fbi->fix.smem_len);
        if (fbi->screen_base == NULL) {
                puts("Unable to allocate framebuffer memory\n");
                fbi->fix.smem_len = 0;
@@ -426,6 +430,8 @@ static int mxcfb_map_video_memory(struct fb_info *fbi)
 
        fbi->screen_size = fbi->fix.smem_len;
 
+       gd->fb_base = fbi->fix.smem_start;
+
        return 0;
 }
 
@@ -437,30 +443,6 @@ static int mxcfb_unmap_video_memory(struct fb_info *fbi)
        return 0;
 }
 
-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);
-               }
-       }
-
-       clk_enable(g_ipu_clk);
-       for (i = 0; i < ARRAY_SIZE(stat->int_stat); i++) {
-               __raw_writel(__raw_readl(&stat->int_stat[i]),
-                       &stat->int_stat[i]);
-       }
-       clk_disable(g_ipu_clk);
-}
-
 /*
  * Initializes the framebuffer information pointer. After allocating
  * sufficient memory for the framebuffer structure, the fields are
@@ -510,7 +492,7 @@ static struct fb_info *mxcfb_init_fbinfo(void)
 
 /*
  * Probe routine for the framebuffer driver. It is called during the
- * driver binding process.      The following functions are performed in
+ * driver binding process. The following functions are performed in
  * this routine: Framebuffer initialization, Memory allocation and
  * mapping, Framebuffer registration, IPU initialization.
  *
@@ -590,6 +572,27 @@ ulong calc_fbsize(void)
                NBITS(panel_info.vl_bpix)) / 8;
 }
 
+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);
+               }
+       }
+       clk_enable(g_ipu_clk);
+       for (i = 0; i < ARRAY_SIZE(stat->int_stat); i++) {
+               __raw_writel(__raw_readl(&stat->int_stat[i]),
+                            &stat->int_stat[i]);
+       }
+       clk_disable(g_ipu_clk);
+}
+
 int ipuv3_fb_init(struct fb_videomode *mode, int di, unsigned int interface_pix_fmt,
                ipu_di_clk_parent_t di_clk_parent, unsigned long di_clk_val, int bpp)
 {