Subject: Re: [PATCH 4/4] 82xx: MGCOGE support

From: Scott Wood <[email-masked]>
Date: Tue, 29 Jan 2008 13:24:54 -0600

On Tue, Jan 29, 2008 at 11:22:55AM +0100, Heiko Schocher wrote:
> To get the serial console on the SMC2 working, the
> following patch is needed:
> 
> Fixing serial console on a SMC on MPC82xx based
> board and using CONFIG_PPC_CPM_NEW_BINDING

No, what's needed is for the device tree to be correct (see my comments on
that patch).

> +		u16 __iomem *pram_base;
> +		struct resource res;
> +
>  		pinfo->flags |= FLAG_SMC;
>  		pinfo->smcp = mem;
>  		pinfo->smcup = pram;
> +
> +		if (of_address_to_resource(np, 1, &res)) {
> +			ret = -ENOMEM;
> +			goto out_pram;
> +		}
> +		pram_base = of_iomap(np, 2);
> +		if (!pram_base) {
> +			ret = -ENOMEM;
> +			goto out_pram;
> +		}
> +		*pram_base = res.start;

First of all, use out_be32() rather than direct dereferencing.

Secondly, is it possible for things to get messed up if the SMC registers
were set somewhere else by the bootloader, and that area was previously
allocated by Linux for some other purpose, and the SMC updated the parameter
RAM and corrupted that other purpose?  Especially if we have early debug
enabled, and thus don't reset the CPM on boot (or worse, are actively using
it prior to register relocation).

-Scott