diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c index c8c5e1b30..c3267cbf5 100644 --- a/board/davinci/da8xxevm/da850evm.c +++ b/board/davinci/da8xxevm/da850evm.c @@ -118,6 +118,39 @@ static const struct lpsc_resource lpsc[] = { { DAVINCI_LPSC_GPIO }, }; +#ifndef CONFIG_DA850_EVM_MAX_CPU_CLK +#define CONFIG_DA850_EVM_MAX_CPU_CLK 300000000 +#endif + +/* + * get_board_rev() - setup to pass kernel board revision information + * Returns: + * bit[0-3] Maximum cpu clock rate supported by onboard SoC + * 0000b - 300 MHz + * 0001b - 372 MHz + * 0010b - 408 MHz + * 0011b - 456 MHz + */ +u32 get_board_rev(void) +{ + char *s; + u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK; + u32 rev = 0; + + s = getenv("maxcpuclk"); + if (s) + maxcpuclk = simple_strtoul(s, NULL, 10); + + if (maxcpuclk >= 456000000) + rev = 3; + else if (maxcpuclk >= 408000000) + rev = 2; + else if (maxcpuclk >= 372000000) + rev = 1; + + return rev; +} + int board_init(void) { #ifndef CONFIG_USE_IRQ diff --git a/doc/README.davinci b/doc/README.davinci index a2e96a5a2..0204372a2 100644 --- a/doc/README.davinci +++ b/doc/README.davinci @@ -95,6 +95,20 @@ into the RAM. The programmers and UBL are always released as part of any standard TI software release associated with an SOC. +Environment Variables +===================== + +The DA850 EVM allows the user to specify the maximum cpu clock allowed by the +silicon, in Hz, via an environment variable "maxcpuclk". + +The maximum clock rate allowed depends on the silicon populated on the EVM. +Please make sure you understand the restrictions placed on this clock in the +device specific datasheet before setting up this variable. This information is +passed to the Linux kernel using the ATAG_REVISION atag. + +If "maxcpuclk" is not defined, the configuration CONFIG_DA850_EVM_MAX_CPU_CLK +is used to obtain this information. + Links ===== diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h index 7b04be05b..61c3205b0 100644 --- a/include/configs/da850evm.h +++ b/include/configs/da850evm.h @@ -140,6 +140,7 @@ */ #define LINUX_BOOT_PARAM_ADDR (PHYS_SDRAM_1 + 0x100) #define CONFIG_CMDLINE_TAG +#define CONFIG_REVISION_TAG #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_BOOTARGS \ "mem=32M console=ttyS2,115200n8 root=/dev/mtdblock2 rw noinitrd ip=dhcp"