public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] replacing do_reset with a custom one
@ 2009-10-23 21:43 Richard Retanubun
  2009-10-24  6:19 ` Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Retanubun @ 2009-10-23 21:43 UTC (permalink / raw)
  To: u-boot

Greetings,

I am sorry if this has been asked before, It does not appear so on the mailing list archive.

I'd like to replace do_reset function with my own custom one, (i.e. resetting by not petting an external hw watchdog).

In previous discussion,
http://lists.denx.de/pipermail/u-boot/2007-January/018848.html

Wolfgang seems to favor creating a custom-board specific command (e.g. wdreset) and calling that
but If I do that, I have to replace all instances of do_reset that matters to my board.
It seems simpler to simply 'hijack and replace/enhance' the existing 'do_reset' to do my bidding.

Is there a recommended way of doing this? Any chance of adding something like this:

/cpu/$some-cpu/cpu.c

do_reset()
{

#ifdef CUSTOM_BOARD_RESET
	custom_board_reset();
#endif;

<normal do_reset command>
}

This way each board can define their own "call_custom_board" function.

Thanks for everyone's time

- Richard

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

* [U-Boot] replacing do_reset with a custom one
  2009-10-23 21:43 [U-Boot] replacing do_reset with a custom one Richard Retanubun
@ 2009-10-24  6:19 ` Mike Frysinger
  2009-10-26 18:44   ` Richard Retanubun
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2009-10-24  6:19 UTC (permalink / raw)
  To: u-boot

On Friday 23 October 2009 17:43:18 Richard Retanubun wrote:
> I am sorry if this has been asked before, It does not appear so on the
>  mailing list archive.
> 
> I'd like to replace do_reset function with my own custom one, (i.e.
>  resetting by not petting an external hw watchdog).
> 
> In previous discussion,
> http://lists.denx.de/pipermail/u-boot/2007-January/018848.html
> 
> Wolfgang seems to favor creating a custom-board specific command (e.g.
>  wdreset) and calling that but If I do that, I have to replace all
>  instances of do_reset that matters to my board. It seems simpler to simply
>  'hijack and replace/enhance' the existing 'do_reset' to do my bidding.
> 
> Is there a recommended way of doing this? Any chance of adding something
>  like this:
> 
> /cpu/$some-cpu/cpu.c
> 
> do_reset()
> {
> 
> #ifdef CUSTOM_BOARD_RESET
> 	custom_board_reset();
> #endif;
> 
> <normal do_reset command>
> }
> 
> This way each board can define their own "call_custom_board" function.

#ifdef's are the past.  weaks are in!

the Blackfin port already does:
void board_reset(void) __attribute__((__weak__));
...
    if (board_reset)
        board_reset();
...

the bf537-stamp uses this to make sure some pins are driven low to workaround 
weak pull ups in the hardware
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091024/1e4224cf/attachment.pgp 

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

* [U-Boot] replacing do_reset with a custom one
  2009-10-24  6:19 ` Mike Frysinger
@ 2009-10-26 18:44   ` Richard Retanubun
  2009-10-26 20:50     ` Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Retanubun @ 2009-10-26 18:44 UTC (permalink / raw)
  To: u-boot

Mike Frysinger wrote:
> 
> #ifdef's are the past.  weaks are in!
> 
> the Blackfin port already does:
> void board_reset(void) __attribute__((__weak__));
> ...
>     if (board_reset)
>         board_reset();
> ...
> 
> the bf537-stamp uses this to make sure some pins are driven low to workaround 
> weak pull ups in the hardware
> -mike

Thanks for the tip Mike! I've submitted patches for MPC83xx and MCF5271 architectures.
They lack cpu.h file though, so I made one, let's see what the maintainers says.

Thanks again,

- Richard

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

* [U-Boot] replacing do_reset with a custom one
  2009-10-26 18:44   ` Richard Retanubun
@ 2009-10-26 20:50     ` Mike Frysinger
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2009-10-26 20:50 UTC (permalink / raw)
  To: u-boot

On Monday 26 October 2009 14:44:28 Richard Retanubun wrote:
> Mike Frysinger wrote:
> > #ifdef's are the past.  weaks are in!
> >
> > the Blackfin port already does:
> > void board_reset(void) __attribute__((__weak__));
> > ...
> >     if (board_reset)
> >         board_reset();
> > ...
> >
> > the bf537-stamp uses this to make sure some pins are driven low to
> > workaround weak pull ups in the hardware
> 
> Thanks for the tip Mike! I've submitted patches for MPC83xx and MCF5271
>  architectures. They lack cpu.h file though, so I made one, let's see what
>  the maintainers says.

it would probably make sense to move the prototype to the common files where 
do_reset() is defined ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091026/326c9c34/attachment.pgp 

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

end of thread, other threads:[~2009-10-26 20:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-23 21:43 [U-Boot] replacing do_reset with a custom one Richard Retanubun
2009-10-24  6:19 ` Mike Frysinger
2009-10-26 18:44   ` Richard Retanubun
2009-10-26 20:50     ` Mike Frysinger

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