From patchwork Tue May 28 13:16:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 2624811 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 010353FDBC for ; Tue, 28 May 2013 13:17:21 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UhJm9-00059j-IN; Tue, 28 May 2013 13:17:17 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UhJm6-0005ZV-Rs; Tue, 28 May 2013 13:17:14 +0000 Received: from mail-db8lp0187.outbound.messaging.microsoft.com ([213.199.154.187] helo=db8outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UhJm4-0005Yt-2o for linux-arm-kernel@lists.infradead.org; Tue, 28 May 2013 13:17:13 +0000 Received: from mail153-db8-R.bigfish.com (10.174.8.237) by DB8EHSOBE022.bigfish.com (10.174.4.85) with Microsoft SMTP Server id 14.1.225.23; Tue, 28 May 2013 13:16:49 +0000 Received: from mail153-db8 (localhost [127.0.0.1]) by mail153-db8-R.bigfish.com (Postfix) with ESMTP id 203D61A02C8; Tue, 28 May 2013 13:16:49 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ah1fc6hzz8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1dc1h1155h) Received: from mail153-db8 (localhost.localdomain [127.0.0.1]) by mail153-db8 (MessageSwitch) id 1369747006589637_9629; Tue, 28 May 2013 13:16:46 +0000 (UTC) Received: from DB8EHSMHS028.bigfish.com (unknown [10.174.8.233]) by mail153-db8.bigfish.com (Postfix) with ESMTP id 857A9400B3; Tue, 28 May 2013 13:16:46 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB8EHSMHS028.bigfish.com (10.174.4.38) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 28 May 2013 13:16:44 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-005.039d.mgd.msft.net (10.84.1.17) with Microsoft SMTP Server (TLS) id 14.2.328.11; Tue, 28 May 2013 13:17:38 +0000 Received: from fabio-Latitude-E6410.am.freescale.net ([10.29.244.74]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r4SDGcf2009464; Tue, 28 May 2013 06:16:39 -0700 From: Fabio Estevam To: Subject: [PATCH v2] ARM: dt: Use the 'model' field for printing the hardware revision Date: Tue, 28 May 2013 10:16:29 -0300 Message-ID: <1369746989-19470-1-git-send-email-fabio.estevam@freescale.com> X-Mailer: git-send-email 1.8.1.2 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130528_091712_364122_1ADD666C X-CRM114-Status: GOOD ( 13.18 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [213.199.154.187 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: nicolas.pitre@linaro.org, Fabio Estevam , grant.likely@secretlab.ca, kernel@pengutronix.de, shawn.guo@linaro.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When booting a device tree kernel, we get the following output from 'cat /proc/cpuinfo': $ cat /proc/cpuinfo processor : 0 model name : ARMv7 Processor rev 5 (v7l) BogoMIPS : 531.66 Features : swp half thumb fastmult vfp edsp neon vfpv3 tls CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc08 CPU revision : 5 Hardware : Freescale i.MX51 (Device Tree Support) Revision : 0000 Serial : 0000000000000000 The Hardware line does not really describe the hardware type, as it is reading the information from the dt 'machine' field. In the dt case, read the 'model' field instead, so that we can have a better description output as follows: Hardware : Freescale i.MX51 Babbage Board The hardware output string is unchanged for the non-dt kernel case. Signed-off-by: Fabio Estevam --- Changes since v1: - Fix typo in 'architecture' arch/arm/include/asm/mach/arch.h | 1 + arch/arm/kernel/devtree.c | 15 ++++++++------- arch/arm/kernel/setup.c | 7 ++++++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 308ad7d..113d4af 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h @@ -23,6 +23,7 @@ struct smp_operations; struct machine_desc { unsigned int nr; /* architecture number */ const char *name; /* architecture name */ + const char *model; /* architecture model */ unsigned long atag_offset; /* tagged list (relative) */ const char *const *dt_compat; /* array of device tree * 'compatible' strings */ diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index 5af04f6..90d541a 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -178,7 +178,6 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) struct machine_desc *mdesc, *mdesc_best = NULL; unsigned int score, mdesc_score = ~1; unsigned long dt_root; - const char *model; #ifdef CONFIG_ARCH_MULTIPLATFORM DT_MACHINE_START(GENERIC_DT, "Generic DT based system") @@ -224,12 +223,14 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) dump_machine_table(); /* does not return */ } - model = of_get_flat_dt_prop(dt_root, "model", NULL); - if (!model) - model = of_get_flat_dt_prop(dt_root, "compatible", NULL); - if (!model) - model = ""; - pr_info("Machine: %s, model: %s\n", mdesc_best->name, model); + mdesc_best->model = of_get_flat_dt_prop(dt_root, "model", NULL); + if (!mdesc_best->model) + mdesc_best->model = of_get_flat_dt_prop(dt_root, "compatible", + NULL); + if (!mdesc_best->model) + mdesc_best->model = ""; + pr_info("Machine: %s, model: %s\n", mdesc_best->name, + mdesc_best->model); /* Retrieve various information from the /chosen node */ of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 79e8d2f..d22f24b 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -137,6 +137,7 @@ EXPORT_SYMBOL(elf_platform); static const char *cpu_name; static const char *machine_name; +static const char *model_name; static char __initdata cmd_line[COMMAND_LINE_SIZE]; struct machine_desc *machine_desc __initdata; @@ -786,6 +787,7 @@ void __init setup_arch(char **cmdline_p) mdesc = setup_machine_tags(__atags_pointer, __machine_arch_type); machine_desc = mdesc; machine_name = mdesc->name; + model_name = mdesc->model; setup_dma_zone(mdesc); @@ -950,7 +952,10 @@ static int c_show(struct seq_file *m, void *v) seq_printf(m, "CPU revision\t: %d\n\n", cpuid & 15); } - seq_printf(m, "Hardware\t: %s\n", machine_name); + if (model_name) + seq_printf(m, "Hardware\t: %s\n", model_name); + else + seq_printf(m, "Hardware\t: %s\n", machine_name); seq_printf(m, "Revision\t: %04x\n", system_rev); seq_printf(m, "Serial\t\t: %08x%08x\n", system_serial_high, system_serial_low);