Skip to contentSkip to conversation

p1022ds: add video support

PATCH New Timur Tabi 4 participants 12 messages Sep 2, 2010 – Sep 22, 2010

lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

PATCH 1/1 p1022ds: add video support

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.

---

This patch depends on:

[v3] fsl: refactor MPC8610 and MPC5121 DIU code to use existing bitmap and logo features

 board/freescale/p1022ds/Makefile |    2 +
 board/freescale/p1022ds/diu.c    |  172 ++++++++++++++++++++++++++++++++++++++
 include/configs/P1022DS.h        |    7 ++-
 3 files changed, 180 insertions(+), 1 deletions(-)
 create mode 100644 board/freescale/p1022ds/diu.c
board/freescale/p1022ds/Makefile +2 -0
index 8ede2d6..678eb2a 100644
@@ -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))
board/freescale/p1022ds/diu.c new file +172 -0

172 lines not on this page · raw message

include/configs/P1022DS.h +6 -1
index dcaca2b..d518c69 100644
@@ -31,6 +31,7 @@
 #define CONFIG_FSL_PCIE_RESET		/* need PCIe reset errata */
 #define CONFIG_SYS_PCI_64BIT		/* enable 64-bit PCI resources */
 #define CONFIG_SYS_HAS_SERDES		/* has SERDES */
+#define CONFIG_FSL_DIU_FB		/* Has a DIU video controller */
 
 #define CONFIG_PHYS_64BIT
 #define CONFIG_ENABLE_36BIT_PHYS
@@ -181,10 +182,14 @@
 #define CONFIG_SYS_DIU_ADDR	(CONFIG_SYS_CCSRBAR + 0x10000)
 
 /* Video */
-/* #define CONFIG_VIDEO */
+#undef CONFIG_VIDEO
+
 #ifdef 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
 
 /*
Signature · 1 line
1.7.2.1
#1 lore raw

PATCH 1/1 p1022ds: add video support

Hi Timur,

On Thu, 2 Sep 2010 15:35:19 -0500
Timur Tabi <[email protected]> wrote:
...

board/freescale/p1022ds/diu.c line 17

Quoted 5 lines
board/freescale/p1022ds/diu.c new file +5 -0
+#include <common.h>
+#include <command.h>
+#include <asm/io.h>
+
+#ifdef CONFIG_FSL_DIU_FB

Please drop the #ifdef above. Conditional compilation is already handled by Makefile.

...

Quoted 1 line

+#define PX_BRDCFG1_DDCEN 0x10

This one is not used, please drop.

...

Quoted 12 lines
board/freescale/p1022ds/diu.c new file +12 -0
+#define AD_BYTE_F		0x10000000
+#define AD_ALPHA_C_MASK		0x0E000000
+#define AD_ALPHA_C_SHIFT	25
+#define AD_BLUE_C_MASK		0x01800000
+#define AD_BLUE_C_SHIFT		23
+#define AD_GREEN_C_MASK		0x00600000
+#define AD_GREEN_C_SHIFT	21
+#define AD_RED_C_MASK		0x00180000
+#define AD_RED_C_SHIFT		19
+#define AD_PALETTE		0x00040000
+#define AD_PIXEL_S_MASK		0x00030000
+#define AD_PIXEL_S_SHIFT	16

board/freescale/p1022ds/diu.c line 63

Quoted 10 lines
board/freescale/p1022ds/diu.c new file +10 -0
+#define AD_COMP_3_MASK		0x0000F000
+#define AD_COMP_3_SHIFT		12
+#define AD_COMP_2_MASK		0x00000F00
+#define AD_COMP_2_SHIFT		8
+#define AD_COMP_1_MASK		0x000000F0
+#define AD_COMP_1_SHIFT		4
+#define AD_COMP_0_MASK		0x0000000F
+#define AD_COMP_0_SHIFT		0
+
+#define AD_DEFAULT

Some of the defines above are not used (*_MASK, AD_PALETTE, AD_DEFAULT), please drop them, too.

...

include/configs/P1022DS.h line 34

Quoted 9 lines
include/configs/P1022DS.h +1 -0
index dcaca2b..d518c69 100644
@@ -31,6 +31,7 @@
 #define CONFIG_FSL_PCIE_RESET		/* need PCIe reset errata */
 #define CONFIG_SYS_PCI_64BIT		/* enable 64-bit PCI resources */
 #define CONFIG_SYS_HAS_SERDES		/* has SERDES */
