From patchwork Tue Dec 8 03:38:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 553722 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5F1AF14029C for ; Tue, 8 Dec 2015 14:49:52 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=EpwNGS5P; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CAD674B705; Tue, 8 Dec 2015 04:49:47 +0100 (CET) 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 t0dHxqyQ3RqW; Tue, 8 Dec 2015 04:49:47 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0EECE4B766; Tue, 8 Dec 2015 04:49:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7BE8F4B6F9 for ; Tue, 8 Dec 2015 04:49:19 +0100 (CET) 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 qsAF9sjpa9pl for ; Tue, 8 Dec 2015 04:49:19 +0100 (CET) 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 mail-ob0-f172.google.com (mail-ob0-f172.google.com [209.85.214.172]) by theia.denx.de (Postfix) with ESMTPS id 19C604B6CD for ; Tue, 8 Dec 2015 04:49:15 +0100 (CET) Received: by obcse5 with SMTP id se5so5281239obc.3 for ; Mon, 07 Dec 2015 19:49:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=aICGEk16nRGksOY1KkxlgxaaWWdGb1A76hDKBxsOwgU=; b=EpwNGS5P1bOV/LOLF4PrGO9vamWSK5maZCXxKbZ+5nowJgsRncf3eIgffRglusr3/q BxCHr5C2vOa5KBUJptDMNyfSDMDAkQc0i/VQ9vYJCThz8HcmVf6xtwjXOyMgokc3YmM1 S+fHSbTv8vEZ25eG6E9yBLPGjcg3wgzL2mPlAq5gs+KYe6s3osp0jzo5WCfVwfQc7ZAs qAHWsoYe2OZXgEHuoSBKF3P3mNkfBEvfVDy1UVGkHiNEeeZlKFB8dWHX0I2PvsgDvSHd RoK4+DwHcyRjRAP8uOT4Dapl0Qck4t9PslQn9Wr6i5YkN0BSXW5vt7vMVcTP1K5gDQTu aRSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=aICGEk16nRGksOY1KkxlgxaaWWdGb1A76hDKBxsOwgU=; b=AE3m8C/xti8IY3U/W3xKLV9zIWXmsQrFq9L6woVIKxfRBh5wcGjdOHXl003mQU04xJ 29abeOvJV5TFHzXmZ1CjQa27zAI9l+pJlRF33veS1wgizKvR6TkCslOHcPWtAjUrgd9S IhtXrroFnMpwhKii4zVPGXfXyTXZJhUkhu2F+gskKrfezbVDqlBQO0QWXp4xHIaYrP5O 1uNjjjOgbGqGPxg9Aim8JCM6MRMgTbuNC9ssqEcaBdJ+i4lAmRwdikLAClX9fNqAepkQ LF0uMtSnKmG6wboonxpZcn+YIAU6YXc4sHPUp5vD6LJDfPge989/sHXo/IEPPfxunk48 abCA== X-Gm-Message-State: ALoCoQk9Zkqv9hSNQmAGWeuX/0+KwE6upCbCze2k0kkuH2GiXAAdS4CeRkzbsay2Uo8B54zb0YFReTfzEZ6mdEoBwxrkqc0Orw== X-Received: by 10.182.186.34 with SMTP id fh2mr451690obc.65.1449546554165; Mon, 07 Dec 2015 19:49:14 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id s133sm594219oie.16.2015.12.07.19.49.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Dec 2015 19:49:13 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id F3D63220A04; Mon, 7 Dec 2015 20:39:20 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Mon, 7 Dec 2015 20:38:40 -0700 Message-Id: <1449545956-2772-22-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 In-Reply-To: <1449545956-2772-1-git-send-email-sjg@chromium.org> References: <1449545956-2772-1-git-send-email-sjg@chromium.org> Cc: Graeme Russ Subject: [U-Boot] [PATCH 21/57] x86: ivybridge: Set up the thermal target correctly X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This uses a non-existent node at present. It should use the first CPU node. The referenced property does not exist (the correct value is the default of 0), but this allows the follow-on init to complete. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/ivybridge/model_206ax.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/x86/cpu/ivybridge/model_206ax.c b/arch/x86/cpu/ivybridge/model_206ax.c index 6ab6ede..a217954 100644 --- a/arch/x86/cpu/ivybridge/model_206ax.c +++ b/arch/x86/cpu/ivybridge/model_206ax.c @@ -283,18 +283,13 @@ static void configure_c_states(void) msr_write(MSR_PP1_CURRENT_CONFIG, msr); } -static int configure_thermal_target(void) +static int configure_thermal_target(struct udevice *dev) { int tcc_offset; msr_t msr; - int node; - /* Find pointer to CPU configuration */ - node = fdtdec_next_compatible(gd->fdt_blob, 0, - COMPAT_INTEL_MODEL_206AX); - if (node < 0) - return -ENOENT; - tcc_offset = fdtdec_get_int(gd->fdt_blob, node, "tcc-offset", 0); + tcc_offset = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "tcc-offset", + 0); /* Set TCC activaiton offset if supported */ msr = msr_read(MSR_PLATFORM_INFO); @@ -403,7 +398,7 @@ static void configure_mca(void) static unsigned ehci_debug_addr; #endif -static int model_206ax_init(void) +static int model_206ax_init(struct udevice *dev) { int ret; @@ -445,7 +440,7 @@ static int model_206ax_init(void) configure_misc(); /* Thermal throttle activation offset */ - ret = configure_thermal_target(); + ret = configure_thermal_target(dev); if (ret) { debug("Cannot set thermal target\n"); return ret; @@ -468,6 +463,10 @@ static int model_206ax_init(void) static int model_206ax_get_info(struct udevice *dev, struct cpu_info *info) { + msr_t msr; + + msr = msr_read(IA32_PERF_CTL); + info->cpu_freq = ((msr.lo >> 8) & 0xff) * SANDYBRIDGE_BCLK * 1000000; info->features = 1 << CPU_FEAT_L1_CACHE | 1 << CPU_FEAT_MMU; return 0; @@ -481,7 +480,7 @@ static int model_206ax_get_count(struct udevice *dev) static int cpu_x86_model_206ax_probe(struct udevice *dev) { if (dev->seq == 0) - model_206ax_init(); + model_206ax_init(dev); return 0; }