From patchwork Tue Nov 20 14:33:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13010 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 412A823FC2 for ; Tue, 20 Nov 2012 14:34:16 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id E3692A185BC for ; Tue, 20 Nov 2012 14:34:15 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so1740455iag.11 for ; Tue, 20 Nov 2012 06:34:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=163VBLajIKX8w9UkyxyRwwuOkpmzzzXic2qwRLejVII=; b=mXfZvIIjXLXIMINfF4O6QXyulJrm7iNmv3bPMtPAgaSvrGlW4WtyB43XoNuzhRSSPK 8syc9B11v4FOKhGvh8c4IJKczLveM/RI+zr80YqmGaofd++nfwb1KDN+4cp2Pn5OVBDQ bud+Z6Jl5RuWYx+SnmZA9dr0ftSPJgfwkNF9/GEJq4cHCofNByukXRNgl59vei7zgdYY rV7oWFCuCeEup5CYJEAjM9KfBoqoGEFPlJgBnuPSLK/vxt6kxEEfglhktTvz+bVtZ375 thd8TgFv8FlvHjXpR4DjiOI4t6zqVhxEbMtqlmfjx3QGh3yTIKCgkk02XNp3YtDVWA2l TKDQ== Received: by 10.50.161.169 with SMTP id xt9mr10009361igb.62.1353422055669; Tue, 20 Nov 2012 06:34:15 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp326848igt; Tue, 20 Nov 2012 06:34:15 -0800 (PST) Received: by 10.180.99.5 with SMTP id em5mr14806570wib.8.1353422054607; Tue, 20 Nov 2012 06:34:14 -0800 (PST) Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com [74.125.82.52]) by mx.google.com with ESMTPS id x77si7147305wen.65.2012.11.20.06.34.14 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Nov 2012 06:34:14 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.52 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.52; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.52 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wg0-f52.google.com with SMTP id fg15so3440479wgb.9 for ; Tue, 20 Nov 2012 06:34:14 -0800 (PST) Received: by 10.180.108.38 with SMTP id hh6mr16881987wib.0.1353422054070; Tue, 20 Nov 2012 06:34:14 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id bn7sm20254052wib.8.2012.11.20.06.34.12 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Nov 2012 06:34:13 -0800 (PST) From: Lee Jones To: u-boot@lists.denx.de Cc: Lee Jones Subject: [PATCH 5/8] arm: Add boottime support for the ARM architecture Date: Tue, 20 Nov 2012 14:33:51 +0000 Message-Id: <1353422034-28107-6-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1353422034-28107-1-git-send-email-lee.jones@linaro.org> References: <1353422034-28107-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQlni8q1h/AOGPJXjPFm/ZfMQo7eHFXqwdWzIiCiZVwZwaD7PPHa+MORvNzzV+drJkp8smmq This patch adds support for passing boot time information to the Linus kernel using ATAGS when booting on ARM based devices. Based heavily on the original driver by Jonas Aaberg. Signed-off-by: Lee Jones --- arch/arm/include/asm/setup.h | 18 +++++++++++++++++ arch/arm/lib/bootm.c | 45 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 78a7fac..6088440 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h @@ -205,6 +205,19 @@ struct tag_memclk { u32 fmemclk; }; +/* for automatic boot timing testcases */ +#define ATAG_BOOTTIME 0x41000403 +#define BOOTTIME_MAX 10 + +#include + +struct tag_boottime { + struct boottime_entry entry[BOOTTIME_MAX]; + u32 idle; /* in us */ + u32 total; /* in us */ + u8 num; +}; + struct tag { struct tag_header hdr; union { @@ -227,6 +240,11 @@ struct tag { * DC21285 specific */ struct tag_memclk memclk; + + /* + * Boot time + */ + struct tag_boottime boottime; } u; }; diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 1bd2730..03774c8 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -114,7 +115,8 @@ static void announce_and_cleanup(void) defined(CONFIG_CMDLINE_TAG) || \ defined(CONFIG_INITRD_TAG) || \ defined(CONFIG_SERIAL_TAG) || \ - defined(CONFIG_REVISION_TAG) + defined(CONFIG_REVISION_TAG) || \ + defined(CONFIG_BOOTTIME) static void setup_start_tag (bd_t *bd) { params = (struct tag *)bd->bi_boot_params; @@ -130,6 +132,37 @@ static void setup_start_tag (bd_t *bd) } #endif +#ifdef CONFIG_BOOTTIME +static void setup_boottime_tags(void) +{ + unsigned int i; + struct boottime_entry *b; + + params->hdr.tag = ATAG_BOOTTIME; + params->hdr.size = tag_size(tag_boottime); + + params->u.boottime.idle = boottime_idle_get(); + params->u.boottime.total = boottime_idle_done(); + + for (i = 0; i < BOOTTIME_MAX; i++) { + b = boottime_get_entry(i); + if (b == NULL) + break; + + params->u.boottime.entry[i].time = b->time; + strncpy((char *)params->u.boottime.entry[i].name, + (char *)b->name, BOOTTIME_MAX_NAME_LEN); + params->u.boottime.entry[i].name[BOOTTIME_MAX_NAME_LEN - 1] = '\0'; + + } + + params->u.boottime.num = i; + + params = tag_next(params); + +} +#endif + #ifdef CONFIG_SETUP_MEMORY_TAGS static void setup_memory_tags(bd_t *bd) { @@ -233,6 +266,10 @@ static void setup_end_tag(bd_t *bd) } #endif +#ifdef CONFIG_BOOTTIME +static void setup_boottime_tags(void); +#endif + #ifdef CONFIG_OF_LIBFDT static int create_fdt(bootm_headers_t *images) { @@ -293,9 +330,13 @@ static void boot_prep_linux(bootm_headers_t *images) defined(CONFIG_CMDLINE_TAG) || \ defined(CONFIG_INITRD_TAG) || \ defined(CONFIG_SERIAL_TAG) || \ - defined(CONFIG_REVISION_TAG) + defined(CONFIG_REVISION_TAG) || \ + defined (CONFIG_BOOTTIME) debug("using: ATAGS\n"); setup_start_tag(gd->bd); +#ifdef CONFIG_BOOTTIME + setup_boottime_tags(); +#endif #ifdef CONFIG_SERIAL_TAG setup_serial_tag(¶ms); #endif