+#define CONFIG_FSL_DIU_FB		/* Has a DIU video controller */

Drop this CONFIG_FSL_DIU_FB define, too. It is already present in the board config file.

Quoted 6 lines
include/configs/P1022DS.h +0 -0
 #define CONFIG_PHYS_64BIT
 #define CONFIG_ENABLE_36BIT_PHYS
@@ -181,10 +182,14 @@
 #define CONFIG_SYS_DIU_ADDR	(CONFIG_SYS_CCSRBAR + 0x10000)
 
 /* Video */

include/configs/P1022DS.h line 193

Quoted 10 lines
include/configs/P1022DS.h +5 -1
-/* #define CONFIG_VIDEO */
+#undef CONFIG_VIDEO
+
 #ifdef 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

CONFIG_VIDEO definition should depend on CONFIG_FSL_DIU_FB, I think. Otherwise the building won't succeed if CONFIG_FSL_DIU_FB is not defined (due to absence of video_hw_init()).

Thanks,
Anatolij

author
#2 lore raw

PATCH 1/1 p1022ds: add video support

Quoted 17 lines · Anatolij Gustschin
Quoted 17 lines
board/freescale/p1022ds/diu.c new file +17 -0
+#define AD_BYTE_F		0x10000000
+#define AD_ALPHA_C_MASK		0x0E000000
+#define AD_ALPHA_C_SHIFT	25
+#define AD_BLUE_C_MASK		0x01800000
+#define AD_BLUE_C_SHIFT		23
+#define AD_GREEN_C_MASK		0x00600000
+#define AD_GREEN_C_SHIFT	21
+#define AD_RED_C_MASK		0x00180000
+#define AD_RED_C_SHIFT		19
+#define AD_PALETTE		0x00040000
+#define AD_PIXEL_S_MASK		0x00030000
+#define AD_PIXEL_S_SHIFT	16
+#define AD_COMP_3_MASK		0x0000F000
+#define AD_COMP_3_SHIFT		12
+#define AD_COMP_2_MASK		0x00000F00
+#define AD_COMP_2_SHIFT		8
+#define AD_COMP_1_MASK		0x000000F0
Quoted 8 lines

board/freescale/p1022ds/diu.c line 63

Quoted 5 lines
board/freescale/p1022ds/diu.c new file +5 -0
+#define AD_COMP_1_SHIFT		4
+#define AD_COMP_0_MASK		0x0000000F
+#define AD_COMP_0_SHIFT		0
+
+#define AD_DEFAULT

Some of the defines above are not used (*_MASK, AD_PALETTE, AD_DEFAULT), please drop them, too.

Does it really matter? These are all in a .c file, so it's not like I'm polluting the name space.

Also, I thought it would be better to provide some sort of completeness for the bits I am using.

Quoted 3 lines

CONFIG_VIDEO definition should depend on CONFIG_FSL_DIU_FB, I think. Otherwise the building won't succeed if CONFIG_FSL_DIU_FB is not defined (due to absence of video_hw_init()).

We need the DIU initialized, even if U-Boot doesn't use it. This is what CONFIG_FSL_DIU_FB does. CONFIG_VIDEO then tells U-Boot to actually use the DIU.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#3 lore raw

PATCH 1/1 p1022ds: add video support

Quoted 28 lines · On Tue, 21 Sep 2010 17:00:19 -0500 Timur Tabi <[email protected]> wrote:
Quoted 17 lines · Anatolij Gustschin
Quoted 17 lines
board/freescale/p1022ds/diu.c new file +17 -0
+#define AD_BYTE_F		0x10000000
+#define AD_ALPHA_C_MASK		0x0E000000
+#define AD_ALPHA_C_SHIFT	25
+#define AD_BLUE_C_MASK		0x01800000
+#define AD_BLUE_C_SHIFT		23
+#define AD_GREEN_C_MASK		0x00600000
+#define AD_GREEN_C_SHIFT	21
+#define AD_RED_C_MASK		0x00180000
+#define AD_RED_C_SHIFT		19
+#define AD_PALETTE		0x00040000
+#define AD_PIXEL_S_MASK		0x00030000
+#define AD_PIXEL_S_SHIFT	16
+#define AD_COMP_3_MASK		0x0000F000
+#define AD_COMP_3_SHIFT		12
+#define AD_COMP_2_MASK		0x00000F00
+#define AD_COMP_2_SHIFT		8
+#define AD_COMP_1_MASK		0x000000F0
Quoted 8 lines

