[U-Boot] [PATCH] video: Add an option to skip video initialization

This patch adds an option to skip the video initialization on for all video drivers. This is needed for the CPCI750 which can be built as CPCI host and adapter/target board. And the adapter board can't access the video cards located on the CompactPCI bus.
Signed-off-by: Stefan Roese sr@denx.de Cc: Anatolij Gustschin agust@denx.de --- This patch replaces the previous one [video: ct6900: Add an option to skip video initialization]. The test is now moved out of the ct6900 file into the generic video init routine drv_video_init() as suggested by Anatolij.
Thanks, Stefan
drivers/video/cfb_console.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 5ee2314..d3d5a6d 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -1330,11 +1330,27 @@ static int video_init (void)
/*****************************************************************************/
+/* + * Implement a weak default function for boards that optionally + * need to skip the video initialization. + */ +int __board_video_skip(void) +{ + /* As default, don't skip test */ + return 0; +} +int board_video_skip(void) __attribute__((weak, alias("__board_video_skip"))); + + int drv_video_init (void) { int skip_dev_init; device_t console_dev;
+ /* Check if video initialization should be skipped */ + if (board_video_skip()) + return 0; + skip_dev_init = 0;
/* Init video chip - returns with framebuffer cleared */

In message 1242369514-24243-1-git-send-email-sr@denx.de Stefan Roese wrote:
This patch adds an option to skip the video initialization on for all video drivers. This is needed for the CPCI750 which can be built as CPCI host and adapter/target board. And the adapter board can't access the video cards located on the CompactPCI bus.
I think we should use this opportunity to clean up the logic of drv_video_init() a bit:
Patch 1/2: drv_video_init(): simplify logic
Make drv_video_init() easier to read.
Patch 2/2: video: Add an option to skip video initialization
Stefan's patch rebased against the simplified code.
Best regards,
Wolfgang Denk

Simplify nesting of drv_video_init() and use a consistent way of indicating failure / success. Before, it took me some time to realize which of the returns was due to an error condition and which of them indicated success.
Signed-off-by: Wolfgang Denk wd@denx.de Cc: Anatolij Gustschin agust@denx.de --- drivers/video/cfb_console.c | 69 ++++++++++++++++++------------------------- 1 files changed, 29 insertions(+), 40 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 5ee2314..f744d57 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -1335,48 +1335,37 @@ int drv_video_init (void) int skip_dev_init; device_t console_dev;
- skip_dev_init = 0; - /* Init video chip - returns with framebuffer cleared */ - if (video_init () == -1) - skip_dev_init = 1; + skip_dev_init = (video_init () == -1)
-#ifdef CONFIG_VGA_AS_SINGLE_DEVICE - /* Devices VGA and Keyboard will be assigned seperately */ - /* Init vga device */ - if (!skip_dev_init) { - memset (&console_dev, 0, sizeof (console_dev)); - strcpy (console_dev.name, "vga"); - console_dev.ext = DEV_EXT_VIDEO; /* Video extensions */ - console_dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_SYSTEM; - console_dev.putc = video_putc; /* 'putc' function */ - console_dev.puts = video_puts; /* 'puts' function */ - console_dev.tstc = NULL; /* 'tstc' function */ - console_dev.getc = NULL; /* 'getc' function */ - - if (device_register (&console_dev) == 0) - return 1; - } -#else +#if !defined(CONFIG_VGA_AS_SINGLE_DEVICE) PRINTD ("KBD: Keyboard init ...\n"); - if (VIDEO_KBD_INIT_FCT == -1) - skip_dev_init = 1; - - /* Init console device */ - if (!skip_dev_init) { - memset (&console_dev, 0, sizeof (console_dev)); - strcpy (console_dev.name, "vga"); - console_dev.ext = DEV_EXT_VIDEO; /* Video extensions */ - console_dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM; - console_dev.putc = video_putc; /* 'putc' function */ - console_dev.puts = video_puts; /* 'puts' function */ - console_dev.tstc = VIDEO_TSTC_FCT; /* 'tstc' function */ - console_dev.getc = VIDEO_GETC_FCT; /* 'getc' function */ - - if (device_register (&console_dev) == 0) - return 1; - } + skip_dev_init |= (VIDEO_KBD_INIT_FCT == -1); +#endif + + if (skip_dev_init) + return 0; + + /* Init vga device */ + memset (&console_dev, 0, sizeof (console_dev)); + strcpy (console_dev.name, "vga"); + console_dev.ext = DEV_EXT_VIDEO; /* Video extensions */ + console_dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_SYSTEM; + console_dev.putc = video_putc; /* 'putc' function */ + console_dev.puts = video_puts; /* 'puts' function */ + console_dev.tstc = NULL; /* 'tstc' function */ + console_dev.getc = NULL; /* 'getc' function */ + +#if !defined(CONFIG_VGA_AS_SINGLE_DEVICE) + /* Also init console device */ + console_dev.flags |= DEV_FLAGS_INPUT; + console_dev.tstc = VIDEO_TSTC_FCT; /* 'tstc' function */ + console_dev.getc = VIDEO_GETC_FCT; /* 'getc' function */ #endif /* CONFIG_VGA_AS_SINGLE_DEVICE */ - /* No console dev available */ - return 0; + + if (device_register (&console_dev) != 0) + return 0; + + /* Return success */ + return 1; }

Simplify nesting of drv_video_init() and use a consistent way of indicating failure / success. Before, it took me some time to realize which of the returns was due to an error condition and which of them indicated success.
Signed-off-by: Wolfgang Denk wd@denx.de Cc: Anatolij Gustschin agust@denx.de
drivers/video/cfb_console.c | 69 ++++++++++++++++++------------------------- 1 files changed, 29 insertions(+), 40 deletions(-)
Applied to u-boot-video/next, Thanks!
Note that i also fixed a missing semicolon after 'skip_dev_init = (video_init () == -1)' statement in both patches before applying.
Anatolij

Dear Anatolij Gustschin,
In message 4A0DF8CD.9030504@denx.de you wrote:
Simplify nesting of drv_video_init() and use a consistent way of indicating failure / success. Before, it took me some time to realize which of the returns was due to an error condition and which of them indicated success.
Signed-off-by: Wolfgang Denk wd@denx.de Cc: Anatolij Gustschin agust@denx.de
drivers/video/cfb_console.c | 69 ++++++++++++++++++------------------------- 1 files changed, 29 insertions(+), 40 deletions(-)
Applied to u-boot-video/next, Thanks!
Thank you.
Note that i also fixed a missing semicolon after 'skip_dev_init = (video_init () == -1)' statement in both patches before applying.
Ouch. Thanks for catching this.
Best regards,
Wolfgang Denk

This patch adds an option to skip the video initialization on for all video drivers. This is needed for the CPCI750 which can be built as CPCI host and adapter/target board. And the adapter board can't access the video cards located on the CompactPCI bus.
Signed-off-by: Stefan Roese sr@denx.de Cc: Anatolij Gustschin agust@denx.de
Rebased against simplifying patch. Signed-off-by: Wolfgang Denk wd@denx.de --- drivers/video/cfb_console.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index f744d57..81b3131 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -1330,11 +1330,26 @@ static int video_init (void)
/*****************************************************************************/
+/* + * Implement a weak default function for boards that optionally + * need to skip the video initialization. + */ +int __board_video_skip(void) +{ + /* As default, don't skip test */ + return 0; +} +int board_video_skip(void) __attribute__((weak, alias("__board_video_skip"))); + int drv_video_init (void) { int skip_dev_init; device_t console_dev;
+ /* Check if video initialization should be skipped */ + if (board_video_skip()) + return 0; + /* Init video chip - returns with framebuffer cleared */ skip_dev_init = (video_init () == -1)

On 10:07 Fri 15 May , Wolfgang Denk wrote:
This patch adds an option to skip the video initialization on for all video drivers. This is needed for the CPCI750 which can be built as CPCI host and adapter/target board. And the adapter board can't access the video cards located on the CompactPCI bus.
Signed-off-by: Stefan Roese sr@denx.de Cc: Anatolij Gustschin agust@denx.de
Rebased against simplifying patch. Signed-off-by: Wolfgang Denk wd@denx.de
It will be nice if you can base it against the stdio patch v4 I send some days agi 297 F May13 To u-boot@lists └─>[PATCH 2/4 v4] stdio/device: rework function naming convention
Best Regards, J.

Jean-Christophe PLAGNIOL-VILLARD wrote:
On 10:07 Fri 15 May , Wolfgang Denk wrote:
This patch adds an option to skip the video initialization on for all video drivers. This is needed for the CPCI750 which can be built as CPCI host and adapter/target board. And the adapter board can't access the video cards located on the CompactPCI bus.
Signed-off-by: Stefan Roese sr@denx.de Cc: Anatolij Gustschin agust@denx.de
Rebased against simplifying patch. Signed-off-by: Wolfgang Denk wd@denx.de
It will be nice if you can base it against the stdio patch v4 I send some days agi 297 F May13 To u-boot@lists └─>[PATCH 2/4 v4] stdio/device: rework function naming convention
but this patch doesn't apply, neither on top of the U-Boot tree nor on top of it's next branch. Sorry, but this can't be considered as a base because it doesn't apply any more.
Even if I try to apply it on top of following patches
[U-Boot] [PATCH 1_2] arm_dcc: use static support to allow to use it at anytime [U-Boot] [PATCH 2_2] arm_dcc: add xcale support [U-Boot] [PATCH 1_4 v4] console.h: remove unused prototype 'console_realloc'
there are still some issues.
Anatolij

On 12:35 Fri 15 May , Anatolij Gustschin wrote:
Jean-Christophe PLAGNIOL-VILLARD wrote:
On 10:07 Fri 15 May , Wolfgang Denk wrote:
This patch adds an option to skip the video initialization on for all video drivers. This is needed for the CPCI750 which can be built as CPCI host and adapter/target board. And the adapter board can't access the video cards located on the CompactPCI bus.
Signed-off-by: Stefan Roese sr@denx.de Cc: Anatolij Gustschin agust@denx.de
Rebased against simplifying patch. Signed-off-by: Wolfgang Denk wd@denx.de
It will be nice if you can base it against the stdio patch v4 I send some days agi 297 F May13 To u-boot@lists └─>[PATCH 2/4 v4] stdio/device: rework function naming convention
but this patch doesn't apply, neither on top of the U-Boot tree nor on top of it's next branch. Sorry, but this can't be considered as a base because it doesn't apply any more.
it apply on the top of the arm-next
u-boot-arm stdio
Best Regards, J.

Jean-Christophe PLAGNIOL-VILLARD wrote:
On 12:35 Fri 15 May , Anatolij Gustschin wrote:
Jean-Christophe PLAGNIOL-VILLARD wrote:
On 10:07 Fri 15 May , Wolfgang Denk wrote:
This patch adds an option to skip the video initialization on for all video drivers. This is needed for the CPCI750 which can be built as CPCI host and adapter/target board. And the adapter board can't access the video cards located on the CompactPCI bus.
Signed-off-by: Stefan Roese sr@denx.de Cc: Anatolij Gustschin agust@denx.de
Rebased against simplifying patch. Signed-off-by: Wolfgang Denk wd@denx.de
It will be nice if you can base it against the stdio patch v4 I send some days agi 297 F May13 To u-boot@lists └─>[PATCH 2/4 v4] stdio/device: rework function naming convention
but this patch doesn't apply, neither on top of the U-Boot tree nor on top of it's next branch. Sorry, but this can't be considered as a base because it doesn't apply any more.
it apply on the top of the arm-next
u-boot-arm stdio
OK, Thanks for this info. I will rebase these patches after arm-next will be merged into u-boot/next.
Best regards, Anatolij

Dear Anatolij,
in message 4A0D6B9E.9020000@denx.de you wrote:
OK, Thanks for this info. I will rebase these patches after arm-next will be merged into u-boot/next.
This makes no sense. Who knows when we will see any pull request for this, if ever.
Reference for postings are well-defined as the maste rbranch or, when it exists like now, the next branch of the maste repository.
Otherwise we will quickly have a maze of interdependent requests who will have to wait for whom.
Best regards,
Wolfgang Denk

On 15:50 Fri 15 May , Wolfgang Denk wrote:
Dear Anatolij,
in message 4A0D6B9E.9020000@denx.de you wrote:
OK, Thanks for this info. I will rebase these patches after arm-next will be merged into u-boot/next.
This makes no sense. Who knows when we will see any pull request for this, if ever.
Reference for postings are well-defined as the maste rbranch or, when it exists like now, the next branch of the maste repository.
Otherwise we will quickly have a maze of interdependent requests who will have to wait for whom.
The arm-pull request is for to tommorow or to night
I've 2 patch apply before
Best Regards, J.

Dear Jean-Christophe PLAGNIOL-VILLARD,
In message 20090515135606.GH16288@game.jcrosoft.org you wrote:
Otherwise we will quickly have a maze of interdependent requests who will have to wait for whom.
The arm-pull request is for to tommorow or to night
I've 2 patch apply before
First come, first serve.
Best regards,
Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,
In message 20090515123753.GG16288@game.jcrosoft.org you wrote:
297 F May13 To u-boot@lists ââ>[PATCH 2/4 v4] stdio/device: rework function naming convention
but this patch doesn't apply, neither on top of the U-Boot tree nor on top of it's next branch. Sorry, but this can't be considered as a base because it doesn't apply any more.
it apply on the top of the arm-next
Sorry, but this is not a reference for any general U-Boot work. As long as it didn't make it at least into "next", you must care yourself to rebase your work against the master or next branches, like anybody else.
Best regards,
Wolfgang Denk

Hello Wolfgang, Stefan,
Wolfgang Denk wrote:
This patch adds an option to skip the video initialization on for all video drivers. This is needed for the CPCI750 which can be built as CPCI host and adapter/target board. And the adapter board can't access the video cards located on the CompactPCI bus.
Signed-off-by: Stefan Roese sr@denx.de Cc: Anatolij Gustschin agust@denx.de
Rebased against simplifying patch. Signed-off-by: Wolfgang Denk wd@denx.de
should these patches go in for v2009.06 ?
Anatolij

On Friday 15 May 2009 12:41:36 Anatolij Gustschin wrote:
This patch adds an option to skip the video initialization on for all video drivers. This is needed for the CPCI750 which can be built as CPCI host and adapter/target board. And the adapter board can't access the video cards located on the CompactPCI bus.
Signed-off-by: Stefan Roese sr@denx.de Cc: Anatolij Gustschin agust@denx.de
Rebased against simplifying patch. Signed-off-by: Wolfgang Denk wd@denx.de
should these patches go in for v2009.06 ?
No. It's not really bug fixes, so let's queue them for the next release.
Best regards, Stefan
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de =====================================================================

Wolfgang Denk wrote:
This patch adds an option to skip the video initialization on for all video drivers. This is needed for the CPCI750 which can be built as CPCI host and adapter/target board. And the adapter board can't access the video cards located on the CompactPCI bus.
Signed-off-by: Stefan Roese sr@denx.de Cc: Anatolij Gustschin agust@denx.de
Rebased against simplifying patch. Signed-off-by: Wolfgang Denk wd@denx.de
drivers/video/cfb_console.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
Applied to u-boot-video/next, Thanks!
Best regards, Anatolij

Stefan Roese wrote:
This patch adds an option to skip the video initialization on for all video drivers. This is needed for the CPCI750 which can be built as CPCI host and adapter/target board. And the adapter board can't access the video cards located on the CompactPCI bus.
Signed-off-by: Stefan Roese sr@denx.de Cc: Anatolij Gustschin agust@denx.de
This patch replaces the previous one [video: ct6900: Add an option to skip video initialization]. The test is now moved out of the ct6900 file into the generic video init routine drv_video_init() as suggested by Anatolij.
Thanks, Stefan
drivers/video/cfb_console.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
i replaced this patch by the same patch from Wolfgang which is rebased on top of his "drv_video_init(): simplify logic" patch. Thanks!
Best regards, Anatolij
participants (4)
-
Anatolij Gustschin
-
Jean-Christophe PLAGNIOL-VILLARD
-
Stefan Roese
-
Wolfgang Denk