public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] 8xx: prevent a machine check in scc_init().
Date: Sun, 14 Sep 2008 19:07:52 +0200	[thread overview]
Message-ID: <20080914170752.914BF248CC@gemini.denx.de> (raw)
In-Reply-To: <20080914114924.0090d95c@peedub.jennejohn.org>

Dear Gary Jennejohn,

In message <20080914114924.0090d95c@peedub.jennejohn.org> you wrote:
> 
> Signed-off-by: Gary Jennejohn <garyj@denx.de>

Sorry, but I don't understand what you're doing here, or why.

Why would there be any machine checks in  scc_init()?  Such  problems
have never been repoorted for any systems. Actuallym this part of the
code  is  one  of  the oldest in U-Boot - if there were machine check
issues in any configruation, these should be known.

> --- a/cpu/mpc8xx/scc.c
> +++ b/cpu/mpc8xx/scc.c
> @@ -70,6 +70,9 @@ static int scc_recv(struct eth_device* dev);
>  static int scc_init (struct eth_device* dev, bd_t * bd);
>  static void scc_halt(struct eth_device* dev);
>  
> +/* avoid unnecessary reinitialization of the SCC */
> +static int scc_init_completed;
> +
>  int scc_initialize(bd_t *bis)
>  {
>  	struct eth_device* dev;
> @@ -193,6 +196,19 @@ static int scc_init (struct eth_device *dev, bd_t * bis)
>  
>  	volatile immap_t *immr = (immap_t *) CFG_IMMR;
>  
> +	/*
> +	 * This routine is called again and again from eth_init(),
> +	 * especially when CONFIG_NETCONSOLE is defined and
> +	 * stdout=nc.
> +	 * Avoid unneccessary flailing, otherwise we can get a panic here.
> +	 */
> +	if (scc_init_completed) {
> +		immr->im_ioport.iop_pcso |= (PC_ENET_CLSN | PC_ENET_RENA);
> +		immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrl |=
> +			(SCC_GSMRL_ENR | SCC_GSMRL_ENT);

If the initialization has already been done, why would we repeat these
two steps here?

And why exactle these two, and not the others that are performed for a
regular init sequence?


> +		return 1;
> +	}
> +
>  #if defined(CONFIG_LWMON)
>  	reset_phy();
>  #endif

I'm not sure if your early return here is actually valid. As you  can
see,  other  actions follow - for example here on the LWMON baord the
PHY reset; I suspect that your change might eventually work  on  your
current system, but break many others.


Also, I'm not sure if you are4 aware that the eth_init() part may  be
called  from  a  interface  switching  sequence,  i.  e. when cycling
between several ethenret interfaces. These will have been  shut  down
before  by  eth_halt()  -  skipping  the init sequence here seems the
wrong thing to me.


Maybe you could explain what problem you are actually truing to fix,
and especially under which situations you observe machine checks.

Best regards,

Wolfgang Denk

-- 
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
The reasonable man adapts himself to the world; the unreasonable  one
persists  in  trying  to  adapt  the  world to himself. Therefore all
progress depends on the unreasonable man."      - George Bernard Shaw

  reply	other threads:[~2008-09-14 17:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-14  9:49 [U-Boot] [PATCH] 8xx: prevent a machine check in scc_init() Gary Jennejohn
2008-09-14 17:07 ` Wolfgang Denk [this message]
2008-09-15  8:59   ` Gary Jennejohn
2008-09-15 10:58     ` Wolfgang Denk
2008-09-18 11:52 ` [U-Boot] [PATCH V2] " Gary Jennejohn
2008-09-22 20:26   ` Wolfgang Denk
2008-09-26  5:29     ` Ben Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080914170752.914BF248CC@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox