From patchwork Mon Jul 6 20:26:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 6727691 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 D6782C05AC for ; Mon, 6 Jul 2015 20:28:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC18920531 for ; Mon, 6 Jul 2015 20:28:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A28B2052F for ; Mon, 6 Jul 2015 20:28:58 +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 1ZCCyv-0005fZ-4E; Mon, 06 Jul 2015 20:27:13 +0000 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZCCyn-0005VD-7m for linux-arm-kernel@lists.infradead.org; Mon, 06 Jul 2015 20:27:05 +0000 Received: by wiga1 with SMTP id a1so238948631wig.0 for ; Mon, 06 Jul 2015 13:26:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=CfE89/5J0RL9torAKWwE20s+PBp1AKeYIysy/L024o8=; b=TEHTOcxiflKJu7FoPloZdJ0WjTb4fmVq4HVy07LU2xLqTSeUUqrWSeqYDMDjG79EKC SGpyHIzMTwn59igPGXl2cy134q3qpRmp0XIVAVWOB5szDXxpYqJwWAjfBGHsza7ImaUr wFER9yoy9Z/foHKEyMRM+J8QWYbUFHhNgXaEwlbQ7Qs06WijopxrAac6GZ0cXFX2VMKH 7P/TmI9sdjrOHr54vI9k6uXSz0COxtwtRHplDqdfgm4eGg75uljIxc0EpngW0pgW6vD/ VB69VymVCDHxpEej25wTOdr+UVu0RkrwuCgjobbDxnW/V8kNpK7gyKWg6uCtY7LEQt/O A11Q== X-Received: by 10.180.90.81 with SMTP id bu17mr24983218wib.35.1436214403710; Mon, 06 Jul 2015 13:26:43 -0700 (PDT) Received: from Pali-Latitude.kolej.mff.cuni.cz (pali.kolej.mff.cuni.cz. [78.128.193.202]) by mx.google.com with ESMTPSA id ck18sm29869344wjb.47.2015.07.06.13.26.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 13:26:42 -0700 (PDT) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Russell King , Laura Abbott , Grant Likely , Rob Herring , Will Deacon , Ivaylo Dimitrov , Sebastian Reichel , Pavel Machek , Tony Lindgren , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH 1/5] arm: devtree: Set system_rev from DT "/revision" Date: Mon, 6 Jul 2015 22:26:09 +0200 Message-Id: <1436214373-12969-2-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1436214373-12969-1-git-send-email-pali.rohar@gmail.com> References: <1436214373-12969-1-git-send-email-pali.rohar@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150706_132705_429618_126E42D5 X-CRM114-Status: GOOD ( 16.16 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 With this patch "/revision" DT entry is used to set global system_rev variable. DT "/revision" is expected to be u32 numeric value. TODO: add documentation Signed-off-by: Pali Rohár --- arch/arm/kernel/devtree.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index 11c54de..7d82749 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 *rev; #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 */ + rev = of_get_flat_dt_prop(dt_root, "revision", NULL); + if (rev) + system_rev = fdt32_to_cpu(*rev); + return mdesc; }