From patchwork Mon Nov 24 22:23:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 5370311 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5C6079F2F5 for ; Mon, 24 Nov 2014 22:26:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D7402015A for ; Mon, 24 Nov 2014 22:26:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8BAF020179 for ; Mon, 24 Nov 2014 22:26:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xt23W-0003A4-7X; Mon, 24 Nov 2014 22:24:26 +0000 Received: from mail-wi0-f177.google.com ([209.85.212.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xt238-0002rH-6W for linux-arm-kernel@lists.infradead.org; Mon, 24 Nov 2014 22:24:03 +0000 Received: by mail-wi0-f177.google.com with SMTP id l15so7421323wiw.10 for ; Mon, 24 Nov 2014 14:23:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HMxCZQN2i5rvVDAp1fEEvkEHShRvs96F5HelzYuQ9kY=; b=kNwvZJrgOD1sP07DjTd7TSGN37HClTZxhD2Dh7/XUNzPSG+YmIxUg75P4lhVxCTrnP iDW8EK8ivRJcwRHz7GD0JljQpSsmqDpLJi38vMb7tK72hwYfH4cFZHsH+zQGKghFmfH3 +vlZNUDH/YPcSAm8OvLCfWZFqNQDSgUGl0pU5mcfnh6wtDtL5OpFaPkBGPwTKdwXtIIS nag8OMV4ojS+w0xWRGD67ykQu3O3pZDFRPxahdhmWap7vnkJT4oOYqz/vnnAlh53Bigo +Z19nk5GTBKSQFzeBR196CZfDSxeN1T8UatyNqnjpMoqkyO5ByXJzTYoWl5ylvaDZbNw wb6A== X-Gm-Message-State: ALoCoQlKT0pWEsvVtJoiPkQFjK2b/2G1xHv4OiDTgp3+l44z+o6YaZDeYJSW+0fR5SGMzG4VW5LN X-Received: by 10.194.71.84 with SMTP id s20mr36917383wju.128.1416867819728; Mon, 24 Nov 2014 14:23:39 -0800 (PST) Received: from mohikan.mushroom.smurfnet.nu (cpc4-cmbg17-2-0-cust71.5-4.cable.virginm.net. [86.14.224.72]) by mx.google.com with ESMTPSA id el6sm13828534wib.23.2014.11.24.14.23.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Nov 2014 14:23:38 -0800 (PST) From: Leif Lindholm To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] of: support passing console options with stdout-path Date: Mon, 24 Nov 2014 22:23:58 +0000 Message-Id: <1416867838-18652-1-git-send-email-leif.lindholm@linaro.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141124_142402_459221_D331265D X-CRM114-Status: GOOD ( 13.35 ) X-Spam-Score: -0.7 (/) Cc: mark.rutland@arm.com, grant.likely@linaro.org, robh+dt@kernel.org, plagnioj@jcrosoft.com, ijc@debian.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Support specifying console options (like with console=ttyXN,) by appending them to the stdout-path property after a separating ':'. Example: stdout-path = "uart0:115200"; This patch also modifies of_find_node_by_path() to match only the portion of the path before a ':'. Signed-off-by: Leif Lindholm --- drivers/of/base.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 3823edf..89c6b33 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -37,6 +37,7 @@ EXPORT_SYMBOL(of_allnodes); struct device_node *of_chosen; struct device_node *of_aliases; struct device_node *of_stdout; +static char *of_stdout_options; struct kset *of_kset; @@ -703,6 +704,8 @@ static struct device_node *__of_find_node_by_path(struct device_node *parent, if (!len) return NULL; + len = strchrnul(path, ':') - path; + __for_each_child_of_node(parent, child) { const char *name = strrchr(child->full_name, '/'); if (WARN(!name, "malformed device_node %s\n", child->full_name)) @@ -747,6 +750,8 @@ struct device_node *of_find_node_by_path(const char *path) if (!of_aliases) return NULL; + len = strchrnul(path, ':') - path; + for_each_property_of_node(of_aliases, pp) { if (strlen(pp->name) == len && !strncmp(pp->name, path, len)) { np = of_find_node_by_path(pp->value); @@ -1830,8 +1835,12 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) name = of_get_property(of_chosen, "linux,stdout-path", NULL); if (IS_ENABLED(CONFIG_PPC) && !name) name = of_get_property(of_aliases, "stdout", NULL); - if (name) + if (name) { of_stdout = of_find_node_by_path(name); + of_stdout_options = strchr(name, ':'); + if (of_stdout_options != NULL) + of_stdout_options++; + } } if (!of_aliases) @@ -1957,7 +1966,7 @@ bool of_console_check(struct device_node *dn, char *name, int index) { if (!dn || dn != of_stdout || console_set_on_cmdline) return false; - return !add_preferred_console(name, index, NULL); + return !add_preferred_console(name, index, of_stdout_options); } EXPORT_SYMBOL_GPL(of_console_check);