From patchwork Fri Aug 27 05:14:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 71833 X-Patchwork-Delegate: s-paulraj@ti.com Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id A1E86157D71 for ; Fri, 27 Aug 2010 07:16:13 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id 9023B30E1863 for ; Fri, 27 Aug 2010 07:16:13 +0200 (MEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.17) for (single-drop); Fri, 27 Aug 2010 07:16:13 +0200 (MEST) Received: from murder ([192.168.8.180]) by backend2 (Cyrus v2.2.12) with LMTPA; Fri, 27 Aug 2010 07:15:19 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend1.mail.m-online.net (Cyrus v2.2.12) with LMTPA; Fri, 27 Aug 2010 07:15:18 +0200 Received: from scanner-3.m-online.net (unknown [192.168.6.168]) by mail.m-online.net (Postfix) with ESMTP id C94E71C00123; Fri, 27 Aug 2010 07:15:18 +0200 (CEST) Received: from mxin-1.m-online.net ([192.168.6.164]) by scanner-3.m-online.net (scanner-3.m-online.net [192.168.6.168]) (amavisd-new, port 10026) with ESMTP id 12808-06-2; Fri, 27 Aug 2010 07:15:17 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-1.m-online.net (Postfix) with ESMTP id 551AC46C0AC; Fri, 27 Aug 2010 07:15:17 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C13DD2809D; Fri, 27 Aug 2010 07:15:14 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HY7OFOhvN7-R; Fri, 27 Aug 2010 07:15:14 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2997F28087; Fri, 27 Aug 2010 07:15:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6629928083 for ; Fri, 27 Aug 2010 07:15:06 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AND+qKdBjKtd for ; Fri, 27 Aug 2010 07:15:06 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by theia.denx.de (Postfix) with ESMTPS id A7BD12807F for ; Fri, 27 Aug 2010 07:15:05 +0200 (CEST) Received: from dbdp31.itg.ti.com ([172.24.170.98]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o7R5F1Iw016729 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 27 Aug 2010 00:15:03 -0500 Received: from psplinux051.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o7R5Ewwc011421; Fri, 27 Aug 2010 10:44:59 +0530 (IST) Received: from psplinux051.india.ti.com (localhost [127.0.0.1]) by psplinux051.india.ti.com (8.13.1/8.13.1) with ESMTP id o7R5EwWY002871; Fri, 27 Aug 2010 10:44:58 +0530 Received: (from a0875516@localhost) by psplinux051.india.ti.com (8.13.1/8.13.1/Submit) id o7R5Ew9j002866; Fri, 27 Aug 2010 10:44:58 +0530 From: Sekhar Nori To: u-boot@lists.denx.de Date: Fri, 27 Aug 2010 10:44:58 +0530 Message-Id: <1282886098-2647-1-git-send-email-nsekhar@ti.com> X-Mailer: git-send-email 1.6.2.4 Cc: Kevin Hilman , Sekhar Nori Subject: [U-Boot] [PATCH v4 2/2] TI: DaVinci DA850 EVM: support passing maximum allowed cpu clock rate information to kernel X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Virus-Scanned: by amavisd-new at m-online.net The TI DA850/OMAP-L138/AM18x EVM can be populated with devices having different maximum allowed CPU clock rating. The maximum clock the chip can support can only be determined from the label on the package (not software readable). Introduce a method to pass the maximum allowed clock rate information to kernel using ATAG_REVISION. The kernel uses this information to determine the maximum cpu clock rate reachable using cpufreq. Note that U-Boot itself does not set the CPU clock rate. The CPU clock is setup by a primary bootloader ("UBL"). The rate setup by UBL could be different from the maximum clock rate supported by the device. Signed-off-by: Sekhar Nori Tested-by: Ben Gardiner --- v4: updated README.davinci to included information regarding ATAG_REVISION. board/davinci/da8xxevm/da850evm.c | 33 +++++++++++++++++++++++++++++++++ doc/README.davinci | 14 ++++++++++++++ include/configs/da850evm.h | 1 + 3 files changed, 48 insertions(+), 0 deletions(-) diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c index eeb456c..266c4d8 100644 --- a/board/davinci/da8xxevm/da850evm.c +++ b/board/davinci/da8xxevm/da850evm.c @@ -70,6 +70,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 a2e96a5..0204372 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 357715d..3ea9032 100644 --- a/include/configs/da850evm.h +++ b/include/configs/da850evm.h @@ -102,6 +102,7 @@ */ #define LINUX_BOOT_PARAM_ADDR (CONFIG_SYS_MEMTEST_START + 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"