From patchwork Mon Oct 21 03:39:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1180255 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="OkKCH9uC"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46xNYk4Db4z9sP6 for ; Mon, 21 Oct 2019 15:14:02 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 361EAC21C8B; Mon, 21 Oct 2019 03:55:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 781AFC21DF9; Mon, 21 Oct 2019 03:55:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4879FC21DFD; Mon, 21 Oct 2019 03:40:56 +0000 (UTC) Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by lists.denx.de (Postfix) with ESMTPS id 78EC1C21DFD for ; Mon, 21 Oct 2019 03:40:56 +0000 (UTC) Received: by mail-io1-f68.google.com with SMTP id r144so2310556iod.8 for ; Sun, 20 Oct 2019 20:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4g3ikFy2u3pMqtm/OPC1ydw8FAkJUja0jUQF9WQ60qA=; b=OkKCH9uCB+31qi1ijcduvqufJ6fJKNTljJmRsVURZH3JyTgBGhVEQuql52W0svxWhY iKjL/LsKeVva9dpygGp7zq4DAebyZYNMXw+NMv3Qy4mul1/VQK4LkfGk7dqaaPl9cmMQ bx1+q+zCp8SsPCnxjtKXSmfHBM1XsHAerlieM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4g3ikFy2u3pMqtm/OPC1ydw8FAkJUja0jUQF9WQ60qA=; b=sw/lk1RdeSYCRYyucdF/cdQK2OgyPD901OkaXa4XPnUG6u8YMlrCXOC0cOGX+Szxvp yrsUeZ/TnBAFJQIGdlK2PY2QkwX8z0A4XK0FSbPNAy97z7h0YJWH3uzHa4ExCg24nQU9 J1MdiAb8JRA3ry8EQebFtot4VxCgtRv5EiH3lr3frrUaJWV1FxfW1zMF4Kye7tTSs0iw +27sfPsoglMyI4N4DIDJcW88ggcAOzIltuoKmdgc1mfTE9ZYxxtI1b9pbXu5YyXR0Vzb VGtrJmmS5nsNh7V7TeaG8Q7V8XkxJc7Ew++U2g5ttgGKcuPLIVBZbbnCBLU/w1m4x/nz HqZg== X-Gm-Message-State: APjAAAWeGngZW1G5uzw7x3B1OZjTsphSx9AG9Oopln0n9Fb+qkLVaLRL iUZDVccp6LrG85MtTk3QWvnEVo6K+23S1w== X-Google-Smtp-Source: APXvYqxlncO2FL69289zO/qzkpSvwAtiEwdE5M8RhX/9HAO1S5hxC1LIaQnxsxR4zhF94/+DjUH17w== X-Received: by 2002:a5d:814c:: with SMTP id f12mr3377663ioo.174.1571629255236; Sun, 20 Oct 2019 20:40:55 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id x14sm1947028ion.67.2019.10.20.20.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2019 20:40:54 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 20 Oct 2019 21:39:07 -0600 Message-Id: <20191021033913.220758-97-sjg@chromium.org> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog In-Reply-To: <20191021033913.220758-22-sjg@chromium.org> References: <20191021033913.220758-22-sjg@chromium.org> MIME-Version: 1.0 Subject: [U-Boot] [PATCH v3 102/108] x86: apollolake: Add a CPU driver X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add a bare-bones CPU driver so that CPUs can be probed. Signed-off-by: Simon Glass --- Changes in v3: - Add two more defines for the CPU driver - Expand comments for BOOT_FROM_FAST_SPI_FLASH Changes in v2: None arch/x86/cpu/apollolake/Makefile | 1 + arch/x86/cpu/apollolake/cpu.c | 51 ++++++++++++++++++++++ arch/x86/include/asm/arch-apollolake/cpu.h | 27 ++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 arch/x86/cpu/apollolake/cpu.c create mode 100644 arch/x86/include/asm/arch-apollolake/cpu.h diff --git a/arch/x86/cpu/apollolake/Makefile b/arch/x86/cpu/apollolake/Makefile index c4ec71e2b76..ee7114b40c9 100644 --- a/arch/x86/cpu/apollolake/Makefile +++ b/arch/x86/cpu/apollolake/Makefile @@ -6,6 +6,7 @@ obj-$(CONFIG_SPL_BUILD) += spl.o obj-$(CONFIG_SPL_BUILD) += systemagent.o ifndef CONFIG_TPL_BUILD +obj-y += cpu.o obj-y += punit.o endif diff --git a/arch/x86/cpu/apollolake/cpu.c b/arch/x86/cpu/apollolake/cpu.c new file mode 100644 index 00000000000..f248623eb49 --- /dev/null +++ b/arch/x86/cpu/apollolake/cpu.c @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2019 Google LLC + */ + +#include +#include +#include +#include +#include + +struct cpu_apollolake_priv { +}; + +static int apollolake_get_info(struct udevice *dev, struct cpu_info *info) +{ + return cpu_intel_get_info(info, INTEL_BCLK_MHZ); +} + +static int apollolake_get_count(struct udevice *dev) +{ + return 4; +} + +static int cpu_x86_apollolake_probe(struct udevice *dev) +{ + return 0; +} + +static const struct cpu_ops cpu_x86_apollolake_ops = { + .get_desc = cpu_x86_get_desc, + .get_info = apollolake_get_info, + .get_count = apollolake_get_count, + .get_vendor = cpu_x86_get_vendor, +}; + +static const struct udevice_id cpu_x86_apollolake_ids[] = { + { .compatible = "intel,apl-cpu" }, + { } +}; + +U_BOOT_DRIVER(cpu_x86_apollolake_drv) = { + .name = "cpu_x86_apollolake", + .id = UCLASS_CPU, + .of_match = cpu_x86_apollolake_ids, + .bind = cpu_x86_bind, + .probe = cpu_x86_apollolake_probe, + .ops = &cpu_x86_apollolake_ops, + .priv_auto_alloc_size = sizeof(struct cpu_apollolake_priv), + .flags = DM_FLAG_PRE_RELOC, +}; diff --git a/arch/x86/include/asm/arch-apollolake/cpu.h b/arch/x86/include/asm/arch-apollolake/cpu.h new file mode 100644 index 00000000000..3047d502fab --- /dev/null +++ b/arch/x86/include/asm/arch-apollolake/cpu.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright 2019 Google LLC + */ + +#ifndef __ASM_ARCH_CPU_H +#define __ASM_ARCH_CPU_H + +/* Common Timer Copy (CTC) frequency - 19.2MHz */ +#define CTC_FREQ 19200000 + +/* + * Set to true to use the fast SPI driver to boot, instead of mapped SPI. + * You also need to enabled CONFIG_SUPPORT_SPI_FLASHBOOT. + */ +#define BOOT_FROM_FAST_SPI_FLASH false + +/* + * We need to read well past the end of the region in order for execution from + * the loaded data to work. It is not clear why. + */ +#define SAFETY_MARGIN 0x4000 + +#define MAX_PCIE_PORTS 6 +#define CLKREQ_DISABLED 0xf + +#endif /* __ASM_ARCH_CPU_H */