From patchwork Tue May 28 12:04:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 2624221 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 1E23FDFB78 for ; Tue, 28 May 2013 12:05:34 +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 1UhIef-0000zL-N9; Tue, 28 May 2013 12:05:29 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UhIec-00043q-E7; Tue, 28 May 2013 12:05:26 +0000 Received: from tx2ehsobe004.messaging.microsoft.com ([65.55.88.14] helo=tx2outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UhIeT-00043H-AG for linux-arm-kernel@lists.infradead.org; Tue, 28 May 2013 12:05:18 +0000 Received: from mail9-tx2-R.bigfish.com (10.9.14.227) by TX2EHSOBE009.bigfish.com (10.9.40.29) with Microsoft SMTP Server id 14.1.225.23; Tue, 28 May 2013 12:04:54 +0000 Received: from mail9-tx2 (localhost [127.0.0.1]) by mail9-tx2-R.bigfish.com (Postfix) with ESMTP id 8AA01340311; Tue, 28 May 2013 12:04:54 +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 mail9-tx2 (localhost.localdomain [127.0.0.1]) by mail9-tx2 (MessageSwitch) id 1369742692743452_6596; Tue, 28 May 2013 12:04:52 +0000 (UTC) Received: from TX2EHSMHS017.bigfish.com (unknown [10.9.14.234]) by mail9-tx2.bigfish.com (Postfix) with ESMTP id B1465C0051; Tue, 28 May 2013 12:04:52 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS017.bigfish.com (10.9.99.117) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 28 May 2013 12:04:52 +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 12:05:47 +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 r4SC4iUU026512; Tue, 28 May 2013 05:04:49 -0700 From: Fabio Estevam To: Subject: [PATCH] ARM: dt: Use the 'model' field for printing the hardware revision Date: Tue, 28 May 2013 09:04:30 -0300 Message-ID: <1369742670-16305-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_080517_503723_5B34EA4C X-CRM114-Status: GOOD ( 12.67 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [65.55.88.14 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 --- 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; /* architectute 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);