board/freescale/p1022ds/diu.c line 63

Quoted 5 lines
board/freescale/p1022ds/diu.c new file +5 -0
+#define AD_COMP_1_SHIFT		4
+#define AD_COMP_0_MASK		0x0000000F
+#define AD_COMP_0_SHIFT		0
+
+#define AD_DEFAULT

Some of the defines above are not used (*_MASK, AD_PALETTE, AD_DEFAULT), please drop them, too.

Quoted 5 lines

Does it really matter? These are all in a .c file, so it's not like I'm polluting the name space.

Also, I thought it would be better to provide some sort of completeness for the bits I am using.

We do not add unused code.

Quoted 6 lines
Quoted 3 lines

CONFIG_VIDEO definition should depend on CONFIG_FSL_DIU_FB, I think. Otherwise the building won't succeed if CONFIG_FSL_DIU_FB is not defined (due to absence of video_hw_init()).

We need the DIU initialized, even if U-Boot doesn't use it. This is what CONFIG_FSL_DIU_FB does. CONFIG_VIDEO then tells U-Boot to actually use the DIU.

I understand it. I didn't say you should make CONFIG_FSL_DIU_FB dependent on CONFIG_VIDEO, but the opposite.

On the other site, one of the design principles states:

initialize devices only when they are needed within U-Boot.

Thanks,
Anatolij

author
#4 lore raw

PATCH 1/1 p1022ds: add video support

Quoted 3 lines · Anatolij Gustschin
Quoted 2 lines

Also, I thought it would be better to provide some sort of completeness for the

Quoted 1 line

bits I am using.

We do not add unused code.

Well, I don't see how macros are "unused code", but I'll delete those lines.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

CONFIG_VIDEO definition should depend on CONFIG_FSL_DIU_FB, I think. Otherwise the building won't succeed if CONFIG_FSL_DIU_FB is not defined (due to absence of video_hw_init()).

We need the DIU initialized, even if U-Boot doesn't use it. This is what CONFIG_FSL_DIU_FB does. CONFIG_VIDEO then tells U-Boot to actually use the DIU.

I understand it. I didn't say you should make CONFIG_FSL_DIU_FB dependent on CONFIG_VIDEO, but the opposite.

Ok.

Quoted 3 lines

On the other site, one of the design principles states:

initialize devices only when they are needed within U-Boot.

Well, I'll try to work toward that, but I'm pretty sure there are plenty of devices that are initialized but not used in U-Boot already.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#5 lore raw

PATCH 1/1 p1022ds: add video support

Hi Timur,

Quoted 17 lines
Quoted 3 lines · Anatolij Gustschin
Quoted 2 lines

Also, I thought it would be better to provide some sort of completeness for the

Quoted 1 line

bits I am using.

We do not add unused code.

Well, I don't see how macros are "unused code", but I'll delete those lines.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

CONFIG_VIDEO definition should depend on CONFIG_FSL_DIU_FB, I think. Otherwise the building won't succeed if CONFIG_FSL_DIU_FB is not defined (due to absence of video_hw_init()).

We need the DIU initialized, even if U-Boot doesn't use it. This is what CONFIG_FSL_DIU_FB does. CONFIG_VIDEO then tells U-Boot to actually use the DIU.

I understand it. I didn't say you should make CONFIG_FSL_DIU_FB dependent on CONFIG_VIDEO, but the opposite.

Quoted 8 lines

Ok.

Quoted 3 lines

On the other site, one of the design principles states:

initialize devices only when they are needed within U-Boot.

Well, I'll try to work toward that, but I'm pretty sure there are plenty of devices that are initialized but not used in U-Boot already.

This "but there are other examples doing just the same!" arguing is getting tiresome. Please accept that this is not an argument capable of convincing people - the opposite is true.

Is there a technical reason why the initialization has to be in U-Boot?

Cheers
Detlev

Signature · 6 lines
Less talking -- more hacking
                                        -- Olin Shivers
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
author
#6 lore raw

PATCH 1/1 p1022ds: add video support

Quoted 3 lines · Detlev Zundel

