public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer
@ 2012-05-16 19:04 Jeroen Hofstee
  2012-05-16 19:04 ` [U-Boot] [PATCH 1/2] omap3_dss: add optional framebuffer Jeroen Hofstee
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Jeroen Hofstee @ 2012-05-16 19:04 UTC (permalink / raw)
  To: u-boot

I could not resist removing some brackets etc while looking at the file..
These changes are optional and in a seperate patch. I will email a
seperate patch which I use for testing, but should NOT be in mainline,
since it assumes which LCD is connected.

Beagle owners, please test that I didn't break your orange background;
I don't have the board.

Jeroen Hofstee (2):
  omap3_dss: add optional framebuffer
  omap3_dss: cosmetic changes

 arch/arm/include/asm/arch-omap3/dss.h |   61 ++++++++++++++++----------
 drivers/video/Makefile                |    2 +-
 drivers/video/omap3_dss.c             |   78 ++++++++++++++++++++++++---------
 3 files changed, 98 insertions(+), 43 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 1/2] omap3_dss: add optional framebuffer
  2012-05-16 19:04 [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer Jeroen Hofstee
@ 2012-05-16 19:04 ` Jeroen Hofstee
  2012-05-16 19:04 ` [U-Boot] [PATCH 2/2] omap3_dss: cosmetic changes Jeroen Hofstee
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Jeroen Hofstee @ 2012-05-16 19:04 UTC (permalink / raw)
  To: u-boot

From: Jeroen Hofstee <jhofstee@victronenergy.com>

The beagle board uses the background color to show an orange screen during
startup. This patch adds the ability to add a frame buffer, with the
intention not to break the beagle board use case (I don't have one).
videomodes.c is not used. Scrolling depends on this patch:

http://patchwork.ozlabs.org/patch/155662/

cc: s-paulraj at ti.com
cc: khasim at ti.com
Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
---
 arch/arm/include/asm/arch-omap3/dss.h |   41 ++++++++++++++++++++++++++----
 drivers/video/Makefile                |    2 +-
 drivers/video/omap3_dss.c             |   45 +++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/arch-omap3/dss.h b/arch/arm/include/asm/arch-omap3/dss.h
index 4c56e5e..ae994ee 100644
--- a/arch/arm/include/asm/arch-omap3/dss.h
+++ b/arch/arm/include/asm/arch-omap3/dss.h
@@ -28,15 +28,19 @@
 #ifndef DSS_H
 #define DSS_H
 
-/*
- * DSS Base Registers
- */
-#define OMAP3_DSS_BASE		0x48050040
-#define OMAP3_DISPC_BASE	0x48050440
+/* DSS Base Registers */
+#define OMAP3_DSS_BASE		0x48050000
+#define OMAP3_DISPC_BASE	0x48050400
 #define OMAP3_VENC_BASE		0x48050C00
 
 /* DSS Registers */
 struct dss_regs {
+	u32 revision;				/* 0x00 */
+	u8 res1[12];				/* 0x04 */
+	u32 sysconfig;				/* 0x10 */
+	u32 sysstatus;				/* 0x14 */
+	u32 irqstatus;				/* 0x18 */
+	u8 res2[36];				/* 0x1C */
 	u32 control;				/* 0x40 */
 	u32 sdi_control;			/* 0x44 */
 	u32 pll_control;			/* 0x48 */
@@ -44,6 +48,13 @@ struct dss_regs {
 
 /* DISPC Registers */
 struct dispc_regs {
+	u32 revision;				/* 0x00 */
+	u8 res1[12];				/* 0x04 */
+	u32 sysconfig;				/* 0x10 */
+	u32 sysstatus;				/* 0x14 */
+	u32 irqstatus;				/* 0x18 */
+	u32 irqenable;				/* 0x1C */
+	u8 res2[32];				/* 0x20 */
 	u32 control;				/* 0x40 */
 	u32 config;				/* 0x44 */
 	u32 reserve_2;				/* 0x48 */
@@ -60,6 +71,18 @@ struct dispc_regs {
 	u32 global_alpha;			/* 0x74 */
 	u32 size_dig;				/* 0x78 */
 	u32 size_lcd;				/* 0x7C */
+	u32 gfx_ba0;				/* 0x80 */
+	u32 gfx_ba1;				/* 0x84 */
+	u32 gfx_position;			/* 0x88 */
+	u32 gfx_size;				/* 0x8C */
+	u8 unused[16];				/* 0x90 */
+	u32 gfx_attributes;			/* 0xA0 */
+	u32 gfx_fifo_threshold;			/* 0xA4 */
+	u32 gfx_fifo_size_status;		/* 0xA8 */
+	u32 gfx_row_inc;			/* 0xAC */
+	u32 gfx_pixel_inc;			/* 0xB0 */
+	u32 gfx_window_skip;			/* 0xB4 */
+	u32 gfx_table_ba;			/* 0xB8 */
 };
 
 /* VENC Registers */
@@ -123,6 +146,13 @@ struct venc_regs {
 #define TFTSTN_SHIFT				3
 #define DATALINES_SHIFT				8
 
+#define GFX_ENABLE				1
+#define GFX_FORMAT_SHIFT			1
+#define LOADMODE_SHIFT				1
+
+#define DSS_SOFTRESET				(1 << 1)
+#define DSS_RESETDONE				1
+
 /* Enabling Display controller */
 #define LCD_ENABLE				1
 #define DIG_ENABLE				(1 << 1)
@@ -161,6 +191,7 @@ struct panel_config {
 	u32 data_lines;
 	u32 load_mode;
 	u32 panel_color;
+	void *frame_buffer;
 };
 
 /*
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 6252f6a..02aa032 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -38,7 +38,7 @@ COBJS-$(CONFIG_VIDEO_MB862xx) += mb862xx.o videomodes.o
 COBJS-$(CONFIG_VIDEO_MB86R0xGDC) += mb86r0xgdc.o videomodes.o
 COBJS-$(CONFIG_VIDEO_MX3) += mx3fb.o videomodes.o
 COBJS-$(CONFIG_VIDEO_MX5) += mxc_ipuv3_fb.o ipu_common.o ipu_disp.o
-COBJS-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o videomodes.o
+COBJS-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o
 COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
 COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o
diff --git a/drivers/video/omap3_dss.c b/drivers/video/omap3_dss.c
index b322cc3..9245c06 100644
--- a/drivers/video/omap3_dss.c
+++ b/drivers/video/omap3_dss.c
@@ -28,6 +28,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/dss.h>
+#include <video_fb.h>
 
 /*
  * Configure VENC for a given Mode (NTSC / PAL)
@@ -105,6 +106,11 @@ void omap3_dss_venc_config(const struct venc_regs *venc_cfg,
 void omap3_dss_panel_config(const struct panel_config *panel_cfg)
 {
 	struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE;
+	struct dss_regs *dss = (struct dss_regs *) OMAP3_DSS_BASE;
+
+	writel(DSS_SOFTRESET, &dss->sysconfig);
+	while (!(readl(&dss->sysstatus) & DSS_RESETDONE))
+		;
 
 	writel(panel_cfg->timing_h, &dispc->timing_h);
 	writel(panel_cfg->timing_v, &dispc->timing_v);
@@ -115,6 +121,16 @@ void omap3_dss_panel_config(const struct panel_config *panel_cfg)
 	writel(((panel_cfg->panel_type << TFTSTN_SHIFT) |
 		(panel_cfg->data_lines << DATALINES_SHIFT)), &dispc->control);
 	writel(panel_cfg->panel_color, &dispc->default_color0);
+	writel((u32) panel_cfg->frame_buffer, &dispc->gfx_ba0);
+
+	if (!panel_cfg->frame_buffer)
+		return;
+
+	writel(panel_cfg->load_mode << LOADMODE_SHIFT, &dispc->config);
+	writel(8 << GFX_FORMAT_SHIFT | GFX_ENABLE, &dispc->gfx_attributes);
+	writel(1, &dispc->gfx_row_inc);
+	writel(1, &dispc->gfx_pixel_inc);
+	writel(panel_cfg->lcd_size, &dispc->gfx_size);
 }
 
 /*
@@ -129,3 +145,32 @@ void omap3_dss_enable(void)
 	l |= DISPC_ENABLE;
 	writel(l, &dispc->control);
 }
+
+#ifdef CONFIG_CFB_CONSOLE
+int __board_video_init(void)
+{
+	return -1;
+}
+
+int board_video_init(void)
+			__attribute__((weak, alias("__board_video_init")));
+
+void *video_hw_init(void)
+{
+	static GraphicDevice dssfb;
+	GraphicDevice *pGD = (GraphicDevice *) &dssfb;
+	struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE;
+
+	if (board_video_init() || !readl(&dispc->gfx_ba0))
+		return NULL;
+
+	memset(pGD, 0, sizeof(GraphicDevice));
+	pGD->winSizeX = (readl(&dispc->size_lcd) & 0x7FF) + 1;
+	pGD->winSizeY = ((readl(&dispc->size_lcd) >> 16) & 0x7FF) + 1;
+	pGD->gdfBytesPP = 4;
+	pGD->gdfIndex = GDF_32BIT_X888RGB;
+	pGD->frameAdrs = readl(&dispc->gfx_ba0);
+
+	return pGD;
+}
+#endif
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 2/2] omap3_dss: cosmetic changes
  2012-05-16 19:04 [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer Jeroen Hofstee
  2012-05-16 19:04 ` [U-Boot] [PATCH 1/2] omap3_dss: add optional framebuffer Jeroen Hofstee
