From patchwork Sun Jan 17 23:11:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 569356 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 07EC0140662 for ; Mon, 18 Jan 2016 10:18:07 +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=g1tWOhtY; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3E2D8B3839; Mon, 18 Jan 2016 00:14:30 +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 ocIksLuE0Nh0; Mon, 18 Jan 2016 00:14:30 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4F16BB37D7; Mon, 18 Jan 2016 00:13:18 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 49BF4A77AA for ; Mon, 18 Jan 2016 00:12:42 +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 zRUO-WEOaiEM for ; Mon, 18 Jan 2016 00:12:42 +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-oi0-f42.google.com (mail-oi0-f42.google.com [209.85.218.42]) by theia.denx.de (Postfix) with ESMTPS id 04FF5A77F7 for ; Mon, 18 Jan 2016 00:12:37 +0100 (CET) Received: by mail-oi0-f42.google.com with SMTP id w75so133844304oie.0 for ; Sun, 17 Jan 2016 15:12:37 -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=fbRJ61kwM3tb3xu/t6lGJTJarCkhyAs409wk7/Vtr8g=; b=g1tWOhtYgpVSDfEReoTAfSJQBuEIKKw0aSvvl55JN/+qs7cYgb61DBnPsOmfjiDIjW 6MDeMnbMzGcOtjwe+hjH3og+J1DG6CLmaGR5utwNElVxRuG50mA+Q+uJEdhlRAhabMMM 0NzLEo50eTQ1W7B1HK9rj5ejj+nTdORYCqOkoz8Ei+po3SEd2MrWXZyfR0sn/Br0z9XQ gphXm0HFUW+hnCe1Q9OK3slwkVIOEhym2ZgFCluKOlf37OBI/0Plh7DUvYVqFwEdrFZ2 q6/Ronv/i7RV+1LvJbUFOvwGLBbA0kAcM6fWLDoWnNb2S+3gDg53wboI3SQaQ1atLpRg pZMg== 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=fbRJ61kwM3tb3xu/t6lGJTJarCkhyAs409wk7/Vtr8g=; b=kUG4XQX4AVNBJvmDsgAR79NJ+g7dUqb7nr8yGmydnDwSvAi38AWcTAdDnALMhv/wXM l3QAG5zUIffmHofui7GRfvAOD7gU2Msvbh/gzS43gudZqoVVSJQ8vg9KyajGyTukgywO dLosS38yQ31B6cH92e6Ntyn8tMNitVN+Ns2nv23hE42zV1z0ESHsRx5sxsQjTLjHo2BD IGtiz9WmfEoUjSpb/HGbBVan7Chza216OKQAFVF4cTmjb3YqXAguv4WguDc2lIspxWLp q9SVdsIefIYV1oBlVHIQKNAkoLzxpEDFziQxyHIce4M42TueaaOTC7dq/hwUPdAMeRgS 5tbQ== X-Gm-Message-State: ALoCoQk1bTUQiAsnA18XvjuOdT9arqmQUm9NSb5n9Kt4SVdFZjcbqL1duOuR0mv2MvkZxCkDBaoK/GZLyBNhPZbjT7DmDZdOGg== X-Received: by 10.202.170.80 with SMTP id t77mr16082100oie.78.1453072356215; Sun, 17 Jan 2016 15:12:36 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id p64sm11751347oia.20.2016.01.17.15.12.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Jan 2016 15:12:32 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 4FA2F221FB8; Sun, 17 Jan 2016 16:12:28 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Sun, 17 Jan 2016 16:11:25 -0700 Message-Id: <1453072320-24298-21-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 In-Reply-To: <1453072320-24298-1-git-send-email-sjg@chromium.org> References: <1453072320-24298-1-git-send-email-sjg@chromium.org> Subject: [U-Boot] [PATCH v2 20/55] 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 --- Changes in v2: None 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; }