*
* (C) Copyright 2004-2011 Freescale Semiconductor, Inc.
*
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier: GPL-2.0+
*/
/* #define DEBUG */
-// #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>
#include <lcd.h>
#include <ipu.h>
#include <video_fb.h>
+#include <mxcfb.h>
+
+#include "ipu_regs.h"
#include "videomodes.h"
-#include "mxcfb.h"
DECLARE_GLOBAL_DATA_PTR;
-extern vidinfo_t panel_info;
-
-void *lcd_base; /* Start of framebuffer memory */
-void *lcd_console_address; /* Start of console buffer */
-
-int lcd_line_length;
-int lcd_color_fg;
-int lcd_color_bg;
-
-short console_col;
-short console_row;
-
static int mxcfb_map_video_memory(struct fb_info *fbi);
static int mxcfb_unmap_video_memory(struct fb_info *fbi);
{
}
-void lcd_disable(void)
-{
-}
-
-void lcd_panel_disable(void)
-{
-}
-
static void fb_videomode_to_var(struct fb_var_screeninfo *var,
const struct fb_videomode *mode)
{
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;
fbi->screen_size = fbi->fix.smem_len;
+ gd->fb_base = fbi->fix.smem_start;
+
return 0;
}
/*
* 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.
*
fbi->fix.smem_len = fbi->var.yres_virtual * fbi->fix.line_length;
mxcfb_check_var(&fbi->var, fbi);
+
+ /* Default Y virtual size is 2x panel size */
+ fbi->var.yres_virtual = fbi->var.yres * 2;
+
mxcfb_set_fix(fbi);
/* allocate fb first */
NBITS(panel_info.vl_bpix)) / 8;
}
-int overwrite_console(void)
+void ipuv3_fb_shutdown(void)
{
- /* Keep stdout / stderr on serial, our LCD is for splashscreen only */
- return 1;
-}
-
-#if 0
-void lcd_ctrl_init(void *lcdbase)
-{
- u32 mem_len = panel_info.vl_col *
- panel_info.vl_row *
- NBITS(panel_info.vl_bpix) / 8;
-
- /*
- * We rely on lcdbase being a physical address, i.e., either MMU off,
- * or 1-to-1 mapping. Might want to add some virt2phys here.
- */
- if (!lcdbase)
- return;
-
- memset(lcdbase, 0, mem_len);
+ 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);
}
-#endif
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)
{
int ret;
-// default_bpp = bpp;
+ default_bpp = bpp;
ret = ipu_probe(di, di_clk_parent, di_clk_val);
if (ret) {
return ret;
}
- debug("Framebuffer at %p\n", lcd_base);
- ret = mxcfb_probe(interface_pix_fmt, mode, di);
-
- return ret;
+ return mxcfb_probe(interface_pix_fmt, mode, di);
}