@ 2012-05-16 19:04 ` Jeroen Hofstee
  2012-05-16 19:40 ` [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer Jeroen Hofstee
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Jeroen Hofstee @ 2012-05-16 19:04 UTC (permalink / raw)
  To: u-boot

From: Jeroen Hofstee <jhofstee@victronenergy.com>

Remove unnecessary brackets.
Unwrap lines which are below 80 chars.
Single line comment as single line.
Moved init values to the source code.

cc: s-paulraj at ti.com
cc: khasim at ti.com
Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
---
 arch/arm/include/asm/arch-omap3/dss.h |   20 +++-----------------
 drivers/video/omap3_dss.c             |   33 +++++++++++++--------------------
 2 files changed, 16 insertions(+), 37 deletions(-)

diff --git a/arch/arm/include/asm/arch-omap3/dss.h b/arch/arm/include/asm/arch-omap3/dss.h
index ae994ee..a830c43 100644
--- a/arch/arm/include/asm/arch-omap3/dss.h
+++ b/arch/arm/include/asm/arch-omap3/dss.h
@@ -161,26 +161,14 @@ struct venc_regs {
 #define GP_OUT0					(1 << 15)
 #define GP_OUT1					(1 << 16)
 
-#define DISPC_ENABLE				(LCD_ENABLE | \
-						 DIG_ENABLE | \
-						 GO_LCD | \
-						 GO_DIG | \
-						 GP_OUT0| \
-						 GP_OUT1)
-
 /* Configure VENC DSS Params */
 #define VENC_CLK_ENABLE				(1 << 3)
 #define DAC_DEMEN				(1 << 4)
 #define DAC_POWERDN				(1 << 5)
 #define VENC_OUT_SEL				(1 << 6)
 #define DIG_LPP_SHIFT				16
-#define VENC_DSS_CONFIG				(VENC_CLK_ENABLE | \
-						 DAC_DEMEN | \
-						 DAC_POWERDN | \
-						 VENC_OUT_SEL)
-/*
- * Panel Configuration
- */
+
+/* Panel Configuration */
 struct panel_config {
 	u32 timing_h;
 	u32 timing_v;
@@ -194,9 +182,7 @@ struct panel_config {
 	void *frame_buffer;
 };
 
-/*
- * Generic DSS Functions
- */
+/* Generic DSS Functions */
 void omap3_dss_venc_config(const struct venc_regs *venc_cfg,
 			u32 height, u32 width);
 void omap3_dss_panel_config(const struct panel_config *panel_cfg);
diff --git a/drivers/video/omap3_dss.c b/drivers/video/omap3_dss.c
index 9245c06..9b75390 100644
--- a/drivers/video/omap3_dss.c
+++ b/drivers/video/omap3_dss.c
@@ -30,9 +30,7 @@
 #include <asm/arch/dss.h>
 #include <video_fb.h>
 
-/*
- * Configure VENC for a given Mode (NTSC / PAL)
- */
+/* Configure VENC for a given Mode (NTSC / PAL) */
 void omap3_dss_venc_config(const struct venc_regs *venc_cfg,
 				u32 height, u32 width)
 {
@@ -65,10 +63,8 @@ void omap3_dss_venc_config(const struct venc_regs *venc_cfg,
 	writel(venc_cfg->savid__eavid, &venc->savid__eavid);
 	writel(venc_cfg->flen__fal, &venc->flen__fal);
 	writel(venc_cfg->lal__phase_reset, &venc->lal__phase_reset);
-	writel(venc_cfg->hs_int_start_stop_x,
-				&venc->hs_int_start_stop_x);
-	writel(venc_cfg->hs_ext_start_stop_x,
-				&venc->hs_ext_start_stop_x);
+	writel(venc_cfg->hs_int_start_stop_x, &venc->hs_int_start_stop_x);
+	writel(venc_cfg->hs_ext_start_stop_x, &venc->hs_ext_start_stop_x);
 	writel(venc_cfg->vs_int_start_x, &venc->vs_int_start_x);
 	writel(venc_cfg->vs_int_stop_x__vs_int_start_y,
 			&venc->vs_int_stop_x__vs_int_start_y);
@@ -94,15 +90,14 @@ void omap3_dss_venc_config(const struct venc_regs *venc_cfg,
 	writel(venc_cfg->dac_b__dac_c, &venc->dac_b__dac_c);
 
 	/* Configure DSS for VENC Settings */
-	writel(VENC_DSS_CONFIG, &dss->control);
+	writel(VENC_CLK_ENABLE | DAC_DEMEN | DAC_POWERDN | VENC_OUT_SEL,
+			&dss->control);
 
 	/* Configure height and width for Digital out */
-	writel(((height << DIG_LPP_SHIFT) | width), &dispc->size_dig);
+	writel(height << DIG_LPP_SHIFT | width, &dispc->size_dig);
 }
 
-/*
- * Configure Panel Specific Parameters
- */
+/* Configure Panel Specific Parameters */
 void omap3_dss_panel_config(const struct panel_config *panel_cfg)
 {
 	struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE;
@@ -117,9 +112,9 @@ void omap3_dss_panel_config(const struct panel_config *panel_cfg)
 	writel(panel_cfg->pol_freq, &dispc->pol_freq);
 	writel(panel_cfg->divisor, &dispc->divisor);
 	writel(panel_cfg->lcd_size, &dispc->size_lcd);
-	writel((panel_cfg->load_mode << FRAME_MODE_SHIFT), &dispc->config);
-	writel(((panel_cfg->panel_type << TFTSTN_SHIFT) |
-		(panel_cfg->data_lines << DATALINES_SHIFT)), &dispc->control);
+	writel(panel_cfg->load_mode << FRAME_MODE_SHIFT, &dispc->config);
+	writel(panel_cfg->panel_type << TFTSTN_SHIFT |
+		panel_cfg->data_lines << DATALINES_SHIFT, &dispc->control);
 	writel(panel_cfg->panel_color, &dispc->default_color0);
 	writel((u32) panel_cfg->frame_buffer, &dispc->gfx_ba0);
 
@@ -133,16 +128,14 @@ void omap3_dss_panel_config(const struct panel_config *panel_cfg)
 	writel(panel_cfg->lcd_size, &dispc->gfx_size);
 }
 
-/*
- * Enable LCD and DIGITAL OUT in DSS
- */
+/* Enable LCD and DIGITAL OUT in DSS */
 void omap3_dss_enable(void)
 {
 	struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE;
-	u32 l = 0;
+	u32 l;
 
 	l = readl(&dispc->control);
-	l |= DISPC_ENABLE;
+	l |= LCD_ENABLE | GO_LCD | DIG_ENABLE | GO_DIG | GP_OUT0 | GP_OUT1;
 	writel(l, &dispc->control);
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer
  2012-05-16 19:04 [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer Jeroen Hofstee
  2012-05-16 19:04 ` [U-Boot] [PATCH 1/2] omap3_dss: add optional framebuffer Jeroen Hofstee
  2012-05-16 19:04 ` [U-Boot] [PATCH 2/2] omap3_dss: cosmetic changes Jeroen Hofstee
@ 2012-05-16 19:40 ` Jeroen Hofstee
  2012-05-18 10:50 ` [U-Boot] [PATCH v2 " Jeroen Hofstee
  2012-05-18 21:22 ` [U-Boot] [PATCH " Anatolij Gustschin
  4 siblings, 0 replies; 13+ messages in thread
From: Jeroen Hofstee @ 2012-05-16 19:40 UTC (permalink / raw)
  To: u-boot

On 05/16/2012 09:04 PM, Jeroen Hofstee wrote:
> I could not resist removing some brackets etc while looking at the file..
> These changes are optional and in a seperate patch. I will email a
> seperate patch which I use for testing, but should NOT be in mainline,
> since it assumes which LCD is connected.
>
> Beagle owners, please test that I didn't break your orange background;
> I don't have the board.
>
> Jeroen Hofstee (2):
>    omap3_dss: add optional framebuffer
>    omap3_dss: cosmetic changes
>
>   arch/arm/include/asm/arch-omap3/dss.h |   61 ++++++++++++++++----------
>   drivers/video/Makefile                |    2 +-
>   drivers/video/omap3_dss.c             |   78 ++++++++++++++++++++++++---------
>   3 files changed, 98 insertions(+), 43 deletions(-)
>
And the promised patch for the twister board, I used for testing;
assuming a lg 4.3 inch display. _Not to be applied, testing only_

Jeroen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twister_4_3.patch
Type: text/x-patch
Size: 3475 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120516/15faedf5/attachment.bin>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH v2 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer
  2012-05-16 19:04 [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer Jeroen Hofstee
                   ` (2 preceding siblings ...)
  2012-05-16 19:40 ` [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer Jeroen Hofstee
@ 2012-05-18 10:50 ` Jeroen Hofstee
  2012-05-18 10:51   ` [U-Boot] [PATCH v2 1/2] omap3_dss: add optional framebuffer Jeroen Hofstee
                     ` (2 more replies)
  2012-05-18 21:22 ` [U-Boot] [PATCH " Anatolij Gustschin
  4 siblings, 3 replies; 13+ messages in thread
From: Jeroen Hofstee @ 2012-05-18 10:50 UTC (permalink / raw)
  To: u-boot

changes for v2:
removed an unneeded cast and memset.

v1:
I could not resist removing some brackets etc while looking at the file..
These changes are optional and in a seperate patch. I will email a
seperate patch which I use for testing, but should NOT be in mainline,
since it assumes which LCD is connected.

Beagle owners, please test that I didn't break your orange background;
I don't have the board.

Jeroen Hofstee (2):
  omap3_dss: add optional framebuffer
  omap3_dss: cosmetic changes

 arch/arm/include/asm/arch-omap3/dss.h |   61 ++++++++++++++++----------
 drivers/video/Makefile                |    2 +-
 drivers/video/omap3_dss.c             |   77 ++++++++++++++++++++++++---------
 3 files changed, 97 insertions(+), 43 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH v2 1/2] omap3_dss: add optional framebuffer
  2012-05-18 10:50 ` [U-Boot] [PATCH v2 " Jeroen Hofstee
@ 2012-05-18 10:51   ` Jeroen Hofstee
  2012-05-25 13:51     ` Anatolij Gustschin
  2012-05-18 10:51   ` [U-Boot] [PATCH v2 2/2] omap3_dss: cosmetic changes Jeroen Hofstee
  2012-05-24 19:17   ` [U-Boot] [PATCH v2 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer Tom Rini
  2 siblings, 1 reply; 13+ messages in thread
From: Jeroen Hofstee @ 2012-05-18 10:51 UTC (permalink / raw)
  To: u-boot

From: Jeroen Hofstee <jhofstee@victronenergy.com>

The beagle board uses the background color to show an orange screen during
startup. This patch adds the ability to add a frame buffer, with the
intention not to break the beagle board use case (I don't have one).
videomodes.c is not used. Scrolling depends on this patch:

http://patchwork.ozlabs.org/patch/155662/

cc: trini at ti.com
cc: s-paulraj at ti.com
cc: khasim at ti.com
Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
---
 arch/arm/include/asm/arch-omap3/dss.h |   37 +++++++++++++++++++++++++--
 drivers/video/Makefile                |    2 +-
 drivers/video/omap3_dss.c             |   44 +++++++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/arch-omap3/dss.h b/arch/arm/include/asm/arch-omap3/dss.h
index 4c56e5e..101e8c8 100644
--- a/arch/arm/include/asm/arch-omap3/dss.h
+++ b/arch/arm/include/asm/arch-omap3/dss.h
@@ -31,12 +31,18 @@
 /*
  * DSS Base Registers
  */
-#define OMAP3_DSS_BASE		0x48050040
-#define OMAP3_DISPC_BASE	0x48050440
+#define OMAP3_DSS_BASE		0x48050000
+#define OMAP3_DISPC_BASE	0x48050400
 #define OMAP3_VENC_BASE		0x48050C00
 
 /* DSS Registers */
 struct dss_regs {
+	u32 revision;				/* 0x00 */
+	u8 res1[12];				/* 0x04 */
+	u32 sysconfig;				/* 0x10 */
+	u32 sysstatus;				/* 0x14 */
+	u32 irqstatus;				/* 0x18 */
+	u8 res2[36];				/* 0x1C */
 	u32 control;				/* 0x40 */
 	u32 sdi_control;			/* 0x44 */
 	u32 pll_control;			/* 0x48 */
@@ -44,6 +50,13 @@ struct dss_regs {
 
 /* DISPC Registers */
 struct dispc_regs {
+	u32 revision;				/* 0x00 */
+	u8 res1[12];				/* 0x04 */
+	u32 sysconfig;				/* 0x10 */
+	u32 sysstatus;				/* 0x14 */
+	u32 irqstatus;				/* 0x18 */
+	u32 irqenable;				/* 0x1C */
+	u8 res2[32];				/* 0x20 */
 	u32 control;				/* 0x40 */
 	u32 config;				/* 0x44 */
 	u32 reserve_2;				/* 0x48 */
@@ -60,6 +73,18 @@ struct dispc_regs {
 	u32 global_alpha;			/* 0x74 */
 	u32 size_dig;				/* 0x78 */
 	u32 size_lcd;				/* 0x7C */
+	u32 gfx_ba0;				/* 0x80 */
+	u32 gfx_ba1;				/* 0x84 */
+	u32 gfx_position;			/* 0x88 */
+	u32 gfx_size;				/* 0x8C */
+	u8 unused[16];				/* 0x90 */
+	u32 gfx_attributes;			/* 0xA0 */
+	u32 gfx_fifo_threshold;			/* 0xA4 */
+	u32 gfx_fifo_size_status;		/* 0xA8 */
+	u32 gfx_row_inc;			/* 0xAC */
+	u32 gfx_pixel_inc;			/* 0xB0 */
+	u32 gfx_window_skip;			/* 0xB4 */
+	u32 gfx_table_ba;			/* 0xB8 */
 };
 
 /* VENC Registers */
@@ -123,6 +148,13 @@ struct venc_regs {
 #define TFTSTN_SHIFT				3
 #define DATALINES_SHIFT				8
 
+#define GFX_ENABLE				1
+#define GFX_FORMAT_SHIFT			1
+#define LOADMODE_SHIFT				1
+
+#define DSS_SOFTRESET				(1 << 1)
+#define DSS_RESETDONE				1
+
 /* Enabling Display controller */
 #define LCD_ENABLE				1
 #define DIG_ENABLE				(1 << 1)
@@ -161,6 +193,7 @@ struct panel_config {
 	u32 data_lines;
 	u32 load_mode;
 	u32 panel_color;
+	void *frame_buffer;
 };
 
 /*
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 6252f6a..02aa032 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -38,7 +38,7 @@ COBJS-$(CONFIG_VIDEO_MB862xx) += mb862xx.o videomodes.o
 COBJS-$(CONFIG_VIDEO_MB86R0xGDC) += mb86r0xgdc.o videomodes.o
 COBJS-$(CONFIG_VIDEO_MX3) += mx3fb.o videomodes.o
 COBJS-$(CONFIG_VIDEO_MX5) += mxc_ipuv3_fb.o ipu_common.o ipu_disp.o
-COBJS-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o videomodes.o
+COBJS-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o
 COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
 COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o
diff --git a/drivers/video/omap3_dss.c b/drivers/video/omap3_dss.c
index b322cc3..dfe61b3 100644
--- a/drivers/video/omap3_dss.c
+++ b/drivers/video/omap3_dss.c
@@ -28,6 +28,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/dss.h>
+#include <video_fb.h>
 
 /*
  * Configure VENC for a given Mode (NTSC / PAL)
@@ -105,6 +106,11 @@ void omap3_dss_venc_config(const struct venc_regs *venc_cfg,
 void omap3_dss_panel_config(const struct panel_config *panel_cfg)
 {
 	struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE;
+	struct dss_regs *dss = (struct dss_regs *) OMAP3_DSS_BASE;
+
+	writel(DSS_SOFTRESET, &dss->sysconfig);
+	while (!(readl(&dss->sysstatus) & DSS_RESETDONE))
+		;
 
 	writel(panel_cfg->timing_h, &dispc->timing_h);
 	writel(panel_cfg->timing_v, &dispc->timing_v);
@@ -115,6 +121,16 @@ void omap3_dss_panel_config(const struct panel_config *panel_cfg)
 	writel(((panel_cfg->panel_type << TFTSTN_SHIFT) |
 		(panel_cfg->data_lines << DATALINES_SHIFT)), &dispc->control);
 	writel(panel_cfg->panel_color, &dispc->default_color0);
+	writel((u32) panel_cfg->frame_buffer, &dispc->gfx_ba0);
+
+	if (!panel_cfg->frame_buffer)
+		return;
+
+	writel(panel_cfg->load_mode << LOADMODE_SHIFT, &dispc->config);
+	writel(8 << GFX_FORMAT_SHIFT | GFX_ENABLE, &dispc->gfx_attributes);
+	writel(1, &dispc->gfx_row_inc);
+	writel(1, &dispc->gfx_pixel_inc);
+	writel(panel_cfg->lcd_size, &dispc->gfx_size);
 }
 
 /*
@@ -129,3 +145,31 @@ void omap3_dss_enable(void)
 	l |= DISPC_ENABLE;
 	writel(l, &dispc->control);
 }
+
+#ifdef CONFIG_CFB_CONSOLE
+int __board_video_init(void)
+{
+	return -1;
+}
+
+int board_video_init(void)
+			__attribute__((weak, alias("__board_video_init")));
+
+void *video_hw_init(void)
+{
+	static GraphicDevice dssfb;
+	GraphicDevice *pGD = &dssfb;
+	struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE;
+
+	if (board_video_init() || !readl(&dispc->gfx_ba0))
+		return NULL;
+
+	pGD->winSizeX = (readl(&dispc->size_lcd) & 0x7FF) + 1;
+	pGD->winSizeY = ((readl(&dispc->size_lcd) >> 16) & 0x7FF) + 1;
+	pGD->gdfBytesPP = 4;
+	pGD->gdfIndex = GDF_32BIT_X888RGB;
+	pGD->frameAdrs = readl(&dispc->gfx_ba0);
+
+	return pGD;
+}
+#endif
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH v2 2/2] omap3_dss: cosmetic changes
  2012-05-18 10:50 ` [U-Boot] [PATCH v2 " Jeroen Hofstee
  2012-05-18 10:51   ` [U-Boot] [PATCH v2 1/2] omap3_dss: add optional framebuffer Jeroen Hofstee
@ 2012-05-18 10:51   ` Jeroen Hofstee
  2012-05-25 13:54     ` Anatolij Gustschin
  2012-05-24 19:17   ` [U-Boot] [PATCH v2 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer Tom Rini
  2 siblings, 1 reply; 13+ messages in thread
From: Jeroen Hofstee @ 2012-05-18 10:51 UTC (permalink / raw)
  To: u-boot

From: Jeroen Hofstee <jhofstee@victronenergy.com>

Remove unnecessary brackets.
Unwrap lines which are below 80 chars.
Single line comment as single line (as the rest).
Moved init values to the source code.

cc: s-paulraj at ti.com
cc: khasim at ti.com
Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
---
 arch/arm/include/asm/arch-omap3/dss.h |   24 ++++--------------------
 drivers/video/omap3_dss.c             |   33 +++++++++++++--------------------
 2 files changed, 17 insertions(+), 40 deletions(-)

diff --git a/arch/arm/include/asm/arch-omap3/dss.h b/arch/arm/include/asm/arch-omap3/dss.h
index 101e8c8..a830c43 100644
--- a/arch/arm/include/asm/arch-omap3/dss.h
+++ b/arch/arm/include/asm/arch-omap3/dss.h
@@ -28,9 +28,7 @@
 #ifndef DSS_H
 #define DSS_H
 
-/*
- * DSS Base Registers
- */
+/* DSS Base Registers */
 #define OMAP3_DSS_BASE		0x48050000
 #define OMAP3_DISPC_BASE	0x48050400
 #define OMAP3_VENC_BASE		0x48050C00
@@ -163,26 +161,14 @@ struct venc_regs {
 #define GP_OUT0					(1 << 15)
 #define GP_OUT1					(1 << 16)
 
-#define DISPC_ENABLE				(LCD_ENABLE | \
-						 DIG_ENABLE | \
-						 GO_LCD | \
-						 GO_DIG | \
-						 GP_OUT0| \
-						 GP_OUT1)
-
 /* Configure VENC DSS Params */
 #define VENC_CLK_ENABLE				(1 << 3)
 #define DAC_DEMEN				(1 << 4)
 #define DAC_POWERDN				(1 << 5)
 #define VENC_OUT_SEL				(1 << 6)
 #define DIG_LPP_SHIFT				16
-#define VENC_DSS_CONFIG				(VENC_CLK_ENABLE | \
-						 DAC_DEMEN | \
-						 DAC_POWERDN | \
-						 VENC_OUT_SEL)
-/*
- * Panel Configuration
- */
+
+/* Panel Configuration */
 struct panel_config {
 	u32 timing_h;
 	u32 timing_v;
@@ -196,9 +182,7 @@ struct panel_config {
 	void *frame_buffer;
 };
 
-/*
- * Generic DSS Functions
- */
+/* Generic DSS Functions */
 void omap3_dss_venc_config(const struct venc_regs *venc_cfg,
 			u32 height, u32 width);
 void omap3_dss_panel_config(const struct panel_config *panel_cfg);
diff --git a/drivers/video/omap3_dss.c b/drivers/video/omap3_dss.c
index dfe61b3..6686718 100644
--- a/drivers/video/omap3_dss.c
+++ b/drivers/video/omap3_dss.c
@@ -30,9 +30,7 @@
 #include <asm/arch/dss.h>
 #include <video_fb.h>
 
-/*
- * Configure VENC for a given Mode (NTSC / PAL)
- */
+/* Configure VENC for a given Mode (NTSC / PAL) */
 void omap3_dss_venc_config(const struct venc_regs *venc_cfg,
 				u32 height, u32 width)
 {
@@ -65,10 +63,8 @@ void omap3_dss_venc_config(const struct venc_regs *venc_cfg,
 	writel(venc_cfg->savid__eavid, &venc->savid__eavid);
 	writel(venc_cfg->flen__fal, &venc->flen__fal);
 	writel(venc_cfg->lal__phase_reset, &venc->lal__phase_reset);
-	writel(venc_cfg->hs_int_start_stop_x,
-				&venc->hs_int_start_stop_x);
-	writel(venc_cfg->hs_ext_start_stop_x,
-				&venc->hs_ext_start_stop_x);
+	writel(venc_cfg->hs_int_start_stop_x, &venc->hs_int_start_stop_x);
+	writel(venc_cfg->hs_ext_start_stop_x, &venc->hs_ext_start_stop_x);
 	writel(venc_cfg->vs_int_start_x, &venc->vs_int_start_x);
 	writel(venc_cfg->vs_int_stop_x__vs_int_start_y,
 			&venc->vs_int_stop_x__vs_int_start_y);
@@ -94,15 +90,14 @@ void omap3_dss_venc_config(const struct venc_regs *venc_cfg,
 	writel(venc_cfg->dac_b__dac_c, &venc->dac_b__dac_c);
 
 	/* Configure DSS for VENC Settings */
-	writel(VENC_DSS_CONFIG, &dss->control);
+	writel(VENC_CLK_ENABLE | DAC_DEMEN | DAC_POWERDN | VENC_OUT_SEL,
+			&dss->control);
 
 	/* Configure height and width for Digital out */
-	writel(((height << DIG_LPP_SHIFT) | width), &dispc->size_dig);
+	writel(height << DIG_LPP_SHIFT | width, &dispc->size_dig);
 }
 
-/*
- * Configure Panel Specific Parameters
- */
+/* Configure Panel Specific Parameters */
 void omap3_dss_panel_config(const struct panel_config *panel_cfg)
 {
 	struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE;
@@ -117,9 +112,9 @@ void omap3_dss_panel_config(const struct panel_config *panel_cfg)
 	writel(panel_cfg->pol_freq, &dispc->pol_freq);
 	writel(panel_cfg->divisor, &dispc->divisor);
 	writel(panel_cfg->lcd_size, &dispc->size_lcd);
-	writel((panel_cfg->load_mode << FRAME_MODE_SHIFT), &dispc->config);
-	writel(((panel_cfg->panel_type << TFTSTN_SHIFT) |
-		(panel_cfg->data_lines << DATALINES_SHIFT)), &dispc->control);
+	writel(panel_cfg->load_mode << FRAME_MODE_SHIFT, &dispc->config);
+	writel(panel_cfg->panel_type << TFTSTN_SHIFT |
+		panel_cfg->data_lines << DATALINES_SHIFT, &dispc->control);
 	writel(panel_cfg->panel_color, &dispc->default_color0);
 	writel((u32) panel_cfg->frame_buffer, &dispc->gfx_ba0);
 
@@ -133,16 +128,14 @@ void omap3_dss_panel_config(const struct panel_config *panel_cfg)
 	writel(panel_cfg->lcd_size, &dispc->gfx_size);
 }
 
-/*
- * Enable LCD and DIGITAL OUT in DSS
- */
+/* Enable LCD and DIGITAL OUT in DSS */
 void omap3_dss_enable(void)
 {
 	struct dispc_regs *dispc = (struct dispc_regs *) OMAP3_DISPC_BASE;
-	u32 l = 0;
+	u32 l;
 
 	l = readl(&dispc->control);
-	l |= DISPC_ENABLE;
+	l |= LCD_ENABLE | GO_LCD | DIG_ENABLE | GO_DIG | GP_OUT0 | GP_OUT1;
 	writel(l, &dispc->control);
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer
  2012-05-16 19:04 [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer Jeroen Hofstee
                   ` (3 preceding siblings ...)
  2012-05-18 10:50 ` [U-Boot] [PATCH v2 " Jeroen Hofstee
@ 2012-05-18 21:22 ` Anatolij Gustschin
  2012-05-18 21:47   ` Jeroen Hofstee
  4 siblings, 1 reply; 13+ messages in thread
From: Anatolij Gustschin @ 2012-05-18 21:22 UTC (permalink / raw)
  To: u-boot

Hi,

On Wed, 16 May 2012 21:04:56 +0200
Jeroen Hofstee <jeroen@myspectrum.nl> wrote:

> I could not resist removing some brackets etc while looking at the file..
> These changes are optional and in a seperate patch. I will email a
> seperate patch which I use for testing, but should NOT be in mainline,
> since it assumes which LCD is connected.
> 
> Beagle owners, please test that I didn't break your orange background;
> I don't have the board.

I used similar patches on beagleboard when debugging cfb console output
on omap3 and will test your patches soon. You also might need this [1]
patch.

Thanks,

Anatolij

[1] http://patchwork.ozlabs.org/patch/155662/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer
  2012-05-18 21:22 ` [U-Boot] [PATCH " Anatolij Gustschin
@ 2012-05-18 21:47   ` Jeroen Hofstee
  0 siblings, 0 replies; 13+ messages in thread
From: Jeroen Hofstee @ 2012-05-18 21:47 UTC (permalink / raw)
  To: u-boot

On 05/18/2012 11:22 PM, Anatolij Gustschin wrote
> I used similar patches on beagleboard when debugging cfb console output
> on omap3 and will test your patches soon. You also might need this [1]
> patch.

Thanks, I was aware of this, see the commit message:

?Scrolling depends on this patch:

http://patchwork.ozlabs.org/patch/155662/"

The path is up for reposting, otherwise I could add the tested-by..


> [1] http://patchwork.ozlabs.org/patch/155662/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH v2 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer
  2012-05-18 10:50 ` [U-Boot] [PATCH v2 " Jeroen Hofstee
  2012-05-18 10:51   ` [U-Boot] [PATCH v2 1/2] omap3_dss: add optional framebuffer Jeroen Hofstee
  2012-05-18 10:51   ` [U-Boot] [PATCH v2 2/2] omap3_dss: cosmetic changes Jeroen Hofstee
@ 2012-05-24 19:17   ` Tom Rini
  2 siblings, 0 replies; 13+ messages in thread
From: Tom Rini @ 2012-05-24 19:17 UTC (permalink / raw)
  To: u-boot

On Fri, May 18, 2012 at 12:50:59PM +0200, Jeroen Hofstee wrote:
> changes for v2:
> removed an unneeded cast and memset.
> 
> v1:
> I could not resist removing some brackets etc while looking at the file..
> These changes are optional and in a seperate patch. I will email a
> seperate patch which I use for testing, but should NOT be in mainline,
> since it assumes which LCD is connected.
> 
> Beagle owners, please test that I didn't break your orange background;
> I don't have the board.

Still seeing orange here.

-- 
Tom

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH v2 1/2] omap3_dss: add optional framebuffer
  2012-05-18 10:51   ` [U-Boot] [PATCH v2 1/2] omap3_dss: add optional framebuffer Jeroen Hofstee
@ 2012-05-25 13:51     ` Anatolij Gustschin
  0 siblings, 0 replies; 13+ messages in thread
From: Anatolij Gustschin @ 2012-05-25 13:51 UTC (permalink / raw)
  To: u-boot

Hi,

On Fri, 18 May 2012 12:51:00 +0200
Jeroen Hofstee <jeroen@myspectrum.nl> wrote:

> From: Jeroen Hofstee <jhofstee@victronenergy.com>
> 
> The beagle board uses the background color to show an orange screen during
> startup. This patch adds the ability to add a frame buffer, with the
> intention not to break the beagle board use case (I don't have one).
> videomodes.c is not used. Scrolling depends on this patch:
> 
> http://patchwork.ozlabs.org/patch/155662/
> 
> cc: trini at ti.com
> cc: s-paulraj at ti.com
> cc: khasim at ti.com
> Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
> ---
>  arch/arm/include/asm/arch-omap3/dss.h |   37 +++++++++++++++++++++++++--
>  drivers/video/Makefile                |    2 +-
>  drivers/video/omap3_dss.c             |   44 +++++++++++++++++++++++++++++++++
>  3 files changed, 80 insertions(+), 3 deletions(-)

Applied to u-boot-video/master, thanks!

Anatolij

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH v2 2/2] omap3_dss: cosmetic changes
  2012-05-18 10:51   ` [U-Boot] [PATCH v2 2/2] omap3_dss: cosmetic changes Jeroen Hofstee
@ 2012-05-25 13:54     ` Anatolij Gustschin
  2012-05-25 14:44       ` Tom Rini
  0 siblings, 1 reply; 13+ messages in thread
From: Anatolij Gustschin @ 2012-05-25 13:54 UTC (permalink / raw)
  To: u-boot

Hi,

On Fri, 18 May 2012 12:51:01 +0200
Jeroen Hofstee <jeroen@myspectrum.nl> wrote:

> From: Jeroen Hofstee <jhofstee@victronenergy.com>
> 
> Remove unnecessary brackets.
> Unwrap lines which are below 80 chars.
> Single line comment as single line (as the rest).
> Moved init values to the source code.
> 
> cc: s-paulraj at ti.com
> cc: khasim at ti.com
> Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
> ---
>  arch/arm/include/asm/arch-omap3/dss.h |   24 ++++--------------------
>  drivers/video/omap3_dss.c             |   33 +++++++++++++--------------------
>  2 files changed, 17 insertions(+), 40 deletions(-)

Applied to u-boot-video/master, thanks!

Anatolij

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH v2 2/2] omap3_dss: cosmetic changes
  2012-05-25 13:54     ` Anatolij Gustschin
@ 2012-05-25 14:44       ` Tom Rini
  0 siblings, 0 replies; 13+ messages in thread
From: Tom Rini @ 2012-05-25 14:44 UTC (permalink / raw)
  To: u-boot

On Fri, May 25, 2012 at 03:54:43PM +0200, Anatolij Gustschin wrote:
> Hi,
> 
> On Fri, 18 May 2012 12:51:01 +0200
> Jeroen Hofstee <jeroen@myspectrum.nl> wrote:
> 
> > From: Jeroen Hofstee <jhofstee@victronenergy.com>
> > 
> > Remove unnecessary brackets.
> > Unwrap lines which are below 80 chars.
> > Single line comment as single line (as the rest).
> > Moved init values to the source code.
> > 
> > cc: s-paulraj at ti.com
> > cc: khasim at ti.com
> > Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
> > ---
> >  arch/arm/include/asm/arch-omap3/dss.h |   24 ++++--------------------
> >  drivers/video/omap3_dss.c             |   33 +++++++++++++--------------------
> >  2 files changed, 17 insertions(+), 40 deletions(-)
> 
> Applied to u-boot-video/master, thanks!

This is fine with me FWIW, I had pulled these into u-boot-ti/master
yesterday locally.  I'll take them out before I do a pull request later
today.

-- 
Tom

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-05-25 14:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-16 19:04 [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer Jeroen Hofstee
2012-05-16 19:04 ` [U-Boot] [PATCH 1/2] omap3_dss: add optional framebuffer Jeroen Hofstee
2012-05-16 19:04 ` [U-Boot] [PATCH 2/2] omap3_dss: cosmetic changes Jeroen Hofstee
2012-05-16 19:40 ` [U-Boot] [PATCH 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer Jeroen Hofstee
2012-05-18 10:50 ` [U-Boot] [PATCH v2 " Jeroen Hofstee
2012-05-18 10:51   ` [U-Boot] [PATCH v2 1/2] omap3_dss: add optional framebuffer Jeroen Hofstee
2012-05-25 13:51     ` Anatolij Gustschin
2012-05-18 10:51   ` [U-Boot] [PATCH v2 2/2] omap3_dss: cosmetic changes Jeroen Hofstee
2012-05-25 13:54     ` Anatolij Gustschin
2012-05-25 14:44       ` Tom Rini
2012-05-24 19:17   ` [U-Boot] [PATCH v2 0/2] omap_dss: add optional 32bit XXRRGGBB framebuffer Tom Rini
2012-05-18 21:22 ` [U-Boot] [PATCH " Anatolij Gustschin
2012-05-18 21:47   ` Jeroen Hofstee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox