[U-Boot] [v2 PATCH 10/12] arm, spl, at91: add at91sam9260 and at91sam9g45 spl support

Heiko Schocher hs at denx.de
Fri Oct 31 07:03:37 CET 2014


Hello Bo,

Am 31.10.2014 02:50, schrieb Bo Shen:
> Hi Heiko,
>
> On 10/30/2014 04:15 PM, Heiko Schocher wrote:
>> diff --git a/arch/arm/cpu/at91-common/spl.c b/arch/arm/cpu/at91-common/spl.c
>> index 674a470..5c9a3ad 100644
>> --- a/arch/arm/cpu/at91-common/spl.c
>> +++ b/arch/arm/cpu/at91-common/spl.c
>
> I am thinking, whether it be better to keep this file as two copy? This will remove #ifdef, although a little code duplication.
>
> If this solution acceptable, some suggestion as following:
> - for armv5 (arm926ejs, now at91 series), named it spl_at91.c,
> - for armv7 (cortex-a5, now, sama5d3), named it spl_atmel.c?
> (As for arm9 series, we have at91 prefix for SoC name, and for armv7 SoC, we don't have at91 prefix, and it now changed to Atmel Smart)

Ok, I look into this.

[...]
>> @@ -57,77 +91,134 @@ static void switch_to_main_crystal_osc(void)
[...]
>> - /* disable watchdog */
>> +void spl_board_init(void)
>> +{
>> + struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
>> +
>> + lowlevel_clock_init();
>> at91_disable_wdt();
>>
>> - /* PMC configuration */
>> - at91_pmc_init();
>> + /*
>> + * At this stage the main oscillator is supposed to be enabled
>> + * PCK = MCK = MOSC
>> + */
>> + writel(0x00, &pmc->pllicpr);
>>
>> - at91_clock_init(CONFIG_SYS_AT91_MAIN_CLOCK);
>> + /* Configure PLLA = MOSC * (PLL_MULA + 1) / PLL_DIVA */
>> + at91_plla_init(CONFIG_SYS_AT91_PLLA);
>>
>> - timer_init();
>> + /* PCK = PLLA = 2 * MCK */
>> + at91_mck_init(CONFIG_SYS_MCKR);
>>
>> - board_early_init_f();
>> + /* Switch MCK on PLLA output */
>> + at91_mck_init(CONFIG_SYS_MCKR_CSS);
>> +
>> +#if defined(CONFIG_SYS_AT91_PLLB)
>> + /* Configure PLLB */
>> + at91_pllb_init(CONFIG_SYS_AT91_PLLB);
>> +#endif
>> +
>> + /* Enable External Reset */
>> + enable_ext_reset();
>>
>> +#if defined(CONFIG_ATMEL_MATRIX_INIT)
>> + /* Initialize matrix */
>> + matrix_init();
>> +#endif
>
> Can this also be weak function? And put matrix_init() code to SoC/board related file.

Changed.

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


More information about the U-Boot mailing list