Skip to contentSkip to conversation

video: ct6900: Add an option to skip video initialization

PATCH New Stefan Roese 3 participants 11 messages May 14, 2009 – May 15, 2009 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: ct6900: Add an option to skip video initialization

This patch adds an option to skip the video initialization on the ct6900. 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.

Cc Anatolij Gustschin <[email protected]>
---
 drivers/video/ct69000.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
drivers/video/ct69000.c +15 -1
index ae219cc..6a5243b 100644
@@ -964,6 +964,16 @@ static struct pci_device_id supported[] = {
 	{}
 };
 
+/*
+ * Implement a weak default function for boards that optionally
+ * need to skip the video initialization.
+ */
+int __board_video_skip(void)
+{
+	return 0;
+}
+int board_video_skip(void) __attribute__((weak, alias("__board_video_skip")));
+
 /*******************************************************************************
 *
 * Init video chip
@@ -982,8 +992,12 @@ video_hw_init (void)
 	struct ctfb_res_modes *res_mode;
 	struct ctfb_res_modes var_mode;
 	struct ctfb_chips_properties *chips_param;
-	/* Search for video chip */
 
+	/* Check if video initialization should be skipped */
+	if (board_video_skip())
+		return NULL;
+
+	/* Search for video chip */
 	if ((devbusfn = pci_find_devices (supported, 0)) < 0) {
 #ifdef CONFIG_VIDEO_ONBOARD
 		printf ("Video: Controller not found !\n");
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 1/1 video: ct6900: Add an option to skip video initialization

Dear Stefan Roese,

Quoted 4 lines · In message <[email protected]> you wrote:

This patch adds an option to skip the video initialization on the ct6900. 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.

Hm... why do you change the code of the viseo driver then? This change should be local to the CPCI750 board only.

Quoted 14 lines
drivers/video/ct69000.c +10 -0
+/*
+ * Implement a weak default function for boards that optionally
+ * need to skip the video initialization.
+ */
+int __board_video_skip(void)
+{
+	return 0;
+}
+int board_video_skip(void) __attribute__((weak, alias("__board_video_skip")));
+
 /*******************************************************************************
 *
 * Init video chip

drivers/video/ct69000.c video_hw_init (void) · line 998

Quoted 8 lines
drivers/video/ct69000.c +3 -1
@@ -982,8 +992,12 @@ video_hw_init (void)
 	struct ctfb_res_modes *res_mode;
 	struct ctfb_res_modes var_mode;
 	struct ctfb_chips_properties *chips_param;
-	/* Search for video chip */
 
+	/* Check if video initialization should be skipped */
+	if (board_video_skip())
+		return NULL;

This makes no sense to me. Instead of adding a (basicly board specific, even if you hide it with the weak implementation) shortcut to video_hw_init() you should not initialize the video driver on this board at all, leaving the video driver code unchanged.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"If the code and  the  comments  disagree,  then  both  are  probably
wrong."                                                - Norm Schryer
#2 lore raw

PATCH 1/1 video: ct6900: Add an option to skip video initialization

Hi Wolfgang,

Quoted 7 lines · On Thursday 14 May 2009 15:37:15 Wolfgang Denk wrote:
Quoted 4 lines

This patch adds an option to skip the video initialization on the ct6900. 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.

Hm... why do you change the code of the viseo driver then? This change should be local to the CPCI750 board only.

I would love to do it this way. It's not possible though. At least I don't see such a solution.

Quoted 20 lines
Quoted 20 lines
drivers/video/ct69000.c +9 -0
+/*
+ * Implement a weak default function for boards that optionally
+ * need to skip the video initialization.
+ */
+int __board_video_skip(void)
+{
+	return 0;
+}
+int board_video_skip(void) __attribute__((weak,

alias("__board_video_skip"))); +

/************************************************************************ ******* *
* Init video chip

drivers/video/ct69000.c +0 -1
@@ -982,8 +992,12 @@ video_hw_init (void)
 	struct ctfb_res_modes *res_mode;
 	struct ctfb_res_modes var_mode;
 	struct ctfb_chips_properties *chips_param;
-	/* Search for video chip */
 
Quoted 8 lines

drivers/video/ct69000.c video_hw_init (void) · line 998

Quoted 3 lines
drivers/video/ct69000.c +3 -0
+	/* Check if video initialization should be skipped */
+	if (board_video_skip())
+		return NULL;

This makes no sense to me. Instead of adding a (basicly board specific, even if you hide it with the weak implementation) shortcut to video_hw_init() you should not initialize the video driver on this board at all, leaving the video driver code unchanged.

Then please let me know how this can be accomplished. The CPCI750 uses the same U-Boot image both for the video-enabled CPCI-host version and for the video-disabled CPCI-adapter version. The video driver is not called from within the CPCI750 board files. It's called from drivers/video/cfb_console.c.

Thanks.

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 at denx.de
=====================================================================

#3 lore raw

PATCH 1/1 video: ct6900: Add an option to skip video initialization

Dear Stefan Roese,

Quoted 3 lines · In message <[email protected]> you wrote:

I would love to do it this way. It's not possible though. At least I don't see such a solution.

Of course it's possible. Anything is possible in software :-)

Quoted 4 lines

Then please let me know how this can be accomplished. The CPCI750 uses the same U-Boot image both for the video-enabled CPCI-host version and for the video-disabled CPCI-adapter version. The video driver is not called from within the CPCI750 board files. It's called from drivers/video/cfb_console.c.

And who calls the code in drivers/video/cfb_console.c ? I think this is the drv_video_init() call in common/devices.c, right?

If this should be the highest level in the call chain, then any conditional calling should be done here. But - don't we already have a board_video_init() which could return proper status to abort initialization?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
God grant me the senility to accept the things I cannot  change,  The
frustration  to  try to change things I cannot affect, and the wisdom
to tell the difference.
#4 lore raw

PATCH 1/1 video: ct6900: Add an option to skip video initialization

Quoted 8 lines · On Thursday 14 May 2009 16:02:00 Wolfgang Denk wrote:
Quoted 5 lines

Then please let me know how this can be accomplished. The CPCI750 uses the same U-Boot image both for the video-enabled CPCI-host version and for the video-disabled CPCI-adapter version. The video driver is not called from within the CPCI750 board files. It's called from drivers/video/cfb_console.c.

And who calls the code in drivers/video/cfb_console.c ? I think this is the drv_video_init() call in common/devices.c, right?

Yes.

Quoted 2 lines

If this should be the highest level in the call chain, then any conditional calling should be done here.

OK, I can move the conditional calling to this level.

Quoted 3 lines

But - don't we already have
a board_video_init() which could return proper status to abort initialization?

This is only implemented for some video drivers (SM501, SED13806, MB826xx) to return the base address for the graphics chip. The PCI drivers like the ct6900 don't use this interface. Here we have other means to get the base address.

I'll move the conditional calling to the highest level and resubmit.

Thanks.

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 at denx.de
=====================================================================

#5 lore raw

PATCH 1/1 video: ct6900: Add an option to skip video initialization

Dear Stefan Roese,

Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 3 lines

If this should be the highest level in the call chain, then any conditional calling should be done here.

OK, I can move the conditional calling to this level.

I'm not sure.

Quoted 9 lines
Quoted 3 lines

But - don't we already have
a board_video_init() which could return proper status to abort initialization?

This is only implemented for some video drivers (SM501, SED13806, MB826xx) to return the base address for the graphics chip. The PCI drivers like the ct6900 don't use this interface. Here we have other means to get the base address.

I'll move the conditional calling to the highest level and resubmit.

I'd probably rahter see that you add a board_video_init() to the ct6900 driver, and have this bail out.

Anatolij, what do you thik is the best solution here?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
[Braddock:] Mr. Churchill, you are drunk.
[Churchill:] And you madam, are ugly.  But I shall be sober tomorrow.
#6 lore raw

PATCH 1/1 video: ct6900: Add an option to skip video initialization

Quoted 16 lines · On Thursday 14 May 2009 17:01:46 Wolfgang Denk wrote:
Quoted 4 lines
Quoted 2 lines

If this should be the highest level in the call chain, then any conditional calling should be done here.

OK, I can move the conditional calling to this level.

I'm not sure.

Quoted 9 lines
Quoted 3 lines

But - don't we already have
a board_video_init() which could return proper status to abort initialization?

This is only implemented for some video drivers (SM501, SED13806, MB826xx) to return the base address for the graphics chip. The PCI drivers like the ct6900 don't use this interface. Here we have other means to get the base address.

Quoted 4 lines
Quoted 1 line

I'll move the conditional calling to the highest level and resubmit.

I'd probably rahter see that you add a board_video_init() to the ct6900 driver, and have this bail out.

And what should this function return? The base address is already available in the driver. Should we move this to all boards using this driver? I don't think so.

Quoted 1 line

Anatolij, what do you thik is the best solution here?

Yes? What's your preference here?

Thanks.

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 at denx.de
=====================================================================

#7 lore raw

PATCH 1/1 video: ct6900: Add an option to skip video initialization

Quoted 18 lines · Stefan Roese
Quoted 8 lines · On Thursday 14 May 2009 17:01:46 Wolfgang Denk wrote:
Quoted 3 lines
Quoted 2 lines

If this should be the highest level in the call chain, then any conditional calling should be done here.

OK, I can move the conditional calling to this level.

I'm not sure.

Quoted 3 lines
Quoted 3 lines

But - don't we already have
a board_video_init() which could return proper status to abort initialization?

Quoted 8 lines
Quoted 6 lines

This is only implemented for some video drivers (SM501, SED13806, MB826xx) to return the base address for the graphics chip. The PCI drivers like the ct6900 don't use this interface. Here we have other means to get the base address.

I'll move the conditional calling to the highest level and resubmit.

I'd probably rahter see that you add a board_video_init() to the ct6900 driver, and have this bail out.

Quoted 7 lines

And what should this function return? The base address is already available in the driver. Should we move this to all boards using this driver? I don't think so.

Quoted 1 line

Anatolij, what do you thik is the best solution here?

Yes? What's your preference here?

i suggest to move the board_video_skip() to the top of drv_video_init() in drivers/video/cfb_console.c.

What are the arguments against doing it?

Best regards,
Anatolij

Signature · 3 lines
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 at denx.de
#8 lore raw

PATCH 1/1 video: ct6900: Add an option to skip video initialization

Dear Anatolij Gustschin,

Quoted 5 lines · In message <[email protected]> you wrote:

i suggest to move the board_video_skip() to the top of drv_video_init() in drivers/video/cfb_console.c.

What are the arguments against doing it?

Not from my side.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Is truth not truth for all?
	-- Natira, "For the World is Hollow and I have Touched
		   the Sky", stardate 5476.4.
#9 lore raw

PATCH 1/1 video: ct6900: Add an option to skip video initialization

Quoted 6 lines · On Friday 15 May 2009 07:36:33 Wolfgang Denk wrote:
Quoted 4 lines

i suggest to move the board_video_skip() to the top of drv_video_init() in drivers/video/cfb_console.c.

What are the arguments against doing it?

Not from my side.

OK, I'll post a new patch in a short while.

Thanks.

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 at denx.de
=====================================================================

#10 lore raw

PATCH 1/1 video: ct6900: Add an option to skip video initialization

In reply to Wolfgang Denk

Hello Wolfgang, Stefan,

Quoted 10 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you wrote:
Quoted 2 lines

If this should be the highest level in the call chain, then any conditional calling should be done here.

OK, I can move the conditional calling to this level.

I'm not sure.

Quoted 3 lines
Quoted 3 lines

But - don't we already have
a board_video_init() which could return proper status to abort initialization?

Quoted 8 lines
Quoted 5 lines

This is only implemented for some video drivers (SM501, SED13806, MB826xx) to return the base address for the graphics chip. The PCI drivers like the ct6900 don't use this interface. Here we have other means to get the base address.

I'll move the conditional calling to the highest level and resubmit.

I'd probably rahter see that you add a board_video_init() to the ct6900 driver, and have this bail out.

this could be done, but the problem here isn't ct6900 driver specific

Quoted 1 line

Anatolij, what do you thik is the best solution here?

i think, there could be other cases were the chip auto-probing in an init routine can't be accomplished, e.g. some pluggable (not PCI) graphic extension modules. If we move this bail out code to the highest level in the call chain ( here i mean to the top of drv_video_init() in drivers/video/cfb_console.c, we can cover other similar cases by providing board_video_skip() in the board code.

Best regards,
Anatolij

Signature · 3 lines
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 at denx.de