This "but there are other examples doing just the same!" arguing is getting tiresome. Please accept that this is not an argument capable of convincing people - the opposite is true.

It's also very frustrating when developers look at the way U-Boot does things, then spend countless hours or days implementing something similar, only be told, "Well, we know this is how it's done, but it's wrong, so you need to rewrite your code."

Frankly, I think *that* is way more tiresome.

Quoted 1 line

Is there a technical reason why the initialization has to be in U-Boot?

I'll have to re-examine the code. There may be a way to eliminate any such initialization.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#7 lore raw

PATCH 1/1 p1022ds: add video support

Quoted 5 lines · Timur Tabi
Quoted 1 line

Is there a technical reason why the initialization has to be in U-Boot?

I'll have to re-examine the code. There may be a way to eliminate any such initialization.

There is a technical reason. The DIU driver needs initialize DVI encoder which is on I2C bus. Linux kernel starts to use console device long before I2C is available. So it has to be done in U-boot.

York

#8 lore raw

PATCH 1/1 p1022ds: add video support

Hi,

Quoted 9 lines · Timur Tabi
Quoted 5 lines
Quoted 1 line

Is there a technical reason why the initialization has to be in U-Boot?

I'll have to re-examine the code. There may be a way to eliminate any such initialization.

There is a technical reason. The DIU driver needs initialize DVI encoder which is on I2C bus. Linux kernel starts to use console device long before I2C is available. So it has to be done in U-boot.

Ok, then why not always define CONFIG_VIDEO for this configuration and let U-Boot initialize _and_ use it? Actually I fail to see why U-Boot shouldn't use it if the support is there or what am I missing?

Best wishes
Detlev

Signature · 8 lines
   "Our enemies  are innovative  and resourceful, and so are we.  They
never stop thinking about new ways to harm our country and our people,
and neither do we."
       -- George W. Bush during a defense bill ceremony on 5. Aug 2004
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
author
#9 lore raw

PATCH 1/1 p1022ds: add video support

Quoted 3 lines · Detlev Zundel

Ok, then why not always define CONFIG_VIDEO for this configuration and let U-Boot initialize _and_ use it? Actually I fail to see why U-Boot shouldn't use it if the support is there or what am I missing?

How can U-Boot know whether a monitor is actually connected to the DVI port?

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#10 lore raw

PATCH 1/1 p1022ds: add video support

Hi Timur,

Quoted 6 lines
Quoted 3 lines · Detlev Zundel

Ok, then why not always define CONFIG_VIDEO for this configuration and let U-Boot initialize _and_ use it? Actually I fail to see why U-Boot shouldn't use it if the support is there or what am I missing?

How can U-Boot know whether a monitor is actually connected to the DVI port?

I don't know - DDC? Isn't it supposed to be used to do exactly this? I'm pretty sure that Anatolij would welcome an implementation :)

Cheers
Detlev

Signature · 8 lines
Summary [of object-oriented programming in Perl 5]
That's all about there is to it. Now you just need to go off and buy a
book about object-oriented design methodology, and bang  your forehead
with it for the next six months or so.    Larry Wall [Creator of Perl]
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#11 lore raw

PATCH 1/1 p1022ds: add video support

In reply to Timur Tabi

Hi Timur,

Quoted 9 lines
Quoted 3 lines · Detlev Zundel

This "but there are other examples doing just the same!" arguing is getting tiresome. Please accept that this is not an argument capable of convincing people - the opposite is true.

It's also very frustrating when developers look at the way U-Boot does things, then spend countless hours or days implementing something similar, only be told, "Well, we know this is how it's done, but it's wrong, so you need to rewrite your code."

It is a simple fact that we cannot remove every part of U-Boot code which is not in alignment with the (current) design principles. The design principles of _every_ software project will develop over its existence and there will always be old code around which is not how it would be done if starting today. This will happen for every moderately large project and should be "common sense" for software engineers.

The only way I can see around this is if the project has a sufficiently large number of "janitors" cleaning up such things. And you know as well as I do that we simply do not have such people for U-Boot, although the work would be much appreciated.

It is not the first and not the second time that you argument this way. Who stops you from posting a small mail with the intent of your changes to get early feedback from others if in doubt? Not only in this context I would advise doing this whenever possible.

Cheers
Detlev

Signature · 7 lines
Another helpful hint for successful MIME processing:

application/msword; rm -f %s; description="MS Word Text";
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de