[PATCH] powerpc/mpc52xx/mtd: fix mtd-ram access for 16-bit Local Plus Bus

Grant Likely grant.likely at secretlab.ca
Sun Jun 14 03:09:24 EST 2009


On Sat, Jun 13, 2009 at 10:45 AM, Albrecht Dreß<albrecht.dress at arcor.de> wrote:
> Am 11.06.09 18:27 schrieb(en) Grant Likely:
>>>
>>> +               *(u16 *)buf = *((volatile u16 *)(vdest - 1));
>>> +               buf[1] = *((u8 *)src);
>>> +               *((volatile u16 *)(vdest - 1)) = *(u16 *)buf;
>>
>> what is the purpose of volatile here?  If you need io barriers, then use
>> the in_/out_be16 macros.
>
> Yes, you're right - should be completely superfluous here.  A result of copy
> & paste without thinking... :-(
>
>> Blech.  ugly #ifdef and not really multiplatform safe (yeah, I know it
>> shouldn't break non-5200 platforms, but it does have an undesirable impact).
>>  There's got to be a better way.
>
> Ouch, yes - I completely forgot the possibility of multi-platform builds.
>
> Am 11.06.09 19:28 schrieb(en) Grant Likely:
>>
>> So; the solution to me seems to be on an MPC5200 platform replace the
>> offending hooks with MPC5200 specific variants at runtime.
>
> Will re-work the patch that way!  BTW, a dumb question: what is the proper
> way to determine which cpu the system is running on?  Check the CPU node of
> the of tree?

In this case I'd walk up the parent nodes in the tree looking for an
"fsl,mpc5200-lpb" compatible value.  That way you only apply the
workaround if the device is on the locaplus bus, and not for example
below the PCI bus.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.



More information about the devicetree-discuss mailing list