* [U-Boot] [PATCH] [v2] p1022ds: add video support
@ 2010-09-22 16:46 Timur Tabi
2010-09-22 23:53 ` Anatolij Gustschin
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Timur Tabi @ 2010-09-22 16:46 UTC (permalink / raw)
To: u-boot
Add support for the DIU controller. If CONFIG_VIDEO is defined, then the
console will appear on a DVI monitor instead of the serial port.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
board/freescale/p1022ds/Makefile | 2 +
board/freescale/p1022ds/diu.c | 148 ++++++++++++++++++++++++++++++++++++++
include/configs/P1022DS.h | 13 ++--
3 files changed, 158 insertions(+), 5 deletions(-)
create mode 100644 board/freescale/p1022ds/diu.c
diff --git a/board/freescale/p1022ds/Makefile b/board/freescale/p1022ds/Makefile
index 8ede2d6..678eb2a 100644
--- a/board/freescale/p1022ds/Makefile
+++ b/board/freescale/p1022ds/Makefile
@@ -16,6 +16,8 @@ COBJS-y += ddr.o
COBJS-y += law.o
COBJS-y += tlb.o
+COBJS-$(CONFIG_FSL_DIU_FB) += diu.o
+
SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS-y))
SOBJS := $(addprefix $(obj),$(SOBJS))
diff --git a/board/freescale/p1022ds/diu.c b/board/freescale/p1022ds/diu.c
new file mode 100644
index 0000000..5cf74ba
--- /dev/null
+++ b/board/freescale/p1022ds/diu.c
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2010 Freescale Semiconductor, Inc.
+ * Authors: Timur Tabi <timur@freescale.com>
+ *
+ * FSL DIU Framebuffer driver
+ *
+ * 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.
+ */
+
+#include <common.h>
+#include <command.h>
+#include <asm/io.h>
+#include <stdio_dev.h>
+#include <video_fb.h>
+#include "../common/ngpixis.h"
+#include "../common/fsl_diu_fb.h"
+
+#define PX_BRDCFG0_ELBC_DIU 0x02
+
+#define PX_BRDCFG1_DVIEN 0x80
+#define PX_BRDCFG1_DFPEN 0x40
+#define PX_BRDCFG1_BACKLIGHT 0x20
+
+/*
+ * DIU Area Descriptor
+ *
+ * Note that we need to byte-swap the value before it's written to the AD
+ * register. So even though the registers don't look like they're in the same
+ * bit positions as they are on the MPC8610, the same value is written to the
+ * AD register on the MPC8610 and on the P1022.
+ */
+#define AD_BYTE_F 0x10000000
+#define AD_ALPHA_C_SHIFT 25
+#define AD_BLUE_C_SHIFT 23
+#define AD_GREEN_C_SHIFT 21
+#define AD_RED_C_SHIFT 19
+#define AD_PIXEL_S_SHIFT 16
+#define AD_COMP_3_SHIFT 12
+#define AD_COMP_2_SHIFT 8
+#define AD_COMP_1_SHIFT 4
+#define AD_COMP_0_SHIFT 0
+
+static int xres, yres;
+
+void diu_set_pixel_clock(unsigned int pixclock)
+{
+ ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+ unsigned long speed_ccb, temp;
+ u32 pixval;
+
+ speed_ccb = get_bus_freq(0);
+ temp = 1000000000 / pixclock;
+ temp *= 1000;
+ pixval = speed_ccb / temp;
+ debug("DIU pixval = %lu\n", pixval);
+
+ /* Modify PXCLK in GUTS CLKDVDR */
+ temp = in_be32(&gur->clkdvdr) & 0x2000FFFF;
+ out_be32(&gur->clkdvdr, temp); /* turn off clock */
+ out_be32(&gur->clkdvdr, temp | 0x80000000 | ((pixval & 0x1F) << 16));
+}
+
+static int p1022ds_diu_init(void)
+{
+ ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+ char *monitor_port;
+ u32 pixel_format;
+ u8 temp;
+
+ pixel_format = cpu_to_le32(AD_BYTE_F | (3 << AD_ALPHA_C_SHIFT) |
+ (0 << AD_BLUE_C_SHIFT) | (1 << AD_GREEN_C_SHIFT) |
+ (2 << AD_RED_C_SHIFT) | (8 << AD_COMP_3_SHIFT) |
+ (8 << AD_COMP_2_SHIFT) | (8 << AD_COMP_1_SHIFT) |
+ (8 << AD_COMP_0_SHIFT) | (3 << AD_PIXEL_S_SHIFT));
+
+ temp = in_8(&pixis->brdcfg1);
+
+ monitor_port = getenv("monitor");
+ if (!strncmp(monitor_port, "1", 1)) { /* 1 - Single link LVDS */
+ xres = 1024;
+ yres = 768;
+ /* Enable the DFP port, disable the DVI and the backlight */
+ temp &= ~(PX_BRDCFG1_DVIEN | PX_BRDCFG1_BACKLIGHT);
+ temp |= PX_BRDCFG1_DFPEN;
+ } else { /* DVI */
+ xres = 1280;
+ yres = 1024;
+ /* Enable the DVI port, disable the DFP and the backlight */
+ temp &= ~(PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT);
+ temp |= PX_BRDCFG1_DVIEN;
+ }
+
+ out_8(&pixis->brdcfg1, temp);
+
+ /*
+ * Route the LAD pins to the DIU. This will disable access to the eLBC,
+ * which means we won't be able to read/write any NOR flash addresses!
+ */
+ out_8(&pixis->brdcfg0, in_8(&pixis->brdcfg0) | PX_BRDCFG0_ELBC_DIU);
+ /* we must do the dummy read from eLBC to sync the write as above */
+ in_8(&pixis->brdcfg0);
+
+ /* Setting PMUXCR to switch to DVI from ELBC */
+ /* Set pmuxcr to allow both i2c1 and i2c2 */
+ clrsetbits_be32(&gur->pmuxcr, 0xc0000000, 0x40000000);
+ in_be32(&gur->pmuxcr);
+
+ return fsl_diu_init(xres, pixel_format, 0);
+}
+
+/*
+ * The Graphic Device
+ */
+static GraphicDevice ctfb;
+
+void *video_hw_init(void)
+{
+ struct fb_info *info;
+
+ if (p1022ds_diu_init() < 0)
+ return NULL;
+
+ /* fill in Graphic device struct */
+ sprintf(ctfb.modeIdent, "%ix%ix%i %ikHz %iHz", xres, yres, 32, 64, 60);
+
+ ctfb.frameAdrs = (unsigned int)fsl_fb_open(&info);
+ ctfb.winSizeX = xres;
+ ctfb.winSizeY = yres;
+ ctfb.plnSizeX = ctfb.winSizeX;
+ ctfb.plnSizeY = ctfb.winSizeY;
+
+ ctfb.gdfBytesPP = 4;
+ ctfb.gdfIndex = GDF_32BIT_X888RGB;
+
+ ctfb.isaBase = 0;
+ ctfb.pciBase = 0;
+ ctfb.memSize = info->screen_size;
+
+ /* Cursor Start Address */
+ ctfb.dprBase = 0;
+ ctfb.vprBase = 0;
+ ctfb.cprBase = 0;
+
+ return &ctfb;
+}
diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h
index dcaca2b..8e0117f 100644
--- a/include/configs/P1022DS.h
+++ b/include/configs/P1022DS.h
@@ -177,14 +177,17 @@
#define CONFIG_SYS_HUSH_PARSER
#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
-#define CONFIG_FSL_DIU_FB
-#define CONFIG_SYS_DIU_ADDR (CONFIG_SYS_CCSRBAR + 0x10000)
-
/* Video */
-/* #define CONFIG_VIDEO */
-#ifdef CONFIG_VIDEO
+#undef CONFIG_FSL_DIU_FB
+
+#ifdef CONFIG_FSL_DIU_FB
+#define CONFIG_SYS_DIU_ADDR (CONFIG_SYS_CCSRBAR + 0x10000)
+#define CONFIG_VIDEO
+#define CONFIG_CMD_BMP
#define CONFIG_CFB_CONSOLE
#define CONFIG_VGA_AS_SINGLE_DEVICE
+#define CONFIG_VIDEO_LOGO
+#define CONFIG_VIDEO_BMP_LOGO
#endif
/*
--
1.7.2.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH] [v2] p1022ds: add video support
2010-09-22 16:46 [U-Boot] [PATCH] [v2] p1022ds: add video support Timur Tabi
@ 2010-09-22 23:53 ` Anatolij Gustschin
2010-09-22 23:57 ` [U-Boot] [PATCH] fsl_diu_fb: further refactoring of FLS DIU code Anatolij Gustschin
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Anatolij Gustschin @ 2010-09-22 23:53 UTC (permalink / raw)
To: u-boot
Hi Timur,
On Wed, 22 Sep 2010 11:46:10 -0500
Timur Tabi <timur@freescale.com> wrote:
> Add support for the DIU controller. If CONFIG_VIDEO is defined, then the
> console will appear on a DVI monitor instead of the serial port.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
> board/freescale/p1022ds/Makefile | 2 +
> board/freescale/p1022ds/diu.c | 148 ++++++++++++++++++++++++++++++++++++++
> include/configs/P1022DS.h | 13 ++--
> 3 files changed, 158 insertions(+), 5 deletions(-)
> create mode 100644 board/freescale/p1022ds/diu.c
Thanks for fixing this. But as Wolfgang said in another thread
we should factor out common DIU code. Therefore I'm afraid
that Wolfgang will reject this patch if I submit a pull
request for it. Could you please apply a patch I'll send
you shortly and test if it breaks DIU support on P1022DS
and MPC8610HPCD? Thanks!
Anatolij
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH] fsl_diu_fb: further refactoring of FLS DIU code
2010-09-22 16:46 [U-Boot] [PATCH] [v2] p1022ds: add video support Timur Tabi
2010-09-22 23:53 ` Anatolij Gustschin
@ 2010-09-22 23:57 ` Anatolij Gustschin
2010-09-23 0:02 ` Anatolij Gustschin
2010-09-23 16:32 ` Timur Tabi
2010-09-24 5:27 ` [U-Boot] [PATCH v2 1/2] fsl_diu_fb: further refactoring of FSL " Anatolij Gustschin
2010-09-24 5:27 ` [U-Boot] [PATCH v2 2/2] p1022ds: add video support Anatolij Gustschin
3 siblings, 2 replies; 10+ messages in thread
From: Anatolij Gustschin @ 2010-09-22 23:57 UTC (permalink / raw)
To: u-boot
This is the first patch version for testing on HW I do not
have (mpc8610hpcd, p1022ds). Tested on pdm360ng board.
The patch will be modified to fix board config files as
needed in the final version. We probably should also move
fsl_diu_fb.c file to 'drivers/video'.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
arch/powerpc/cpu/mpc512x/diu.c | 62 ++----------------
board/davedenx/aria/aria.c | 5 --
board/freescale/common/fsl_diu_fb.c | 41 ++++++++++++-
board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c | 74 +++------------------
board/freescale/p1022ds/diu.c | 52 ++-------------
board/pdm360ng/pdm360ng.c | 3 -
include/configs/MPC8610HPCD.h | 4 +-
include/configs/P1022DS.h | 2 +-
{board/freescale/common => include}/fsl_diu_fb.h | 1 +
9 files changed, 70 insertions(+), 174 deletions(-)
rename {board/freescale/common => include}/fsl_diu_fb.h (97%)
diff --git a/arch/powerpc/cpu/mpc512x/diu.c b/arch/powerpc/cpu/mpc512x/diu.c
index fa4a0bc..c4108af 100644
--- a/arch/powerpc/cpu/mpc512x/diu.c
+++ b/arch/powerpc/cpu/mpc512x/diu.c
@@ -27,17 +27,10 @@
#include <command.h>
#include <asm/io.h>
-#include "../../../../board/freescale/common/fsl_diu_fb.h"
-
-#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
-#include <stdio_dev.h>
-#include <video_fb.h>
-#endif
+#include <fsl_diu_fb.h>
DECLARE_GLOBAL_DATA_PTR;
-static int xres, yres;
-
void diu_set_pixel_clock(unsigned int pixclock)
{
volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
@@ -58,61 +51,20 @@ void diu_set_pixel_clock(unsigned int pixclock)
debug("DIU: Modified value of CLKDVDR = 0x%08x\n", in_be32(clkdvdr));
}
-int mpc5121_diu_init(void)
+int platform_diu_init(unsigned int *xres, unsigned int *yres)
{
unsigned int pixel_format;
#if defined(CONFIG_VIDEO_XRES) & defined(CONFIG_VIDEO_YRES)
- xres = CONFIG_VIDEO_XRES;
- yres = CONFIG_VIDEO_YRES;
+ *xres = CONFIG_VIDEO_XRES;
+ *yres = CONFIG_VIDEO_YRES;
#else
- xres = 1024;
- yres = 768;
+ *xres = 1024;
+ *yres = 768;
#endif
pixel_format = 0x88883316;
debug("mpc5121_diu_init\n");
- return fsl_diu_init(xres, pixel_format, 0);
+ return fsl_diu_init(*xres, pixel_format, 0);
}
-
-#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
-
-/*
- * The Graphic Device
- */
-GraphicDevice ctfb;
-void *video_hw_init(void)
-{
- GraphicDevice *pGD = (GraphicDevice *) &ctfb;
- struct fb_info *info;
-
- if (mpc5121_diu_init() < 0)
- return NULL;
-
- /* fill in Graphic device struct */
- sprintf(pGD->modeIdent, "%dx%dx%d %dkHz %dHz",
- xres, yres, 32, 64, 60);
-
- pGD->frameAdrs = (unsigned int)fsl_fb_open(&info);
- pGD->winSizeX = xres;
- pGD->winSizeY = yres;
- pGD->plnSizeX = pGD->winSizeX;
- pGD->plnSizeY = pGD->winSizeY;
-
- pGD->gdfBytesPP = 4;
- pGD->gdfIndex = GDF_32BIT_X888RGB;
-
- pGD->isaBase = 0;
- pGD->pciBase = 0;
- pGD->memSize = info->screen_size;
-
- /* Cursor Start Address */
- pGD->dprBase = 0;
- pGD->vprBase = 0;
- pGD->cprBase = 0;
-
- return (void *)pGD;
-}
-
-#endif /* defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) */
diff --git a/board/davedenx/aria/aria.c b/board/davedenx/aria/aria.c
index f17df60..31b079b 100644
--- a/board/davedenx/aria/aria.c
+++ b/board/davedenx/aria/aria.c
@@ -119,11 +119,6 @@ int misc_init_r(void)
tmp & 0x000000FF
);
-#ifdef CONFIG_FSL_DIU_FB
-# if !(defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE))
- mpc5121_diu_init();
-# endif
-#endif
return 0;
}
diff --git a/board/freescale/common/fsl_diu_fb.c b/board/freescale/common/fsl_diu_fb.c
index 394b71f..35ed938 100644
--- a/board/freescale/common/fsl_diu_fb.c
+++ b/board/freescale/common/fsl_diu_fb.c
@@ -28,7 +28,7 @@
#include <malloc.h>
#include <asm/io.h>
-#include "fsl_diu_fb.h"
+#include <fsl_diu_fb.h>
struct fb_videomode {
const char *name; /* optional */
@@ -472,3 +472,42 @@ static int allocate_buf(struct diu_addr *buf, u32 size, u32 bytes_align)
buf->offset = 0;
return 0;
}
+
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+#include <stdio_dev.h>
+#include <video_fb.h>
+/*
+ * The Graphic Device
+ */
+static GraphicDevice ctfb;
+
+void *video_hw_init(void)
+{
+ struct fb_info *info;
+
+ if (platform_diu_init(&ctfb.winSizeX, &ctfb.winSizeY) < 0)
+ return NULL;
+
+ /* fill in Graphic device struct */
+ sprintf(ctfb.modeIdent, "%ix%ix%i %ikHz %iHz",
+ ctfb.winSizeX, ctfb.winSizeY, 32, 64, 60);
+
+ ctfb.frameAdrs = (unsigned int)fsl_fb_open(&info);
+ ctfb.plnSizeX = ctfb.winSizeX;
+ ctfb.plnSizeY = ctfb.winSizeY;
+
+ ctfb.gdfBytesPP = 4;
+ ctfb.gdfIndex = GDF_32BIT_X888RGB;
+
+ ctfb.isaBase = 0;
+ ctfb.pciBase = 0;
+ ctfb.memSize = info->screen_size;
+
+ /* Cursor Start Address */
+ ctfb.dprBase = 0;
+ ctfb.vprBase = 0;
+ ctfb.cprBase = 0;
+
+ return &ctfb;
+}
+#endif /* defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) */
diff --git a/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c b/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c
index 960c8ed..81e53e7 100644
--- a/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c
+++ b/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c
@@ -26,17 +26,7 @@
#include <common.h>
#include <command.h>
#include <asm/io.h>
-
-#ifdef CONFIG_FSL_DIU_FB
-
-#include "../common/fsl_diu_fb.h"
-
-#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
-#include <stdio_dev.h>
-#include <video_fb.h>
-#endif
-
-static int xres, yres;
+#include <fsl_diu_fb.h>
void diu_set_pixel_clock(unsigned int pixclock)
{
@@ -59,7 +49,7 @@ void diu_set_pixel_clock(unsigned int pixclock)
debug("DIU: Modified value of CLKDVDR = 0x%08x\n", *guts_clkdvdr);
}
-int mpc8610hpcd_diu_init(void)
+int platform_diu_init(unsigned int *xres, unsigned int *yres)
{
char *monitor_port;
int gamma_fix;
@@ -73,8 +63,8 @@ int mpc8610hpcd_diu_init(void)
monitor_port = getenv("monitor");
if (!strncmp(monitor_port, "0", 1)) { /* 0 - DVI */
- xres = 1280;
- yres = 1024;
+ *xres = 1280;
+ *yres = 1024;
if (pixis_arch == 0x01)
pixel_format = 0x88882317;
else
@@ -83,68 +73,26 @@ int mpc8610hpcd_diu_init(void)
out_8(pixis_base + PIXIS_BRDCFG0, tmp_val | 0x08);
} else if (!strncmp(monitor_port, "1", 1)) { /* 1 - Single link LVDS */
- xres = 1024;
- yres = 768;
+ *xres = 1024;
+ *yres = 768;
pixel_format = 0x88883316;
gamma_fix = 0;
out_8(pixis_base + PIXIS_BRDCFG0, (tmp_val & 0xf7) | 0x10);
} else if (!strncmp(monitor_port, "2", 1)) { /* 2 - Double link LVDS */
- xres = 1280;
- yres = 1024;
+ *xres = 1280;
+ *yres = 1024;
pixel_format = 0x88883316;
gamma_fix = 1;
out_8(pixis_base + PIXIS_BRDCFG0, tmp_val & 0xe7);
} else { /* DVI */
- xres = 1280;
- yres = 1024;
+ *xres = 1280;
+ *yres = 1024;
pixel_format = 0x88882317;
gamma_fix = 0;
out_8(pixis_base + PIXIS_BRDCFG0, tmp_val | 0x08);
}
- return fsl_diu_init(xres, pixel_format, gamma_fix);
-}
-
-#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
-
-/*
- * The Graphic Device
- */
-static GraphicDevice ctfb;
-
-void *video_hw_init(void)
-{
- struct fb_info *info;
-
- if (mpc8610hpcd_diu_init() < 0)
- return NULL;
-
- /* fill in Graphic device struct */
- sprintf(ctfb.modeIdent, "%ix%ix%i %ikHz %iHz", xres, yres, 32, 64, 60);
-
- ctfb.frameAdrs = (unsigned int)fsl_fb_open(&info);
- ctfb.winSizeX = xres;
- ctfb.winSizeY = yres;
- ctfb.plnSizeX = ctfb.winSizeX;
- ctfb.plnSizeY = ctfb.winSizeY;
-
- ctfb.gdfBytesPP = 4;
- ctfb.gdfIndex = GDF_32BIT_X888RGB;
-
- ctfb.isaBase = 0;
- ctfb.pciBase = 0;
- ctfb.memSize = info->screen_size;
-
- /* Cursor Start Address */
- ctfb.dprBase = 0;
- ctfb.vprBase = 0;
- ctfb.cprBase = 0;
-
- return &ctfb;
+ return fsl_diu_init(*xres, pixel_format, gamma_fix);
}
-
-#endif /* defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) */
-
-#endif /* CONFIG_FSL_DIU_FB */
diff --git a/board/freescale/p1022ds/diu.c b/board/freescale/p1022ds/diu.c
index 5cf74ba..5ca84df 100644
--- a/board/freescale/p1022ds/diu.c
+++ b/board/freescale/p1022ds/diu.c
@@ -16,7 +16,7 @@
#include <stdio_dev.h>
#include <video_fb.h>
#include "../common/ngpixis.h"
-#include "../common/fsl_diu_fb.h"
+#include <fsl_diu_fb.h>
#define PX_BRDCFG0_ELBC_DIU 0x02
@@ -43,8 +43,6 @@
#define AD_COMP_1_SHIFT 4
#define AD_COMP_0_SHIFT 0
-static int xres, yres;
-
void diu_set_pixel_clock(unsigned int pixclock)
{
ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
@@ -63,7 +61,7 @@ void diu_set_pixel_clock(unsigned int pixclock)
out_be32(&gur->clkdvdr, temp | 0x80000000 | ((pixval & 0x1F) << 16));
}
-static int p1022ds_diu_init(void)
+int platform_diu_init(unsigned int *xres, unsigned int *yres)
{
ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
char *monitor_port;
@@ -80,14 +78,14 @@ static int p1022ds_diu_init(void)
monitor_port = getenv("monitor");
if (!strncmp(monitor_port, "1", 1)) { /* 1 - Single link LVDS */
- xres = 1024;
- yres = 768;
+ *xres = 1024;
+ *yres = 768;
/* Enable the DFP port, disable the DVI and the backlight */
temp &= ~(PX_BRDCFG1_DVIEN | PX_BRDCFG1_BACKLIGHT);
temp |= PX_BRDCFG1_DFPEN;
} else { /* DVI */
- xres = 1280;
- yres = 1024;
+ *xres = 1280;
+ *yres = 1024;
/* Enable the DVI port, disable the DFP and the backlight */
temp &= ~(PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT);
temp |= PX_BRDCFG1_DVIEN;
@@ -108,41 +106,5 @@ static int p1022ds_diu_init(void)
clrsetbits_be32(&gur->pmuxcr, 0xc0000000, 0x40000000);
in_be32(&gur->pmuxcr);
- return fsl_diu_init(xres, pixel_format, 0);
-}
-
-/*
- * The Graphic Device
- */
-static GraphicDevice ctfb;
-
-void *video_hw_init(void)
-{
- struct fb_info *info;
-
- if (p1022ds_diu_init() < 0)
- return NULL;
-
- /* fill in Graphic device struct */
- sprintf(ctfb.modeIdent, "%ix%ix%i %ikHz %iHz", xres, yres, 32, 64, 60);
-
- ctfb.frameAdrs = (unsigned int)fsl_fb_open(&info);
- ctfb.winSizeX = xres;
- ctfb.winSizeY = yres;
- ctfb.plnSizeX = ctfb.winSizeX;
- ctfb.plnSizeY = ctfb.winSizeY;
-
- ctfb.gdfBytesPP = 4;
- ctfb.gdfIndex = GDF_32BIT_X888RGB;
-
- ctfb.isaBase = 0;
- ctfb.pciBase = 0;
- ctfb.memSize = info->screen_size;
-
- /* Cursor Start Address */
- ctfb.dprBase = 0;
- ctfb.vprBase = 0;
- ctfb.cprBase = 0;
-
- return &ctfb;
+ return fsl_diu_init(*xres, pixel_format, 0);
}
diff --git a/board/pdm360ng/pdm360ng.c b/board/pdm360ng/pdm360ng.c
index e3abeb8..e8714e3 100644
--- a/board/pdm360ng/pdm360ng.c
+++ b/board/pdm360ng/pdm360ng.c
@@ -237,9 +237,6 @@ int misc_init_r(void)
#endif
#ifdef CONFIG_FSL_DIU_FB
-# if !(defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE))
- mpc5121_diu_init();
-#endif
#if defined(CONFIG_SERIAL_MULTI)
set_lcd_brightness(0);
#endif
diff --git a/include/configs/MPC8610HPCD.h b/include/configs/MPC8610HPCD.h
index 58d3d99..9f3f843 100644
--- a/include/configs/MPC8610HPCD.h
+++ b/include/configs/MPC8610HPCD.h
@@ -22,7 +22,9 @@
#define CONFIG_FSL_DIU_FB 1 /* FSL DIU */
/* video */
-#undef CONFIG_VIDEO
+#ifdef CONFIG_FSL_DIU_FB
+#define CONFIG_VIDEO
+#endif
#ifdef CONFIG_VIDEO
#define CONFIG_CMD_BMP
diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h
index 8e0117f..523494d 100644
--- a/include/configs/P1022DS.h
+++ b/include/configs/P1022DS.h
@@ -178,7 +178,7 @@
#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
/* Video */
-#undef CONFIG_FSL_DIU_FB
+#define CONFIG_FSL_DIU_FB
#ifdef CONFIG_FSL_DIU_FB
#define CONFIG_SYS_DIU_ADDR (CONFIG_SYS_CCSRBAR + 0x10000)
diff --git a/board/freescale/common/fsl_diu_fb.h b/include/fsl_diu_fb.h
similarity index 97%
rename from board/freescale/common/fsl_diu_fb.h
rename to include/fsl_diu_fb.h
index 3a5fc9f..87443e1 100644
--- a/board/freescale/common/fsl_diu_fb.h
+++ b/include/fsl_diu_fb.h
@@ -57,3 +57,4 @@ struct fb_info {
extern char *fsl_fb_open(struct fb_info **info);
int fsl_diu_init(int xres, unsigned int pixel_format, int gamma_fix);
+int platform_diu_init(unsigned int *xres, unsigned int *yres);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH] fsl_diu_fb: further refactoring of FLS DIU code
2010-09-22 23:57 ` [U-Boot] [PATCH] fsl_diu_fb: further refactoring of FLS DIU code Anatolij Gustschin
@ 2010-09-23 0:02 ` Anatolij Gustschin
2010-09-23 16:32 ` Timur Tabi
1 sibling, 0 replies; 10+ messages in thread
From: Anatolij Gustschin @ 2010-09-23 0:02 UTC (permalink / raw)
To: u-boot
On Thu, 23 Sep 2010 01:57:16 +0200
Anatolij Gustschin <agust@denx.de> wrote:
> This is the first patch version for testing on HW I do not
> have (mpc8610hpcd, p1022ds). Tested on pdm360ng board.
>
> The patch will be modified to fix board config files as
> needed in the final version. We probably should also move
> fsl_diu_fb.c file to 'drivers/video'.
Note: This applies on top of your p1022ds video patch v2
applied to u-boot.git/next branch.
Thanks,
Anatolij
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH] fsl_diu_fb: further refactoring of FLS DIU code
2010-09-22 23:57 ` [U-Boot] [PATCH] fsl_diu_fb: further refactoring of FLS DIU code Anatolij Gustschin
2010-09-23 0:02 ` Anatolij Gustschin
@ 2010-09-23 16:32 ` Timur Tabi
2010-09-23 16:38 ` Anatolij Gustschin
1 sibling, 1 reply; 10+ messages in thread
From: Timur Tabi @ 2010-09-23 16:32 UTC (permalink / raw)
To: u-boot
Anatolij Gustschin wrote:
> This is the first patch version for testing on HW I do not
> have (mpc8610hpcd, p1022ds). Tested on pdm360ng board.
>
> The patch will be modified to fix board config files as
> needed in the final version. We probably should also move
> fsl_diu_fb.c file to 'drivers/video'.
This works, except the default should be CONFIG_VIDEO is undefined. It's
unlikely the customer will have a monitor connected to the DVI port.
So ...
> diff --git a/include/configs/MPC8610HPCD.h b/include/configs/MPC8610HPCD.h
> index 58d3d99..9f3f843 100644
> --- a/include/configs/MPC8610HPCD.h
> +++ b/include/configs/MPC8610HPCD.h
> @@ -22,7 +22,9 @@
> #define CONFIG_FSL_DIU_FB 1 /* FSL DIU */
>
> /* video */
> -#undef CONFIG_VIDEO
> +#ifdef CONFIG_FSL_DIU_FB
> +#define CONFIG_VIDEO
> +#endif
leave this undefined, and ...
> diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h
> index 8e0117f..523494d 100644
> --- a/include/configs/P1022DS.h
> +++ b/include/configs/P1022DS.h
> @@ -178,7 +178,7 @@
> #define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
>
> /* Video */
> -#undef CONFIG_FSL_DIU_FB
> +#define CONFIG_FSL_DIU_FB
don't make this change.
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH] fsl_diu_fb: further refactoring of FLS DIU code
2010-09-23 16:32 ` Timur Tabi
@ 2010-09-23 16:38 ` Anatolij Gustschin
0 siblings, 0 replies; 10+ messages in thread
From: Anatolij Gustschin @ 2010-09-23 16:38 UTC (permalink / raw)
To: u-boot
On Thu, 23 Sep 2010 11:32:17 -0500
Timur Tabi <timur@freescale.com> wrote:
> Anatolij Gustschin wrote:
> > This is the first patch version for testing on HW I do not
> > have (mpc8610hpcd, p1022ds). Tested on pdm360ng board.
> >
> > The patch will be modified to fix board config files as
> > needed in the final version. We probably should also move
> > fsl_diu_fb.c file to 'drivers/video'.
>
> This works, except the default should be CONFIG_VIDEO is undefined. It's
> unlikely the customer will have a monitor connected to the DVI port.
Ok, thanks.
> > +++ b/include/configs/MPC8610HPCD.h
> > @@ -22,7 +22,9 @@
> > #define CONFIG_FSL_DIU_FB 1 /* FSL DIU */
> >
> > /* video */
> > -#undef CONFIG_VIDEO
> > +#ifdef CONFIG_FSL_DIU_FB
> > +#define CONFIG_VIDEO
> > +#endif
>
> leave this undefined, and ...
Okay.
...
> > +++ b/include/configs/P1022DS.h
> > @@ -178,7 +178,7 @@
> > #define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
> >
> > /* Video */
> > -#undef CONFIG_FSL_DIU_FB
> > +#define CONFIG_FSL_DIU_FB
>
> don't make this change.
Yes. I enabled it for your test and will remove it.
Thanks,
Anatolij
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH v2 1/2] fsl_diu_fb: further refactoring of FSL DIU code
2010-09-22 16:46 [U-Boot] [PATCH] [v2] p1022ds: add video support Timur Tabi
2010-09-22 23:53 ` Anatolij Gustschin
2010-09-22 23:57 ` [U-Boot] [PATCH] fsl_diu_fb: further refactoring of FLS DIU code Anatolij Gustschin
@ 2010-09-24 5:27 ` Anatolij Gustschin
2010-09-25 11:49 ` Anatolij Gustschin
2010-09-24 5:27 ` [U-Boot] [PATCH v2 2/2] p1022ds: add video support Anatolij Gustschin
3 siblings, 1 reply; 10+ messages in thread
From: Anatolij Gustschin @ 2010-09-24 5:27 UTC (permalink / raw)
To: u-boot
Move common code to the fsl_diu_fb.c file and remove obsolete
code from board files (aria, mpc8610hpcd and pdm360ng).
Move fsl_diu_fb.h file to the include directory.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
v2:
- fixed commit message
- dropped p1022ds fixes as the cleaned up p1022ds video
patch will be applied on top of this patch
- dropped unneeded board config file changes
arch/powerpc/cpu/mpc512x/diu.c | 62 ++----------------
board/davedenx/aria/aria.c | 5 --
board/freescale/common/fsl_diu_fb.c | 41 ++++++++++++-
board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c | 74 +++------------------
board/pdm360ng/pdm360ng.c | 3 -
{board/freescale/common => include}/fsl_diu_fb.h | 1 +
6 files changed, 59 insertions(+), 127 deletions(-)
rename {board/freescale/common => include}/fsl_diu_fb.h (97%)
diff --git a/arch/powerpc/cpu/mpc512x/diu.c b/arch/powerpc/cpu/mpc512x/diu.c
index fa4a0bc..c4108af 100644
--- a/arch/powerpc/cpu/mpc512x/diu.c
+++ b/arch/powerpc/cpu/mpc512x/diu.c
@@ -27,17 +27,10 @@
#include <command.h>
#include <asm/io.h>
-#include "../../../../board/freescale/common/fsl_diu_fb.h"
-
-#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
-#include <stdio_dev.h>
-#include <video_fb.h>
-#endif
+#include <fsl_diu_fb.h>
DECLARE_GLOBAL_DATA_PTR;
-static int xres, yres;
-
void diu_set_pixel_clock(unsigned int pixclock)
{
volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
@@ -58,61 +51,20 @@ void diu_set_pixel_clock(unsigned int pixclock)
debug("DIU: Modified value of CLKDVDR = 0x%08x\n", in_be32(clkdvdr));
}
-int mpc5121_diu_init(void)
+int platform_diu_init(unsigned int *xres, unsigned int *yres)
{
unsigned int pixel_format;
#if defined(CONFIG_VIDEO_XRES) & defined(CONFIG_VIDEO_YRES)
- xres = CONFIG_VIDEO_XRES;
- yres = CONFIG_VIDEO_YRES;
+ *xres = CONFIG_VIDEO_XRES;
+ *yres = CONFIG_VIDEO_YRES;
#else
- xres = 1024;
- yres = 768;
+ *xres = 1024;
+ *yres = 768;
#endif
pixel_format = 0x88883316;
debug("mpc5121_diu_init\n");
- return fsl_diu_init(xres, pixel_format, 0);
+ return fsl_diu_init(*xres, pixel_format, 0);
}
-
-#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
-
-/*
- * The Graphic Device
- */
-GraphicDevice ctfb;
-void *video_hw_init(void)
-{
- GraphicDevice *pGD = (GraphicDevice *) &ctfb;
- struct fb_info *info;
-
- if (mpc5121_diu_init() < 0)
- return NULL;
-
- /* fill in Graphic device struct */
- sprintf(pGD->modeIdent, "%dx%dx%d %dkHz %dHz",
- xres, yres, 32, 64, 60);
-
- pGD->frameAdrs = (unsigned int)fsl_fb_open(&info);
- pGD->winSizeX = xres;
- pGD->winSizeY = yres;
- pGD->plnSizeX = pGD->winSizeX;
- pGD->plnSizeY = pGD->winSizeY;
-
- pGD->gdfBytesPP = 4;
- pGD->gdfIndex = GDF_32BIT_X888RGB;
-
- pGD->isaBase = 0;
- pGD->pciBase = 0;
- pGD->memSize = info->screen_size;
-
- /* Cursor Start Address */
- pGD->dprBase = 0;
- pGD->vprBase = 0;
- pGD->cprBase = 0;
-
- return (void *)pGD;
-}
-
-#endif /* defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) */
diff --git a/board/davedenx/aria/aria.c b/board/davedenx/aria/aria.c
index f17df60..31b079b 100644
--- a/board/davedenx/aria/aria.c
+++ b/board/davedenx/aria/aria.c
@@ -119,11 +119,6 @@ int misc_init_r(void)
tmp & 0x000000FF
);
-#ifdef CONFIG_FSL_DIU_FB
-# if !(defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE))
- mpc5121_diu_init();
-# endif
-#endif
return 0;
}
diff --git a/board/freescale/common/fsl_diu_fb.c b/board/freescale/common/fsl_diu_fb.c
index 394b71f..35ed938 100644
--- a/board/freescale/common/fsl_diu_fb.c
+++ b/board/freescale/common/fsl_diu_fb.c
@@ -28,7 +28,7 @@
#include <malloc.h>
#include <asm/io.h>
-#include "fsl_diu_fb.h"
+#include <fsl_diu_fb.h>
struct fb_videomode {
const char *name; /* optional */
@@ -472,3 +472,42 @@ static int allocate_buf(struct diu_addr *buf, u32 size, u32 bytes_align)
buf->offset = 0;
return 0;
}
+
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+#include <stdio_dev.h>
+#include <video_fb.h>
+/*
+ * The Graphic Device
+ */
+static GraphicDevice ctfb;
+
+void *video_hw_init(void)
+{
+ struct fb_info *info;
+
+ if (platform_diu_init(&ctfb.winSizeX, &ctfb.winSizeY) < 0)
+ return NULL;
+
+ /* fill in Graphic device struct */
+ sprintf(ctfb.modeIdent, "%ix%ix%i %ikHz %iHz",
+ ctfb.winSizeX, ctfb.winSizeY, 32, 64, 60);
+
+ ctfb.frameAdrs = (unsigned int)fsl_fb_open(&info);
+ ctfb.plnSizeX = ctfb.winSizeX;
+ ctfb.plnSizeY = ctfb.winSizeY;
+
+ ctfb.gdfBytesPP = 4;
+ ctfb.gdfIndex = GDF_32BIT_X888RGB;
+
+ ctfb.isaBase = 0;
+ ctfb.pciBase = 0;
+ ctfb.memSize = info->screen_size;
+
+ /* Cursor Start Address */
+ ctfb.dprBase = 0;
+ ctfb.vprBase = 0;
+ ctfb.cprBase = 0;
+
+ return &ctfb;
+}
+#endif /* defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) */
diff --git a/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c b/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c
index 960c8ed..81e53e7 100644
--- a/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c
+++ b/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c
@@ -26,17 +26,7 @@
#include <common.h>
#include <command.h>
#include <asm/io.h>
-
-#ifdef CONFIG_FSL_DIU_FB
-
-#include "../common/fsl_diu_fb.h"
-
-#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
-#include <stdio_dev.h>
-#include <video_fb.h>
-#endif
-
-static int xres, yres;
+#include <fsl_diu_fb.h>
void diu_set_pixel_clock(unsigned int pixclock)
{
@@ -59,7 +49,7 @@ void diu_set_pixel_clock(unsigned int pixclock)
debug("DIU: Modified value of CLKDVDR = 0x%08x\n", *guts_clkdvdr);
}
-int mpc8610hpcd_diu_init(void)
+int platform_diu_init(unsigned int *xres, unsigned int *yres)
{
char *monitor_port;
int gamma_fix;
@@ -73,8 +63,8 @@ int mpc8610hpcd_diu_init(void)
monitor_port = getenv("monitor");
if (!strncmp(monitor_port, "0", 1)) { /* 0 - DVI */
- xres = 1280;
- yres = 1024;
+ *xres = 1280;
+ *yres = 1024;
if (pixis_arch == 0x01)
pixel_format = 0x88882317;
else
@@ -83,68 +73,26 @@ int mpc8610hpcd_diu_init(void)
out_8(pixis_base + PIXIS_BRDCFG0, tmp_val | 0x08);
} else if (!strncmp(monitor_port, "1", 1)) { /* 1 - Single link LVDS */
- xres = 1024;
- yres = 768;
+ *xres = 1024;
+ *yres = 768;
pixel_format = 0x88883316;
gamma_fix = 0;
out_8(pixis_base + PIXIS_BRDCFG0, (tmp_val & 0xf7) | 0x10);
} else if (!strncmp(monitor_port, "2", 1)) { /* 2 - Double link LVDS */
- xres = 1280;
- yres = 1024;
+ *xres = 1280;
+ *yres = 1024;
pixel_format = 0x88883316;
gamma_fix = 1;
out_8(pixis_base + PIXIS_BRDCFG0, tmp_val & 0xe7);
} else { /* DVI */
- xres = 1280;
- yres = 1024;
+ *xres = 1280;
+ *yres = 1024;
pixel_format = 0x88882317;
gamma_fix = 0;
out_8(pixis_base + PIXIS_BRDCFG0, tmp_val | 0x08);
}
- return fsl_diu_init(xres, pixel_format, gamma_fix);
-}
-
-#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
-
-/*
- * The Graphic Device
- */
-static GraphicDevice ctfb;
-
-void *video_hw_init(void)
-{
- struct fb_info *info;
-
- if (mpc8610hpcd_diu_init() < 0)
- return NULL;
-
- /* fill in Graphic device struct */
- sprintf(ctfb.modeIdent, "%ix%ix%i %ikHz %iHz", xres, yres, 32, 64, 60);
-
- ctfb.frameAdrs = (unsigned int)fsl_fb_open(&info);
- ctfb.winSizeX = xres;
- ctfb.winSizeY = yres;
- ctfb.plnSizeX = ctfb.winSizeX;
- ctfb.plnSizeY = ctfb.winSizeY;
-
- ctfb.gdfBytesPP = 4;
- ctfb.gdfIndex = GDF_32BIT_X888RGB;
-
- ctfb.isaBase = 0;
- ctfb.pciBase = 0;
- ctfb.memSize = info->screen_size;
-
- /* Cursor Start Address */
- ctfb.dprBase = 0;
- ctfb.vprBase = 0;
- ctfb.cprBase = 0;
-
- return &ctfb;
+ return fsl_diu_init(*xres, pixel_format, gamma_fix);
}
-
-#endif /* defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) */
-
-#endif /* CONFIG_FSL_DIU_FB */
diff --git a/board/pdm360ng/pdm360ng.c b/board/pdm360ng/pdm360ng.c
index e3abeb8..e8714e3 100644
--- a/board/pdm360ng/pdm360ng.c
+++ b/board/pdm360ng/pdm360ng.c
@@ -237,9 +237,6 @@ int misc_init_r(void)
#endif
#ifdef CONFIG_FSL_DIU_FB
-# if !(defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE))
- mpc5121_diu_init();
-#endif
#if defined(CONFIG_SERIAL_MULTI)
set_lcd_brightness(0);
#endif
diff --git a/board/freescale/common/fsl_diu_fb.h b/include/fsl_diu_fb.h
similarity index 97%
rename from board/freescale/common/fsl_diu_fb.h
rename to include/fsl_diu_fb.h
index 3a5fc9f..87443e1 100644
--- a/board/freescale/common/fsl_diu_fb.h
+++ b/include/fsl_diu_fb.h
@@ -57,3 +57,4 @@ struct fb_info {
extern char *fsl_fb_open(struct fb_info **info);
int fsl_diu_init(int xres, unsigned int pixel_format, int gamma_fix);
+int platform_diu_init(unsigned int *xres, unsigned int *yres);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH v2 2/2] p1022ds: add video support
2010-09-22 16:46 [U-Boot] [PATCH] [v2] p1022ds: add video support Timur Tabi
` (2 preceding siblings ...)
2010-09-24 5:27 ` [U-Boot] [PATCH v2 1/2] fsl_diu_fb: further refactoring of FSL " Anatolij Gustschin
@ 2010-09-24 5:27 ` Anatolij Gustschin
2010-09-25 11:51 ` Anatolij Gustschin
3 siblings, 1 reply; 10+ messages in thread
From: Anatolij Gustschin @ 2010-09-24 5:27 UTC (permalink / raw)
To: u-boot
From: Timur Tabi <timur@freescale.com>
Add support for the DIU controller. If CONFIG_VIDEO is defined, then
the console will appear on a DVI monitor instead of the serial port.
Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
v2:
- rebased on top of FSL DIU code refactoring patch
to avoid some code duplication.
board/freescale/p1022ds/Makefile | 2 +
board/freescale/p1022ds/diu.c | 110 ++++++++++++++++++++++++++++++++++++++
include/configs/P1022DS.h | 13 +++--
3 files changed, 120 insertions(+), 5 deletions(-)
create mode 100644 board/freescale/p1022ds/diu.c
diff --git a/board/freescale/p1022ds/Makefile b/board/freescale/p1022ds/Makefile
index 8ede2d6..678eb2a 100644
--- a/board/freescale/p1022ds/Makefile
+++ b/board/freescale/p1022ds/Makefile
@@ -16,6 +16,8 @@ COBJS-y += ddr.o
COBJS-y += law.o
COBJS-y += tlb.o
+COBJS-$(CONFIG_FSL_DIU_FB) += diu.o
+
SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS-y))
SOBJS := $(addprefix $(obj),$(SOBJS))
diff --git a/board/freescale/p1022ds/diu.c b/board/freescale/p1022ds/diu.c
new file mode 100644
index 0000000..5ca84df
--- /dev/null
+++ b/board/freescale/p1022ds/diu.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2010 Freescale Semiconductor, Inc.
+ * Authors: Timur Tabi <timur@freescale.com>
+ *
+ * FSL DIU Framebuffer driver
+ *
+ * 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.
+ */
+
+#include <common.h>
+#include <command.h>
+#include <asm/io.h>
+#include <stdio_dev.h>
+#include <video_fb.h>
+#include "../common/ngpixis.h"
+#include <fsl_diu_fb.h>
+
+#define PX_BRDCFG0_ELBC_DIU 0x02
+
+#define PX_BRDCFG1_DVIEN 0x80
+#define PX_BRDCFG1_DFPEN 0x40
+#define PX_BRDCFG1_BACKLIGHT 0x20
+
+/*
+ * DIU Area Descriptor
+ *
+ * Note that we need to byte-swap the value before it's written to the AD
+ * register. So even though the registers don't look like they're in the same
+ * bit positions as they are on the MPC8610, the same value is written to the
+ * AD register on the MPC8610 and on the P1022.
+ */
+#define AD_BYTE_F 0x10000000
+#define AD_ALPHA_C_SHIFT 25
+#define AD_BLUE_C_SHIFT 23
+#define AD_GREEN_C_SHIFT 21
+#define AD_RED_C_SHIFT 19
+#define AD_PIXEL_S_SHIFT 16
+#define AD_COMP_3_SHIFT 12
+#define AD_COMP_2_SHIFT 8
+#define AD_COMP_1_SHIFT 4
+#define AD_COMP_0_SHIFT 0
+
+void diu_set_pixel_clock(unsigned int pixclock)
+{
+ ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+ unsigned long speed_ccb, temp;
+ u32 pixval;
+
+ speed_ccb = get_bus_freq(0);
+ temp = 1000000000 / pixclock;
+ temp *= 1000;
+ pixval = speed_ccb / temp;
+ debug("DIU pixval = %lu\n", pixval);
+
+ /* Modify PXCLK in GUTS CLKDVDR */
+ temp = in_be32(&gur->clkdvdr) & 0x2000FFFF;
+ out_be32(&gur->clkdvdr, temp); /* turn off clock */
+ out_be32(&gur->clkdvdr, temp | 0x80000000 | ((pixval & 0x1F) << 16));
+}
+
+int platform_diu_init(unsigned int *xres, unsigned int *yres)
+{
+ ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+ char *monitor_port;
+ u32 pixel_format;
+ u8 temp;
+
+ pixel_format = cpu_to_le32(AD_BYTE_F | (3 << AD_ALPHA_C_SHIFT) |
+ (0 << AD_BLUE_C_SHIFT) | (1 << AD_GREEN_C_SHIFT) |
+ (2 << AD_RED_C_SHIFT) | (8 << AD_COMP_3_SHIFT) |
+ (8 << AD_COMP_2_SHIFT) | (8 << AD_COMP_1_SHIFT) |
+ (8 << AD_COMP_0_SHIFT) | (3 << AD_PIXEL_S_SHIFT));
+
+ temp = in_8(&pixis->brdcfg1);
+
+ monitor_port = getenv("monitor");
+ if (!strncmp(monitor_port, "1", 1)) { /* 1 - Single link LVDS */
+ *xres = 1024;
+ *yres = 768;
+ /* Enable the DFP port, disable the DVI and the backlight */
+ temp &= ~(PX_BRDCFG1_DVIEN | PX_BRDCFG1_BACKLIGHT);
+ temp |= PX_BRDCFG1_DFPEN;
+ } else { /* DVI */
+ *xres = 1280;
+ *yres = 1024;
+ /* Enable the DVI port, disable the DFP and the backlight */
+ temp &= ~(PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT);
+ temp |= PX_BRDCFG1_DVIEN;
+ }
+
+ out_8(&pixis->brdcfg1, temp);
+
+ /*
+ * Route the LAD pins to the DIU. This will disable access to the eLBC,
+ * which means we won't be able to read/write any NOR flash addresses!
+ */
+ out_8(&pixis->brdcfg0, in_8(&pixis->brdcfg0) | PX_BRDCFG0_ELBC_DIU);
+ /* we must do the dummy read from eLBC to sync the write as above */
+ in_8(&pixis->brdcfg0);
+
+ /* Setting PMUXCR to switch to DVI from ELBC */
+ /* Set pmuxcr to allow both i2c1 and i2c2 */
+ clrsetbits_be32(&gur->pmuxcr, 0xc0000000, 0x40000000);
+ in_be32(&gur->pmuxcr);
+
+ return fsl_diu_init(*xres, pixel_format, 0);
+}
diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h
index dcaca2b..8e0117f 100644
--- a/include/configs/P1022DS.h
+++ b/include/configs/P1022DS.h
@@ -177,14 +177,17 @@
#define CONFIG_SYS_HUSH_PARSER
#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
-#define CONFIG_FSL_DIU_FB
-#define CONFIG_SYS_DIU_ADDR (CONFIG_SYS_CCSRBAR + 0x10000)
-
/* Video */
-/* #define CONFIG_VIDEO */
-#ifdef CONFIG_VIDEO
+#undef CONFIG_FSL_DIU_FB
+
+#ifdef CONFIG_FSL_DIU_FB
+#define CONFIG_SYS_DIU_ADDR (CONFIG_SYS_CCSRBAR + 0x10000)
+#define CONFIG_VIDEO
+#define CONFIG_CMD_BMP
#define CONFIG_CFB_CONSOLE
#define CONFIG_VGA_AS_SINGLE_DEVICE
+#define CONFIG_VIDEO_LOGO
+#define CONFIG_VIDEO_BMP_LOGO
#endif
/*
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH v2 1/2] fsl_diu_fb: further refactoring of FSL DIU code
2010-09-24 5:27 ` [U-Boot] [PATCH v2 1/2] fsl_diu_fb: further refactoring of FSL " Anatolij Gustschin
@ 2010-09-25 11:49 ` Anatolij Gustschin
0 siblings, 0 replies; 10+ messages in thread
From: Anatolij Gustschin @ 2010-09-25 11:49 UTC (permalink / raw)
To: u-boot
On Fri, 24 Sep 2010 07:27:21 +0200
Anatolij Gustschin <agust@denx.de> wrote:
> Move common code to the fsl_diu_fb.c file and remove obsolete
> code from board files (aria, mpc8610hpcd and pdm360ng).
> Move fsl_diu_fb.h file to the include directory.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
> v2:
> - fixed commit message
> - dropped p1022ds fixes as the cleaned up p1022ds video
> patch will be applied on top of this patch
> - dropped unneeded board config file changes
>
> arch/powerpc/cpu/mpc512x/diu.c | 62 ++----------------
> board/davedenx/aria/aria.c | 5 --
> board/freescale/common/fsl_diu_fb.c | 41 ++++++++++++-
> board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c | 74 +++------------------
> board/pdm360ng/pdm360ng.c | 3 -
> {board/freescale/common => include}/fsl_diu_fb.h | 1 +
> 6 files changed, 59 insertions(+), 127 deletions(-)
> rename {board/freescale/common => include}/fsl_diu_fb.h (97%)
Applied to u-boot-video/next.
Anatolij
^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH v2 2/2] p1022ds: add video support
2010-09-24 5:27 ` [U-Boot] [PATCH v2 2/2] p1022ds: add video support Anatolij Gustschin
@ 2010-09-25 11:51 ` Anatolij Gustschin
0 siblings, 0 replies; 10+ messages in thread
From: Anatolij Gustschin @ 2010-09-25 11:51 UTC (permalink / raw)
To: u-boot
On Fri, 24 Sep 2010 07:27:22 +0200
Anatolij Gustschin <agust@denx.de> wrote:
> From: Timur Tabi <timur@freescale.com>
>
> Add support for the DIU controller. If CONFIG_VIDEO is defined, then
> the console will appear on a DVI monitor instead of the serial port.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
> v2:
> - rebased on top of FSL DIU code refactoring patch
> to avoid some code duplication.
>
> board/freescale/p1022ds/Makefile | 2 +
> board/freescale/p1022ds/diu.c | 110 ++++++++++++++++++++++++++++++++++++++
> include/configs/P1022DS.h | 13 +++--
> 3 files changed, 120 insertions(+), 5 deletions(-)
> create mode 100644 board/freescale/p1022ds/diu.c
Applied to u-boot-video/next.
Anatolij
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-09-25 11:51 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-22 16:46 [U-Boot] [PATCH] [v2] p1022ds: add video support Timur Tabi
2010-09-22 23:53 ` Anatolij Gustschin
2010-09-22 23:57 ` [U-Boot] [PATCH] fsl_diu_fb: further refactoring of FLS DIU code Anatolij Gustschin
2010-09-23 0:02 ` Anatolij Gustschin
2010-09-23 16:32 ` Timur Tabi
2010-09-23 16:38 ` Anatolij Gustschin
2010-09-24 5:27 ` [U-Boot] [PATCH v2 1/2] fsl_diu_fb: further refactoring of FSL " Anatolij Gustschin
2010-09-25 11:49 ` Anatolij Gustschin
2010-09-24 5:27 ` [U-Boot] [PATCH v2 2/2] p1022ds: add video support Anatolij Gustschin
2010-09-25 11:51 ` Anatolij Gustschin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox