From patchwork Mon Jan 26 19:09:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 5712301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D40EBC058D for ; Mon, 26 Jan 2015 19:12:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E79EA2015A for ; Mon, 26 Jan 2015 19:12:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A00A200F3 for ; Mon, 26 Jan 2015 19:12:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YFp36-0007sA-VI; Mon, 26 Jan 2015 19:10:12 +0000 Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YFp34-0006g9-O0 for linux-arm-kernel@lists.infradead.org; Mon, 26 Jan 2015 19:10:11 +0000 Received: by mail-wg0-f51.google.com with SMTP id k14so10752773wgh.10 for ; Mon, 26 Jan 2015 11:09:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; bh=hkYc+naixmIALS6wBZE2tQp1u60UuKKeKDWzFiiRh8M=; b=xn47XdYMAW/7j3SuT0fALhvw4Q7Q42fRkLEBu59pVamIKlFfok5LXoQrGiz7k5xPfU mYM5jCMeufnWYUnnyUpwJ4p3yE9rMLCnxKvFc+d3ozVd8eV4887inuwAqC47Y5jj9qh8 5ScdeUbSlD1hLvaAv7j/5t2iKY8rKLGcpOWFo8JrlIw0HRp02Yh2oeBtYd5MmTZx0MLF K3KjGWrXRSikpfwdf/jLIMmnoTzZv7DoeJgHCjIJpMQZ7/hQ34LVXf/P2qAVKRvd5CbQ CEY8YNe+U0eR5YPYoZgV7InMhk7tomVK0gnUeDqpETjiHEupI1Gl/vkuP1EEow0dfs0e B63A== X-Received: by 10.180.20.226 with SMTP id q2mr24327042wie.28.1422299387941; Mon, 26 Jan 2015 11:09:47 -0800 (PST) Received: from pali-latitude.localnet ([2001:718:1e03:a01::1ca]) by mx.google.com with ESMTPSA id et4sm15498914wjd.15.2015.01.26.11.09.46 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:09:46 -0800 (PST) From: Pali =?utf-8?q?Roh=C3=A1r?= To: Rob Herring Subject: [PATCH] ARM: /proc/cpuinfo: DT: Add support for Revision Date: Mon, 26 Jan 2015 20:09:45 +0100 User-Agent: KMail/1.13.7 (Linux/3.13.0-44-generic; KDE/4.14.2; x86_64; ; ) References: <1403110464-29646-1-git-send-email-pali.rohar@gmail.com> <201412041857.49341@pali> In-Reply-To: MIME-Version: 1.0 Message-Id: <201501262009.45854@pali> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150126_111010_934686_317419B5 X-CRM114-Status: GOOD ( 15.60 ) X-Spam-Score: -0.8 (/) Cc: Ivaylo Dimitrov , Russell King , Tony Lindgren , Sebastian Reichel , Will Deacon , "linux-kernel@vger.kernel.org" , Pavel Machek , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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 X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ok, here is patch which set Revision field (global variable system_rev) in /proc/cpuinfo from DT revision property: I tested it on DT booted Nokia N900 and it is working, in /proc/cpuinfo is revision from ATAG. I do not know which DT property to use for storing HW Revision, so if "/revision" is not correct one, let me know what to use instead. Also you can add my Signed-off-by for both patches. Acked-by: Pavel Machek diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index 11c54de..9946c1b 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -26,6 +27,7 @@ #include #include #include +#include #ifdef CONFIG_SMP @@ -204,6 +206,8 @@ static const void * __init arch_get_next_mach(const char *const **match) const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) { const struct machine_desc *mdesc, *mdesc_best = NULL; + unsigned long dt_root; + const u32 *prop; #ifdef CONFIG_ARCH_MULTIPLATFORM DT_MACHINE_START(GENERIC_DT, "Generic DT based system") @@ -215,17 +219,16 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) if (!dt_phys || !early_init_dt_verify(phys_to_virt(dt_phys))) return NULL; + dt_root = of_get_flat_dt_root(); mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach); if (!mdesc) { const char *prop; int size; - unsigned long dt_root; early_print("\nError: unrecognized/unsupported " "device tree compatible list:\n[ "); - dt_root = of_get_flat_dt_root(); prop = of_get_flat_dt_prop(dt_root, "compatible", &size); while (size > 0) { early_print("'%s' ", prop); @@ -246,5 +249,10 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) /* Change machine number to match the mdesc we're using */ __machine_arch_type = mdesc->nr; + /* Set system revision from DT */ + prop = of_get_flat_dt_prop(dt_root, "revision", NULL); + if (prop) + system_rev = fdt32_to_cpu(*prop); + return mdesc; } And here is patch which convert ATAG revision into DT revision property and append it into DT in decompress code: diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c index 9448aa0..e7e1cc9 100644 --- a/arch/arm/boot/compressed/atags_to_fdt.c +++ b/arch/arm/boot/compressed/atags_to_fdt.c @@ -171,6 +171,8 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space) cpu_to_fdt32(atag->u.mem.size); } + } else if (atag->hdr.tag == ATAG_REVISION) { + setprop_cell(fdt, "/", "revision", atag->u.revision.rev); } else if (atag->hdr.tag == ATAG_INITRD2) { uint32_t initrd_start, initrd_size; initrd_start = atag->u.initrd.start;