[U-Boot] [PATCH V2 1/2] [NEXT] orion5x: fix relocation-incompatible code

Albert ARIBAUD
2010-09-27T06:47:01Z

Le 27/09/2010 08:36, Prafulla Wadaskar a ?crit :
>
>
>> -----Original Message-----
>> From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
>> Sent: Monday, September 27, 2010 12:05 PM
>> To: Prafulla Wadaskar
>> Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
>> Subject: Re: [U-Boot] [PATCH V2 1/2] [NEXT] orion5x: fix
>> relocation-incompatible code
>>
>> Le 27/09/2010 07:52, Prafulla Wadaskar a ?crit :
>>
>>>> + * NOTES:
>>
>>>> + * 2) in order to avoid losing access to BOOTCS when
>>>> disabling window 7,
>>>> + * first configure window 6 for BOOTCS, then configure
>>>> window 7 for BOOTCS,
>>>> + * then configure windows 6 for its own target.
>>
>>>> +/* Disable window 6, configure it for FLASH, enable it. */
>>>> + writel(0,&winregs[6].ctrl);
>>>> + writel(ORION5X_ADR_BOOTROM,&winregs[6].base);
>>>> + writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_BOOTROM,
>>>> + ORION5X_TARGET_DEVICE, ORION5X_ATTR_BOOTROM,
>>>> ORION5X_WIN_ENABLE),&winregs[6].ctrl);
>>>> - writel(ORION5X_ADR_DEV_CS2,&winregs[6].base);
>>>> -
>>>> - /* Window 7: BOOT Memory address space */
>>>> +/* Disable window 7, configure it for FLASH, enable it. */
>>>> + writel(0,&winregs[7].ctrl);
>>>> + writel(ORION5X_ADR_BOOTROM,&winregs[7].base);
>>>> writel(ORION5X_CPU_WIN_CTRL_DATA(ORION5X_SZ_BOOTROM,
>>>> ORION5X_TARGET_DEVICE, ORION5X_ATTR_BOOTROM,
>>>> ORION5X_WIN_ENABLE),&winregs[7].ctrl);
>>>> - writel(ORION5X_ADR_BOOTROM,&winregs[7].base);
>>>> +/* Disable window 6, configure it for its intended target,
>>>> enable it. */
>>>> + writel(0,&winregs[6].ctrl);
>>>
>>> This conflicts with above win6 configuration.
>>> If done purposely then pls provide comments.
>>>
>>> Regards..
>>> Prafulla . .
>>
>> Er... The comment *is* there, right before the sequence.
>
> Why do you need to configure win6 twice?

Because if I don't set a window beside 7 to access BOOTCS, then
reconfiguring window 7 (BOOTCs, i.e. FLASH) leaves the system with no
access to BOOT CS thus no access to FLASH thus no way to continue
executing this code, which runs from FLASH.

Thus I chose window 6 (I could have chosen any other, of course) and set
it up for flash so that code can still run while reconfiguring window 7;
then window 6 must, and can safely, be reconfigured for its own target.

(This issue of FLASH access does not happen on designs where boot is
from NAND, of course; but the fix would be harmless even on these)

> Regards..
> Prafulla . .

Amicalement,
--
Albert.