From patchwork Tue Aug 29 20:15:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807268 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="EEtgSJjc"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhg0P0c0dz9sR9 for ; Wed, 30 Aug 2017 06:17:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id AC511C22674; Tue, 29 Aug 2017 20:16:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id A67C9C225B7; Tue, 29 Aug 2017 20:16:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4C55FC21E1E; Tue, 29 Aug 2017 20:16:11 +0000 (UTC) Received: from mail-oi0-f49.google.com (mail-oi0-f49.google.com [209.85.218.49]) by lists.denx.de (Postfix) with ESMTPS id 9D96CC21DF8 for ; Tue, 29 Aug 2017 20:16:10 +0000 (UTC) Received: by mail-oi0-f49.google.com with SMTP id r203so36444737oih.0 for ; Tue, 29 Aug 2017 13:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=KcSg1LnL6ip/8QPG3BE5F1uDb7YnpXIu0AtcskEFYek=; b=EEtgSJjckkawCVZ9ysQlrOvbItmY4uJ/hmjTFYtBhixvLq/Hv/Nt9qRzpBh33l4qrI XqMVA5VMko/7Ywb3jQK8AnnlRRY4dyI/OuddIr2TB+KxQyj5Bv9ca6UJIUrVGd1vYQPu Yr5DTi96eQcK8lkqu1e33s0VbVA/AB+cJ0pAFADbQbmqGqEcC/0/aswRHBllfzdHrTsY CXC6Ups6XNq/7b5S6KfSWGBjslBJBOETvm662G1fkLbKyVKj92owKxmVik+a3M5HsCdY H7f8THfmaXDZutah03rcsgd3F2k+rxjXfElC9qOKMlIaP9fqbTloxjdMjehUPXETFqtD J4eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=KcSg1LnL6ip/8QPG3BE5F1uDb7YnpXIu0AtcskEFYek=; b=WDdDuoRHCWoimI5nVZM/ghQ9GnNvXYsuJsUM10/EGGPEDXwds/aMVlzjqr5CSkWWRf DtTHk/ldHf+8mCwPh9zZYDVw1sGxqUQe+RdNwSY4ly+dFovTKuJ2et9Up2JdA9hrvNtI ac/8Z/SzPFZ/xqfz7vrgV5dqhi2GLIsciVZFoL0KycJBZgfF3r403JNnpCheEI5+qfn9 7HHmdTMkIYfgIH7NpSkEPpjloqtCXeSoljQ3VdWjKvfc/u/USjqJBVrKC5xku144yN/7 5wKLNYOEZgmi27ei5cDiB0V3L8n0w0R2Uy2FQWqTxxFmtqqxgbySNU5/RMKC4f1VyX0G KRsw== X-Gm-Message-State: AHYfb5j7/xbRzWAIplFvVExUq0PPBSprNg777regJ7lCI+prBuRxzG0A sGmJrv2YiPrKanP5 X-Google-Smtp-Source: ADKCNb4fZ/3tkQdbqjdKVagNIGZ5U/kHgf05DPLnrc/8GOwSizTj8Wbi8OyOvEhmMKlvAGnZS1eOYA== X-Received: by 10.202.114.199 with SMTP id p190mr1367530oic.122.1504037768910; Tue, 29 Aug 2017 13:16:08 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id j138sm3718052oib.20.2017.08.29.13.16.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:08 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id A34A213FC5F; Tue, 29 Aug 2017 14:16:07 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:46 -0600 Message-Id: <20170829201601.64312-2-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini , Jerry Van Baren Subject: [U-Boot] [PATCH v2 01/16] fdt: Sync libfdt up to upstream X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add upstream changes to U-Boot: - new pylibfdt functions - fdt_setprop_placeholder() Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None lib/libfdt/fdt_rw.c | 20 ++++++++++++--- lib/libfdt/libfdt.h | 31 +++++++++++++++++++++++ lib/libfdt/pylibfdt/libfdt.i | 58 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 3 deletions(-) diff --git a/lib/libfdt/fdt_rw.c b/lib/libfdt/fdt_rw.c index 80a3212141..3dc775261f 100644 --- a/lib/libfdt/fdt_rw.c +++ b/lib/libfdt/fdt_rw.c @@ -228,8 +228,8 @@ int fdt_set_name(void *fdt, int nodeoffset, const char *name) return 0; } -int fdt_setprop(void *fdt, int nodeoffset, const char *name, - const void *val, int len) +int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name, + int len, void **prop_data) { struct fdt_property *prop; int err; @@ -242,8 +242,22 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name, if (err) return err; + *prop_data = prop->data; + return 0; +} + +int fdt_setprop(void *fdt, int nodeoffset, const char *name, + const void *val, int len) +{ + void *prop_data; + int err; + + err = fdt_setprop_placeholder(fdt, nodeoffset, name, len, &prop_data); + if (err) + return err; + if (len) - memcpy(prop->data, val, len); + memcpy(prop_data, val, len); return 0; } diff --git a/lib/libfdt/libfdt.h b/lib/libfdt/libfdt.h index f3f9cad184..6af94cb3f7 100644 --- a/lib/libfdt/libfdt.h +++ b/lib/libfdt/libfdt.h @@ -1404,6 +1404,37 @@ int fdt_set_name(void *fdt, int nodeoffset, const char *name); int fdt_setprop(void *fdt, int nodeoffset, const char *name, const void *val, int len); +/** + * fdt_setprop _placeholder - allocate space for a property + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose property to change + * @name: name of the property to change + * @len: length of the property value + * @prop_data: return pointer to property data + * + * fdt_setprop_placeholer() allocates the named property in the given node. + * If the property exists it is resized. In either case a pointer to the + * property data is returned. + * + * This function may insert or delete data from the blob, and will + * therefore change the offsets of some existing nodes. + * + * returns: + * 0, on success + * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to + * contain the new property value + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADLAYOUT, + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_BADLAYOUT, + * -FDT_ERR_TRUNCATED, standard meanings + */ +int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name, + int len, void **prop_data); + /** * fdt_setprop_u32 - set a property to a 32-bit integer * @fdt: pointer to the device tree blob diff --git a/lib/libfdt/pylibfdt/libfdt.i b/lib/libfdt/pylibfdt/libfdt.i index 3b11bb0c95..6c44996c31 100644 --- a/lib/libfdt/pylibfdt/libfdt.i +++ b/lib/libfdt/pylibfdt/libfdt.i @@ -128,6 +128,23 @@ class Fdt: self._fdt = bytearray(data) check_err(fdt_check_header(self._fdt)); + def subnode_offset(self, parentoffset, name, quiet=()): + """Get the offset of a named subnode + + Args: + parentoffset: Offset of the parent node to check + name: Name of the required subnode, e.g. 'subnode@1' + quiet: Errors to ignore (empty to raise on all errors) + + Returns: + The node offset of the found node, if any + + Raises + FdtException if there is no node with that name, or other error + """ + return check_err(fdt_subnode_offset(self._fdt, parentoffset, name), + quiet) + def path_offset(self, path, quiet=()): """Get the offset for a given path @@ -302,6 +319,47 @@ class Fdt: return pdata return bytearray(pdata[0]) + def get_phandle(self, nodeoffset): + """Get the phandle of a node + + Args: + nodeoffset: Node offset to check + + Returns: + phandle of node, or 0 if the node has no phandle or another error + occurs + """ + return fdt_get_phandle(self._fdt, nodeoffset) + + def parent_offset(self, nodeoffset, quiet=()): + """Get the offset of a node's parent + + Args: + nodeoffset: Node offset to check + quiet: Errors to ignore (empty to raise on all errors) + + Returns: + The offset of the parent node, if any + + Raises: + FdtException if no parent found or other error occurs + """ + return check_err(fdt_parent_offset(self._fdt, nodeoffset), quiet) + + def node_offset_by_phandle(self, phandle, quiet=()): + """Get the offset of a node with the given phandle + + Args: + phandle: Phandle to search for + quiet: Errors to ignore (empty to raise on all errors) + + Returns: + The offset of node with that phandle, if any + + Raises: + FdtException if no node found or other error occurs + """ + return check_err(fdt_node_offset_by_phandle(self._fdt, phandle), quiet) class Property: """Holds a device tree property name and value. From patchwork Tue Aug 29 20:15:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807275 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="GXXbuJ9x"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhg7K6Ygnz9sRV for ; Wed, 30 Aug 2017 06:23:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 94ACEC21E1E; Tue, 29 Aug 2017 20:17:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 7C7E2C221BC; Tue, 29 Aug 2017 20:16:29 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5E615C221BC; Tue, 29 Aug 2017 20:16:17 +0000 (UTC) Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by lists.denx.de (Postfix) with ESMTPS id E7B5DC225A6 for ; Tue, 29 Aug 2017 20:16:13 +0000 (UTC) Received: by mail-oi0-f53.google.com with SMTP id r203so36445916oih.0 for ; Tue, 29 Aug 2017 13:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ddHxAA57aLoRKPGFLOPsxVYOFiwBY4xH+6TXxKSU8Ig=; b=GXXbuJ9xivJL5JPO2N1iMu6ihmKWNuBkkaeED7gZvv4xxVFnLgS8jPXcNvDVtB4W3g JxqpqvnsMSsESlZB8LCU6xMMDT6hGGAJtyiiR0/Nu+rKJYWpj4NYAQLhbBFTXnwa4s8E uefReStL5PemRW6oudSHVz0JHzieKBf0YNJ95bjxEdCYfVlgZCurLtj2Z0/Mo+P1lccK kdg9wvE2sKCfBTTspHn5TAKNNEOVGUOwdfO39AU0D/aj4nPmt57P2J3IGQalcQZt6jo2 pz3QLQgBR30TgM7190zMaiA+f8kQRXd9RaLdLXHnAUYkg/4b91fJC4qXgpRB37GAem3/ lw3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ddHxAA57aLoRKPGFLOPsxVYOFiwBY4xH+6TXxKSU8Ig=; b=i8UdiZoEF+7JuVpcIlJreoBh6pbpqv1A6USEcm4Pl9KtP6UbrLWPyMqE1e8fLFSMsd T4xdPwj80KXZSQGYZZDmRv4ukXefzZh9Imiwbpv8vcGte8ZFos5TE80TNKa+2juZOoRD e02m3ElzOfKS8Wdpd+MmdPwvc8/LWUqro/9DQfmfrkkj0m447NKZqnYaSuO/EkrNlgXt Mw/kAm1ANuP3EZzO5Ljv3iidXY3IpgLCQ8OhWfw7DG+Nvjl9U1h4TK9DXxsUVnSBE4LI J0Lp5/iGec1Sf1DaMB7k05Pup8rRPKAs1UNLdHbFkDR9d1hpmSNZDnX1aqoUhbpLfhmf DZ5w== X-Gm-Message-State: AHYfb5ghn7CVsv0fGphJQN1CDKvMllA9O+VSjH4YjOYZwI+OHDfSsTt3 l93KeDvYqQCShiiFwiWYNQ== X-Google-Smtp-Source: ADKCNb5iXeJB+EhMbMBotD932t6Gr5gzmamHaF4cymXeLVMkJT/AvANjYEBafsB+C5/adn/4jCeFXw== X-Received: by 10.202.169.19 with SMTP id s19mr574788oie.306.1504037772347; Tue, 29 Aug 2017 13:16:12 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id n2sm3669484oib.27.2017.08.29.13.16.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:09 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id B7D2513FAB7; Tue, 29 Aug 2017 14:16:08 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:47 -0600 Message-Id: <20170829201601.64312-3-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 02/16] dtoc: Adjust Node to record its parent X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" We need to be able to search back up the tree for #address-cells and #size-cells. Record the parent of each node to make this easier. Signed-off-by: Simon Glass Reviewed-by: Philipp Tomsich Tested-by: Philipp Tomsich Signed-off-by: Simon Glass Reviewed-by: Philipp Tomsich Tested-by: Philipp Tomsich --- Changes in v2: None tools/dtoc/fdt.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 63a32ea2d7..49409a62ec 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -174,8 +174,9 @@ class Node: props: A dict of properties for this node, each a Prop object. Keyed by property name """ - def __init__(self, fdt, offset, name, path): + def __init__(self, fdt, parent, offset, name, path): self._fdt = fdt + self.parent = parent self._offset = offset self.name = name self.path = path @@ -217,7 +218,7 @@ class Node: sep = '' if self.path[-1] == '/' else '/' name = self._fdt._fdt_obj.get_name(offset) path = self.path + sep + name - node = Node(self._fdt, offset, name, path) + node = Node(self._fdt, self, offset, name, path) self.subnodes.append(node) node.Scan() @@ -279,7 +280,7 @@ class Fdt: TODO(sjg@chromium.org): Implement the 'root' parameter """ - self._root = self.Node(self, 0, '/', '/') + self._root = self.Node(self, None, 0, '/', '/') self._root.Scan() def GetRoot(self): @@ -386,7 +387,7 @@ class Fdt: return libfdt.fdt_off_dt_struct(self._fdt) + offset @classmethod - def Node(self, fdt, offset, name, path): + def Node(self, fdt, parent, offset, name, path): """Create a new node This is used by Fdt.Scan() to create a new node using the correct @@ -394,11 +395,12 @@ class Fdt: Args: fdt: Fdt object + parent: Parent node, or None if this is the root node offset: Offset of node name: Node name path: Full path to node """ - node = Node(fdt, offset, name, path) + node = Node(fdt, parent, offset, name, path) return node def FdtScan(fname): From patchwork Tue Aug 29 20:15:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807276 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="TlQjhSmM"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhg7S32Y0z9sQl for ; Wed, 30 Aug 2017 06:23:16 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 0B3ECC226C5; Tue, 29 Aug 2017 20:18:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5B7A5C225BA; Tue, 29 Aug 2017 20:16:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5660AC22602; Tue, 29 Aug 2017 20:16:18 +0000 (UTC) Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) by lists.denx.de (Postfix) with ESMTPS id 90D05C225AB for ; Tue, 29 Aug 2017 20:16:14 +0000 (UTC) Received: by mail-oi0-f50.google.com with SMTP id k77so36399832oib.2 for ; Tue, 29 Aug 2017 13:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=haBOpWoD43Oy3HrMplmjgXDkLGMwHCnDSInV9CrEkEo=; b=TlQjhSmMJ/H3ivymwmrLUeJQOThO7/IXmoDa8X7ZdvURHssrtlQuM6rlZx7EGHVwCD h5bmZdNZrhDocHCHrbQ++B1lIaj5rXBDbk+i3lsWispY99jGCanmV893qff7g9UyFYSp Pas01dAHMqgqd8nDu1TiBVWpLxEro7wSkxkudc0sQ6/x4//ZZ56WJZ8Cfr/7OY2Opm7c mxYxdbsOwFh1YSuZ/VsZ5t2e9Ljj++6gccAiWalyl4iP1M7CMcDSv9X3jJHhyTb+Mn5n iNJzrwMiA/2vxWLnRDLwKMrJ9RLD2TPejoOhKbpUw06EWMTwws2x3ZwF7bZeL3vETqBK 73gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=haBOpWoD43Oy3HrMplmjgXDkLGMwHCnDSInV9CrEkEo=; b=G71T9ZoJTipSS82qpfd0jQqoYwX6h9JQ8WSvBv4OAixG05Mpm+RLZH8b8FeRYrxyIJ iJu8P7VSbyj5Km5F4Htssoe6WRLDjVUT3pVymctlWQtyDT/Q8i+khh2k7lRswq+5Cfv7 Pzv4q3dODDHO6LGvM74fOCtEvNlLyHL8wj7MLTxJXqG2/2YgVuJOm3re9Zu68bg2HI7+ 5NQR1AFVmXz4yk2KbXRgFtOHSHEjskH3TbEYx6eQ5F7XgKQ2pVJ6lte/s+snRtc+Lzsm K3PSa7mBgH00vgfPiyfEiyA2h+Qh9n/kYbWqHsosnENX/V5jk9GjyehhUmrIITD2Du37 GPQQ== X-Gm-Message-State: AHYfb5gc3jx8cBUkr15hEtTqBiqXeILuKhl+3GMq1kgzCewvuuo5+0JJ gzUjy6oIH1GB34ah X-Google-Smtp-Source: ADKCNb5dmGIKkgdMPSApbLz2eiK0ehmaEI8PLDZQYQMGiZCbdmQv3e02rD3nJWY1tVHUPsSr9FEq6A== X-Received: by 10.202.44.10 with SMTP id s10mr1460940ois.256.1504037773053; Tue, 29 Aug 2017 13:16:13 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id e184sm4032429oih.35.2017.08.29.13.16.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:12 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id C7F6313FC5F; Tue, 29 Aug 2017 14:16:09 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:48 -0600 Message-Id: <20170829201601.64312-4-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 03/16] dtoc: Add a 64-bit type and a way to convert cells into 64 bits X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When dealing with multi-cell values we need a type that can hold this value. Add this and a function to process it from a list of cell values. Signed-off-by: Simon Glass Reviewed-by: Philipp Tomsich Tested-by: Philipp Tomsich Signed-off-by: Simon Glass Reviewed-by: Philipp Tomsich Tested-by: Philipp Tomsich --- Changes in v2: None tools/dtoc/dtb_platdata.py | 3 +++ tools/dtoc/fdt.py | 2 +- tools/dtoc/fdt_util.py | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 041a33188f..4a1162a9fa 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -38,6 +38,7 @@ TYPE_NAMES = { fdt.TYPE_BYTE: 'unsigned char', fdt.TYPE_STRING: 'const char *', fdt.TYPE_BOOL: 'bool', + fdt.TYPE_INT64: 'fdt64_t', } STRUCT_PREFIX = 'dtd_' @@ -95,6 +96,8 @@ def get_value(ftype, value): return '"%s"' % value elif ftype == fdt.TYPE_BOOL: return 'true' + elif ftype == fdt.TYPE_INT64: + return '%#x' % value def get_compat_name(node): """Get a node's first compatible string as a C identifier diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 49409a62ec..ffd42ce541 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -21,7 +21,7 @@ import libfdt # so it is fairly efficient. # A list of types we support -(TYPE_BYTE, TYPE_INT, TYPE_STRING, TYPE_BOOL) = range(4) +(TYPE_BYTE, TYPE_INT, TYPE_STRING, TYPE_BOOL, TYPE_INT64) = range(5) def CheckErr(errnum, msg): if errnum: diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py index b9dfae8d0e..bec6ee947a 100644 --- a/tools/dtoc/fdt_util.py +++ b/tools/dtoc/fdt_util.py @@ -29,6 +29,20 @@ def fdt32_to_cpu(val): val = val.encode('raw_unicode_escape') return struct.unpack('>I', val)[0] +def fdt_cells_to_cpu(val, cells): + """Convert one or two cells to a long integer + + Args: + Value to convert (array of one or more 4-character strings) + + Return: + A native-endian long value + """ + out = long(fdt32_to_cpu(val[0])) + if cells == 2: + out = out << 32 | fdt32_to_cpu(val[1]) + return out + def EnsureCompiled(fname): """Compile an fdt .dts source file into a .dtb binary blob if needed. From patchwork Tue Aug 29 20:15:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807270 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="nUMQCFhb"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhg2c4bz2z9sR9 for ; Wed, 30 Aug 2017 06:19:04 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 4F77FC226AE; Tue, 29 Aug 2017 20:17:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 134C3C225F0; Tue, 29 Aug 2017 20:16:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1922DC22602; Tue, 29 Aug 2017 20:16:18 +0000 (UTC) Received: from mail-oi0-f41.google.com (mail-oi0-f41.google.com [209.85.218.41]) by lists.denx.de (Postfix) with ESMTPS id 43963C22455 for ; Tue, 29 Aug 2017 20:16:15 +0000 (UTC) Received: by mail-oi0-f41.google.com with SMTP id k77so36400153oib.2 for ; Tue, 29 Aug 2017 13:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=VLkYkWx3bjbErVKmAZikiJnqX3U9hVOFxdBRwJnUeTg=; b=nUMQCFhb/lmcb4iF0/OvWElSBVtYgbRx20T5zruS0kSaJLyCksTkfUtyWudN/2/MXz CqQQ6bHWyfxXuUa9f0C/G26Hou71NnYNaI+kbV4YlZr1/u4GBru+bFzGgf4cOOx+nOw1 ribZ30LwQJqKVfFq1yhtc7OdWeLHHzC+NOw44hFbIG5m2VC4GzDepb7H6iQ5SmfrYcnx 0WVpakD5BD/ZQDfjKQxRf7/sUOsRcU0BsPSE7lU5/duZ90eZg+25Y45oRqoLeESPP+/0 kbFlQ11+AxoulCLOIlzN094lN11JvmQRdZFf9eje2UJgoInluhL7eZppviO6K6cdSsEI nNyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=VLkYkWx3bjbErVKmAZikiJnqX3U9hVOFxdBRwJnUeTg=; b=Z+v6ZxOFXuRkRK/m3UIayOc6XmkcJaviOcMRPkkTWp7olr0q+7c5ZzjctL13jyfh7z OHxROg0nlFXXLQsvRboO1yq+lKRw3kjsCYSQq8d5Kvr7AggbL9SY8yEmAWagGLzAwzIs tuiqJPBzys+3jpmrjh49wXNBJ1Zh4A/sxeWM54Y141g+/sOamzHoViZE3OzETdef8Oue 1C3BXpDdh34HKGeu3EoZ8OVVpEk4vwQlcUjIjnYiMjOz+B7UIzCfhN+M7M76Lb4/O8bi UqO/BP63hkXw8i06ZgZIwfpHYFp7IO+67QCA4gzaquZfO84HaqN0m4D4yPlpvxkb55+Q 8Lkw== X-Gm-Message-State: AHYfb5jXO5JBlUBOIFBwE8p40pYHfGAGrat9ZLNHmW+0iT++byqVunds hWo+xI0dkn90gtu4oUSnVw== X-Google-Smtp-Source: ADKCNb4xeqXckYzmtG6fAdYD5celWIa64JQtvU9jCdV9PmaM5HXxNi6TiE9cFXnYMUC4B5wtA0Zo+g== X-Received: by 10.202.199.198 with SMTP id x189mr1494720oif.279.1504037773656; Tue, 29 Aug 2017 13:16:13 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id o7sm3248850oia.44.2017.08.29.13.16.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:12 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id C9B6E13FCAB; Tue, 29 Aug 2017 14:16:10 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:49 -0600 Message-Id: <20170829201601.64312-5-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 04/16] dtoc: Avoid very long lines in output X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Large arrays can result in lines with hundreds or thousands of characters which is not very editor-friendly. To avoid this, addjust the tool to group values 8 per line. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None tools/dtoc/dtb_platdata.py | 7 ++++++- tools/dtoc/test_dtoc.py | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 4a1162a9fa..3243bccfe8 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -385,7 +385,12 @@ class DtbPlatdata(object): else: for val in prop.value: vals.append(get_value(prop.type, val)) - self.buf(', '.join(vals)) + + # Put 8 values per line to avoid very long lines. + for i in xrange(0, len(vals), 8): + if i: + self.buf(',\n\t\t') + self.buf(', '.join(vals[i:i + 8])) self.buf('}') else: self.buf(get_value(prop.type, prop.value)) diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 8b95c4124f..5040f23325 100644 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -146,7 +146,8 @@ static struct dtd_sandbox_spl_test dtv_spl_test = { \t.bytearray\t\t= {0x6, 0x0, 0x0}, \t.byteval\t\t= 0x5, \t.intval\t\t\t= 0x1, -\t.longbytearray\t\t= {0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11}, +\t.longbytearray\t\t= {0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, +\t\t0x11}, \t.stringval\t\t= "message", \t.boolval\t\t= true, \t.intarray\t\t= {0x2, 0x3, 0x4, 0x0}, @@ -162,7 +163,8 @@ static struct dtd_sandbox_spl_test dtv_spl_test2 = { \t.bytearray\t\t= {0x1, 0x23, 0x34}, \t.byteval\t\t= 0x8, \t.intval\t\t\t= 0x3, -\t.longbytearray\t\t= {0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, +\t.longbytearray\t\t= {0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, +\t\t0x0}, \t.stringval\t\t= "message2", \t.intarray\t\t= {0x5, 0x0, 0x0, 0x0}, \t.stringarray\t\t= {"another", "multi-word", "message"}, From patchwork Tue Aug 29 20:15:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807271 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="LKl9L3g2"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhg3l3q8Xz9t0F for ; Wed, 30 Aug 2017 06:20:03 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 10189C22455; Tue, 29 Aug 2017 20:16:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2696DC22608; Tue, 29 Aug 2017 20:16:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5A39AC225F0; Tue, 29 Aug 2017 20:16:21 +0000 (UTC) Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by lists.denx.de (Postfix) with ESMTPS id 2ED5CC21E1E for ; Tue, 29 Aug 2017 20:16:17 +0000 (UTC) Received: by mail-oi0-f53.google.com with SMTP id t75so36448894oie.3 for ; Tue, 29 Aug 2017 13:16:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=++6QufUtZnKDjRtm0pGbKVuebyaIVZ8cxEvgRPFjUi8=; b=LKl9L3g2Jcu/6kaR7fA6ryUfmA8hqpyIDnrGg/+5QmVC7tUHJP3wvFcGewndWEA4V2 aSHcKCtJPVRDza+sodDTQBCc1W7pmiTCreyqLnilsjMAEfVeQF/nS8IH/9OebxOeYvwL xbB4Js1xjL8wLYD841KCsEVECTSbs3NJCRKZ7NiO8Ayc+2rpW7qASzvCIY0BneNXXeU/ WedwAnMvDz4YdtoX5jd7FcGyKBJiTrRTCYxB/uSA0Vm9oUsvy/0QdrTXL6YBh8GYm13M CYmecMoJlhXDCBZh0LEcyAshorzPNkaOYzu35y4HWVk7lNDL+Ac5UfHL4LWrlbNGep0s 2GYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=++6QufUtZnKDjRtm0pGbKVuebyaIVZ8cxEvgRPFjUi8=; b=CRDPBslcuh+4q8xJCLBiXHyV+LhUlo33AyizUvL9FVzcF4lK5s+pcWyj+bQWPUlbaM xGOnNaijlaqq8+G1WWIsjOgdC7RrXQypg6HQ+qd1AwKoxHYgspIH4YTiXCiMtQG0te0x KOes0py6WQ7DjIyQfix3vdlJ8TbDHgaHo6VGX5afbwGBs0q7JTD/F8dKYD9L9nApkZnn Y17yfb8f6QusE713+gwdq126c9M+e4WH68GMbHF6464rTYMUxqg+WADr+/28Uo4/bkeC N55rGlOhcPn3+LRCgHdo+ZTrfw3sFzdBZJZVbOGezXtQZT3rBwRJkRZUrjhJVQLnQn9g eDYQ== X-Gm-Message-State: AHYfb5gfN+m+3fTfA49xhgzHTN6TrkBXf4qjFeidiTb2yk6LR8NoDwDb QKmKHAqavFdHSde2 X-Google-Smtp-Source: ADKCNb7JTphqrBO4RruU/uZwLcHYrxKBhcAlF+f46UuGBSHPdn4u51dPqz8YeURRfaa1NQr/VVbXDA== X-Received: by 10.202.171.132 with SMTP id u126mr1605648oie.9.1504037775211; Tue, 29 Aug 2017 13:16:15 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id m72sm3725309oig.3.2017.08.29.13.16.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:13 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id E2DAA13FE6E; Tue, 29 Aug 2017 14:16:11 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:50 -0600 Message-Id: <20170829201601.64312-6-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 05/16] dtoc: Add support for 32 or 64-bit addresses X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When using 32-bit addresses dtoc works correctly. For 64-bit addresses it does not since it ignores the #address-cells and #size-cells properties. Update the tool to use fdt64_t as the element type for reg properties when either the address or size is larger than one cell. Use the correct value so that C code can obtain the information from the device tree easily. Alos create a new type, fdt_val_t, which is defined to either fdt32_t or fdt64_t depending on the word size of the machine. This type corresponds to fdt_addr_t and fdt_size_t. Unfortunately we cannot just use those types since they are defined to phys_addr_t and phys_size_t which use 'unsigned long' in the 32-bit case, rather than 'unsigned int'. Add tests for the four combinations of address and size values (32/32, 64/64, 32/64, 64/32). Also update existing uses for rk3399 and rk3368 which now need to use the new fdt_val_t type. Signed-off-by: Simon Glass Suggested-by: Heiko Stuebner Reported-by: Kever Yang Reviewed-by: Philipp Tomsich --- Changes in v2: - Support 'reg' properties with a single cell (e.g. #size-cells = 0) - Introduce an fdt_val_t type which is either 32- or 64-bits long - Update rk3368 and rk3399 uses - Drop review tags since there are significant changes in this patch drivers/clk/rockchip/clk_rk3368.c | 2 +- drivers/clk/rockchip/clk_rk3399.c | 4 +- drivers/core/regmap.c | 2 +- include/fdtdec.h | 2 + include/regmap.h | 2 +- include/syscon.h | 6 +- tools/dtoc/dtb_platdata.py | 61 +++++++++++ tools/dtoc/dtoc_test_addr32.dts | 27 +++++ tools/dtoc/dtoc_test_addr32_64.dts | 33 ++++++ tools/dtoc/dtoc_test_addr64.dts | 33 ++++++ tools/dtoc/dtoc_test_addr64_32.dts | 33 ++++++ tools/dtoc/fdt_util.py | 2 + tools/dtoc/test_dtoc.py | 212 +++++++++++++++++++++++++++++++++++++ 13 files changed, 413 insertions(+), 6 deletions(-) create mode 100644 tools/dtoc/dtoc_test_addr32.dts create mode 100644 tools/dtoc/dtoc_test_addr32_64.dts create mode 100644 tools/dtoc/dtoc_test_addr64.dts create mode 100644 tools/dtoc/dtoc_test_addr64_32.dts diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c index 2be1f572d7..0160d50c03 100644 --- a/drivers/clk/rockchip/clk_rk3368.c +++ b/drivers/clk/rockchip/clk_rk3368.c @@ -471,7 +471,7 @@ static int rk3368_clk_probe(struct udevice *dev) #if CONFIG_IS_ENABLED(OF_PLATDATA) struct rk3368_clk_plat *plat = dev_get_platdata(dev); - priv->cru = map_sysmem(plat->dtd.reg[1], plat->dtd.reg[3]); + priv->cru = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]); #endif #if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD) rkclk_init(priv->cru); diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index 3edafea140..0de3db620d 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -963,7 +963,7 @@ static int rk3399_clk_probe(struct udevice *dev) #if CONFIG_IS_ENABLED(OF_PLATDATA) struct rk3399_clk_plat *plat = dev_get_platdata(dev); - priv->cru = map_sysmem(plat->dtd.reg[1], plat->dtd.reg[3]); + priv->cru = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[0]); #endif rkclk_init(priv->cru); #endif @@ -1145,7 +1145,7 @@ static int rk3399_pmuclk_probe(struct udevice *dev) #if CONFIG_IS_ENABLED(OF_PLATDATA) struct rk3399_pmuclk_plat *plat = dev_get_platdata(dev); - priv->pmucru = map_sysmem(plat->dtd.reg[1], plat->dtd.reg[3]); + priv->pmucru = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]); #endif #ifndef CONFIG_SPL_BUILD diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c index d4e16a27ef..0f1d30820c 100644 --- a/drivers/core/regmap.c +++ b/drivers/core/regmap.c @@ -40,7 +40,7 @@ static struct regmap *regmap_alloc_count(int count) } #if CONFIG_IS_ENABLED(OF_PLATDATA) -int regmap_init_mem_platdata(struct udevice *dev, u32 *reg, int count, +int regmap_init_mem_platdata(struct udevice *dev, fdt_val_t *reg, int count, struct regmap **mapp) { struct regmap_range *range; diff --git a/include/fdtdec.h b/include/fdtdec.h index 4a0947c626..1ba02be8e1 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -27,10 +27,12 @@ typedef phys_size_t fdt_size_t; #define FDT_ADDR_T_NONE (-1ULL) #define fdt_addr_to_cpu(reg) be64_to_cpu(reg) #define fdt_size_to_cpu(reg) be64_to_cpu(reg) +typedef fdt64_t fdt_val_t; #else #define FDT_ADDR_T_NONE (-1U) #define fdt_addr_to_cpu(reg) be32_to_cpu(reg) #define fdt_size_to_cpu(reg) be32_to_cpu(reg) +typedef fdt32_t fdt_val_t; #endif /* Information obtained about memory from the FDT */ diff --git a/include/regmap.h b/include/regmap.h index 1eed94e47a..493a5d8eff 100644 --- a/include/regmap.h +++ b/include/regmap.h @@ -69,7 +69,7 @@ int regmap_init_mem(struct udevice *dev, struct regmap **mapp); * @count: Number of pairs (e.g. 1 if the regmap has a single entry) * @mapp: Returns allocated map */ -int regmap_init_mem_platdata(struct udevice *dev, u32 *reg, int count, +int regmap_init_mem_platdata(struct udevice *dev, fdt_val_t *reg, int count, struct regmap **mapp); /** diff --git a/include/syscon.h b/include/syscon.h index 34842aa470..5d52b1cc3c 100644 --- a/include/syscon.h +++ b/include/syscon.h @@ -8,6 +8,8 @@ #ifndef __SYSCON_H #define __SYSCON_H +#include + /** * struct syscon_uc_info - Information stored by the syscon UCLASS_UCLASS * @@ -28,9 +30,11 @@ struct syscon_ops { * We don't support 64-bit machines. If they are so resource-contrained that * they need to use OF_PLATDATA, something is horribly wrong with the * education of our hardware engineers. + * + * Update: 64-bit is now supported and we have an education crisis. */ struct syscon_base_platdata { - u32 reg[2]; + fdt_val_t reg[2]; }; #endif diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 3243bccfe8..0c719310b1 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -242,6 +242,66 @@ class DtbPlatdata(object): self._valid_nodes = [] return self.scan_node(self._fdt.GetRoot()) + @staticmethod + def get_num_cells(node): + """Get the number of cells in addresses and sizes for this node + + Args: + node: Node to check + + Returns: + Tuple: + Number of address cells for this node + Number of size cells for this node + """ + parent = node.parent + na, ns = 2, 2 + if parent: + na_prop = parent.props.get('#address-cells') + ns_prop = parent.props.get('#size-cells') + if na_prop: + na = fdt_util.fdt32_to_cpu(na_prop.value) + if ns_prop: + ns = fdt_util.fdt32_to_cpu(ns_prop.value) + return na, ns + + def scan_reg_sizes(self): + """Scan for 64-bit 'reg' properties and update the values + + This finds 'reg' properties with 64-bit data and converts the value to + an array of 64-values. This allows it to be output in a way that the + C code can read. + """ + for node in self._valid_nodes: + reg = node.props.get('reg') + if not reg: + continue + na, ns = self.get_num_cells(node) + total = na + ns + + if reg.type != fdt.TYPE_INT: + raise ValueError("Node '%s' reg property is not an int") + if len(reg.value) % total: + raise ValueError("Node '%s' reg property has %d cells " + 'which is not a multiple of na + ns = %d + %d)' % + (node.name, len(reg.value), na, ns)) + reg.na = na + reg.ns = ns + if na != 1 or ns != 1: + reg.type = fdt.TYPE_INT64 + i = 0 + new_value = [] + val = reg.value + if not isinstance(val, list): + val = [val] + while i < len(val): + addr = fdt_util.fdt_cells_to_cpu(val[i:], reg.na) + i += na + size = fdt_util.fdt_cells_to_cpu(val[i:], reg.ns) + i += ns + new_value += [addr, size] + reg.value = new_value + def scan_structs(self): """Scan the device tree building up the C structures we will use. @@ -450,6 +510,7 @@ def run_steps(args, dtb_file, include_disabled, output): plat = DtbPlatdata(dtb_file, include_disabled) plat.scan_dtb() plat.scan_tree() + plat.scan_reg_sizes() plat.setup_output(output) structs = plat.scan_structs() plat.scan_phandles() diff --git a/tools/dtoc/dtoc_test_addr32.dts b/tools/dtoc/dtoc_test_addr32.dts new file mode 100644 index 0000000000..bcfdcae10b --- /dev/null +++ b/tools/dtoc/dtoc_test_addr32.dts @@ -0,0 +1,27 @@ +/* + * Test device tree file for dtoc + * + * Copyright 2017 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + + /dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + test1 { + u-boot,dm-pre-reloc; + compatible = "test1"; + reg = <0x1234 0x5678>; + }; + + test2 { + u-boot,dm-pre-reloc; + compatible = "test2"; + reg = <0x12345678 0x98765432 2 3>; + }; + +}; diff --git a/tools/dtoc/dtoc_test_addr32_64.dts b/tools/dtoc/dtoc_test_addr32_64.dts new file mode 100644 index 0000000000..1c96243310 --- /dev/null +++ b/tools/dtoc/dtoc_test_addr32_64.dts @@ -0,0 +1,33 @@ +/* + * Test device tree file for dtoc + * + * Copyright 2017 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + + /dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <2>; + + test1 { + u-boot,dm-pre-reloc; + compatible = "test1"; + reg = <0x1234 0x5678 0x0>; + }; + + test2 { + u-boot,dm-pre-reloc; + compatible = "test2"; + reg = <0x12345678 0x98765432 0x10987654>; + }; + + test3 { + u-boot,dm-pre-reloc; + compatible = "test3"; + reg = <0x12345678 0x98765432 0x10987654 2 0 3>; + }; + +}; diff --git a/tools/dtoc/dtoc_test_addr64.dts b/tools/dtoc/dtoc_test_addr64.dts new file mode 100644 index 0000000000..4c0ad0ec36 --- /dev/null +++ b/tools/dtoc/dtoc_test_addr64.dts @@ -0,0 +1,33 @@ +/* + * Test device tree file for dtoc + * + * Copyright 2017 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + + /dts-v1/; + +/ { + #address-cells = <2>; + #size-cells = <2>; + + test1 { + u-boot,dm-pre-reloc; + compatible = "test1"; + reg = /bits/ 64 <0x1234 0x5678>; + }; + + test2 { + u-boot,dm-pre-reloc; + compatible = "test2"; + reg = /bits/ 64 <0x1234567890123456 0x9876543210987654>; + }; + + test3 { + u-boot,dm-pre-reloc; + compatible = "test3"; + reg = /bits/ 64 <0x1234567890123456 0x9876543210987654 2 3>; + }; + +}; diff --git a/tools/dtoc/dtoc_test_addr64_32.dts b/tools/dtoc/dtoc_test_addr64_32.dts new file mode 100644 index 0000000000..c36f6b726e --- /dev/null +++ b/tools/dtoc/dtoc_test_addr64_32.dts @@ -0,0 +1,33 @@ +/* + * Test device tree file for dtoc + * + * Copyright 2017 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + + /dts-v1/; + +/ { + #address-cells = <2>; + #size-cells = <1>; + + test1 { + u-boot,dm-pre-reloc; + compatible = "test1"; + reg = <0x1234 0x0 0x5678>; + }; + + test2 { + u-boot,dm-pre-reloc; + compatible = "test2"; + reg = <0x12345678 0x90123456 0x98765432>; + }; + + test3 { + u-boot,dm-pre-reloc; + compatible = "test3"; + reg = <0x12345678 0x90123456 0x98765432 0 2 3>; + }; + +}; diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py index bec6ee947a..338d47a5e1 100644 --- a/tools/dtoc/fdt_util.py +++ b/tools/dtoc/fdt_util.py @@ -38,6 +38,8 @@ def fdt_cells_to_cpu(val, cells): Return: A native-endian long value """ + if not cells: + return 0 out = long(fdt32_to_cpu(val[0])) if cells == 2: out = out << 32 | fdt32_to_cpu(val[1]) diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 5040f23325..09cfddaaaa 100644 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -270,4 +270,216 @@ U_BOOT_DEVICE(spl_test) = { \t.platdata_size\t= sizeof(dtv_spl_test), }; +''', data) + + def test_addresses64(self): + """Test output from a node with a 'reg' property with na=2, ns=2""" + dtb_file = get_dtb_file('dtoc_test_addr64.dts') + output = tools.GetOutputFilename('output') + dtb_platdata.run_steps(['struct'], dtb_file, False, output) + with open(output) as infile: + data = infile.read() + self.assertEqual('''#include +#include +struct dtd_test1 { +\tfdt64_t\t\treg[2]; +}; +struct dtd_test2 { +\tfdt64_t\t\treg[2]; +}; +struct dtd_test3 { +\tfdt64_t\t\treg[4]; +}; +''', data) + + dtb_platdata.run_steps(['platdata'], dtb_file, False, output) + with open(output) as infile: + data = infile.read() + self.assertEqual('''#include +#include +#include + +static struct dtd_test1 dtv_test1 = { +\t.reg\t\t\t= {0x1234, 0x5678}, +}; +U_BOOT_DEVICE(test1) = { +\t.name\t\t= "test1", +\t.platdata\t= &dtv_test1, +\t.platdata_size\t= sizeof(dtv_test1), +}; + +static struct dtd_test2 dtv_test2 = { +\t.reg\t\t\t= {0x1234567890123456, 0x9876543210987654}, +}; +U_BOOT_DEVICE(test2) = { +\t.name\t\t= "test2", +\t.platdata\t= &dtv_test2, +\t.platdata_size\t= sizeof(dtv_test2), +}; + +static struct dtd_test3 dtv_test3 = { +\t.reg\t\t\t= {0x1234567890123456, 0x9876543210987654, 0x2, 0x3}, +}; +U_BOOT_DEVICE(test3) = { +\t.name\t\t= "test3", +\t.platdata\t= &dtv_test3, +\t.platdata_size\t= sizeof(dtv_test3), +}; + +''', data) + + def test_addresses32(self): + """Test output from a node with a 'reg' property with na=1, ns=1""" + dtb_file = get_dtb_file('dtoc_test_addr32.dts') + output = tools.GetOutputFilename('output') + dtb_platdata.run_steps(['struct'], dtb_file, False, output) + with open(output) as infile: + data = infile.read() + self.assertEqual('''#include +#include +struct dtd_test1 { +\tfdt32_t\t\treg[2]; +}; +struct dtd_test2 { +\tfdt32_t\t\treg[4]; +}; +''', data) + + dtb_platdata.run_steps(['platdata'], dtb_file, False, output) + with open(output) as infile: + data = infile.read() + self.assertEqual('''#include +#include +#include + +static struct dtd_test1 dtv_test1 = { +\t.reg\t\t\t= {0x1234, 0x5678}, +}; +U_BOOT_DEVICE(test1) = { +\t.name\t\t= "test1", +\t.platdata\t= &dtv_test1, +\t.platdata_size\t= sizeof(dtv_test1), +}; + +static struct dtd_test2 dtv_test2 = { +\t.reg\t\t\t= {0x12345678, 0x98765432, 0x2, 0x3}, +}; +U_BOOT_DEVICE(test2) = { +\t.name\t\t= "test2", +\t.platdata\t= &dtv_test2, +\t.platdata_size\t= sizeof(dtv_test2), +}; + +''', data) + + def test_addresses64_32(self): + """Test output from a node with a 'reg' property with na=2, ns=1""" + dtb_file = get_dtb_file('dtoc_test_addr64_32.dts') + output = tools.GetOutputFilename('output') + dtb_platdata.run_steps(['struct'], dtb_file, False, output) + with open(output) as infile: + data = infile.read() + self.assertEqual('''#include +#include +struct dtd_test1 { +\tfdt64_t\t\treg[2]; +}; +struct dtd_test2 { +\tfdt64_t\t\treg[2]; +}; +struct dtd_test3 { +\tfdt64_t\t\treg[4]; +}; +''', data) + + dtb_platdata.run_steps(['platdata'], dtb_file, False, output) + with open(output) as infile: + data = infile.read() + self.assertEqual('''#include +#include +#include + +static struct dtd_test1 dtv_test1 = { +\t.reg\t\t\t= {0x123400000000, 0x5678}, +}; +U_BOOT_DEVICE(test1) = { +\t.name\t\t= "test1", +\t.platdata\t= &dtv_test1, +\t.platdata_size\t= sizeof(dtv_test1), +}; + +static struct dtd_test2 dtv_test2 = { +\t.reg\t\t\t= {0x1234567890123456, 0x98765432}, +}; +U_BOOT_DEVICE(test2) = { +\t.name\t\t= "test2", +\t.platdata\t= &dtv_test2, +\t.platdata_size\t= sizeof(dtv_test2), +}; + +static struct dtd_test3 dtv_test3 = { +\t.reg\t\t\t= {0x1234567890123456, 0x98765432, 0x2, 0x3}, +}; +U_BOOT_DEVICE(test3) = { +\t.name\t\t= "test3", +\t.platdata\t= &dtv_test3, +\t.platdata_size\t= sizeof(dtv_test3), +}; + +''', data) + + def test_addresses32_64(self): + """Test output from a node with a 'reg' property with na=1, ns=2""" + dtb_file = get_dtb_file('dtoc_test_addr32_64.dts') + output = tools.GetOutputFilename('output') + dtb_platdata.run_steps(['struct'], dtb_file, False, output) + with open(output) as infile: + data = infile.read() + self.assertEqual('''#include +#include +struct dtd_test1 { +\tfdt64_t\t\treg[2]; +}; +struct dtd_test2 { +\tfdt64_t\t\treg[2]; +}; +struct dtd_test3 { +\tfdt64_t\t\treg[4]; +}; +''', data) + + dtb_platdata.run_steps(['platdata'], dtb_file, False, output) + with open(output) as infile: + data = infile.read() + self.assertEqual('''#include +#include +#include + +static struct dtd_test1 dtv_test1 = { +\t.reg\t\t\t= {0x1234, 0x567800000000}, +}; +U_BOOT_DEVICE(test1) = { +\t.name\t\t= "test1", +\t.platdata\t= &dtv_test1, +\t.platdata_size\t= sizeof(dtv_test1), +}; + +static struct dtd_test2 dtv_test2 = { +\t.reg\t\t\t= {0x12345678, 0x9876543210987654}, +}; +U_BOOT_DEVICE(test2) = { +\t.name\t\t= "test2", +\t.platdata\t= &dtv_test2, +\t.platdata_size\t= sizeof(dtv_test2), +}; + +static struct dtd_test3 dtv_test3 = { +\t.reg\t\t\t= {0x12345678, 0x9876543210987654, 0x2, 0x3}, +}; +U_BOOT_DEVICE(test3) = { +\t.name\t\t= "test3", +\t.platdata\t= &dtv_test3, +\t.platdata_size\t= sizeof(dtv_test3), +}; + ''', data) From patchwork Tue Aug 29 20:15:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807272 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="eff51R3N"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhg4D73k5z9sR9 for ; Wed, 30 Aug 2017 06:20:28 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9E7E7C22600; Tue, 29 Aug 2017 20:18:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 7FD80C225BF; Tue, 29 Aug 2017 20:16:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CD8E1C21E1E; Tue, 29 Aug 2017 20:16:19 +0000 (UTC) Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by lists.denx.de (Postfix) with ESMTPS id 2FDB3C225DE for ; Tue, 29 Aug 2017 20:16:16 +0000 (UTC) Received: by mail-oi0-f52.google.com with SMTP id k77so36400447oib.2 for ; Tue, 29 Aug 2017 13:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=K99ItINdMceuF4qW6y9gaE+eVHt+beRCPpQGhqL+6fQ=; b=eff51R3Nhe66d4HgS9i/vBhIs7vtcAXh6Ne/KVuuAwy3fkCZj4re/tvwynKJN5MrDE MxrzWbngPh0DxlLFbsq/gHZdoSbcwgA04QD94SR8XdaVJjMav+HNROqaUiKYFObKK17s neST8eE1l9TRw1mmEsVegdGd4iNIR6RPlSfj6xpIfEihHWFdFMd2snaU0XQ1wqloNCML InoJuEBQ6z4Y81IMz9ycGVHSQjxG2JbCp0D+6K+As/cV5Y+MhpIvQeM3/oxoYh/SMKuk 60NoxPgQXTmMTgBOHG2b90AlnMVEGebBwPRqaTf+qDxy9bG55MbAS+7oWLda+fY751AB FFwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=K99ItINdMceuF4qW6y9gaE+eVHt+beRCPpQGhqL+6fQ=; b=DVbuGcydyAeMlASP7eoxRZTPtl/fDIEgAq7J4lPhXdnsA6KqIDK6Aj5wqFWIwdjEzS rS39IgIVxzNnW7dfUfJUd2cZaoPVJfMfmtKorTLCI2f10hmE7aNiMPeSAcaGv+gMFUFW kzxQmeTSbuMrOUsiUU+iPo2Zx+aZywIMGNjDVZToZFRqm3mabNgs6gq9FvcgNOir38M3 Px5DoYZ8HljAKiQAKjLhr74FBBYpYn84kkvpVKueadZSs0S7HjQzHlL3Jrl8lymX7QWG 4R6HecB5V5gV6ibw/eCnWRZ53m3YzXGGnAHdAWrZYvk3KhvFdhKclYLL6grPyLhj0NGh oWTw== X-Gm-Message-State: AHYfb5jQS3aiundIfv7wOI+ZpmixY8JT4FJJBpnq6wgtVAOkzSDkXKav CGGD2dXNbHOjltIg X-Google-Smtp-Source: ADKCNb7zbHN+/OVp6578nxOCT1lsOvtUBgb/MYT7P0RCwJ1PgkgHS8IWY8Z7IEdsPju46cI/FiKjJg== X-Received: by 10.202.79.205 with SMTP id d196mr1393778oib.18.1504037774654; Tue, 29 Aug 2017 13:16:14 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id a190sm3829121oib.38.2017.08.29.13.16.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:13 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id F3D4813FAB7; Tue, 29 Aug 2017 14:16:12 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:51 -0600 Message-Id: <20170829201601.64312-7-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 06/16] dtoc: Handle 'reg' properties with unusual sizes X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" At present dtoc assumes that all 'reg' properties have both an address and a size. For I2C devices we do not have this. Adjust dtoc to cope. Reported-by: Philipp Tomsich Signed-off-by: Simon Glass Reported-by: Philipp Tomsich Signed-off-by: Simon Glass --- Changes in v2: None tools/dtoc/dtoc_test_simple.dts | 14 ++++++++++++++ tools/dtoc/test_dtoc.py | 24 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/tools/dtoc/dtoc_test_simple.dts b/tools/dtoc/dtoc_test_simple.dts index c736686263..6afe674b1f 100644 --- a/tools/dtoc/dtoc_test_simple.dts +++ b/tools/dtoc/dtoc_test_simple.dts @@ -9,6 +9,8 @@ /dts-v1/; / { + #address-cells = <1>; + #size-cells = <1>; spl-test { u-boot,dm-pre-reloc; compatible = "sandbox,spl-test"; @@ -45,4 +47,16 @@ compatible = "sandbox,spl-test.2"; }; + i2c@0 { + compatible = "sandbox,i2c-test"; + u-boot,dm-pre-reloc; + #address-cells = <1>; + #size-cells = <0>; + pmic@9 { + compatible = "sandbox,pmic-test"; + u-boot,dm-pre-reloc; + reg = <9>; + low-power; + }; + }; }; diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 09cfddaaaa..62460acb7c 100644 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -121,6 +121,12 @@ class TestDtoc(unittest.TestCase): data = infile.read() self.assertEqual('''#include #include +struct dtd_sandbox_i2c_test { +}; +struct dtd_sandbox_pmic_test { +\tbool\t\tlow_power; +\tfdt64_t\t\treg[2]; +}; struct dtd_sandbox_spl_test { \tbool\t\tboolval; \tunsigned char\tbytearray[3]; @@ -192,6 +198,24 @@ U_BOOT_DEVICE(spl_test4) = { \t.platdata_size\t= sizeof(dtv_spl_test4), }; +static struct dtd_sandbox_i2c_test dtv_i2c_at_0 = { +}; +U_BOOT_DEVICE(i2c_at_0) = { +\t.name\t\t= "sandbox_i2c_test", +\t.platdata\t= &dtv_i2c_at_0, +\t.platdata_size\t= sizeof(dtv_i2c_at_0), +}; + +static struct dtd_sandbox_pmic_test dtv_pmic_at_9 = { +\t.low_power\t\t= true, +\t.reg\t\t\t= {0x9, 0x0}, +}; +U_BOOT_DEVICE(pmic_at_9) = { +\t.name\t\t= "sandbox_pmic_test", +\t.platdata\t= &dtv_pmic_at_9, +\t.platdata_size\t= sizeof(dtv_pmic_at_9), +}; + ''', data) def test_phandle(self): From patchwork Tue Aug 29 20:15:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807273 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="WIUq/3wL"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhg5r2kVLz9sD9 for ; Wed, 30 Aug 2017 06:21:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 06D66C22569; Tue, 29 Aug 2017 20:19:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B2295C22664; Tue, 29 Aug 2017 20:16:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 14F6AC22643; Tue, 29 Aug 2017 20:16:21 +0000 (UTC) Received: from mail-oi0-f48.google.com (mail-oi0-f48.google.com [209.85.218.48]) by lists.denx.de (Postfix) with ESMTPS id F3581C225C6 for ; Tue, 29 Aug 2017 20:16:17 +0000 (UTC) Received: by mail-oi0-f48.google.com with SMTP id r203so36447395oih.0 for ; Tue, 29 Aug 2017 13:16:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=S9njrX30Cv26sVygdaT8wG4WkVFfpLiMAS8Dp7kdpME=; b=WIUq/3wLOuH6VZ/jf59eyBOhY3bxe97YTcQ3VOLR2R/EmSGYxiAjmYg1HSvnMSipYb 3HYcvu+xoT0LsvAy0cIW3A1EqHJxm9q75BzEMZr82YjddpkVv6g8YQtbRf9QclW8P54w RBhY7+uhGTur7DwQweVZoycpsaXDLbcHOgOtiNCSSzrlLN45NHbj4RJdKTnqYmQDlDGv 9JERS+MfJRmbNCSuhtBY7p3PmjC6jREQQdsyd0RmNlPJv9lvtZhZQ17arHqLoygMpYJ7 9G4EVixH5u1HdcGo5+NKr5Yc7sip/ldmBUXrk5HBBbjIR1SftE3U2bXloZtWcE2d6Uut cIEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=S9njrX30Cv26sVygdaT8wG4WkVFfpLiMAS8Dp7kdpME=; b=gvOt3lQI/RZ+YPfWu/8W+NUuGgnpF9zbIp7tyztoYCgkRNKwK9cnsVJUOIwsZ8RI2A 5WMphQ8RF2WoHpyzixF4HPwCiUOZu2nt6UpXZmbIqNk+o0/9fzrAb+R4S5zCIz1fyR2z r2Zquz6efYdGDUYnuxRMmjSLLLxB50Mkf5+ci8jdGv01Y6CAvVx3zEBJopQ3Adchg8WD RwyLWfAHnz7SKNo8AdBuOi/l0gEgvIkPu+JCm9lpk3T9zo+g5Aae7Xvcen0jSg2SvEmS UlHLngGep9u22iWvgoYJ6oM11h3s5bjca94A/FNk53Bk90YgybzJEdJA89m3WC8JGhft ORCA== X-Gm-Message-State: AHYfb5if1bOwzrt3eVR/GEInxE12jaaTFTFb/Gdegv9hgPSUzCYcKTZA 29Oz5DCnm8sMIckxkJAJeg== X-Google-Smtp-Source: ADKCNb6z28g0O/OQO/pQ2A0TdSv74HRZuMGpbTFf3Hfu0r1eaBWCnMpjhjfm5WcT9aDpQlTOlrlyUg== X-Received: by 10.202.229.198 with SMTP id c189mr1314960oih.5.1504037776491; Tue, 29 Aug 2017 13:16:16 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id a190sm3829160oib.38.2017.08.29.13.16.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:15 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 0A89413FC5F; Tue, 29 Aug 2017 14:16:14 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:52 -0600 Message-Id: <20170829201601.64312-8-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 07/16] dtoc: Update the Fdt class to record phandles X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add a map from phandles to nodes. This can be used by clients of the the class instead of maintaining this themselves. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None tools/dtoc/fdt.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index ffd42ce541..dbc338653b 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -212,6 +212,10 @@ class Node: searching into subnodes so that the entire tree is built. """ self.props = self._fdt.GetProps(self) + phandle = self.props.get('phandle') + if phandle: + val = fdt_util.fdt32_to_cpu(phandle.value) + self._fdt.phandle_to_node[val] = self offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self.Offset()) while offset >= 0: @@ -263,6 +267,7 @@ class Fdt: def __init__(self, fname): self._fname = fname self._cached_offsets = False + self.phandle_to_node = {} if self._fname: self._fname = fdt_util.EnsureCompiled(self._fname) From patchwork Tue Aug 29 20:15:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807281 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="BmPa6x0Z"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhgCf4g2gz9sQl for ; Wed, 30 Aug 2017 06:26:54 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 610FEC22345; Tue, 29 Aug 2017 20:24:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0D0F5C22670; Tue, 29 Aug 2017 20:18:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1C385C2266A; Tue, 29 Aug 2017 20:16:22 +0000 (UTC) Received: from mail-oi0-f44.google.com (mail-oi0-f44.google.com [209.85.218.44]) by lists.denx.de (Postfix) with ESMTPS id DBC3FC225CA for ; Tue, 29 Aug 2017 20:16:18 +0000 (UTC) Received: by mail-oi0-f44.google.com with SMTP id r203so36447696oih.0 for ; Tue, 29 Aug 2017 13:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=9PBlIwbZW+Prc5/Mqx6QaTRerlUoEeSwM8TxV02K3ek=; b=BmPa6x0ZtvP5RqASMStgmv09fdJILmjPYvVU4BsqA7vVVdI90RI5BUnJTaQWVxSwzM u15dqsS9hmAvSjw/O7UIzK/aXRrMHsIgDjgPBTExtddk0kXCT+IFSGJJx96ZXLdFgXyj ki0blj0Mod7aLIQlX3bSSdcxQ1deLCahJz7YRfGJQooxi3Xabtm7G5z6XZ7bE2B5Qhhg I6TRkYiO+yG/z8gfaxDM500hUjxiF52tukD8oVCtw1A1ro/SAG7+8MQIA1juAuZ89SJ2 puIj+JejQPhq+i6QpVtU6+DkSu5kQXb0q4d7rQRHCQ21bqRKEF/FfZSWxh9ld1F1VlMd cjfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=9PBlIwbZW+Prc5/Mqx6QaTRerlUoEeSwM8TxV02K3ek=; b=DMkDaXMUvbno/fkzxouiQHGWwuLK1KQimnsbmUqon4m6C5MfjTLNW6FQ+gSsecu0Og hicZ7SjL4Mp0Gibh4sBtA62aoMVCqQoPyVn0mfkaLSoDda0lBnfbYsaC2jqzvkdi9zee ligloTG0pKqqFDcz9KRVLcUj2uy49uEhrvv5gXs3gjKzSpZIq+Uc931iP9FSpJti7TSH 7ABW/gRDejr49AuS3oQCJGgX01+tU6ka07ZNsMCxv7ToEV0LL03zZ/00Nv9GRs79Xxzf albVIkwRthF1cpy4qXJUoLFxbdrJPL/rEsRcc85DjnjyetQUlKPEOHFVgM3E4iNJi1ym M43g== X-Gm-Message-State: AHYfb5hK2E2mzdO32ltU5h16m8CHTtI2QrXuAvjIP6sMmcsgGXJjVRv8 vAa7bnuelAOVi4EiwVGCGQ== X-Google-Smtp-Source: ADKCNb5AqDZfeuqJoqIgI7jVYSMlwOm7PJNDibT64WwLqxponsSoxsiJ5OtpPgdlQF4SYpMRaQnpDA== X-Received: by 10.202.181.195 with SMTP id e186mr1294940oif.280.1504037777199; Tue, 29 Aug 2017 13:16:17 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id h125sm4017700oic.54.2017.08.29.13.16.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:15 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 16B5B13FAB7; Tue, 29 Aug 2017 14:16:15 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:53 -0600 Message-Id: <20170829201601.64312-9-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 08/16] dtoc: Use the Fdt's class's phandle map X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Now that the Fdt class can map phandles to the associated nodes, use that instead of a separate implementation. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None tools/dtoc/dtb_platdata.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 0c719310b1..705ab27c86 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -144,17 +144,14 @@ class DtbPlatdata(object): _dtb_fname: Filename of the input device tree binary file _valid_nodes: A list of Node object with compatible strings _include_disabled: true to include nodes marked status = "disabled" - _phandle_nodes: A dict of nodes indexed by phandle number (1, 2...) _outfile: The current output file (sys.stdout or a real file) _lines: Stashed list of output lines for outputting in the future - _phandle_nodes: A dict of Nodes indexed by phandle (an integer) """ def __init__(self, dtb_fname, include_disabled): self._fdt = None self._dtb_fname = dtb_fname self._valid_nodes = None self._include_disabled = include_disabled - self._phandle_nodes = {} self._outfile = None self._lines = [] self._aliases = {} @@ -210,8 +207,7 @@ class DtbPlatdata(object): def scan_node(self, root): """Scan a node and subnodes to build a tree of node and phandle info - This adds each node to self._valid_nodes and each phandle to - self._phandle_nodes. + This adds each node to self._valid_nodes. Args: root: Root node for scan @@ -222,10 +218,6 @@ class DtbPlatdata(object): if (not self._include_disabled and not status or status.value != 'disabled'): self._valid_nodes.append(node) - phandle_prop = node.props.get('phandle') - if phandle_prop: - phandle = phandle_prop.GetPhandle() - self._phandle_nodes[phandle] = node # recurse to handle any subnodes self.scan_node(node) @@ -234,11 +226,9 @@ class DtbPlatdata(object): """Scan the device tree for useful information This fills in the following properties: - _phandle_nodes: A dict of Nodes indexed by phandle (an integer) _valid_nodes: A list of nodes we wish to consider include in the platform data """ - self._phandle_nodes = {} self._valid_nodes = [] return self.scan_node(self._fdt.GetRoot()) @@ -374,7 +364,7 @@ class DtbPlatdata(object): value_it = iter(prop.value) for phandle_cell, _ in zip(value_it, value_it): phandle = fdt_util.fdt32_to_cpu(phandle_cell) - target_node = self._phandle_nodes[phandle] + target_node = self._fdt.phandle_to_node[phandle] node.phandles.add(target_node) @@ -439,7 +429,7 @@ class DtbPlatdata(object): for phandle_cell, id_cell in zip(value_it, value_it): phandle = fdt_util.fdt32_to_cpu(phandle_cell) id_num = fdt_util.fdt32_to_cpu(id_cell) - target_node = self._phandle_nodes[phandle] + target_node = self._fdt.phandle_to_node[phandle] name = conv_name_to_c(target_node.name) vals.append('{&%s%s, %d}' % (VAL_PREFIX, name, id_num)) else: From patchwork Tue Aug 29 20:15:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807280 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="mBwvdH4c"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhg8w11Rsz9sQl for ; Wed, 30 Aug 2017 06:24:32 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D75C8C222A0; Tue, 29 Aug 2017 20:20:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1DD32C22653; Tue, 29 Aug 2017 20:17:18 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C2EB9C222E9; Tue, 29 Aug 2017 20:16:23 +0000 (UTC) Received: from mail-oi0-f49.google.com (mail-oi0-f49.google.com [209.85.218.49]) by lists.denx.de (Postfix) with ESMTPS id 88A98C22104 for ; Tue, 29 Aug 2017 20:16:19 +0000 (UTC) Received: by mail-oi0-f49.google.com with SMTP id k77so36401461oib.2 for ; Tue, 29 Aug 2017 13:16:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=93nQjTmqXBvOvuS8bMJRb9U1TSheLGB/k4oqTXNgzbY=; b=mBwvdH4cY0EFW9YZLX14h4Kk7F7wU4lgeK49uQ4P1ZqQBjbaPXtEpoIQhRjJlZySBR xfMLl95szWQSpG1qjxA5Crx4RXkO03Xls9tyk9KBGKda9YZjaAGFDz6M3fzLB3F1Gt3R O8RNkGV6LkRfh/mt2nqFikpjwYTtc9Kdop9UjYn5/CDQfaudaPRWok8cdhDpyzWPJc7t M8P/BowQeugcU5+hTtdONJzWME+ni655GH0GtpzbRwBihkia0wXTfyK4/x7tti6XuySr 6CwsyVsM9ZVZjN0Ep8NHz2FfkxVOVOktutxIeLIAVS0AhLUW8IpjPoXpYWRWg6B4nCDE fZhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=93nQjTmqXBvOvuS8bMJRb9U1TSheLGB/k4oqTXNgzbY=; b=jG6gyXnQrrL42eKMZ8LmTy6PKzuGYjwqDxKkzqt9Nufl/WuwGxgnqx5jRWtUdZcurH mj+rU5aot6P/GhD9aTXwHj/GY9Wm4Yagcu48NQPeOkp03OoxI2sTIlfHGrPq47xAfPiC wBKPVnvDYg3MwH5iMDMbYPmJXJbIBRlwYAEjLvADi4IPqlw81OuKbiqyefklXiUmF3WU b74WMeXY2s1PGO/TLuDCqUBWs9ofI1VtWY4/+xOzu4yAeh1ecnDCL3sa9blmDZ3m0K9u FWfgS5MhF3novq84ghqbt6YPwNiiJc3qby200hYK5/J65ZcGjKIMdQn80FKAEWKz4osa T9fg== X-Gm-Message-State: AHYfb5hFsbD4acmo9AR6QFmyJANSb39wA8E0H/isqLaqvJJcaE7p3UUL 8KeiwFH0S7iWiSLPagJn1w== X-Google-Smtp-Source: ADKCNb5VmUabEhvO9sMh+I9Y9zyHK0Z/ImVfKwcy0iHrGGDsH25/jPhO6ZgUalo7L/Q0tFMApsPxcw== X-Received: by 10.202.173.21 with SMTP id w21mr1394026oie.106.1504037777984; Tue, 29 Aug 2017 13:16:17 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id o7sm3249013oia.44.2017.08.29.13.16.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:17 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 16CE313FCAB; Tue, 29 Aug 2017 14:16:16 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:54 -0600 Message-Id: <20170829201601.64312-10-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 09/16] dtoc: Make is_phandle() a member function X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This function will need to have access to class members once we enhance it to support multiple phandle values. In preparation for that, move it into the class. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None tools/dtoc/dtb_platdata.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 705ab27c86..a483d6c875 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -116,21 +116,6 @@ def get_compat_name(node): compat, aliases = compat[0], compat[1:] return conv_name_to_c(compat), [conv_name_to_c(a) for a in aliases] -def is_phandle(prop): - """Check if a node contains phandles - - We have no reliable way of detecting whether a node uses a phandle - or not. As an interim measure, use a list of known property names. - - Args: - prop: Prop object to check - Return: - True if the object value contains phandles, else False - """ - if prop.name in ['clocks']: - return True - return False - class DtbPlatdata(object): """Provide a means to convert device tree binary data to platform data @@ -196,6 +181,21 @@ class DtbPlatdata(object): self._lines = [] return lines + def is_phandle(self, prop): + """Check if a node contains phandles + + We have no reliable way of detecting whether a node uses a phandle + or not. As an interim measure, use a list of known property names. + + Args: + prop: Prop object to check + Return: + True if the object value contains phandles, else False + """ + if prop.name in ['clocks']: + return True + return False + def scan_dtb(self): """Scan the device tree to obtain a tree of nodes and properties @@ -359,7 +359,7 @@ class DtbPlatdata(object): if pname in PROP_IGNORE_LIST or pname[0] == '#': continue if isinstance(prop.value, list): - if is_phandle(prop): + if self.is_phandle(prop): # Process the list as pairs of (phandle, id) value_it = iter(prop.value) for phandle_cell, _ in zip(value_it, value_it): @@ -383,7 +383,7 @@ class DtbPlatdata(object): self.out('struct %s%s {\n' % (STRUCT_PREFIX, name)) for pname in sorted(structs[name]): prop = structs[name][pname] - if is_phandle(prop): + if self.is_phandle(prop): # For phandles, include a reference to the target self.out('\t%s%s[%d]' % (tab_to(2, 'struct phandle_2_cell'), conv_name_to_c(prop.name), @@ -423,7 +423,7 @@ class DtbPlatdata(object): vals = [] # For phandles, output a reference to the platform data # of the target node. - if is_phandle(prop): + if self.is_phandle(prop): # Process the list as pairs of (phandle, id) value_it = iter(prop.value) for phandle_cell, id_cell in zip(value_it, value_it): From patchwork Tue Aug 29 20:15:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807286 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="D14kquHC"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhgHG5s2Cz9sQl for ; Wed, 30 Aug 2017 06:30:02 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 740ADC2254B; Tue, 29 Aug 2017 20:23:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2E6AEC2268A; Tue, 29 Aug 2017 20:18:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5C486C22656; Tue, 29 Aug 2017 20:16:26 +0000 (UTC) Received: from mail-oi0-f47.google.com (mail-oi0-f47.google.com [209.85.218.47]) by lists.denx.de (Postfix) with ESMTPS id 6CD2FC225AB for ; Tue, 29 Aug 2017 20:16:20 +0000 (UTC) Received: by mail-oi0-f47.google.com with SMTP id r203so36448231oih.0 for ; Tue, 29 Aug 2017 13:16:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=dRuJPnj08/Sb98QR3/N2nVJv3A6iAlwg8JQoIy4HUAA=; b=D14kquHCQQs8zMU2bxluV7fnlbyGKH/o8uEmSLDkDwiZ7G+qDBiVFAH168WGQbofQA aDX8zHTE5mBh+yI6ijz+IMqYRxUzt1HzOLOOmAqe9scAeYqg281Kvc5WbZi3BBsoKApS Ouw5ooHei/1XA7b3SuheKqHWELWRYjTOuWwwoN/qJVV69L+Vi/wq8q5A+nFJ78s8wm1J z4M2x7O+geNdIKtUpxlXI/JI0JkwsJjRsRFR24ZvsXp9wy/G0Kc1GXxrT0WzOFYE+76u DH42Pn1SvVe0TZe+mp2RKgRY6KB34g5LQL+fNmJnArQ3bJMdB4xglpKyhrsG8P2QsRAc imXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=dRuJPnj08/Sb98QR3/N2nVJv3A6iAlwg8JQoIy4HUAA=; b=EK8YpFprsbIM/ih7XA3fNGInNxI7rhLcamKHsLLamq4jgLl/grCso17gM89lncjVL2 lmD6+fL0V/OotuJhu9tFibPxZcLa90o2NbxPIT433abt5MRSkQH2m8/3xFhVkTAHdAre tWxJHdNm9fvsAcYml6OhQHtQzmXH7VqjLF8LdUIz4DsXszGAUdTpcpxHcKqXh1anyRUc svOysrZFBZcvkU2SIfZeMc3AJMQxMswPa1kXWSWlWy2wg3V3V+Tk4ilM2V4+ilHaDu13 v1jBWIbEzO+c1Zztdbx6Guo8QhnzGTBmJhHizdy8mYAMyuerG6u3zb5QoHSKhe0MNOER eiXA== X-Gm-Message-State: AHYfb5iGGXp/vvyDZNkLjy/Lwcj3zkFSV/jneVWAkY5A2FlHR/LSzVfs yXoUsm8ELbqqn/uo X-Google-Smtp-Source: ADKCNb41QrsW2Q2x2D3PitVgxFhmJOUJ4+SSJRux+bGGAquKn+p7qRMLn6BYQJK/WYca9F1c11N73g== X-Received: by 10.202.172.66 with SMTP id v63mr1597492oie.87.1504037778878; Tue, 29 Aug 2017 13:16:18 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:0:10f2:0:e46b:9284:3d4c:e46e]) by smtp.gmail.com with ESMTPSA id p128sm3538155oif.33.2017.08.29.13.16.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:18 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 20CE613FC5F; Tue, 29 Aug 2017 14:16:17 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:55 -0600 Message-Id: <20170829201601.64312-11-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 10/16] dtoc: Rename is_phandle() and adjust it to return more detail X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Update this function to return more detail about a property that contains phandles. This will allow (in a future commit) more accurate handling of these properties. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None tools/dtoc/dtb_platdata.py | 79 +++++++++++++++++++++++++++++----------- tools/dtoc/dtoc_test_phandle.dts | 1 + 2 files changed, 58 insertions(+), 22 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index a483d6c875..001bc4ea66 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -12,6 +12,7 @@ This supports converting device tree data to C structures definitions and static data. """ +import collections import copy import sys @@ -44,6 +45,14 @@ TYPE_NAMES = { STRUCT_PREFIX = 'dtd_' VAL_PREFIX = 'dtv_' +# This holds information about a property which includes phandles. +# +# max_args: integer: Maximum number or arguments that any phandle uses (int). +# args: Number of args for each phandle in the property. The total number of +# phandles is len(args). This is a list of integers. +PhandleInfo = collections.namedtuple('PhandleInfo', ['max_args', 'args']) + + def conv_name_to_c(name): """Convert a device-tree name to a C identifier @@ -181,20 +190,42 @@ class DtbPlatdata(object): self._lines = [] return lines - def is_phandle(self, prop): - """Check if a node contains phandles + def get_phandle_argc(self, prop, node_name): + """Check if a node contains phandles - We have no reliable way of detecting whether a node uses a phandle - or not. As an interim measure, use a list of known property names. + We have no reliable way of detecting whether a node uses a phandle + or not. As an interim measure, use a list of known property names. - Args: - prop: Prop object to check - Return: - True if the object value contains phandles, else False - """ - if prop.name in ['clocks']: - return True - return False + Args: + prop: Prop object to check + Return: + Number of argument cells is this is a phandle, else None + """ + if prop.name in ['clocks']: + val = prop.value + if not isinstance(val, list): + val = [val] + i = 0 + + max_args = 0 + args = [] + while i < len(val): + phandle = fdt_util.fdt32_to_cpu(val[i]) + target = self._fdt.phandle_to_node.get(phandle) + if not target: + raise ValueError("Cannot parse '%s' in node '%s'" % + (prop.name, node_name)) + prop_name = '#clock-cells' + cells = target.props.get(prop_name) + if not cells: + raise ValueError("Node '%s' has no '%s' property" % + (target.name, prop_name)) + num_args = fdt_util.fdt32_to_cpu(cells.value) + max_args = max(max_args, num_args) + args.append(num_args) + i += 1 + num_args + return PhandleInfo(max_args, args) + return None def scan_dtb(self): """Scan the device tree to obtain a tree of nodes and properties @@ -358,14 +389,16 @@ class DtbPlatdata(object): for pname, prop in node.props.items(): if pname in PROP_IGNORE_LIST or pname[0] == '#': continue - if isinstance(prop.value, list): - if self.is_phandle(prop): - # Process the list as pairs of (phandle, id) - value_it = iter(prop.value) - for phandle_cell, _ in zip(value_it, value_it): - phandle = fdt_util.fdt32_to_cpu(phandle_cell) - target_node = self._fdt.phandle_to_node[phandle] - node.phandles.add(target_node) + info = self.get_phandle_argc(prop, node.name) + if info: + if not isinstance(prop.value, list): + prop.value = [prop.value] + # Process the list as pairs of (phandle, id) + value_it = iter(prop.value) + for phandle_cell, _ in zip(value_it, value_it): + phandle = fdt_util.fdt32_to_cpu(phandle_cell) + target_node = self._fdt.phandle_to_node[phandle] + node.phandles.add(target_node) def generate_structs(self, structs): @@ -383,7 +416,8 @@ class DtbPlatdata(object): self.out('struct %s%s {\n' % (STRUCT_PREFIX, name)) for pname in sorted(structs[name]): prop = structs[name][pname] - if self.is_phandle(prop): + info = self.get_phandle_argc(prop, structs[name]) + if info: # For phandles, include a reference to the target self.out('\t%s%s[%d]' % (tab_to(2, 'struct phandle_2_cell'), conv_name_to_c(prop.name), @@ -423,7 +457,8 @@ class DtbPlatdata(object): vals = [] # For phandles, output a reference to the platform data # of the target node. - if self.is_phandle(prop): + info = self.get_phandle_argc(prop, node.name) + if info: # Process the list as pairs of (phandle, id) value_it = iter(prop.value) for phandle_cell, id_cell in zip(value_it, value_it): diff --git a/tools/dtoc/dtoc_test_phandle.dts b/tools/dtoc/dtoc_test_phandle.dts index e9828a695b..c0a602f296 100644 --- a/tools/dtoc/dtoc_test_phandle.dts +++ b/tools/dtoc/dtoc_test_phandle.dts @@ -13,6 +13,7 @@ u-boot,dm-pre-reloc; compatible = "target"; intval = <1>; + #clock-cells = <1>; }; phandle-source { From patchwork Tue Aug 29 20:15:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807278 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Qt+5v59X"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhg870766z9sQl for ; Wed, 30 Aug 2017 06:23:50 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 96280C2219B; Tue, 29 Aug 2017 20:20:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2E6AEC225C8; Tue, 29 Aug 2017 20:17:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 35B89C22643; Tue, 29 Aug 2017 20:16:26 +0000 (UTC) Received: from mail-oi0-f51.google.com (mail-oi0-f51.google.com [209.85.218.51]) by lists.denx.de (Postfix) with ESMTPS id 52C8FC22578 for ; Tue, 29 Aug 2017 20:16:21 +0000 (UTC) Received: by mail-oi0-f51.google.com with SMTP id k77so36402008oib.2 for ; Tue, 29 Aug 2017 13:16:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=t79eqeF5lA1VVNjM9H4DnL76Yaj4HkESUcgdl4Y7bJ0=; b=Qt+5v59XI/iD/Ski/9FVRQcNZaEzs9bGDrQL5ijyeHqcQOYMHmCT8211IgZDXQmruJ 4F+cOYshDBRPajo8KbrDz0/8JDR+ESvoGwxlIiH95T+prLa8lSVwlM+vA/3ibs7OiDxk e6Xh9cISDYEMcpJ7UZT3jNsFHjFUGDlLzOADjIcLm/vlLbQ9NqgaxkjmNTkXii2scXtz /BCbPCyMjNHkOEeM7zPKRAyFabC3sfI4rfpv0/pOp5CP9kpjJRzx196473bORX8OrDeb JcxwBSawR88N7rN1v9AATdQ1Z4VD6iks9K2DRfqoJQxYCZ+C1hAcCpFDI4dWfFSYjB/0 vP/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=t79eqeF5lA1VVNjM9H4DnL76Yaj4HkESUcgdl4Y7bJ0=; b=l/VtCVMhP3ZYMyw3iYWDtDNHIINEF/LVLI4uVHQhlM+2avvS9Xix83tk69MySG4QWB GmYLBC0j4+EodjoY90GYthaao+wcawl549MDgLT38LbHpsLkQPMpnn31FNs3pnYsaCog ovb3dFBfQ0vbFVgcU7KqvvFgEn/ozXek34aoaU1isTMCfVyW5cOgu/YXnKttwCiA/xIi O4lhgiED+0ay5MYFwBrDtoE9koQFZ8UMveMQ3T6nkek5XliuEyTKxZuRAknEpILd4OM8 p9MjlY8UcXJwDOeqsd3oAEcdiVxTaj6sVI5DFslspBeJcJPFFlRwlJ+Sp8r25itcFZ6Q ZNrQ== X-Gm-Message-State: AHYfb5iZx0gJdCsAw3AOAq4XX1CNf+G1Dazk2skVNo7Nw5shs0PIAYId FG8+RyKDaSlFQ7pc X-Google-Smtp-Source: ADKCNb5YkeukDGl60BBFJJZxJ7BP3Z60D6ntEBpZSFAG5N3larS6IbYri9PPBXPKbR7CZOzqMaOs/w== X-Received: by 10.202.199.86 with SMTP id x83mr1655372oif.116.1504037779786; Tue, 29 Aug 2017 13:16:19 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id v128sm3553158oie.1.2017.08.29.13.16.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:19 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 2304C13FAB7; Tue, 29 Aug 2017 14:16:18 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:56 -0600 Message-Id: <20170829201601.64312-12-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 11/16] dtoc: Rename the phandle struct X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Rather than naming the phandle struct according to the number of cells it uses (e.g. struct phandle_2_cell) name it according to the number of arguments it has (e.g. struct phandle_1_arg). This is a more intuitive naming. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None doc/driver-model/of-plat.txt | 2 +- drivers/clk/clk-uclass.c | 2 +- include/clk.h | 4 ++-- include/dt-structs.h | 7 ++++++- tools/dtoc/dtb_platdata.py | 3 ++- tools/dtoc/test_dtoc.py | 2 +- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/doc/driver-model/of-plat.txt b/doc/driver-model/of-plat.txt index 3ed8c759d6..732bc34f06 100644 --- a/doc/driver-model/of-plat.txt +++ b/doc/driver-model/of-plat.txt @@ -111,7 +111,7 @@ struct dtd_rockchip_rk3288_dw_mshc { bool cap_sd_highspeed; fdt32_t card_detect_delay; fdt32_t clock_freq_min_max[2]; - struct phandle_2_cell clocks[4]; + struct phandle_1_arg clocks[4]; bool disable_wp; fdt32_t fifo_depth; fdt32_t interrupts[3]; diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index e68d9279b9..8b40326efa 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -23,7 +23,7 @@ static inline struct clk_ops *clk_dev_ops(struct udevice *dev) #if CONFIG_IS_ENABLED(OF_CONTROL) # if CONFIG_IS_ENABLED(OF_PLATDATA) int clk_get_by_index_platdata(struct udevice *dev, int index, - struct phandle_2_cell *cells, struct clk *clk) + struct phandle_1_arg *cells, struct clk *clk) { int ret; diff --git a/include/clk.h b/include/clk.h index c5988f78a8..e7ce3e8576 100644 --- a/include/clk.h +++ b/include/clk.h @@ -61,9 +61,9 @@ struct clk { }; #if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK) -struct phandle_2_cell; +struct phandle_1_arg; int clk_get_by_index_platdata(struct udevice *dev, int index, - struct phandle_2_cell *cells, struct clk *clk); + struct phandle_1_arg *cells, struct clk *clk); /** * clock_get_by_index - Get/request a clock by integer index. diff --git a/include/dt-structs.h b/include/dt-structs.h index 0732c442ff..2ed997115a 100644 --- a/include/dt-structs.h +++ b/include/dt-structs.h @@ -9,7 +9,12 @@ /* These structures may only be used in SPL */ #if CONFIG_IS_ENABLED(OF_PLATDATA) -struct phandle_2_cell { +struct phandle_0_arg { + const void *node; + int id[0]; +}; + +struct phandle_1_arg { const void *node; int id; }; diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 001bc4ea66..0234f71b76 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -419,7 +419,8 @@ class DtbPlatdata(object): info = self.get_phandle_argc(prop, structs[name]) if info: # For phandles, include a reference to the target - self.out('\t%s%s[%d]' % (tab_to(2, 'struct phandle_2_cell'), + struct_name = 'struct phandle_%d_arg' % info.max_args + self.out('\t%s%s[%d]' % (tab_to(2, struct_name), conv_name_to_c(prop.name), len(prop.value) / 2)) else: diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 62460acb7c..23c4439ed9 100644 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -228,7 +228,7 @@ U_BOOT_DEVICE(pmic_at_9) = { self.assertEqual('''#include #include struct dtd_source { -\tstruct phandle_2_cell clocks[1]; +\tstruct phandle_1_arg clocks[1]; }; struct dtd_target { \tfdt32_t\t\tintval; From patchwork Tue Aug 29 20:15:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807277 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="AshaMPhu"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhg7s5NQfz9sR9 for ; Wed, 30 Aug 2017 06:23:37 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 642D7C21DDE; Tue, 29 Aug 2017 20:20:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id A0CEDC22608; Tue, 29 Aug 2017 20:17:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8C952C225B7; Tue, 29 Aug 2017 20:16:27 +0000 (UTC) Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by lists.denx.de (Postfix) with ESMTPS id 17898C225BF for ; Tue, 29 Aug 2017 20:16:22 +0000 (UTC) Received: by mail-oi0-f53.google.com with SMTP id r203so36448766oih.0 for ; Tue, 29 Aug 2017 13:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=tgZjk3qfD7AI3fxUUp+409LcpKrRs3IQ1fcF6rlogu4=; b=AshaMPhuqn66UEFd711Ie6nv7tvWHOk2Lr+aGtgAr3qBJfcdb4kUKXOcCcehqUl2Iy f1Qw5Q5hCUV6Wpq4FeyEReiNm4TswZU0XyzFysxrbuuRpYiLwQFAxnJAQGTVjf4uqTui bmRCydcRSQhu8QEoGkkU2xLtuxzKzmxEzA0FQqvmnp8CrBf9eXsg/bitvTwx4cpIuNLs NFesww3rVbfnAZNDgo3yIHgLIwqnQZEuHHGaxFr4OvGlnEoBK+bRYBS4nTRZ03IUZK9z H4HxnCX8VvaZJBFKw5f1jgwNB3T4QGHUTk3UJnrzXZziM49RMOD6Tg+/TDrGW/29fvNI krbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=tgZjk3qfD7AI3fxUUp+409LcpKrRs3IQ1fcF6rlogu4=; b=EXU3LhZYp930dUwvsJZcHV39lbbP36d0yYXgyP6kSfExmqbo8pt/ZSEAErnF1lX0hS CPblZRj1anCRoCbbnpkHJody66ixyrBk+e0XD/EIqWRxWejHFv6rRA79jgqRaR6c5Wtt dAQDQvDptoIBs7FNSCd2ryNtyXYXWvXxedr35zghvVvPfTb/kQSR5k3kdhlqdgRY3fCS INFAPkWXJyzTeOpHPicOlC+IT+GE439MvSCykszbwGf8LgVUkwMmROUnLVUGFjkA5/J7 dnJGkyfB7HGdu+AuaW6PahqQa0bSYa/oNZC+6IyMHOCXzD7ERneH7vlJodL7hefJINvi w32Q== X-Gm-Message-State: AHYfb5hR5bXTAJ0PQRFUcUd32SBqTuChi6HBDwNyosGk+INgUsRkm0+k JuhjyJxomig2GNnxFKlPUg== X-Google-Smtp-Source: ADKCNb47y0ft97r5o1jgmRdI0LZTXrZJv1+FynJTd2FKu64IxxKpT+iJvBax+c5EN0izHozwG1wRFw== X-Received: by 10.202.228.10 with SMTP id b10mr1609457oih.39.1504037780478; Tue, 29 Aug 2017 13:16:20 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id s140sm4242470oie.0.2017.08.29.13.16.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:19 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 2662513FC5F; Tue, 29 Aug 2017 14:16:19 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:57 -0600 Message-Id: <20170829201601.64312-13-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 12/16] dtoc: Put each phandle on a separate line X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When writing values from properties which contain phandles, dtoc currently writes 8 phandles per line. Change this to write one phandle per line. This helps reduce line length, since phandles are generally longer and may have arguments. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None tools/dtoc/dtb_platdata.py | 12 +++++++----- tools/dtoc/test_dtoc.py | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 0234f71b76..c0a3ae692b 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -468,15 +468,17 @@ class DtbPlatdata(object): target_node = self._fdt.phandle_to_node[phandle] name = conv_name_to_c(target_node.name) vals.append('{&%s%s, %d}' % (VAL_PREFIX, name, id_num)) + for val in vals: + self.buf('\n\t\t%s,' % val) else: for val in prop.value: vals.append(get_value(prop.type, val)) - # Put 8 values per line to avoid very long lines. - for i in xrange(0, len(vals), 8): - if i: - self.buf(',\n\t\t') - self.buf(', '.join(vals[i:i + 8])) + # Put 8 values per line to avoid very long lines. + for i in xrange(0, len(vals), 8): + if i: + self.buf(',\n\t\t') + self.buf(', '.join(vals[i:i + 8])) self.buf('}') else: self.buf(get_value(prop.type, prop.value)) diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 23c4439ed9..aa617a649c 100644 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -252,7 +252,8 @@ U_BOOT_DEVICE(phandle_target) = { }; static struct dtd_source dtv_phandle_source = { -\t.clocks\t\t\t= {{&dtv_phandle_target, 1}}, +\t.clocks\t\t\t= { +\t\t{&dtv_phandle_target, 1},}, }; U_BOOT_DEVICE(phandle_source) = { \t.name\t\t= "source", From patchwork Tue Aug 29 20:15:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807288 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="KSYycmd9"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhgHp1XnXz9sRV for ; Wed, 30 Aug 2017 06:30:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D3652C2263E; Tue, 29 Aug 2017 20:20:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 799E3C21DF8; Tue, 29 Aug 2017 20:17:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6DD8BC22542; Tue, 29 Aug 2017 20:16:29 +0000 (UTC) Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by lists.denx.de (Postfix) with ESMTPS id 0627FC22600 for ; Tue, 29 Aug 2017 20:16:26 +0000 (UTC) Received: by mail-oi0-f53.google.com with SMTP id k77so36403535oib.2 for ; Tue, 29 Aug 2017 13:16:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=BwvucLNONeh6iRsxyX8hadD8szsAq3BsXaTETGD4fJI=; b=KSYycmd9YBT7ne1h4J3BStGSoaMMl7q9iPzLaWspr+yVysscYF92dlldp4WK5WsTL7 KHFS14lZdcxyQe3Z7jofEn3qu710oyMvXtHEQ08Ciqy2BC50nbRxAI+fAxzzwAOv5v9Q Z51rjG9hOSCytaR/73OCkyrEsLnG8hE1oaBfG5hE7stBiN7twvoj9LXtc2JS+32NzvUn I+/DkEOH9uCYR3pwSLEnojRRVQQZ0LK1mThFW5qcIW9ZWXWwIGjKvXHzDdY/307EPtu2 s/YulCLJ5iH1cgXUI/+8r//CnB1L2n9CFxjMVET2vvHObBuxkEJceQY8aPkbLy7tNNV+ XzCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=BwvucLNONeh6iRsxyX8hadD8szsAq3BsXaTETGD4fJI=; b=RTNb7wrmz7Ohfhnu/OxU6s3gBSNcGO8VI3FcTOPG4HWRzeKSJ31KS2nw6z+hbPf8p3 4MlfmecQhb0BVDpeswXzwn7sdRnhg1kMbDgp/HkBWMFfBzND46Tsr8sfokx1ND0o2Lof BDPdlJBgC0gxQg5opaKj8ZoLS9VOhE8B6Ckj+pI16bi3VzikHN1dooxKIPOVOhxlfHnw cXEroq9oA1AcUDjBd+uvdFUrG6RV9qBfokLyngHO5Cdl5qSXR77ktvvKXqhq5nEtxsvt /MSB21UHz3l49TbhwIUSRDSmsqqWinLt+gG6zjiuC3wowTUbmPhNvclY4Uivy1PQQAoU pKOw== X-Gm-Message-State: AHYfb5jjssKs9uLJeJvxnO61ePY1ecWFSsXeQrpNHTLNesVsGc1iViNz Meye5yv+KW4ix9Nu X-Google-Smtp-Source: ADKCNb4ubzzFK3Xuubrj/Rst2MIqffx0gwp8Whvjw3c1fbRJlbVzoKY/6Eiyt2+bj9xI4u6c4wRyFQ== X-Received: by 10.202.71.5 with SMTP id u5mr1393747oia.56.1504037784418; Tue, 29 Aug 2017 13:16:24 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:0:10f2:0:e46b:9284:3d4c:e46e]) by smtp.gmail.com with ESMTPSA id m3sm3890238oif.17.2017.08.29.13.16.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:20 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 5B22513FAB7; Tue, 29 Aug 2017 14:16:20 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:58 -0600 Message-Id: <20170829201601.64312-14-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 13/16] dtoc: Put phandle args in an array X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" We want to support more than one phandle argument. It makes sense to use an array for this rather than discrete struct members. Adjust the code to support this. Rename the member to 'arg' instead of 'id'. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None drivers/clk/clk-uclass.c | 2 +- include/dt-structs.h | 4 ++-- tools/dtoc/dtb_platdata.py | 2 +- tools/dtoc/test_dtoc.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 8b40326efa..83ba13374c 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -32,7 +32,7 @@ int clk_get_by_index_platdata(struct udevice *dev, int index, ret = uclass_get_device(UCLASS_CLK, 0, &clk->dev); if (ret) return ret; - clk->id = cells[0].id; + clk->id = cells[0].arg[0]; return 0; } diff --git a/include/dt-structs.h b/include/dt-structs.h index 2ed997115a..9ab4e2524d 100644 --- a/include/dt-structs.h +++ b/include/dt-structs.h @@ -11,12 +11,12 @@ #if CONFIG_IS_ENABLED(OF_PLATDATA) struct phandle_0_arg { const void *node; - int id[0]; + int arg[0]; }; struct phandle_1_arg { const void *node; - int id; + int arg[1]; }; #include #endif diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index c0a3ae692b..1920a59f82 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -467,7 +467,7 @@ class DtbPlatdata(object): id_num = fdt_util.fdt32_to_cpu(id_cell) target_node = self._fdt.phandle_to_node[phandle] name = conv_name_to_c(target_node.name) - vals.append('{&%s%s, %d}' % (VAL_PREFIX, name, id_num)) + vals.append('{&%s%s, {%d}}' % (VAL_PREFIX, name, id_num)) for val in vals: self.buf('\n\t\t%s,' % val) else: diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index aa617a649c..fbae927cf8 100644 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -253,7 +253,7 @@ U_BOOT_DEVICE(phandle_target) = { static struct dtd_source dtv_phandle_source = { \t.clocks\t\t\t= { -\t\t{&dtv_phandle_target, 1},}, +\t\t{&dtv_phandle_target, {1}},}, }; U_BOOT_DEVICE(phandle_source) = { \t.name\t\t= "source", From patchwork Tue Aug 29 20:15:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807289 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="wPv5O/mZ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhgKz4kZYz9s72 for ; Wed, 30 Aug 2017 06:32:23 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 64D02C22453; Tue, 29 Aug 2017 20:24:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 97CCBC225DE; Tue, 29 Aug 2017 20:18:28 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CFC8CC22542; Tue, 29 Aug 2017 20:16:32 +0000 (UTC) Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) by lists.denx.de (Postfix) with ESMTPS id C3998C225A6 for ; Tue, 29 Aug 2017 20:16:27 +0000 (UTC) Received: by mail-oi0-f50.google.com with SMTP id r203so36450688oih.0 for ; Tue, 29 Aug 2017 13:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=C2apwSXrbNURxzhxTBmHJxgVKNmqJRVjRhoIY/lcY4g=; b=wPv5O/mZu3NE13ehDWaSjoqhFXtZE10I/mGv9uYQY+sIWTuif8+dNL4XYr/oiK7udJ nNKwd9eWPffYtF9A6gcB88dx5CzA0RPE0sgD348HFluGin6+HSvcsJB9vHby/cE9G0ll Q7ZETdTfAAj43VwcUyI/W6sVDNGJX2Br/mCtd1K6Z6+ogSakA80bi4adntFZ6RpzG4nn z+dI3xA3+HwJz86toxDngtjhdw9bMtPJzhwTz4lJIWVfQp6dk84aD4lxf0QlADVwNQaT OLya3V9BW30TjdFlSr/kOwEiCiHezJ3gDqtkYfF8u6uczWhfajXGowluyUJ6QUHlEvNa XxFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=C2apwSXrbNURxzhxTBmHJxgVKNmqJRVjRhoIY/lcY4g=; b=sLU9hO5gzChoGmaQwRVp5nQh7FRvkEez7oeN/9oUUQTEVIfiWpR371SAZbJYyXRN12 2iICp93P6DDxO8R8Fhyf4ALHfFSRNJT6AccAT7J0wZTrv3ANmXnDEkF+drKFTCL6cDNb +3lkMIdVkMUPokHH8zLewBk02VW6BpB0yRJJ/55wRTG5c2FX6UzdqgkpmANv8c3JUR+H yKUAooUomoPlH4qxFIKxw/VEiGQTmDuOkWBIlqFAz0Vt1xZpQhO+i9RlvgLdslub04GG HR8/HAovOIm7QPNJ6wk2EEFYkZHBCZUJp6uf1oucjmMQlHKgx7ep0jFkUUiwMZNG6qNM xP5A== X-Gm-Message-State: AHYfb5iXz8rLCqN3VKBLe+R/dshEGkKnP+eK8pi5AYC+SeIfZGAy9G/x iEIZhkapQLNRXrqj X-Google-Smtp-Source: ADKCNb7bzbf9ha2MyQhx8gKa+L9+ynCfUitwrs0MH/D06WStvDMtZ324kvPrLpAm4JxmsWJ2eNk9xg== X-Received: by 10.202.46.70 with SMTP id u67mr1368111oiu.312.1504037786213; Tue, 29 Aug 2017 13:16:26 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:0:10f2:0:e46b:9284:3d4c:e46e]) by smtp.gmail.com with ESMTPSA id k129sm3830245oif.10.2017.08.29.13.16.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:24 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 6F9C313FC5F; Tue, 29 Aug 2017 14:16:21 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:15:59 -0600 Message-Id: <20170829201601.64312-15-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 14/16] dtoc: Support properties containing multiple phandle values X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" At present dtoc has a very simplistic view of phandles. It assumes that a property has only a single phandle with a single argument (i.e. two cells per property). This is not true in many cases. Enhance the implementation to scan all phandles in a property and to use the correct number of arguments (which can be 0, 1, 2 or more) when generating the C code. For the struct definitions, use a struct which can hold the maximum number of arguments used by the property. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None include/dt-structs.h | 5 +++++ tools/dtoc/dtb_platdata.py | 21 ++++++++++++++------- tools/dtoc/dtoc_test_phandle.dts | 17 +++++++++++++++-- tools/dtoc/test_dtoc.py | 27 ++++++++++++++++++++++++--- 4 files changed, 58 insertions(+), 12 deletions(-) diff --git a/include/dt-structs.h b/include/dt-structs.h index 9ab4e2524d..76979e73e1 100644 --- a/include/dt-structs.h +++ b/include/dt-structs.h @@ -18,6 +18,11 @@ struct phandle_1_arg { const void *node; int arg[1]; }; + +struct phandle_2_arg { + const void *node; + int arg[2]; +}; #include #endif diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 1920a59f82..cfca45b0ac 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -394,11 +394,13 @@ class DtbPlatdata(object): if not isinstance(prop.value, list): prop.value = [prop.value] # Process the list as pairs of (phandle, id) - value_it = iter(prop.value) - for phandle_cell, _ in zip(value_it, value_it): + pos = 0 + for args in info.args: + phandle_cell = prop.value[pos] phandle = fdt_util.fdt32_to_cpu(phandle_cell) target_node = self._fdt.phandle_to_node[phandle] node.phandles.add(target_node) + pos += 1 + args def generate_structs(self, structs): @@ -422,7 +424,7 @@ class DtbPlatdata(object): struct_name = 'struct phandle_%d_arg' % info.max_args self.out('\t%s%s[%d]' % (tab_to(2, struct_name), conv_name_to_c(prop.name), - len(prop.value) / 2)) + len(info.args))) else: ptype = TYPE_NAMES[prop.type] self.out('\t%s%s' % (tab_to(2, ptype), @@ -461,13 +463,18 @@ class DtbPlatdata(object): info = self.get_phandle_argc(prop, node.name) if info: # Process the list as pairs of (phandle, id) - value_it = iter(prop.value) - for phandle_cell, id_cell in zip(value_it, value_it): + pos = 0 + for args in info.args: + phandle_cell = prop.value[pos] phandle = fdt_util.fdt32_to_cpu(phandle_cell) - id_num = fdt_util.fdt32_to_cpu(id_cell) target_node = self._fdt.phandle_to_node[phandle] name = conv_name_to_c(target_node.name) - vals.append('{&%s%s, {%d}}' % (VAL_PREFIX, name, id_num)) + arg_values = [] + for i in range(args): + arg_values.append(str(fdt_util.fdt32_to_cpu(prop.value[pos + 1 + i]))) + pos += 1 + args + vals.append('\t{&%s%s, {%s}}' % (VAL_PREFIX, name, + ', '.join(arg_values))) for val in vals: self.buf('\n\t\t%s,' % val) else: diff --git a/tools/dtoc/dtoc_test_phandle.dts b/tools/dtoc/dtoc_test_phandle.dts index c0a602f296..ba12b0fe65 100644 --- a/tools/dtoc/dtoc_test_phandle.dts +++ b/tools/dtoc/dtoc_test_phandle.dts @@ -10,15 +10,28 @@ / { phandle: phandle-target { + u-boot,dm-pre-reloc; + compatible = "target"; + intval = <0>; + #clock-cells = <0>; + }; + + phandle_1: phandle2-target { u-boot,dm-pre-reloc; compatible = "target"; intval = <1>; - #clock-cells = <1>; + #clock-cells = <1>; + }; + phandle_2: phandle3-target { + u-boot,dm-pre-reloc; + compatible = "target"; + intval = <2>; + #clock-cells = <2>; }; phandle-source { u-boot,dm-pre-reloc; compatible = "source"; - clocks = <&phandle 1>; + clocks = <&phandle &phandle_1 11 &phandle_2 12 13 &phandle>; }; }; diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index fbae927cf8..cc009b2a25 100644 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -228,7 +228,7 @@ U_BOOT_DEVICE(pmic_at_9) = { self.assertEqual('''#include #include struct dtd_source { -\tstruct phandle_1_arg clocks[1]; +\tstruct phandle_2_arg clocks[4]; }; struct dtd_target { \tfdt32_t\t\tintval; @@ -243,7 +243,7 @@ struct dtd_target { #include static struct dtd_target dtv_phandle_target = { -\t.intval\t\t\t= 0x1, +\t.intval\t\t\t= 0x0, }; U_BOOT_DEVICE(phandle_target) = { \t.name\t\t= "target", @@ -251,9 +251,30 @@ U_BOOT_DEVICE(phandle_target) = { \t.platdata_size\t= sizeof(dtv_phandle_target), }; +static struct dtd_target dtv_phandle2_target = { +\t.intval\t\t\t= 0x1, +}; +U_BOOT_DEVICE(phandle2_target) = { +\t.name\t\t= "target", +\t.platdata\t= &dtv_phandle2_target, +\t.platdata_size\t= sizeof(dtv_phandle2_target), +}; + +static struct dtd_target dtv_phandle3_target = { +\t.intval\t\t\t= 0x2, +}; +U_BOOT_DEVICE(phandle3_target) = { +\t.name\t\t= "target", +\t.platdata\t= &dtv_phandle3_target, +\t.platdata_size\t= sizeof(dtv_phandle3_target), +}; + static struct dtd_source dtv_phandle_source = { \t.clocks\t\t\t= { -\t\t{&dtv_phandle_target, {1}},}, +\t\t\t{&dtv_phandle_target, {}}, +\t\t\t{&dtv_phandle2_target, {11}}, +\t\t\t{&dtv_phandle3_target, {12, 13}}, +\t\t\t{&dtv_phandle_target, {}},}, }; U_BOOT_DEVICE(phandle_source) = { \t.name\t\t= "source", From patchwork Tue Aug 29 20:16:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807274 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="HHYWKJVl"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhg7J6yRkz9sR9 for ; Wed, 30 Aug 2017 06:23:08 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A393DC226CA; Tue, 29 Aug 2017 20:19:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id D073EC22669; Tue, 29 Aug 2017 20:16:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4E3C3C22655; Tue, 29 Aug 2017 20:16:30 +0000 (UTC) Received: from mail-oi0-f42.google.com (mail-oi0-f42.google.com [209.85.218.42]) by lists.denx.de (Postfix) with ESMTPS id D8438C225D3 for ; Tue, 29 Aug 2017 20:16:26 +0000 (UTC) Received: by mail-oi0-f42.google.com with SMTP id t75so36452099oie.3 for ; Tue, 29 Aug 2017 13:16:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=K9BWpmwFfPTx/WvCLZaEyvWvB/JwRBsVF9wODGakdN4=; b=HHYWKJVlu1bZn2xxooKYCnXDjpVNMNvFxpnpm+HqBaO3PDCliUUthbr0529rwXiL5E DyrTM8+uORiqwbtynTbw6dEWHLPLkBWpEkt/TlrPkGaCv7nOL/eCSKdqZxYD68stMiNo fL1c9G8wruJzKpTPP8K2RV7cKmFp9uzgC4PxXB9LtAmesrsPH9DcRq168Gzq0B9yZDAj 6QDIzaTJ34+GC9xqVJYHbdAvEFC1CKd++gOYPQYELLRmjOwyj65j7sP+GWwIEPT2krKg RpgAwvzj37WNnBF8JsBaBDTisQkIM8zeTdoAqA1+8ubtKI7xMSHZ6lwYJHy6iYT2cKxv YijA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=K9BWpmwFfPTx/WvCLZaEyvWvB/JwRBsVF9wODGakdN4=; b=NK/Ix5MtrDHh8rnZqKuczHKmNULaPglraWzveHsDCQWGXqAKqWZSR2CshwSDV8WPIC 3CQgMyhEzEkIeMbJEOjvX8F+tnVjpE77Tg+KGzAEsh3JKGSsHwKE3gj5T/5dis/L4Nl7 b+IUJzhuxmpMhmvWpPHcCqWmiSbCdU2SMayjZdqDTfLu0CCQ5a1aF+jT9PMYF/B8ipRE /XcEYXIKpTV5jW7JHJfQG5WjJCB5JesOYvi8nsiQdCshhT+sH1rumEva56gUkJLH8RVy fG/4nmbKbuMnaKwItL+ZUPwuo1F1nAU63hW703sH4WulDwnnU2YRWXmJaUdphHYeEYoi Xn5g== X-Gm-Message-State: AHYfb5iUkxBPQGjEBiSWJbFObpX1RcDCWjJSQTrB1mSbDxh+439arD5M swoTMUZ2CbFZ5Tse X-Google-Smtp-Source: ADKCNb7yxXrmQkOtqUo6QAyNpz6Xp3sOdwOjR77rgACMTvUV/tAhaH9q6x++LeFZlYZ0shN0TUL8Gw== X-Received: by 10.202.72.19 with SMTP id v19mr1558087oia.237.1504037785314; Tue, 29 Aug 2017 13:16:25 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:0:10f2:0:e46b:9284:3d4c:e46e]) by smtp.gmail.com with ESMTPSA id n2sm3669990oib.27.2017.08.29.13.16.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:24 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 9933E13FCAB; Tue, 29 Aug 2017 14:16:22 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:16:00 -0600 Message-Id: <20170829201601.64312-16-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 15/16] dtoc: Rename the auto-generated dt-structs.h file X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The filename of the auto-generated file is the same as the file that includes it. Even though the form is in the generated/ subdirectory, this could be confused. Rename the generated file to something that makes it clear it is auto-generated. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None include/dt-structs.h | 2 +- scripts/Makefile.spl | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/dt-structs.h b/include/dt-structs.h index 76979e73e1..c0f56951b5 100644 --- a/include/dt-structs.h +++ b/include/dt-structs.h @@ -23,7 +23,7 @@ struct phandle_2_arg { const void *node; int arg[2]; }; -#include +#include #endif #endif diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index dd8065d87d..b86ea76bab 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -257,14 +257,15 @@ cmd_dtoch = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o quiet_cmd_plat = PLAT $@ cmd_plat = $(CC) $(c_flags) -c $< -o $@ -$(obj)/dts/dt-platdata.o: $(obj)/dts/dt-platdata.c include/generated/dt-structs.h +$(obj)/dts/dt-platdata.o: $(obj)/dts/dt-platdata.c \ + include/generated/dt-structs-gen.h $(call if_changed,plat) PHONY += dts_dir dts_dir: $(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts) -include/generated/dt-structs.h: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc +include/generated/dt-structs-gen.h: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc $(call if_changed,dtoch) $(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc From patchwork Tue Aug 29 20:16:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 807287 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="TysEgoXc"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xhgHL0gpRz9sQl for ; Wed, 30 Aug 2017 06:30:06 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D092DC2254B; Tue, 29 Aug 2017 20:23:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id BA01EC2269A; Tue, 29 Aug 2017 20:18:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BD114C21E5D; Tue, 29 Aug 2017 20:16:32 +0000 (UTC) Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by lists.denx.de (Postfix) with ESMTPS id 48051C2254B for ; Tue, 29 Aug 2017 20:16:28 +0000 (UTC) Received: by mail-oi0-f53.google.com with SMTP id k77so36404271oib.2 for ; Tue, 29 Aug 2017 13:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=WWRYvb4yC+RyR2qxp8JMxDrTaDUyvHPEaX/AJ4GM3HI=; b=TysEgoXc33uD77n8iH8NmCQxJwChnEOGdl0UGcBhZRhe4mSEzX35zpCEk01mC0OnXz g7F0dZv90gDZQ/GFEq14QWpt2W2QrtuJusbW5B3radLahp1+0bpVhVYWa1otsIw//Ogr XNSCOV8TfGD/CZY1vJ/1I+WsfR6fKalr83KL9G9od3Z2Luk+zkWaM8/TLcueqzu9bQKj nRwKTJXUza/UtDX65q+7ZkvVqeWza4zxlAs2bfquikCah65xwdaR4K3NJwcZALw+kedS 7MKriA/Dd1zeZbHszW9LO7/YPNRZeRPDocVQvpoKZSiqlqJYmeCW7Vqr2iZQoc61yo5u YI4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=WWRYvb4yC+RyR2qxp8JMxDrTaDUyvHPEaX/AJ4GM3HI=; b=hdgfqP5ysl7J2Lj4guKqCSaWOYNX4IqlYUQJXAPaJPc4xfeBbZdDGXIpFmJsBlFeo4 PU+gwrQXC37v/kfmV2ph5+CAXdRFnDKfn6kLkz7802J3nfvO9gyPEI9VI44+zqYU2vi5 wcyOc4TyNSsuvdQFT1c6EPPGPlZCTBDgrN2ZZUjYZPDf4D6A/8dqLxDH3ef0muVA6szr 30zgACNZ0LskykdZ+zT6NcnHQmsx3x6aOvCeNdD9LL+G897DO/8OklBNaZ1YKRrDxnnO nljegVm5kD5EXtYCO+DDlDzn2l25fbHEXYYMdsODDhZE5I3zvmMyB9aWGYcle0D9/Azj /PSQ== X-Gm-Message-State: AHYfb5gZ/d2ZM5aQZ6zoQNJdl1p2XHWx0JQKXZejE6VNeK9XFcdiQj1D Sl2KVM76G0RSUwsU X-Google-Smtp-Source: ADKCNb76JjYY6qlKm8brahI2m+vftxwjb95EdNyHpvnHfkEUgdFsdJeNY2THqLIxrfgWVtUZ9m9K4Q== X-Received: by 10.202.81.200 with SMTP id f191mr1578124oib.162.1504037786762; Tue, 29 Aug 2017 13:16:26 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id m72sm3725803oig.3.2017.08.29.13.16.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 13:16:24 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id AEB9F13FE6E; Tue, 29 Aug 2017 14:16:23 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 29 Aug 2017 14:16:01 -0600 Message-Id: <20170829201601.64312-17-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 16/16] dtoc: Add a header to the generated files X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add a header that indicates that the files generated by dtoc should not be modified. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None tools/dtoc/dtb_platdata.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index cfca45b0ac..dc9c0d9f45 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -190,6 +190,16 @@ class DtbPlatdata(object): self._lines = [] return lines + def out_header(self): + """Output a message indicating that this is an auto-generated file""" + self.out('''/* + * DO NOT MODIFY + * + * This file was generated by dtoc from a .dtb (device tree binary) file. + */ + +''') + def get_phandle_argc(self, prop, node_name): """Check if a node contains phandles @@ -410,6 +420,7 @@ class DtbPlatdata(object): definitions for node in self._valid_nodes. See the documentation in README.of-plat for more information. """ + self.out_header() self.out('#include \n') self.out('#include \n') @@ -512,6 +523,7 @@ class DtbPlatdata(object): See the documentation in doc/driver-model/of-plat.txt for more information. """ + self.out_header() self.out('#include \n') self.out('#include \n') self.out('#include \n')