[U-Boot] [PATCH V2 4/7] Tegra30: Add common CPU (shared) files

Tom Warren
2012-12-05T21:32:56Z

Stephen,

On Wed, Dec 5, 2012 at 1:37 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 12/03/2012 04:45 PM, Tom Warren wrote:
>> These files are used by both SPL and main U-Boot.
>> Also made minor changes to shared Tegra code to support
>> T30 differences.
>
>> diff --git a/arch/arm/cpu/tegra-common/ap.c b/arch/arm/cpu/tegra-common/ap.c
>
>> + case CHIPID_TEGRA30:
>> + switch (tegra_sku_id) {
>> + case SKU_ID_T30:
>> + /*
>> + * T30 has two options. We will return TEGRA_SOC_T30
>> + * until we have the fdt set up when it may change to
>> + * TEGRA_SOC_T30_408MHZ depending on the PLLP freq.
>> + */
>> + if (clock_get_rate(CLOCK_ID_PERIPH) == 408000000)
>> + return TEGRA_SOC_T30_408MHZ;
>> + else
>> + return TEGRA_SOC_T30;
>
> Just for completeness, I'm going to mention again that I think this
> should just return TEGRA_SOC_T30 all the time. Sorry if that's
> belaboring the point!
>
> I just noticed your recent email saying you got 408MHz working, so I
> guess my comment is moot anyway:-)

Yep. TEGRA_SOC_T30_408MHZ is gone; TEGRA_SOC_T30 is returned for Tegra30.

>
>> diff --git a/arch/arm/cpu/tegra-common/sys_info.c b/arch/arm/cpu/tegra-common/sys_info.c
>
>> /* Print CPU information */
>> int print_cpuinfo(void)
>> {
>> +#if defined(CONFIG_TEGRA20)
>> puts("TEGRA20\n");
>> -
>> +#else /* Tegra30 */
>> + puts("TEGRA30\n");
>> +#endif
>
> This is fine, but the following wouldn't require editing again for
> future chips:
>
> puts(CONFIG_SYS_SOC);
> puts("\n");
>
> (although it ends up being all lower-case; perhaps there's some other
> variable that is upper-case?)

How about this:

#include <common.h>
#include <linux/ctype.h>

#ifdef CONFIG_DISPLAY_CPUINFO
void upstring(char *s)
{
while(*s) {
*s = toupper(*s);
s++;
}
}

/* Print CPU information */
int print_cpuinfo(void)
{
upstring(CONFIG_SYS_SOC);
puts(CONFIG_SYS_SOC);
puts("\n");

return 0;
)
#endif

What do you think?

Tom