From patchwork Fri Feb 27 15:55:28 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: 444329 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 11CBB14011D for ; Sat, 28 Feb 2015 02:59:01 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=oYWcD3lu; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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 1YRNH9-0005BW-K9; Fri, 27 Feb 2015 15:56:27 +0000 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YRNGs-0004pg-UN for linux-arm-kernel@lists.infradead.org; Fri, 27 Feb 2015 15:56:11 +0000 Received: by widex7 with SMTP id ex7so1129357wid.1 for ; Fri, 27 Feb 2015 07:55:48 -0800 (PST) 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=73XiqwRf76dMV+s2Wmn6ipP4oukYYt9CdsZKP82toEw=; b=oYWcD3lu4k3XRjAD4JIA6z0RUOvdHgHZ8a3AOIyemS+5lt/4xReqjm8giGrDItbgh3 ekOlXcwZXzoniwbo5bwH+dC5R6FW432+6xlXfR1ejHWUrlUqDrLr0tOa3+W9qNwpNPxZ +pNNPKBvp8LAtmA1YO1xOxQBTDwo5eeZXU/ljNveFxCv77fZfBSeBGiS1BUJtCfj8D75 C6nGPALDEk/hOdfHsi/XQZsRQ6qzTWupiWBZbZzXRkWLqjRJcZTVilc8NfpvTHpoxhhd Mv+h2IVRbWJz4pcmgJiV6zJOB90eiTQcUtkoV3TBIoSb2Oc2QZTwaPKJLpOSqUe7jVKu /eew== X-Received: by 10.180.98.167 with SMTP id ej7mr7723925wib.87.1425052548847; Fri, 27 Feb 2015 07:55:48 -0800 (PST) Received: from Pali-Latitude.kolej.mff.cuni.cz (pali.kolej.mff.cuni.cz. [78.128.193.202]) by mx.google.com with ESMTPSA id fs8sm3369310wib.8.2015.02.27.07.55.45 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Feb 2015 07:55:46 -0800 (PST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Rob Herring , Russell King , Will Deacon , Ivaylo Dimitrov , Sebastian Reichel , Pavel Machek , Tony Lindgren , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH v2 2/2] arm: boot: convert ATAG_REVISION to DT revision field Date: Fri, 27 Feb 2015 16:55:28 +0100 Message-Id: <1425052528-18995-3-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1425052528-18995-1-git-send-email-pali.rohar@gmail.com> References: <201502271645.58765@pali> <1425052528-18995-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-20150227_075611_148388_BD274A07 X-CRM114-Status: GOOD ( 15.20 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (pali.rohar[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c05:0:0:0:230 listed in] [list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Cc: "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , =?UTF-8?q?Pali=20Roh=C3=A1r?= X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org ATAG_REVISION is unsigned number and revision in DT is stored as hexadecimal string value. It means that it will be correctly parsed by kernel. Signed-off-by: Pali Rohár --- arch/arm/boot/compressed/atags_to_fdt.c | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c index 9448aa0..b23748e 100644 --- a/arch/arm/boot/compressed/atags_to_fdt.c +++ b/arch/arm/boot/compressed/atags_to_fdt.c @@ -97,6 +97,39 @@ static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline) setprop_string(fdt, "/chosen", "bootargs", cmdline); } +static void tohexstr(char * str, int size, unsigned int num) +{ + int len = 0; + int i, tmp; + + if (size < 4) { + if (size > 0) + str[0] = 0; + return; + } + + str[len++] = '0'; + str[len++] = 'x'; + + while (len-1 < size && num) { + tmp = num % 16; + if (tmp >= 10) + tmp += 'A'; + else + tmp += '0'; + str[len++] = tmp; + num /= 16; + } + + str[len] = 0; + + for (i = 2; i < 2+(len-2)/2; ++i) { + tmp = str[i]; + str[i] = str[len-i+1]; + str[len-i+1] = tmp; + } +} + /* * Convert and fold provided ATAGs into the provided FDT. * @@ -171,6 +204,10 @@ 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) { + char revision[11]; + tohexstr(revision, sizeof(revision), atag->u.revision.rev); + setprop_string(fdt, "/", "revision", revision); } else if (atag->hdr.tag == ATAG_INITRD2) { uint32_t initrd_start, initrd_size; initrd_start = atag->u.initrd.start;